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