1 /** 2 * Copyright (c) 2007, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.internal.statusbar; 18 19 import android.app.Notification; 20 import android.content.ComponentName; 21 import android.graphics.drawable.Icon; 22 import android.graphics.Rect; 23 import android.hardware.biometrics.IBiometricContextListener; 24 import android.hardware.biometrics.IBiometricSysuiReceiver; 25 import android.hardware.biometrics.PromptInfo; 26 import android.hardware.fingerprint.IUdfpsRefreshRateRequestCallback; 27 import android.media.INearbyMediaDevicesProvider; 28 import android.media.MediaRoute2Info; 29 import android.net.Uri; 30 import android.os.Bundle; 31 import android.os.UserHandle; 32 import android.view.KeyEvent; 33 import android.service.notification.StatusBarNotification; 34 35 import com.android.internal.logging.InstanceId; 36 import com.android.internal.statusbar.IAddTileResultCallback; 37 import com.android.internal.statusbar.ISessionListener; 38 import com.android.internal.statusbar.IStatusBar; 39 import com.android.internal.statusbar.IUndoMediaTransferCallback; 40 import com.android.internal.statusbar.RegisterStatusBarResult; 41 import com.android.internal.statusbar.StatusBarIcon; 42 import com.android.internal.statusbar.StatusBarIconList; 43 import com.android.internal.statusbar.NotificationVisibility; 44 45 /** @hide */ 46 interface IStatusBarService 47 { 48 @UnsupportedAppUsage expandNotificationsPanel()49 void expandNotificationsPanel(); 50 @UnsupportedAppUsage collapsePanels()51 void collapsePanels(); togglePanel()52 void togglePanel(); 53 @UnsupportedAppUsage disable(int what, IBinder token, String pkg)54 void disable(int what, IBinder token, String pkg); disableForUser(int what, IBinder token, String pkg, int userId)55 void disableForUser(int what, IBinder token, String pkg, int userId); disable2(int what, IBinder token, String pkg)56 void disable2(int what, IBinder token, String pkg); disable2ForUser(int what, IBinder token, String pkg, int userId)57 void disable2ForUser(int what, IBinder token, String pkg, int userId); getDisableFlags(IBinder token, int userId)58 int[] getDisableFlags(IBinder token, int userId); setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription)59 void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription); 60 @UnsupportedAppUsage setIconVisibility(String slot, boolean visible)61 void setIconVisibility(String slot, boolean visible); 62 @UnsupportedAppUsage removeIcon(String slot)63 void removeIcon(String slot); setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition, boolean showImeSwitcher)64 void setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition, 65 boolean showImeSwitcher); expandSettingsPanel(String subPanel)66 void expandSettingsPanel(String subPanel); 67 68 // ---- Methods below are for use by the status bar policy services ---- 69 // You need the STATUS_BAR_SERVICE permission registerStatusBar(IStatusBar callbacks)70 RegisterStatusBarResult registerStatusBar(IStatusBar callbacks); onPanelRevealed(boolean clearNotificationEffects, int numItems)71 void onPanelRevealed(boolean clearNotificationEffects, int numItems); onPanelHidden()72 void onPanelHidden(); 73 // Mark current notifications as "seen" and stop ringing, vibrating, blinking. clearNotificationEffects()74 oneway void clearNotificationEffects(); onNotificationClick(String key, in NotificationVisibility nv)75 void onNotificationClick(String key, in NotificationVisibility nv); onNotificationActionClick(String key, int actionIndex, in Notification.Action action, in NotificationVisibility nv, boolean generatedByAssistant)76 void onNotificationActionClick(String key, int actionIndex, in Notification.Action action, in NotificationVisibility nv, boolean generatedByAssistant); onNotificationError(String pkg, String tag, int id, int uid, int initialPid, String message, int userId)77 void onNotificationError(String pkg, String tag, int id, 78 int uid, int initialPid, String message, int userId); onClearAllNotifications(int userId)79 void onClearAllNotifications(int userId); onNotificationClear(String pkg, int userId, String key, int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv)80 void onNotificationClear(String pkg, int userId, String key, 81 int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv); onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys, in NotificationVisibility[] noLongerVisibleKeys)82 void onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys, 83 in NotificationVisibility[] noLongerVisibleKeys); onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded, in int notificationLocation)84 void onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded, in int notificationLocation); onNotificationDirectReplied(String key)85 void onNotificationDirectReplied(String key); onNotificationSmartSuggestionsAdded(String key, int smartReplyCount, int smartActionCount, boolean generatedByAsssistant, boolean editBeforeSending)86 void onNotificationSmartSuggestionsAdded(String key, int smartReplyCount, int smartActionCount, 87 boolean generatedByAsssistant, boolean editBeforeSending); onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply, in int notificationLocation, boolean modifiedBeforeSending)88 void onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply, 89 in int notificationLocation, boolean modifiedBeforeSending); onNotificationSettingsViewed(String key)90 void onNotificationSettingsViewed(String key); onNotificationBubbleChanged(String key, boolean isBubble, int flags)91 void onNotificationBubbleChanged(String key, boolean isBubble, int flags); onBubbleMetadataFlagChanged(String key, int flags)92 void onBubbleMetadataFlagChanged(String key, int flags); hideCurrentInputMethodForBubbles(int displayId)93 void hideCurrentInputMethodForBubbles(int displayId); grantInlineReplyUriPermission(String key, in Uri uri, in UserHandle user, String packageName)94 void grantInlineReplyUriPermission(String key, in Uri uri, in UserHandle user, String packageName); clearInlineReplyUriPermissions(String key)95 oneway void clearInlineReplyUriPermissions(String key); onNotificationFeedbackReceived(String key, in Bundle feedback)96 void onNotificationFeedbackReceived(String key, in Bundle feedback); 97 onGlobalActionsShown()98 void onGlobalActionsShown(); onGlobalActionsHidden()99 void onGlobalActionsHidden(); 100 101 /** 102 * These methods are needed for global actions control which the UI is shown in sysui. 103 */ shutdown()104 void shutdown(); reboot(boolean safeMode)105 void reboot(boolean safeMode); 106 107 /** just restarts android without rebooting device. Used for some feature flags. */ restart()108 void restart(); 109 addTile(in ComponentName tile)110 void addTile(in ComponentName tile); remTile(in ComponentName tile)111 void remTile(in ComponentName tile); clickTile(in ComponentName tile)112 void clickTile(in ComponentName tile); 113 @UnsupportedAppUsage handleSystemKey(in KeyEvent key)114 void handleSystemKey(in KeyEvent key); getLastSystemKey()115 int getLastSystemKey(); 116 117 /** 118 * Methods to show toast messages for screen pinning 119 */ showPinningEnterExitToast(boolean entering)120 void showPinningEnterExitToast(boolean entering); showPinningEscapeToast()121 void showPinningEscapeToast(); 122 123 // Used to show the authentication dialog (Biometrics, Device Credential) showAuthenticationDialog(in PromptInfo promptInfo, IBiometricSysuiReceiver sysuiReceiver, in int[] sensorIds, boolean credentialAllowed, boolean requireConfirmation, int userId, long operationId, String opPackageName, long requestId)124 void showAuthenticationDialog(in PromptInfo promptInfo, IBiometricSysuiReceiver sysuiReceiver, 125 in int[] sensorIds, boolean credentialAllowed, boolean requireConfirmation, 126 int userId, long operationId, String opPackageName, long requestId); 127 128 // Used to notify the authentication dialog that a biometric has been authenticated onBiometricAuthenticated(int modality)129 void onBiometricAuthenticated(int modality); 130 // Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc onBiometricHelp(int modality, String message)131 void onBiometricHelp(int modality, String message); 132 // Used to show an error - the dialog will dismiss after a certain amount of time onBiometricError(int modality, int error, int vendorCode)133 void onBiometricError(int modality, int error, int vendorCode); 134 // Used to hide the authentication dialog, e.g. when the application cancels authentication hideAuthenticationDialog(long requestId)135 void hideAuthenticationDialog(long requestId); 136 // Used to notify the biometric service of events that occur outside of an operation. setBiometicContextListener(in IBiometricContextListener listener)137 void setBiometicContextListener(in IBiometricContextListener listener); 138 139 /** 140 * Sets an instance of IUdfpsRefreshRateRequestCallback for UdfpsController. 141 */ setUdfpsRefreshRateCallback(in IUdfpsRefreshRateRequestCallback callback)142 void setUdfpsRefreshRateCallback(in IUdfpsRefreshRateRequestCallback callback); 143 144 /** 145 * Show a warning that the device is about to go to sleep due to user inactivity. 146 */ showInattentiveSleepWarning()147 void showInattentiveSleepWarning(); 148 149 /** 150 * Dismiss the warning that the device is about to go to sleep due to user inactivity. 151 */ dismissInattentiveSleepWarning(boolean animated)152 void dismissInattentiveSleepWarning(boolean animated); 153 154 /** 155 * Notifies SystemUI to start tracing. 156 */ startTracing()157 void startTracing(); 158 159 /** 160 * Notifies SystemUI to stop tracing. 161 */ stopTracing()162 void stopTracing(); 163 164 /** 165 * Returns whether SystemUI tracing is enabled. 166 */ isTracing()167 boolean isTracing(); 168 169 /** 170 * If true, suppresses the ambient display from showing. If false, re-enables the ambient 171 * display. 172 */ suppressAmbientDisplay(boolean suppress)173 void suppressAmbientDisplay(boolean suppress); 174 175 /** 176 * Send a request to SystemUI to put a given active tile in listening state 177 */ requestTileServiceListeningState(in ComponentName componentName, int userId)178 void requestTileServiceListeningState(in ComponentName componentName, int userId); 179 requestAddTile(in ComponentName componentName, in CharSequence label, in Icon icon, int userId, in IAddTileResultCallback callback)180 void requestAddTile(in ComponentName componentName, in CharSequence label, in Icon icon, int userId, in IAddTileResultCallback callback); cancelRequestAddTile(in String packageName)181 void cancelRequestAddTile(in String packageName); 182 183 /** 184 * Sets the navigation bar mode. 185 * 186 * @param navBarMode the mode of the navigation bar to be set. 187 * 188 * @hide 189 */ setNavBarMode(int navBarMode)190 void setNavBarMode(int navBarMode); 191 192 /** 193 * Gets the navigation bar mode. 194 * 195 * @hide 196 */ getNavBarMode()197 int getNavBarMode(); 198 199 /** 200 * Register a listener for certain sessions. Each session may be guarded by its own permission. 201 */ registerSessionListener(int sessionFlags, in ISessionListener listener)202 void registerSessionListener(int sessionFlags, in ISessionListener listener); unregisterSessionListener(int sessionFlags, in ISessionListener listener)203 void unregisterSessionListener(int sessionFlags, in ISessionListener listener); 204 205 /** 206 * Informs all registered listeners that a session has begun and has the following instanceId. 207 * Can only be set by callers with certain permission based on the session type being updated. 208 */ onSessionStarted(int sessionType, in InstanceId instanceId)209 void onSessionStarted(int sessionType, in InstanceId instanceId); onSessionEnded(int sessionType, in InstanceId instanceId)210 void onSessionEnded(int sessionType, in InstanceId instanceId); 211 212 /** Notifies System UI about an update to the media tap-to-transfer sender state. */ updateMediaTapToTransferSenderDisplay( int displayState, in MediaRoute2Info routeInfo, in IUndoMediaTransferCallback undoCallback)213 void updateMediaTapToTransferSenderDisplay( 214 int displayState, 215 in MediaRoute2Info routeInfo, 216 in IUndoMediaTransferCallback undoCallback); 217 218 /** Notifies System UI about an update to the media tap-to-transfer receiver state. */ updateMediaTapToTransferReceiverDisplay( int displayState, in MediaRoute2Info routeInfo, in Icon appIcon, in CharSequence appName)219 void updateMediaTapToTransferReceiverDisplay( 220 int displayState, 221 in MediaRoute2Info routeInfo, 222 in Icon appIcon, 223 in CharSequence appName); 224 225 /** Registers a nearby media devices provider. */ registerNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider)226 void registerNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider); 227 228 /** Unregisters a nearby media devices provider. */ unregisterNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider)229 void unregisterNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider); 230 231 /** Shows rear display educational dialog */ showRearDisplayDialog(int currentBaseState)232 void showRearDisplayDialog(int currentBaseState); 233 } 234