1 /**
2  * Copyright (c) 2013, 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.server.statusbar;
18 
19 import android.annotation.Nullable;
20 import android.app.ITransientNotificationCallback;
21 import android.content.ComponentName;
22 import android.hardware.fingerprint.IUdfpsRefreshRateRequestCallback;
23 import android.os.Bundle;
24 import android.os.IBinder;
25 import android.os.UserHandle;
26 import android.view.WindowInsets.Type.InsetsType;
27 import android.view.WindowInsetsController.Appearance;
28 import android.view.WindowInsetsController.Behavior;
29 
30 import com.android.internal.statusbar.LetterboxDetails;
31 import com.android.internal.view.AppearanceRegion;
32 import com.android.server.notification.NotificationDelegate;
33 
34 public interface StatusBarManagerInternal {
setNotificationDelegate(NotificationDelegate delegate)35     void setNotificationDelegate(NotificationDelegate delegate);
showScreenPinningRequest(int taskId)36     void showScreenPinningRequest(int taskId);
showAssistDisclosure()37     void showAssistDisclosure();
38 
preloadRecentApps()39     void preloadRecentApps();
40 
cancelPreloadRecentApps()41     void cancelPreloadRecentApps();
42 
showRecentApps(boolean triggeredFromAltTab)43     void showRecentApps(boolean triggeredFromAltTab);
44 
hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey)45     void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
46 
47     /** Collapses the notification shade. */
collapsePanels()48     void collapsePanels();
49 
dismissKeyboardShortcutsMenu()50     void dismissKeyboardShortcutsMenu();
toggleKeyboardShortcutsMenu(int deviceId)51     void toggleKeyboardShortcutsMenu(int deviceId);
52 
53     /**
54      * Used by InputMethodManagerService to notify the IME status.
55      *
56      * @param displayId The display to which the IME is bound to.
57      * @param token The IME token.
58      * @param vis Bit flags about the IME visibility.
59      *            (e.g. {@link android.inputmethodservice.InputMethodService#IME_ACTIVE})
60      * @param backDisposition Bit flags about the IME back disposition.
61      *         (e.g. {@link android.inputmethodservice.InputMethodService#BACK_DISPOSITION_DEFAULT})
62      * @param showImeSwitcher {@code true} when the IME switcher button should be shown.
63      */
setImeWindowStatus(int displayId, IBinder token, int vis, int backDisposition, boolean showImeSwitcher)64     void setImeWindowStatus(int displayId, IBinder token, int vis,
65             int backDisposition, boolean showImeSwitcher);
66 
67     /**
68      * See {@link android.app.StatusBarManager#setIcon(String, int, int, String)}.
69      */
setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription)70     void setIcon(String slot, String iconPackage, int iconId, int iconLevel,
71             String contentDescription);
72 
73     /**
74      * See {@link android.app.StatusBarManager#setIconVisibility(String, boolean)}.
75      */
setIconVisibility(String slot, boolean visibility)76     void setIconVisibility(String slot, boolean visibility);
77 
showChargingAnimation(int batteryLevel)78     void showChargingAnimation(int batteryLevel);
79 
80     /**
81      * Show picture-in-picture menu.
82      */
showPictureInPictureMenu()83     void showPictureInPictureMenu();
84 
setWindowState(int displayId, int window, int state)85     void setWindowState(int displayId, int window, int state);
86 
87     /**
88      * Notifies the status bar that an app transition is pending to delay applying some flags with
89      * visual impact until {@link #appTransitionReady} is called.
90      *
91      * @param displayId the ID of the display which has this event.
92      */
appTransitionPending(int displayId)93     void appTransitionPending(int displayId);
94 
95     /**
96      * Notifies the status bar that a pending app transition has been cancelled.
97      *
98      * @param displayId the ID of the display which has this event.
99      */
appTransitionCancelled(int displayId)100     void appTransitionCancelled(int displayId);
101 
102     /**
103      * Notifies the status bar that an app transition is now being executed.
104      *
105      * @param displayId the ID of the display which has this event.
106      * @param statusBarAnimationsStartTime the desired start time for all visual animations in the
107      *        status bar caused by this app transition in uptime millis
108      * @param statusBarAnimationsDuration the duration for all visual animations in the status
109      *        bar caused by this app transition in millis
110      */
appTransitionStarting(int displayId, long statusBarAnimationsStartTime, long statusBarAnimationsDuration)111     void appTransitionStarting(int displayId, long statusBarAnimationsStartTime,
112             long statusBarAnimationsDuration);
113 
startAssist(Bundle args)114     void startAssist(Bundle args);
onCameraLaunchGestureDetected(int source)115     void onCameraLaunchGestureDetected(int source);
setDisableFlags(int displayId, int flags, String cause)116     void setDisableFlags(int displayId, int flags, String cause);
toggleSplitScreen()117     void toggleSplitScreen();
appTransitionFinished(int displayId)118     void appTransitionFinished(int displayId);
119 
120     /**
121      * Notifies the status bar that a Emergency Action launch gesture has been detected.
122      *
123      * TODO (b/169175022) Update method name and docs when feature name is locked.
124      */
onEmergencyActionLaunchGestureDetected()125     void onEmergencyActionLaunchGestureDetected();
126 
127     /** Toggle the task bar stash state. */
toggleTaskbar()128     void toggleTaskbar();
129 
130     /** Toggle recents. */
toggleRecentApps()131     void toggleRecentApps();
132 
setCurrentUser(int newUserId)133     void setCurrentUser(int newUserId);
134 
135     /**
136      * Set whether the top app currently hides the statusbar.
137      *
138      * @param hidesStatusBar whether it is being hidden
139      */
setTopAppHidesStatusBar(boolean hidesStatusBar)140     void setTopAppHidesStatusBar(boolean hidesStatusBar);
141 
showShutdownUi(boolean isReboot, String requestString)142     boolean showShutdownUi(boolean isReboot, String requestString);
143 
144     /**
145      * Notify system UI the immersive prompt should be dismissed as confirmed, and the confirmed
146      * status should be saved without user clicking on the button. This could happen when a user
147      * swipe on the edge with the confirmation prompt showing.
148      */
confirmImmersivePrompt()149     void confirmImmersivePrompt();
150 
151     /**
152      * Notify System UI that the system get into or exit immersive mode.
153      * @param rootDisplayAreaId The changed display area Id.
154      * @param isImmersiveMode {@code true} if the display area get into immersive mode.
155      */
immersiveModeChanged(int rootDisplayAreaId, boolean isImmersiveMode)156     void immersiveModeChanged(int rootDisplayAreaId, boolean isImmersiveMode);
157 
158     /**
159      * Show a rotation suggestion that a user may approve to rotate the screen.
160      *
161      * @param rotation rotation suggestion
162      */
onProposedRotationChanged(int rotation, boolean isValid)163     void onProposedRotationChanged(int rotation, boolean isValid);
164 
165     /**
166      * Notifies System UI that the display is ready to show system decorations.
167      *
168      * @param displayId display ID
169      */
onDisplayReady(int displayId)170     void onDisplayReady(int displayId);
171 
172     /**
173      * Notifies System UI whether the recents animation is running.
174      */
onRecentsAnimationStateChanged(boolean running)175     void onRecentsAnimationStateChanged(boolean running);
176 
177     /** @see com.android.internal.statusbar.IStatusBar#onSystemBarAttributesChanged */
onSystemBarAttributesChanged(int displayId, @Appearance int appearance, AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme, @Behavior int behavior, @InsetsType int requestedVisibleTypes, String packageName, LetterboxDetails[] letterboxDetails)178     void onSystemBarAttributesChanged(int displayId, @Appearance int appearance,
179             AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme,
180             @Behavior int behavior, @InsetsType int requestedVisibleTypes, String packageName,
181             LetterboxDetails[] letterboxDetails);
182 
183     /** @see com.android.internal.statusbar.IStatusBar#showTransient */
showTransient(int displayId, @InsetsType int types, boolean isGestureOnSystemBar)184     void showTransient(int displayId, @InsetsType int types, boolean isGestureOnSystemBar);
185 
186     /** @see com.android.internal.statusbar.IStatusBar#abortTransient */
abortTransient(int displayId, @InsetsType int types)187     void abortTransient(int displayId, @InsetsType int types);
188 
189     /**
190      * @see com.android.internal.statusbar.IStatusBar#showToast(String, IBinder, CharSequence,
191      * IBinder, int, ITransientNotificationCallback, int)
192      */
showToast(int uid, String packageName, IBinder token, CharSequence text, IBinder windowToken, int duration, @Nullable ITransientNotificationCallback textCallback, int displayId)193     void showToast(int uid, String packageName, IBinder token, CharSequence text,
194             IBinder windowToken, int duration,
195             @Nullable ITransientNotificationCallback textCallback, int displayId);
196 
197     /** @see com.android.internal.statusbar.IStatusBar#hideToast(String, IBinder)  */
hideToast(String packageName, IBinder token)198     void hideToast(String packageName, IBinder token);
199 
200     /**
201      * @see com.android.internal.statusbar.IStatusBar#requestMagnificationConnection(boolean
202      * request)
203      */
requestMagnificationConnection(boolean request)204     boolean requestMagnificationConnection(boolean request);
205 
206     /**
207      * @see com.android.internal.statusbar.IStatusBar#setNavigationBarLumaSamplingEnabled(int,
208      * boolean)
209      */
setNavigationBarLumaSamplingEnabled(int displayId, boolean enable)210     void setNavigationBarLumaSamplingEnabled(int displayId, boolean enable);
211 
212     /**
213      * Sets the system-wide callback for UDFPS refresh rate changes.
214      *
215      * @see com.android.internal.statusbar.IStatusBar#setUdfpsRefreshRateCallback
216      * (IUdfpsRefreshRateRequestCallback)
217      */
setUdfpsRefreshRateCallback(IUdfpsRefreshRateRequestCallback callback)218     void setUdfpsRefreshRateCallback(IUdfpsRefreshRateRequestCallback callback);
219 
220     /**
221      * Shows the rear display educational dialog
222      *
223      * @see com.android.internal.statusbar.IStatusBar#showRearDisplayDialog
224      */
showRearDisplayDialog(int currentBaseState)225     void showRearDisplayDialog(int currentBaseState);
226 
227     /**
228      * Called when requested to go to fullscreen from the focused app.
229      *
230      * @param displayId of the current display.
231      */
moveFocusedTaskToFullscreen(int displayId)232     void moveFocusedTaskToFullscreen(int displayId);
233 
234     /**
235      * Enters stage split from a current running app.
236      *
237      * @see com.android.internal.statusbar.IStatusBar#moveFocusedTaskToStageSplit
238      */
moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop)239     void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop);
240 
241     /**
242      * Change the split screen focus to the left / top app or the right / bottom app based on
243      * {@param leftOrTop}.
244      *
245      * @see com.android.internal.statusbar.IStatusBar#setSplitscreenFocus
246      */
setSplitscreenFocus(boolean leftOrTop)247     void setSplitscreenFocus(boolean leftOrTop);
248 
249     /**
250      * Shows the media output switcher dialog.
251      *
252      * @param targetPackageName of the session for which the output switcher is shown.
253      * @see com.android.internal.statusbar.IStatusBar#showMediaOutputSwitcher
254      */
showMediaOutputSwitcher(String targetPackageName, UserHandle targetUserHandle)255     void showMediaOutputSwitcher(String targetPackageName, UserHandle targetUserHandle);
256 
257     /**
258      * Add a tile to the Quick Settings Panel
259      * @param tile the ComponentName of the {@link android.service.quicksettings.TileService}
260      * @param end if true, the tile will be added at the end. If false, at the beginning.
261      */
addQsTileToFrontOrEnd(ComponentName tile, boolean end)262     void addQsTileToFrontOrEnd(ComponentName tile, boolean end);
263 
264     /**
265      * Remove the tile from the Quick Settings Panel
266      * @param tile the ComponentName of the {@link android.service.quicksettings.TileService}
267      */
removeQsTile(ComponentName tile)268     void removeQsTile(ComponentName tile);
269 
270     /**
271      * Called when requested to enter desktop from a focused app.
272      */
moveFocusedTaskToDesktop(int displayId)273     void moveFocusedTaskToDesktop(int displayId);
274 }
275