// This is a MangedServices object that keeps track of the ranker.
mRankerServices = new NotificationRankers();
// Find the updatable ranker and register it.
- Set<ComponentName> rankerComponents = mRankerServices.queryPackageForServices(
- mRankerServicePackageName, UserHandle.USER_SYSTEM, null);
- Iterator<ComponentName> iterator = rankerComponents.iterator();
- if (iterator.hasNext()) {
- ComponentName rankerComponent = iterator.next();
- if (iterator.hasNext()) {
- Slog.e(TAG, "found multiple ranker services:" + rankerComponents);
- } else {
- mRankerServices.registerSystemService(rankerComponent, UserHandle.USER_SYSTEM);
- }
- } else {
- Slog.w(TAG, "could not start ranker service: none found");
- }
+ mRankerServices.registerRanker();
mStatusBar = getLocalService(StatusBarManagerInternal.class);
- mStatusBar.setNotificationDelegate(mNotificationDelegate);
+ if (mStatusBar != null) {
+ mStatusBar.setNotificationDelegate(mNotificationDelegate);
+ }
final LightsManager lights = getLocalService(LightsManager.class);
mNotificationLight = lights.getLight(LightsManager.LIGHT_ID_NOTIFICATIONS);