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.Rect;
22 import android.hardware.biometrics.IBiometricSysuiReceiver;
23 import android.hardware.biometrics.PromptInfo;
24 import android.hardware.fingerprint.IUdfpsHbmListener;
25 import android.os.Bundle;
26 import android.os.ParcelFileDescriptor;
27 import android.service.notification.StatusBarNotification;
28 import android.view.InsetsVisibilities;
29 
30 import com.android.internal.statusbar.StatusBarIcon;
31 import com.android.internal.view.AppearanceRegion;
32 
33 /** @hide */
34 oneway interface IStatusBar
35 {
setIcon(String slot, in StatusBarIcon icon)36     void setIcon(String slot, in StatusBarIcon icon);
removeIcon(String slot)37     void removeIcon(String slot);
disable(int displayId, int state1, int state2)38     void disable(int displayId, int state1, int state2);
animateExpandNotificationsPanel()39     void animateExpandNotificationsPanel();
animateExpandSettingsPanel(String subPanel)40     void animateExpandSettingsPanel(String subPanel);
animateCollapsePanels()41     void animateCollapsePanels();
togglePanel()42     void togglePanel();
43 
showWirelessChargingAnimation(int batteryLevel)44     void showWirelessChargingAnimation(int batteryLevel);
45 
setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition, boolean showImeSwitcher, boolean isMultiClientImeEnabled)46     void setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition,
47             boolean showImeSwitcher, boolean isMultiClientImeEnabled);
setWindowState(int display, int window, int state)48     void setWindowState(int display, int window, int state);
49 
showRecentApps(boolean triggeredFromAltTab)50     void showRecentApps(boolean triggeredFromAltTab);
hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey)51     void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
toggleRecentApps()52     void toggleRecentApps();
toggleSplitScreen()53     void toggleSplitScreen();
preloadRecentApps()54     void preloadRecentApps();
cancelPreloadRecentApps()55     void cancelPreloadRecentApps();
showScreenPinningRequest(int taskId)56     void showScreenPinningRequest(int taskId);
57 
dismissKeyboardShortcutsMenu()58     void dismissKeyboardShortcutsMenu();
toggleKeyboardShortcutsMenu(int deviceId)59     void toggleKeyboardShortcutsMenu(int deviceId);
60 
61     /**
62      * Notifies System UI on the specified display that an app transition is pending to delay
63      * applying some flags with visual impact until {@link #appTransitionReady} is called.
64      *
65      * @param displayId the id of the display to notify
66      */
appTransitionPending(int displayId)67     void appTransitionPending(int displayId);
68 
69     /**
70      * Notifies System UI on the specified display that a pending app transition has been cancelled.
71      *
72      * @param displayId the id of the display to notify
73      */
appTransitionCancelled(int displayId)74     void appTransitionCancelled(int displayId);
75 
76     /**
77      * Notifies System UI on the specified display that an app transition is now being executed.
78      *
79      * @param displayId the id of the display to notify
80      * @param statusBarAnimationsStartTime the desired start time for all visual animations in the
81      *        status bar caused by this app transition in uptime millis
82      * @param statusBarAnimationsDuration the duration for all visual animations in the status
83      *        bar caused by this app transition in millis
84      */
appTransitionStarting(int displayId, long statusBarAnimationsStartTime, long statusBarAnimationsDuration)85     void appTransitionStarting(int displayId, long statusBarAnimationsStartTime,
86             long statusBarAnimationsDuration);
87 
88     /**
89      * Notifies System UI on the specified display that an app transition is done.
90      *
91      * @param displayId the id of the display to notify
92      */
appTransitionFinished(int displayId)93     void appTransitionFinished(int displayId);
94 
showAssistDisclosure()95     void showAssistDisclosure();
startAssist(in Bundle args)96     void startAssist(in Bundle args);
97 
98     /**
99      * Notifies the status bar that a camera launch gesture has been detected.
100      *
101      * @param source the identifier for the gesture, see {@link StatusBarManager}
102      */
onCameraLaunchGestureDetected(int source)103     void onCameraLaunchGestureDetected(int source);
104 
105     /**
106      * Notifies the status bar that the Emergency Action launch gesture has been detected.
107      *
108      * TODO(b/169175022) Update method name and docs when feature name is locked.
109      */
onEmergencyActionLaunchGestureDetected()110     void onEmergencyActionLaunchGestureDetected();
111 
112     /**
113      * Shows the picture-in-picture menu if an activity is in picture-in-picture mode.
114      */
showPictureInPictureMenu()115     void showPictureInPictureMenu();
116 
117     /**
118      * Shows the global actions menu.
119      */
showGlobalActionsMenu()120     void showGlobalActionsMenu();
121 
122     /**
123      * Notifies the status bar that a new rotation suggestion is available.
124      */
onProposedRotationChanged(int rotation, boolean isValid)125     void onProposedRotationChanged(int rotation, boolean isValid);
126 
127     /**
128      * Set whether the top app currently hides the statusbar.
129      *
130      * @param hidesStatusBar whether it is being hidden
131      */
setTopAppHidesStatusBar(boolean hidesStatusBar)132     void setTopAppHidesStatusBar(boolean hidesStatusBar);
133 
addQsTile(in ComponentName tile)134     void addQsTile(in ComponentName tile);
remQsTile(in ComponentName tile)135     void remQsTile(in ComponentName tile);
clickQsTile(in ComponentName tile)136     void clickQsTile(in ComponentName tile);
handleSystemKey(in int key)137     void handleSystemKey(in int key);
138 
139     /**
140      * Methods to show toast messages for screen pinning
141      */
showPinningEnterExitToast(boolean entering)142     void showPinningEnterExitToast(boolean entering);
showPinningEscapeToast()143     void showPinningEscapeToast();
144 
showShutdownUi(boolean isReboot, String reason)145     void showShutdownUi(boolean isReboot, String reason);
146 
147     /**
148     * Used to show the authentication dialog (Biometrics, Device Credential).
149     */
showAuthenticationDialog(in PromptInfo promptInfo, IBiometricSysuiReceiver sysuiReceiver, in int[] sensorIds, boolean credentialAllowed, boolean requireConfirmation, int userId, long operationId, String opPackageName, long requestId, int multiSensorConfig)150     void showAuthenticationDialog(in PromptInfo promptInfo, IBiometricSysuiReceiver sysuiReceiver,
151             in int[] sensorIds, boolean credentialAllowed, boolean requireConfirmation, int userId,
152             long operationId, String opPackageName, long requestId, int multiSensorConfig);
153     /**
154     * Used to notify the authentication dialog that a biometric has been authenticated.
155     */
onBiometricAuthenticated()156     void onBiometricAuthenticated();
157     /**
158     * Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc.
159     */
onBiometricHelp(int modality, String message)160     void onBiometricHelp(int modality, String message);
161     /** Used to show an error - the dialog will dismiss after a certain amount of time. */
onBiometricError(int modality, int error, int vendorCode)162     void onBiometricError(int modality, int error, int vendorCode);
163     /**
164     * Used to hide the authentication dialog, e.g. when the application cancels authentication.
165     */
hideAuthenticationDialog()166     void hideAuthenticationDialog();
167 
168     /**
169      * Sets an instance of IUdfpsHbmListener for UdfpsController.
170      */
setUdfpsHbmListener(in IUdfpsHbmListener listener)171     void setUdfpsHbmListener(in IUdfpsHbmListener listener);
172 
173     /**
174      * Notifies System UI that the display is ready to show system decorations.
175      */
onDisplayReady(int displayId)176     void onDisplayReady(int displayId);
177 
178     /**
179      * Notifies System UI whether the recents animation is running or not.
180      */
onRecentsAnimationStateChanged(boolean running)181     void onRecentsAnimationStateChanged(boolean running);
182 
183     /**
184      * Notifies System UI side of system bar attribute change on the specified display.
185      *
186      * @param displayId the ID of the display to notify.
187      * @param appearance the appearance of the focused window. The light top bar appearance is not
188      *                   controlled here, but primaryAppearance and secondaryAppearance.
189      * @param appearanceRegions a set of appearances which will be only applied in their own bounds.
190      *                         This is for system bars which across multiple stack, e.g., status
191      *                         bar, that the bar can have partial appearances in corresponding
192      *                         stacks.
193      * @param navbarColorManagedByIme {@code true} if navigation bar color is managed by IME.
194      * @param behavior the behavior of the focused window.
195      * @param requestedVisibilities the collection of the requested visibilities of system insets.
196      * @param packageName the package name of the focused app.
197      */
onSystemBarAttributesChanged(int displayId, int appearance, in AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme, int behavior, in InsetsVisibilities requestedVisibilities, String packageName)198     void onSystemBarAttributesChanged(int displayId, int appearance,
199             in AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme,
200             int behavior, in InsetsVisibilities requestedVisibilities, String packageName);
201 
202     /**
203      * Notifies System UI to show transient bars. The transient bars are system bars, e.g., status
204      * bar and navigation bar which are temporarily visible to the user.
205      *
206      * @param displayId the ID of the display to notify.
207      * @param types the internal insets types of the bars are about to show transiently.
208      * @param isGestureOnSystemBar whether the gesture to show the transient bar was a gesture on
209      *        one of the bars itself.
210      */
showTransient(int displayId, in int[] types, boolean isGestureOnSystemBar)211     void showTransient(int displayId, in int[] types, boolean isGestureOnSystemBar);
212 
213     /**
214      * Notifies System UI to abort the transient state of system bars, which prevents the bars being
215      * hidden automatically. This is usually called when the app wants to show the permanent system
216      * bars again.
217      *
218      * @param displayId the ID of the display to notify.
219      * @param types the internal insets types of the bars are about to abort the transient state.
220      */
abortTransient(int displayId, in int[] types)221     void abortTransient(int displayId, in int[] types);
222 
223     /**
224      * Show a warning that the device is about to go to sleep due to user inactivity.
225      */
showInattentiveSleepWarning()226     void showInattentiveSleepWarning();
227 
228     /**
229      * Dismiss the warning that the device is about to go to sleep due to user inactivity.
230      */
dismissInattentiveSleepWarning(boolean animated)231     void dismissInattentiveSleepWarning(boolean animated);
232 
233     /**
234      * Displays a text toast.
235      */
showToast(int uid, String packageName, IBinder token, CharSequence text, IBinder windowToken, int duration, @nullable ITransientNotificationCallback callback)236     void showToast(int uid, String packageName, IBinder token, CharSequence text,
237             IBinder windowToken, int duration, @nullable ITransientNotificationCallback callback);
238 
239     /**
240      * Cancels toast with token {@code token} in {@code packageName}.
241      */
hideToast(String packageName, IBinder token)242     void hideToast(String packageName, IBinder token);
243 
244     /**
245      * Notifies SystemUI to start tracing.
246      */
startTracing()247     void startTracing();
248 
249     /**
250      * Notifies SystemUI to stop tracing.
251      */
stopTracing()252     void stopTracing();
253 
254     /**
255      * Handles a logging command from the WM shell command.
256      */
handleWindowManagerLoggingCommand(in String[] args, in ParcelFileDescriptor outFd)257     void handleWindowManagerLoggingCommand(in String[] args, in ParcelFileDescriptor outFd);
258 
259     /**
260      * If true, suppresses the ambient display from showing. If false, re-enables the ambient
261      * display.
262      */
suppressAmbientDisplay(boolean suppress)263     void suppressAmbientDisplay(boolean suppress);
264 
265     /**
266      * Requests {@link WindowMagnification} to set window magnification connection through
267      * {@link AccessibilityManager#setWindowMagnificationConnection(IWindowMagnificationConnection)}
268      *
269      * @param connect {@code true} if needs connection, otherwise set the connection to null.
270      */
requestWindowMagnificationConnection(boolean connect)271     void requestWindowMagnificationConnection(boolean connect);
272 
273     /**
274      * Allow for pass-through arguments from `adb shell cmd statusbar <args>`, and write to the
275      * file descriptor passed in.
276      */
passThroughShellCommand(in String[] args, in ParcelFileDescriptor pfd)277      void passThroughShellCommand(in String[] args, in ParcelFileDescriptor pfd);
278 
279     /**
280      * Enables/disables the navigation bar luma sampling.
281      *
282      * @param displayId the id of the display to notify.
283      * @param enable {@code true} if enable, otherwise set to {@code false}.
284      */
setNavigationBarLumaSamplingEnabled(int displayId, boolean enable)285     void setNavigationBarLumaSamplingEnabled(int displayId, boolean enable);
286 
287     /**
288      * Triggers a GC in the system and status bar.
289      */
runGcForTest()290     void runGcForTest();
291 }
292