use of android.app.INotificationManager in project android_frameworks_base by AOSPA.
the class NotificationListenerService method unregisterAsSystemService.
/**
* Directly unregister this service from the Notification Manager.
*
* <p>This method will fail for listeners that were not registered
* with (@link registerAsService).
* @hide
*/
@SystemApi
public void unregisterAsSystemService() throws RemoteException {
if (mWrapper != null) {
INotificationManager noMan = getNotificationInterface();
noMan.unregisterListener(mWrapper, mCurrentUser);
}
}
use of android.app.INotificationManager in project android_frameworks_base by AOSPA.
the class NotificationBackupHelper method getBackupPayload.
@Override
protected byte[] getBackupPayload(String key) {
byte[] newPayload = null;
if (KEY_NOTIFICATIONS.equals(key)) {
try {
INotificationManager nm = INotificationManager.Stub.asInterface(ServiceManager.getService("notification"));
// TODO: http://b/22388012
newPayload = nm.getBackupPayload(UserHandle.USER_SYSTEM);
} catch (Exception e) {
// Treat as no data
Slog.e(TAG, "Couldn't communicate with notification manager");
newPayload = null;
}
}
return newPayload;
}
use of android.app.INotificationManager in project android_frameworks_base by ResurrectionRemix.
the class AccountManagerService method cancelNotification.
protected void cancelNotification(int id, String packageName, UserHandle user) {
long identityToken = clearCallingIdentity();
try {
INotificationManager service = INotificationManager.Stub.asInterface(ServiceManager.getService(Context.NOTIFICATION_SERVICE));
service.cancelNotificationWithTag(packageName, null, id, user.getIdentifier());
} catch (RemoteException e) {
/* ignore - local call */
} finally {
restoreCallingIdentity(identityToken);
}
}
use of android.app.INotificationManager in project android_frameworks_base by ResurrectionRemix.
the class ConditionProviders method onPackagesChanged.
@Override
public void onPackagesChanged(boolean removingPackage, String[] pkgList) {
if (removingPackage) {
INotificationManager inm = NotificationManager.getService();
if (pkgList != null && (pkgList.length > 0)) {
for (String pkgName : pkgList) {
try {
inm.removeAutomaticZenRules(pkgName);
inm.setNotificationPolicyAccessGranted(pkgName, false);
} catch (Exception e) {
Slog.e(TAG, "Failed to clean up rules for " + pkgName, e);
}
}
}
}
super.onPackagesChanged(removingPackage, pkgList);
}
use of android.app.INotificationManager in project android_frameworks_base by ResurrectionRemix.
the class NotificationListenerService method unregisterAsSystemService.
/**
* Directly unregister this service from the Notification Manager.
*
* <p>This method will fail for listeners that were not registered
* with (@link registerAsService).
* @hide
*/
@SystemApi
public void unregisterAsSystemService() throws RemoteException {
if (mWrapper != null) {
INotificationManager noMan = getNotificationInterface();
noMan.unregisterListener(mWrapper, mCurrentUser);
}
}
Aggregations