use of android.app.INotificationManager in project android_frameworks_base by DirtyUnicorns.
the class Toast method show.
/**
* Show the view for the specified duration.
*/
public void show() {
if (mNextView == null) {
throw new RuntimeException("setView must have been called");
}
INotificationManager service = getService();
String pkg = mContext.getOpPackageName();
TN tn = mTN;
tn.mNextView = mNextView;
try {
service.enqueueToast(pkg, tn, mDuration);
} catch (RemoteException e) {
// Empty
}
}
use of android.app.INotificationManager in project android_frameworks_base by DirtyUnicorns.
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 DirtyUnicorns.
the class NotificationBackupHelper method applyRestoredPayload.
@Override
protected void applyRestoredPayload(String key, byte[] payload) {
if (DEBUG) {
Slog.v(TAG, "Got restore of " + key);
}
if (KEY_NOTIFICATIONS.equals(key)) {
try {
INotificationManager nm = INotificationManager.Stub.asInterface(ServiceManager.getService("notification"));
// TODO: http://b/22388012
nm.applyRestore(payload, UserHandle.USER_SYSTEM);
} catch (Exception e) {
Slog.e(TAG, "Couldn't communicate with notification manager");
}
}
}
use of android.app.INotificationManager in project android_frameworks_base by AOSPA.
the class NotificationBackupHelper method applyRestoredPayload.
@Override
protected void applyRestoredPayload(String key, byte[] payload) {
if (DEBUG) {
Slog.v(TAG, "Got restore of " + key);
}
if (KEY_NOTIFICATIONS.equals(key)) {
try {
INotificationManager nm = INotificationManager.Stub.asInterface(ServiceManager.getService("notification"));
// TODO: http://b/22388012
nm.applyRestore(payload, UserHandle.USER_SYSTEM);
} catch (Exception e) {
Slog.e(TAG, "Couldn't communicate with notification manager");
}
}
}
use of android.app.INotificationManager in project android_frameworks_base by AOSPA.
the class NotificationListenerService method requestUnbind.
/**
* Request that the service be unbound.
*
* <p>This will no longer receive updates until
* {@link #requestRebind(ComponentName)} is called.
* The service will likely be kiled by the system after this call.
*
* <p>The service should wait for the {@link #onListenerConnected()} event
* before performing this operation. I know it's tempting, but you must wait.
*/
public final void requestUnbind() {
if (mWrapper != null) {
INotificationManager noMan = getNotificationInterface();
try {
noMan.requestUnbindListener(mWrapper);
// Disable future messages.
isConnected = false;
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
}
}
Aggregations