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