public abstract class NotificationRankerService extends NotificationListenerService
NotificationListenerService.NotificationListenerWrapper, NotificationListenerService.Ranking, NotificationListenerService.RankingMap
Service.StartArgFlags, Service.StartResult, Service.StopForegroundFlags
Context.BindServiceFlags, Context.CreatePackageOptions, Context.ServiceName
Modifier and Type | Field and Description |
---|---|
static int |
REASON_APP_CANCEL
Notification was canceled by the app canceling this specific notification.
|
static int |
REASON_APP_CANCEL_ALL
Notification was canceled by the app cancelling all its notifications.
|
static int |
REASON_DELEGATE_CANCEL
Notification was canceled by the status bar reporting a user dismissal.
|
static int |
REASON_DELEGATE_CANCEL_ALL
Notification was canceled by the status bar reporting a user dismiss all.
|
static int |
REASON_DELEGATE_CLICK
Notification was canceled by the status bar reporting a click.
|
static int |
REASON_DELEGATE_ERROR
Notification was canceled by the status bar reporting an inflation error.
|
static int |
REASON_GROUP_OPTIMIZATION
Notification was canceled because it was an invisible member of a group.
|
static int |
REASON_GROUP_SUMMARY_CANCELED
Notification was canceled because it was a member of a canceled group.
|
static int |
REASON_LISTENER_CANCEL
Notification was canceled by a listener reporting a user dismissal.
|
static int |
REASON_LISTENER_CANCEL_ALL
Notification was canceled by a listener reporting a user dismiss all.
|
static int |
REASON_PACKAGE_BANNED
Notification was canceled by the user banning the package.
|
static int |
REASON_PACKAGE_CHANGED
Notification was canceled by the package manager modifying the package.
|
static int |
REASON_PACKAGE_SUSPENDED
Notification was canceled by the device administrator suspending the package.
|
static int |
REASON_PROFILE_TURNED_OFF
Notification was canceled by the owning managed profile being turned off.
|
static int |
REASON_UNAUTOBUNDLED
Autobundled summary notification was canceled because its group was unbundled
|
static int |
REASON_USER_STOPPED
Notification was canceled by the owning user context being stopped.
|
static String |
SERVICE_INTERFACE
The
Intent that must be declared as handled by the service. |
HINT_HOST_DISABLE_CALL_EFFECTS, HINT_HOST_DISABLE_EFFECTS, HINT_HOST_DISABLE_NOTIFICATION_EFFECTS, INTERRUPTION_FILTER_ALARMS, INTERRUPTION_FILTER_ALL, INTERRUPTION_FILTER_NONE, INTERRUPTION_FILTER_PRIORITY, INTERRUPTION_FILTER_UNKNOWN, mCurrentUser, mSystemContext, mWrapper, SUPPRESSED_EFFECT_SCREEN_OFF, SUPPRESSED_EFFECT_SCREEN_ON, TRIM_FULL, TRIM_LIGHT
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY, START_TASK_REMOVED_COMPLETE, STOP_FOREGROUND_DETACH, STOP_FOREGROUND_REMOVE
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BACKUP_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_ALLOW_WHITELIST_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_FOREGROUND_SERVICE, BIND_FOREGROUND_SERVICE_WHILE_AWAKE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_NOT_VISIBLE, BIND_SHOWING_UI, BIND_TREAT_LIKE_ACTIVITY, BIND_VISIBLE, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_CREDENTIAL_PROTECTED_STORAGE, CONTEXT_DEVICE_PROTECTED_STORAGE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_REGISTER_PACKAGE, CONTEXT_RESTRICTED, CONTEXTHUB_SERVICE, COUNTRY_DETECTOR, DEVICE_IDLE_CONTROLLER, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, ETHERNET_SERVICE, FINGERPRINT_SERVICE, GATEKEEPER_SERVICE, HARDWARE_PROPERTIES_SERVICE, HDMI_CONTROL_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_POLICY_SERVICE, NETWORK_SCORE_SERVICE, NETWORK_STATS_SERVICE, NETWORKMANAGEMENT_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, PERSISTENT_DATA_BLOCK_SERVICE, POWER_SERVICE, PRINT_SERVICE, RADIO_SERVICE, RECOVERY_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SERIAL_SERVICE, SHORTCUT_SERVICE, SIP_SERVICE, SOUND_TRIGGER_SERVICE, STATUS_BAR_SERVICE, STORAGE_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TRUST_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, UPDATE_LOCK_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, VOICE_INTERACTION_MANAGER_SERVICE, WALLPAPER_SERVICE, WIFI_NAN_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_SERVICE, WIFI_SCANNING_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description |
---|
NotificationRankerService() |
Modifier and Type | Method and Description |
---|---|
void |
adjustNotification(Adjustment adjustment)
Updates a notification.
|
void |
adjustNotifications(List<Adjustment> adjustments)
Updates existing notifications.
|
protected void |
attachBaseContext(Context base)
Set the base context for this ContextWrapper.
|
IBinder |
onBind(Intent intent)
This is not the lifecycle event you are looking for.
|
void |
onNotificationActionClick(String key,
long time,
int actionIndex)
The user clicked on a notification action.
|
void |
onNotificationClick(String key,
long time)
The user clicked on a notification.
|
abstract Adjustment |
onNotificationEnqueued(StatusBarNotification sbn,
int importance,
boolean user)
A notification was posted by an app.
|
void |
onNotificationRemoved(String key,
long time,
int reason)
A notification was removed.
|
void |
onNotificationVisibilityChanged(String key,
long time,
boolean visible)
The visibility of a notification has changed.
|
void |
registerAsSystemService(Context context,
ComponentName componentName,
int currentUser)
Directly register this service with the Notification Manager.
|
void |
unregisterAsSystemService()
Directly unregister this service from the Notification Manager.
|
cancelAllNotifications, cancelNotification, cancelNotification, cancelNotifications, getActiveNotifications, getActiveNotifications, getActiveNotifications, getActiveNotifications, getContext, getCurrentInterruptionFilter, getCurrentListenerHints, getCurrentRanking, getNotificationInterface, isBound, onDestroy, onInterruptionFilterChanged, onListenerConnected, onListenerDisconnected, onListenerHintsChanged, onNotificationPosted, onNotificationPosted, onNotificationRankingUpdate, onNotificationRemoved, onNotificationRemoved, requestInterruptionFilter, requestListenerHints, requestRebind, requestUnbind, setNotificationsShown, setOnNotificationPostedTrim
attach, dump, getApplication, onConfigurationChanged, onCreate, onLowMemory, onRebind, onStart, onStartCommand, onTaskRemoved, onTrimMemory, onUnbind, setForeground, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
bindService, bindServiceAsUser, canStartActivityForResult, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermission, clearWallpaper, createApplicationContext, createConfigurationContext, createCredentialProtectedStorageContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createPackageContextAsUser, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getBasePackageName, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getDisplay, getDisplayAdjustments, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSharedPreferences, getSharedPreferencesPath, getSystemService, getSystemServiceName, getTheme, getThemeResId, getUserId, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isCredentialProtectedStorage, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiverAsUser, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendBroadcastAsUser, sendBroadcastMultiplePermissions, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendOrderedBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivitiesAsUser, startActivity, startActivity, startActivityAsUser, startActivityAsUser, startActivityForResult, startInstrumentation, startIntentSender, startIntentSender, startService, startServiceAsUser, stopService, stopServiceAsUser, unbindService, unregisterReceiver
bindServiceAsUser, createCredentialEncryptedStorageContext, createDeviceEncryptedStorageContext, getColor, getColorStateList, getDrawable, getSharedPrefsFile, getString, getString, getSystemService, getText, isCredentialEncryptedStorage, isDeviceEncryptedStorage, migrateDatabaseFrom, migrateSharedPreferencesFrom, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
public static final String SERVICE_INTERFACE
Intent
that must be declared as handled by the service.public static final int REASON_DELEGATE_CLICK
public static final int REASON_DELEGATE_CANCEL
public static final int REASON_DELEGATE_CANCEL_ALL
public static final int REASON_DELEGATE_ERROR
public static final int REASON_PACKAGE_CHANGED
public static final int REASON_USER_STOPPED
public static final int REASON_PACKAGE_BANNED
public static final int REASON_APP_CANCEL
public static final int REASON_APP_CANCEL_ALL
public static final int REASON_LISTENER_CANCEL
public static final int REASON_LISTENER_CANCEL_ALL
public static final int REASON_GROUP_SUMMARY_CANCELED
public static final int REASON_GROUP_OPTIMIZATION
public static final int REASON_PACKAGE_SUSPENDED
public static final int REASON_PROFILE_TURNED_OFF
public static final int REASON_UNAUTOBUNDLED
public void registerAsSystemService(Context context, ComponentName componentName, int currentUser)
NotificationListenerService
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.
registerAsSystemService
in class NotificationListenerService
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.componentName
- the component that will consume the notification informationcurrentUser
- the user to use as the stream filterpublic void unregisterAsSystemService()
NotificationListenerService
This method will fail for listeners that were not registered with (@link registerAsService).
unregisterAsSystemService
in class NotificationListenerService
protected void attachBaseContext(Context base)
ContextWrapper
attachBaseContext
in class NotificationListenerService
base
- The new base context for this wrapper.public final IBinder onBind(Intent intent)
NotificationListenerService
The service should wait for the NotificationListenerService.onListenerConnected()
event
before performing any operations.
onBind
in class NotificationListenerService
intent
- The Intent that was used to bind to this service,
as given to Context.bindService
. Note that any extras that were included with
the Intent at that point will not be seen here.public abstract Adjustment onNotificationEnqueued(StatusBarNotification sbn, int importance, boolean user)
sbn
- the new notificationimportance
- the initial importance of the notification.user
- true if the initial importance reflects an explicit user preference.public void onNotificationVisibilityChanged(String key, long time, boolean visible)
key
- the notification keytime
- milliseconds since midnight, January 1, 1970 UTC.visible
- true if the notification became visible, false if hidden.public void onNotificationClick(String key, long time)
key
- the notification keytime
- milliseconds since midnight, January 1, 1970 UTC.public void onNotificationActionClick(String key, long time, int actionIndex)
key
- the notification keytime
- milliseconds since midnight, January 1, 1970 UTC.actionIndex
- the index of the action button that was pressed.public void onNotificationRemoved(String key, long time, int reason)
key
- the notification keytime
- milliseconds since midnight, January 1, 1970 UTC.reason
- see REASON_LISTENER_CANCEL
, etc.public final void adjustNotification(Adjustment adjustment)
adjustment
- the adjustment with an explanationpublic final void adjustNotifications(List<Adjustment> adjustments)
adjustments
- a list of adjustments with explanations