Java Code Examples for com.android.server.LocalServices#addService()
The following examples show how to use
com.android.server.LocalServices#addService() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private UserManagerService(Context context, PackageManagerService pm, UserDataPreparer userDataPreparer, Object packagesLock, File dataDir) { mContext = context; mPm = pm; mPackagesLock = packagesLock; mHandler = new MainHandler(); mUserDataPreparer = userDataPreparer; synchronized (mPackagesLock) { mUsersDir = new File(dataDir, USER_INFO_DIR); mUsersDir.mkdirs(); // Make zeroth user directory, for services to migrate their files to that location File userZeroDir = new File(mUsersDir, String.valueOf(UserHandle.USER_SYSTEM)); userZeroDir.mkdirs(); FileUtils.setPermissions(mUsersDir.toString(), FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IROTH | FileUtils.S_IXOTH, -1, -1); mUserListFile = new File(mUsersDir, USER_LIST_FILENAME); initDefaultGuestRestrictions(); readUserListLP(); sInstance = this; } mLocalService = new LocalService(); LocalServices.addService(UserManagerInternal.class, mLocalService); mLockPatternUtils = new LockPatternUtils(mContext); mUserStates.put(UserHandle.USER_SYSTEM, UserState.STATE_BOOTING); }
Example 2
Source File: NetworkStatsService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@VisibleForTesting NetworkStatsService(Context context, INetworkManagementService networkManager, AlarmManager alarmManager, PowerManager.WakeLock wakeLock, Clock clock, TelephonyManager teleManager, NetworkStatsSettings settings, NetworkStatsObservers statsObservers, File systemDir, File baseDir) { mContext = checkNotNull(context, "missing Context"); mNetworkManager = checkNotNull(networkManager, "missing INetworkManagementService"); mAlarmManager = checkNotNull(alarmManager, "missing AlarmManager"); mClock = checkNotNull(clock, "missing Clock"); mSettings = checkNotNull(settings, "missing NetworkStatsSettings"); mTeleManager = checkNotNull(teleManager, "missing TelephonyManager"); mWakeLock = checkNotNull(wakeLock, "missing WakeLock"); mStatsObservers = checkNotNull(statsObservers, "missing NetworkStatsObservers"); mSystemDir = checkNotNull(systemDir, "missing systemDir"); mBaseDir = checkNotNull(baseDir, "missing baseDir"); mUseBpfTrafficStats = new File("/sys/fs/bpf/traffic_uid_stats_map").exists(); LocalServices.addService(NetworkStatsManagerInternal.class, new NetworkStatsManagerInternalImpl()); }
Example 3
Source File: InputManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public InputManagerService(Context context) { this.mContext = context; this.mHandler = new InputManagerHandler(DisplayThread.get().getLooper()); mUseDevInputEventForAudioJack = context.getResources().getBoolean(R.bool.config_useDevInputEventForAudioJack); Slog.i(TAG, "Initializing input manager, mUseDevInputEventForAudioJack=" + mUseDevInputEventForAudioJack); mPtr = nativeInit(this, mContext, mHandler.getLooper().getQueue()); String doubleTouchGestureEnablePath = context.getResources().getString( R.string.config_doubleTouchGestureEnableFile); mDoubleTouchGestureEnableFile = TextUtils.isEmpty(doubleTouchGestureEnablePath) ? null : new File(doubleTouchGestureEnablePath); LocalServices.addService(InputManagerInternal.class, new LocalService()); }
Example 4
Source File: StatusBarManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Construct the service, add the status bar view to the window manager */ public StatusBarManagerService(Context context, WindowManagerService windowManager) { mContext = context; mWindowManager = windowManager; LocalServices.addService(StatusBarManagerInternal.class, mInternalService); LocalServices.addService(GlobalActionsProvider.class, mGlobalActionsProvider); }
Example 5
Source File: LockSettingsService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@VisibleForTesting protected LockSettingsService(Injector injector) { mInjector = injector; mContext = injector.getContext(); mKeyStore = injector.getKeyStore(); mRecoverableKeyStoreManager = injector.getRecoverableKeyStoreManager(mKeyStore); mHandler = injector.getHandler(); mStrongAuth = injector.getStrongAuth(); mActivityManager = injector.getActivityManager(); mLockPatternUtils = injector.getLockPatternUtils(); mFirstCallToVold = true; IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_ADDED); filter.addAction(Intent.ACTION_USER_STARTING); filter.addAction(Intent.ACTION_USER_REMOVED); injector.getContext().registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null); mStorage = injector.getStorage(); mNotificationManager = injector.getNotificationManager(); mUserManager = injector.getUserManager(); mStrongAuthTracker = injector.getStrongAuthTracker(); mStrongAuthTracker.register(mStrongAuth); mSpManager = injector.getSyntheticPasswordManager(mStorage); LocalServices.addService(LockSettingsInternal.class, new LocalService()); }
Example 6
Source File: ArtManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public ArtManagerService(Context context, IPackageManager pm, Installer installer, Object installLock) { mContext = context; mPackageManager = pm; mInstaller = installer; mInstallLock = installLock; mHandler = new Handler(BackgroundThread.getHandler().getLooper()); LocalServices.addService(ArtManagerInternal.class, new ArtManagerInternalImpl()); }
Example 7
Source File: IpConnectivityMetrics.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void onBootPhase(int phase) { if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) { if (DBG) Log.d(TAG, "onBootPhase"); mNetdListener = new NetdEventListenerService(getContext()); publishBinderService(SERVICE_NAME, impl); publishBinderService(mNetdListener.SERVICE_NAME, mNetdListener); LocalServices.addService(Logger.class, new LoggerImpl()); } }
Example 8
Source File: PermissionManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
PermissionManagerService(Context context, @Nullable DefaultPermissionGrantedCallback defaultGrantCallback, @NonNull Object externalLock) { mContext = context; mLock = externalLock; mPackageManagerInt = LocalServices.getService(PackageManagerInternal.class); mUserManagerInt = LocalServices.getService(UserManagerInternal.class); mSettings = new PermissionSettings(context, mLock); mHandlerThread = new ServiceThread(TAG, Process.THREAD_PRIORITY_BACKGROUND, true /*allowIo*/); mHandlerThread.start(); mHandler = new Handler(mHandlerThread.getLooper()); Watchdog.getInstance().addThread(mHandler); mDefaultPermissionGrantPolicy = new DefaultPermissionGrantPolicy( context, mHandlerThread.getLooper(), defaultGrantCallback, this); SystemConfig systemConfig = SystemConfig.getInstance(); mSystemPermissions = systemConfig.getSystemPermissions(); mGlobalGids = systemConfig.getGlobalGids(); // propagate permission configuration final ArrayMap<String, SystemConfig.PermissionEntry> permConfig = SystemConfig.getInstance().getPermissions(); synchronized (mLock) { for (int i=0; i<permConfig.size(); i++) { final SystemConfig.PermissionEntry perm = permConfig.valueAt(i); BasePermission bp = mSettings.getPermissionLocked(perm.name); if (bp == null) { bp = new BasePermission(perm.name, "android", BasePermission.TYPE_BUILTIN); mSettings.putPermissionLocked(perm.name, bp); } if (perm.gids != null) { bp.setGids(perm.gids, perm.perUser); } } } LocalServices.addService( PermissionManagerInternal.class, new PermissionManagerInternalImpl()); }
Example 9
Source File: ShortcutService.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@VisibleForTesting ShortcutService(Context context, Looper looper, boolean onlyForPackageManagerApis) { mContext = Preconditions.checkNotNull(context); LocalServices.addService(ShortcutServiceInternal.class, new LocalService()); mHandler = new Handler(looper); mIPackageManager = AppGlobals.getPackageManager(); mPackageManagerInternal = Preconditions.checkNotNull( LocalServices.getService(PackageManagerInternal.class)); mUserManagerInternal = Preconditions.checkNotNull( LocalServices.getService(UserManagerInternal.class)); mUsageStatsManagerInternal = Preconditions.checkNotNull( LocalServices.getService(UsageStatsManagerInternal.class)); mActivityManagerInternal = Preconditions.checkNotNull( LocalServices.getService(ActivityManagerInternal.class)); mShortcutRequestPinProcessor = new ShortcutRequestPinProcessor(this, mLock); mShortcutBitmapSaver = new ShortcutBitmapSaver(this); mShortcutDumpFiles = new ShortcutDumpFiles(this); if (onlyForPackageManagerApis) { return; // Don't do anything further. For unit tests only. } // Register receivers. // We need to set a priority, so let's just not use PackageMonitor for now. // TODO Refactor PackageMonitor to support priorities. final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addAction(Intent.ACTION_PACKAGE_CHANGED); packageFilter.addAction(Intent.ACTION_PACKAGE_DATA_CLEARED); packageFilter.addDataScheme("package"); packageFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); mContext.registerReceiverAsUser(mPackageMonitor, UserHandle.ALL, packageFilter, null, mHandler); final IntentFilter preferedActivityFilter = new IntentFilter(); preferedActivityFilter.addAction(Intent.ACTION_PREFERRED_ACTIVITY_CHANGED); preferedActivityFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); mContext.registerReceiverAsUser(mPackageMonitor, UserHandle.ALL, preferedActivityFilter, null, mHandler); final IntentFilter localeFilter = new IntentFilter(); localeFilter.addAction(Intent.ACTION_LOCALE_CHANGED); localeFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, localeFilter, null, mHandler); injectRegisterUidObserver(mUidObserver, ActivityManager.UID_OBSERVER_PROCSTATE | ActivityManager.UID_OBSERVER_GONE); }
Example 10
Source File: GestureLauncherService.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
public void onStart() { LocalServices.addService(GestureLauncherService.class, this); }
Example 11
Source File: BatteryStatsService.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
public void publish() { LocalServices.addService(BatteryStatsInternal.class, new LocalService()); ServiceManager.addService(BatteryStats.SERVICE_NAME, asBinder()); }