Search in sources :

Example 21 with INotificationManager

use of android.app.INotificationManager in project android_frameworks_base by ResurrectionRemix.

the class NotificationListenerService method registerAsSystemService.

/**
     * Directly register this service with the Notification Manager.
     *
     * <p>Only system services may use this call. It will fail for non-system callers.
     * Apps should ask the user to add their listener in Settings.
     *
     * @param context Context required for accessing resources. Since this service isn't
     *    launched as a real Service when using this method, a context has to be passed in.
     * @param componentName the component that will consume the notification information
     * @param currentUser the user to use as the stream filter
     * @hide
     */
@SystemApi
public void registerAsSystemService(Context context, ComponentName componentName, int currentUser) throws RemoteException {
    if (mWrapper == null) {
        mWrapper = new NotificationListenerWrapper();
    }
    mSystemContext = context;
    INotificationManager noMan = getNotificationInterface();
    mHandler = new MyHandler(context.getMainLooper());
    mCurrentUser = currentUser;
    noMan.registerListener(mWrapper, componentName, currentUser);
}
Also used : INotificationManager(android.app.INotificationManager) SystemApi(android.annotation.SystemApi)

Example 22 with INotificationManager

use of android.app.INotificationManager in project android_frameworks_base by ResurrectionRemix.

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();
        }
    }
}
Also used : INotificationManager(android.app.INotificationManager) RemoteException(android.os.RemoteException)

Example 23 with INotificationManager

use of android.app.INotificationManager in project android_frameworks_base by crdroidandroid.

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;
}
Also used : INotificationManager(android.app.INotificationManager)

Example 24 with INotificationManager

use of android.app.INotificationManager in project android_frameworks_base by crdroidandroid.

the class NotificationListenerService method registerAsSystemService.

/**
     * Directly register this service with the Notification Manager.
     *
     * <p>Only system services may use this call. It will fail for non-system callers.
     * Apps should ask the user to add their listener in Settings.
     *
     * @param context Context required for accessing resources. Since this service isn't
     *    launched as a real Service when using this method, a context has to be passed in.
     * @param componentName the component that will consume the notification information
     * @param currentUser the user to use as the stream filter
     * @hide
     */
@SystemApi
public void registerAsSystemService(Context context, ComponentName componentName, int currentUser) throws RemoteException {
    if (mWrapper == null) {
        mWrapper = new NotificationListenerWrapper();
    }
    mSystemContext = context;
    INotificationManager noMan = getNotificationInterface();
    mHandler = new MyHandler(context.getMainLooper());
    mCurrentUser = currentUser;
    noMan.registerListener(mWrapper, componentName, currentUser);
}
Also used : INotificationManager(android.app.INotificationManager) SystemApi(android.annotation.SystemApi)

Example 25 with INotificationManager

use of android.app.INotificationManager in project android_frameworks_base by crdroidandroid.

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();
        }
    }
}
Also used : INotificationManager(android.app.INotificationManager) RemoteException(android.os.RemoteException)

Aggregations

INotificationManager (android.app.INotificationManager)48 RemoteException (android.os.RemoteException)28 SystemApi (android.annotation.SystemApi)10 Context (android.content.Context)4 Configuration (android.content.res.Configuration)4 Theme (android.content.res.Resources.Theme)4 IMountService (android.os.storage.IMountService)4 DisplayMetrics (android.util.DisplayMetrics)4 WindowManager (android.view.WindowManager)4 ILockSettings (com.android.internal.widget.ILockSettings)4 AccessibilityManagerService (com.android.server.accessibility.AccessibilityManagerService)4 AudioService (com.android.server.audio.AudioService)4 ClipboardService (com.android.server.clipboard.ClipboardService)4 DevicePolicyManagerService (com.android.server.devicepolicy.DevicePolicyManagerService)4 InputManagerService (com.android.server.input.InputManagerService)4 MediaRouterService (com.android.server.media.MediaRouterService)4 NetworkPolicyManagerService (com.android.server.net.NetworkPolicyManagerService)4 NetworkStatsService (com.android.server.net.NetworkStatsService)4 SchedulingPolicyService (com.android.server.os.SchedulingPolicyService)4 ShortcutService (com.android.server.pm.ShortcutService)4