public void registerService(IInterface service, ComponentName component, int userid) {
checkNotNull(service);
- registerServiceImpl(service, component, userid);
+ ManagedServiceInfo info = registerServiceImpl(service, component, userid);
+ if (info != null) {
+ onServiceAdded(info);
+ }
}
/**
}
}
- private void registerServiceImpl(final IInterface service,
+ private ManagedServiceInfo registerServiceImpl(final IInterface service,
final ComponentName component, final int userid) {
synchronized (mMutex) {
try {
true /*isSystem*/, null, Build.VERSION_CODES.L);
service.asBinder().linkToDeath(info, 0);
mServices.add(info);
+ return info;
} catch (RemoteException e) {
// already dead
}
}
+ return null;
}
/**
@Override
public void registerListener(final INotificationListener listener,
final ComponentName component, final int userid) {
- checkCallerIsSystem();
+ enforceSystemOrSystemUI("INotificationManager.registerListener");
mListeners.registerService(listener, component, userid);
}