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.ITransientNotificationCallback;
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.os.Bundle;
30 import android.os.ParcelFileDescriptor;
31 import android.view.KeyEvent;
32 import android.service.notification.StatusBarNotification;
33 
34 import com.android.internal.statusbar.IAddTileResultCallback;
35 import com.android.internal.statusbar.IUndoMediaTransferCallback;
36 import com.android.internal.statusbar.LetterboxDetails;
37 import com.android.internal.statusbar.StatusBarIcon;
38 import com.android.internal.view.AppearanceRegion;
39 
40 /** @hide */
41 oneway interface IStatusBar
42 {
setIcon(String slot, in StatusBarIcon icon)43     void setIcon(String slot, in StatusBarIcon icon);
removeIcon(String slot)44     void removeIcon(String slot);
disable(int displayId, int state1, int state2)45     void disable(int displayId, int state1, int state2);
animateExpandNotificationsPanel()46     void animateExpandNotificationsPanel();
animateExpandSettingsPanel(String subPanel)47     void animateExpandSettingsPanel(String subPanel);
animateCollapsePanels()48     void animateCollapsePanels();
togglePanel()49     void togglePanel();
50 
showWirelessChargingAnimation(int batteryLevel)51     void showWirelessChargingAnimation(int batteryLevel);
52 
setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition, boolean showImeSwitcher)53     void setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition,
54             boolean showImeSwitcher);
setWindowState(int display, int window, int state)55     void setWindowState(int display, int window, int state);
56 
showRecentApps(boolean triggeredFromAltTab)57     void showRecentApps(boolean triggeredFromAltTab);
hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey)58     void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
toggleRecentApps()59     void toggleRecentApps();
toggleTaskbar()60     void toggleTaskbar();
toggleSplitScreen()61     void toggleSplitScreen();
preloadRecentApps()62     void preloadRecentApps();
cancelPreloadRecentApps()63     void cancelPreloadRecentApps();
showScreenPinningRequest(int taskId)64     void showScreenPinningRequest(int taskId);
65 
66     /**
67      * Notify system UI the immersive prompt should be dismissed as confirmed, and the confirmed
68      * status should be saved without user clicking on the button. This could happen when a user
69      * swipe on the edge with the confirmation prompt showing.
70      */
confirmImmersivePrompt()71     void confirmImmersivePrompt();
72 
73     /**
74      * Notify system UI the immersive mode changed. This shall be removed when client immersive is
75      * enabled.
76      */
immersiveModeChanged(int rootDisplayAreaId, boolean isImmersiveMode)77     void immersiveModeChanged(int rootDisplayAreaId, boolean isImmersiveMode);
78 
dismissKeyboardShortcutsMenu()79     void dismissKeyboardShortcutsMenu();
toggleKeyboardShortcutsMenu(int deviceId)80     void toggleKeyboardShortcutsMenu(int deviceId);
81 
82     /**
83      * Notifies System UI on the specified display that an app transition is pending to delay
84      * applying some flags with visual impact until {@link #appTransitionReady} is called.
85      *
86      * @param displayId the id of the display to notify
87      */
appTransitionPending(int displayId)88     void appTransitionPending(int displayId);
89 
90     /**
91      * Notifies System UI on the specified display that a pending app transition has been cancelled.
92      *
93      * @param displayId the id of the display to notify
94      */
appTransitionCancelled(int displayId)95     void appTransitionCancelled(int displayId);
96 
97     /**
98      * Notifies System UI on the specified display that an app transition is now being executed.
99      *
100      * @param displayId the id of the display to notify
101      * @param statusBarAnimationsStartTime the desired start time for all visual animations in the
102      *        status bar caused by this app transition in uptime millis
103      * @param statusBarAnimationsDuration the duration for all visual animations in the status
104      *        bar caused by this app transition in millis
105      */
appTransitionStarting(int displayId, long statusBarAnimationsStartTime, long statusBarAnimationsDuration)106     void appTransitionStarting(int displayId, long statusBarAnimationsStartTime,
107             long statusBarAnimationsDuration);
108 
109     /**
110      * Notifies System UI on the specified display that an app transition is done.
111      *
112      * @param displayId the id of the display to notify
113      */
appTransitionFinished(int displayId)114     void appTransitionFinished(int displayId);
115 
showAssistDisclosure()116     void showAssistDisclosure();
startAssist(in Bundle args)117     void startAssist(in Bundle args);
118 
119     /**
120      * Notifies the status bar that a camera launch gesture has been detected.
121      *
122      * @param source the identifier for the gesture, see {@link StatusBarManager}
123      */
onCameraLaunchGestureDetected(int source)124     void onCameraLaunchGestureDetected(int source);
125 
126     /**
127      * Notifies the status bar that the Emergency Action launch gesture has been detected.
128      *
129      * TODO(b/169175022) Update method name and docs when feature name is locked.
130      */
onEmergencyActionLaunchGestureDetected()131     void onEmergencyActionLaunchGestureDetected();
132 
133     /**
134      * Shows the picture-in-picture menu if an activity is in picture-in-picture mode.
135      */
showPictureInPictureMenu()136     void showPictureInPictureMenu();
137 
138     /**
139      * Shows the global actions menu.
140      */
showGlobalActionsMenu()141     void showGlobalActionsMenu();
142 
143     /**
144      * Notifies the status bar that a new rotation suggestion is available.
145      */
onProposedRotationChanged(int rotation, boolean isValid)146     void onProposedRotationChanged(int rotation, boolean isValid);
147 
148     /**
149      * Set whether the top app currently hides the statusbar.
150      *
151      * @param hidesStatusBar whether it is being hidden
152      */
setTopAppHidesStatusBar(boolean hidesStatusBar)153     void setTopAppHidesStatusBar(boolean hidesStatusBar);
154 
addQsTile(in ComponentName tile)155     void addQsTile(in ComponentName tile);
remQsTile(in ComponentName tile)156     void remQsTile(in ComponentName tile);
clickQsTile(in ComponentName tile)157     void clickQsTile(in ComponentName tile);
handleSystemKey(in KeyEvent key)158     void handleSystemKey(in KeyEvent key);
159 
160     /**
161      * Methods to show toast messages for screen pinning
162      */
showPinningEnterExitToast(boolean entering)163     void showPinningEnterExitToast(boolean entering);
showPinningEscapeToast()164     void showPinningEscapeToast();
165 
showShutdownUi(boolean isReboot, String reason)166     void showShutdownUi(boolean isReboot, String reason);
167 
168     /**
169     * Used to show the authentication dialog (Biometrics, Device Credential).
170     */
showAuthenticationDialog(in PromptInfo promptInfo, IBiometricSysuiReceiver sysuiReceiver, in int[] sensorIds, boolean credentialAllowed, boolean requireConfirmation, int userId, long operationId, String opPackageName, long requestId)171     void showAuthenticationDialog(in PromptInfo promptInfo, IBiometricSysuiReceiver sysuiReceiver,
172             in int[] sensorIds, boolean credentialAllowed, boolean requireConfirmation, int userId,
173             long operationId, String opPackageName, long requestId);
174     /**
175     * Used to notify the authentication dialog that a biometric has been authenticated.
176     */
onBiometricAuthenticated(int modality)177     void onBiometricAuthenticated(int modality);
178     /**
179     * Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc.
180     */
onBiometricHelp(int modality, String message)181     void onBiometricHelp(int modality, String message);
182     /** Used to show an error - the dialog will dismiss after a certain amount of time. */
onBiometricError(int modality, int error, int vendorCode)183     void onBiometricError(int modality, int error, int vendorCode);
184     /**
185     * Used to hide the authentication dialog, e.g. when the application cancels authentication.
186     */
hideAuthenticationDialog(long requestId)187     void hideAuthenticationDialog(long requestId);
188     /* Used to notify the biometric service of events that occur outside of an operation. */
setBiometicContextListener(in IBiometricContextListener listener)189     void setBiometicContextListener(in IBiometricContextListener listener);
190 
191     /**
192      * Sets an instance of IUdfpsRefreshRateRequestCallback for UdfpsController.
193      */
setUdfpsRefreshRateCallback(in IUdfpsRefreshRateRequestCallback callback)194     void setUdfpsRefreshRateCallback(in IUdfpsRefreshRateRequestCallback callback);
195 
196     /**
197      * Notifies System UI that the display is ready to show system decorations.
198      */
onDisplayReady(int displayId)199     void onDisplayReady(int displayId);
200 
201     /**
202      * Notifies System UI whether the recents animation is running or not.
203      */
onRecentsAnimationStateChanged(boolean running)204     void onRecentsAnimationStateChanged(boolean running);
205 
206     /**
207      * Notifies System UI side of system bar attribute change on the specified display.
208      *
209      * @param displayId the ID of the display to notify.
210      * @param appearance the appearance of the focused window. The light top bar appearance is not
211      *                   controlled here, but primaryAppearance and secondaryAppearance.
212      * @param appearanceRegions a set of appearances which will be only applied in their own bounds.
213      *                         This is for system bars which across multiple stack, e.g., status
214      *                         bar, that the bar can have partial appearances in corresponding
215      *                         stacks.
216      * @param navbarColorManagedByIme {@code true} if navigation bar color is managed by IME.
217      * @param behavior the behavior of the focused window.
218      * @param requestedVisibleTypes the collection of insets types requested visible.
219      * @param packageName the package name of the focused app.
220      * @param letterboxDetails a set of letterbox details of apps visible on the screen.
221      */
onSystemBarAttributesChanged(int displayId, int appearance, in AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme, int behavior, int requestedVisibleTypes, String packageName, in LetterboxDetails[] letterboxDetails)222     void onSystemBarAttributesChanged(int displayId, int appearance,
223             in AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme,
224             int behavior, int requestedVisibleTypes, String packageName,
225             in LetterboxDetails[] letterboxDetails);
226 
227     /**
228      * Notifies System UI to show transient bars. The transient bars are system bars, e.g., status
229      * bar and navigation bar which are temporarily visible to the user.
230      *
231      * @param displayId the ID of the display to notify.
232      * @param types the insets types of the bars are about to show transiently.
233      * @param isGestureOnSystemBar whether the gesture to show the transient bar was a gesture on
234      *        one of the bars itself.
235      */
showTransient(int displayId, int types, boolean isGestureOnSystemBar)236     void showTransient(int displayId, int types, boolean isGestureOnSystemBar);
237 
238     /**
239      * Notifies System UI to abort the transient state of system bars, which prevents the bars being
240      * hidden automatically. This is usually called when the app wants to show the permanent system
241      * bars again.
242      *
243      * @param displayId the ID of the display to notify.
244      * @param types the insets types of the bars are about to abort the transient state.
245      */
abortTransient(int displayId, int types)246     void abortTransient(int displayId, int types);
247 
248     /**
249      * Show a warning that the device is about to go to sleep due to user inactivity.
250      */
showInattentiveSleepWarning()251     void showInattentiveSleepWarning();
252 
253     /**
254      * Dismiss the warning that the device is about to go to sleep due to user inactivity.
255      */
dismissInattentiveSleepWarning(boolean animated)256     void dismissInattentiveSleepWarning(boolean animated);
257 
258     /**
259      * Displays a text toast.
260      */
showToast(int uid, String packageName, IBinder token, CharSequence text, IBinder windowToken, int duration, @nullable ITransientNotificationCallback callback, int displayId)261     void showToast(int uid, String packageName, IBinder token, CharSequence text,
262             IBinder windowToken, int duration, @nullable ITransientNotificationCallback callback,
263             int displayId);
264 
265     /**
266      * Cancels toast with token {@code token} in {@code packageName}.
267      */
hideToast(String packageName, IBinder token)268     void hideToast(String packageName, IBinder token);
269 
270     /**
271      * Notifies SystemUI to start tracing.
272      */
startTracing()273     void startTracing();
274 
275     /**
276      * Notifies SystemUI to stop tracing.
277      */
stopTracing()278     void stopTracing();
279 
280     /**
281      * If true, suppresses the ambient display from showing. If false, re-enables the ambient
282      * display.
283      */
suppressAmbientDisplay(boolean suppress)284     void suppressAmbientDisplay(boolean suppress);
285 
286     /**
287      * Requests {@link WindowMagnification} to set window magnification connection through
288      * {@link AccessibilityManager#setWindowMagnificationConnection(IWindowMagnificationConnection)}
289      *
290      * @param connect {@code true} if needs connection, otherwise set the connection to null.
291      */
requestWindowMagnificationConnection(boolean connect)292     void requestWindowMagnificationConnection(boolean connect);
293 
294     /**
295      * Allow for pass-through arguments from `adb shell cmd statusbar <args>`, and write to the
296      * file descriptor passed in.
297      */
passThroughShellCommand(in String[] args, in ParcelFileDescriptor pfd)298      void passThroughShellCommand(in String[] args, in ParcelFileDescriptor pfd);
299 
300     /**
301      * Enables/disables the navigation bar luma sampling.
302      *
303      * @param displayId the id of the display to notify.
304      * @param enable {@code true} if enable, otherwise set to {@code false}.
305      */
setNavigationBarLumaSamplingEnabled(int displayId, boolean enable)306     void setNavigationBarLumaSamplingEnabled(int displayId, boolean enable);
307 
308     /**
309      * Triggers a GC in the system and status bar.
310      */
runGcForTest()311     void runGcForTest();
312 
313     /**
314      * Send a request to SystemUI to put a given active tile in listening state
315      */
requestTileServiceListeningState(in ComponentName componentName)316     void requestTileServiceListeningState(in ComponentName componentName);
317 
requestAddTile(in ComponentName componentName, in CharSequence appName, in CharSequence label, in Icon icon, in IAddTileResultCallback callback)318     void requestAddTile(in ComponentName componentName, in CharSequence appName, in CharSequence label, in Icon icon, in IAddTileResultCallback callback);
cancelRequestAddTile(in String packageName)319     void cancelRequestAddTile(in String packageName);
320 
321     /** Notifies System UI about an update to the media tap-to-transfer sender state. */
updateMediaTapToTransferSenderDisplay( int displayState, in MediaRoute2Info routeInfo, in IUndoMediaTransferCallback undoCallback)322     void updateMediaTapToTransferSenderDisplay(
323         int displayState,
324         in MediaRoute2Info routeInfo,
325         in IUndoMediaTransferCallback undoCallback);
326 
327     /** 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)328     void updateMediaTapToTransferReceiverDisplay(
329         int displayState,
330         in MediaRoute2Info routeInfo,
331         in Icon appIcon,
332         in CharSequence appName);
333 
334     /** Registers a nearby media devices provider. */
registerNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider)335     void registerNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider);
336 
337     /** Unregisters a nearby media devices provider. */
unregisterNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider)338     void unregisterNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider);
339 
340     /** Dump protos from SystemUI. The proto definition is defined there */
dumpProto(in String[] args, in ParcelFileDescriptor pfd)341     void dumpProto(in String[] args, in ParcelFileDescriptor pfd);
342 
343     /** Shows rear display educational dialog */
showRearDisplayDialog(int currentBaseState)344     void showRearDisplayDialog(int currentBaseState);
345 
346     /** Called when requested to go to fullscreen from the active split app. */
goToFullscreenFromSplit()347     void goToFullscreenFromSplit();
348 
349     /**
350      * Enters stage split from a current running app.
351      *
352      * @param leftOrTop indicates where the stage split is.
353      */
enterStageSplitFromRunningApp(boolean leftOrTop)354     void enterStageSplitFromRunningApp(boolean leftOrTop);
355 
356     /**
357      * Shows the media output switcher dialog.
358      *
359      * @param packageName of the session for which the output switcher is shown.
360      */
showMediaOutputSwitcher(String packageName)361     void showMediaOutputSwitcher(String packageName);
362 }
363