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