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