blob: 904478efb5687f053996ef3229a95a2894f68f15 [file] [log] [blame]
Joe Onorato0cbda992010-05-02 16:28:15 -07001/*
2 * Copyright (C) 2010 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
Joe Onorato79de0c52010-05-26 17:03:26 -040017package com.android.systemui.statusbar;
Joe Onorato0cbda992010-05-02 16:28:15 -070018
Charles Chenf3d295c2018-11-30 18:15:21 +080019import static android.app.StatusBarManager.DISABLE2_NONE;
20import static android.app.StatusBarManager.DISABLE_NONE;
21import static android.view.Display.DEFAULT_DISPLAY;
22
Jason Monk297c04e2018-08-23 17:16:59 -040023import static com.android.systemui.statusbar.phone.StatusBar.ONLY_CORE_APPS;
24
25import android.app.StatusBarManager;
Charles Chenf3d295c2018-11-30 18:15:21 +080026import android.app.StatusBarManager.Disable2Flags;
27import android.app.StatusBarManager.DisableFlags;
28import android.app.StatusBarManager.WindowType;
29import android.app.StatusBarManager.WindowVisibleState;
Jason Monk7e53f202016-01-28 10:40:20 -050030import android.content.ComponentName;
Charles Chenf3d295c2018-11-30 18:15:21 +080031import android.content.Context;
Jorim Jaggi86905582016-02-09 21:36:09 -080032import android.graphics.Rect;
Kevin Chyn23289ef2018-11-28 16:32:36 -080033import android.hardware.biometrics.IBiometricServiceReceiverInternal;
Charles Chenf3d295c2018-11-30 18:15:21 +080034import android.hardware.display.DisplayManager;
35import android.inputmethodservice.InputMethodService.BackDispositionMode;
Jorim Jaggi165ce062015-07-06 16:18:11 -070036import android.os.Bundle;
Joe Onorato0cbda992010-05-02 16:28:15 -070037import android.os.Handler;
Joe Onoratoa0c56fe2010-05-20 10:21:52 -070038import android.os.IBinder;
Jason Monkb5b092012017-01-05 11:35:34 -050039import android.os.Looper;
Joe Onorato0cbda992010-05-02 16:28:15 -070040import android.os.Message;
Kevin Chyn1b9f8df2018-11-12 19:04:55 -080041import android.util.Pair;
Charles Chenf3d295c2018-11-30 18:15:21 +080042import android.util.SparseArray;
Jason Monk297c04e2018-08-23 17:16:59 -040043
Aurimas Liutikasfd52c142018-04-17 09:50:46 -070044import androidx.annotation.VisibleForTesting;
Winsonc0d70582016-01-29 10:24:39 -080045
Jorim Jaggi86905582016-02-09 21:36:09 -080046import com.android.internal.os.SomeArgs;
Joe Onorato0cbda992010-05-02 16:28:15 -070047import com.android.internal.statusbar.IStatusBar;
48import com.android.internal.statusbar.StatusBarIcon;
Jason Monkb5b092012017-01-05 11:35:34 -050049import com.android.systemui.SystemUI;
Jason Monkd7c98552018-12-04 11:14:50 -050050import com.android.systemui.statusbar.CommandQueue.Callbacks;
51import com.android.systemui.statusbar.policy.CallbackController;
Joe Onorato0cbda992010-05-02 16:28:15 -070052
Jason Monk49fa0162017-01-11 09:21:56 -050053import java.util.ArrayList;
54
Joe Onoratof3f0e052010-05-14 18:49:29 -070055/**
56 * This class takes the functions from IStatusBar that come in on
57 * binder pool threads and posts messages to get them onto the main
58 * thread, and calls onto Callbacks. It also takes care of
Joe Onorato4762c2d2010-05-17 15:42:59 -070059 * coalescing these calls so they don't stack up. For the calls
60 * are coalesced, note that they are all idempotent.
Joe Onoratof3f0e052010-05-14 18:49:29 -070061 */
Charles Chenf3d295c2018-11-30 18:15:21 +080062public class CommandQueue extends IStatusBar.Stub implements CallbackController<Callbacks>,
63 DisplayManager.DisplayListener {
Daniel Sandler1d4d30a2011-04-28 12:35:29 -040064 private static final int INDEX_MASK = 0xffff;
65 private static final int MSG_SHIFT = 16;
66 private static final int MSG_MASK = 0xffff << MSG_SHIFT;
Joe Onorato0cbda992010-05-02 16:28:15 -070067
Daniel Sandler1d4d30a2011-04-28 12:35:29 -040068 private static final int OP_SET_ICON = 1;
Joe Onorato0cbda992010-05-02 16:28:15 -070069 private static final int OP_REMOVE_ICON = 2;
70
Jaewan Kimc552b042016-01-18 16:08:45 +090071 private static final int MSG_ICON = 1 << MSG_SHIFT;
72 private static final int MSG_DISABLE = 2 << MSG_SHIFT;
73 private static final int MSG_EXPAND_NOTIFICATIONS = 3 << MSG_SHIFT;
74 private static final int MSG_COLLAPSE_PANELS = 4 << MSG_SHIFT;
75 private static final int MSG_EXPAND_SETTINGS = 5 << MSG_SHIFT;
76 private static final int MSG_SET_SYSTEMUI_VISIBILITY = 6 << MSG_SHIFT;
77 private static final int MSG_TOP_APP_WINDOW_CHANGED = 7 << MSG_SHIFT;
78 private static final int MSG_SHOW_IME_BUTTON = 8 << MSG_SHIFT;
79 private static final int MSG_TOGGLE_RECENT_APPS = 9 << MSG_SHIFT;
80 private static final int MSG_PRELOAD_RECENT_APPS = 10 << MSG_SHIFT;
81 private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 11 << MSG_SHIFT;
82 private static final int MSG_SET_WINDOW_STATE = 12 << MSG_SHIFT;
83 private static final int MSG_SHOW_RECENT_APPS = 13 << MSG_SHIFT;
84 private static final int MSG_HIDE_RECENT_APPS = 14 << MSG_SHIFT;
Jaewan Kimc552b042016-01-18 16:08:45 +090085 private static final int MSG_SHOW_SCREEN_PIN_REQUEST = 18 << MSG_SHIFT;
86 private static final int MSG_APP_TRANSITION_PENDING = 19 << MSG_SHIFT;
87 private static final int MSG_APP_TRANSITION_CANCELLED = 20 << MSG_SHIFT;
88 private static final int MSG_APP_TRANSITION_STARTING = 21 << MSG_SHIFT;
89 private static final int MSG_ASSIST_DISCLOSURE = 22 << MSG_SHIFT;
90 private static final int MSG_START_ASSIST = 23 << MSG_SHIFT;
91 private static final int MSG_CAMERA_LAUNCH_GESTURE = 24 << MSG_SHIFT;
92 private static final int MSG_TOGGLE_KEYBOARD_SHORTCUTS = 25 << MSG_SHIFT;
Winson Chungac52f282017-03-30 14:44:52 -070093 private static final int MSG_SHOW_PICTURE_IN_PICTURE_MENU = 26 << MSG_SHIFT;
Jason Monk7e53f202016-01-28 10:40:20 -050094 private static final int MSG_ADD_QS_TILE = 27 << MSG_SHIFT;
95 private static final int MSG_REMOVE_QS_TILE = 28 << MSG_SHIFT;
96 private static final int MSG_CLICK_QS_TILE = 29 << MSG_SHIFT;
Phil Weaver315c34e2016-02-19 15:12:29 -080097 private static final int MSG_TOGGLE_APP_SPLIT_SCREEN = 30 << MSG_SHIFT;
Jorim Jaggi2adba072016-03-03 13:43:39 +010098 private static final int MSG_APP_TRANSITION_FINISHED = 31 << MSG_SHIFT;
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +010099 private static final int MSG_DISMISS_KEYBOARD_SHORTCUTS = 32 << MSG_SHIFT;
Philip Quinnc3a503d2017-07-18 23:23:41 -0700100 private static final int MSG_HANDLE_SYSTEM_KEY = 33 << MSG_SHIFT;
Jason Monk361915c2017-03-21 20:33:59 -0400101 private static final int MSG_SHOW_GLOBAL_ACTIONS = 34 << MSG_SHIFT;
Anthony Chen9ad00e02017-05-12 15:53:36 -0700102 private static final int MSG_TOGGLE_PANEL = 35 << MSG_SHIFT;
Jason Monk0b994022017-08-08 16:27:14 -0400103 private static final int MSG_SHOW_SHUTDOWN_UI = 36 << MSG_SHIFT;
Selim Cinek3a49ba22017-08-10 11:17:39 -0700104 private static final int MSG_SET_TOP_APP_HIDES_STATUS_BAR = 37 << MSG_SHIFT;
Mike Digman93f08342017-11-24 21:46:53 -0800105 private static final int MSG_ROTATION_PROPOSAL = 38 << MSG_SHIFT;
Kevin Chyne9275662018-07-23 16:42:06 -0700106 private static final int MSG_BIOMETRIC_SHOW = 39 << MSG_SHIFT;
107 private static final int MSG_BIOMETRIC_AUTHENTICATED = 40 << MSG_SHIFT;
108 private static final int MSG_BIOMETRIC_HELP = 41 << MSG_SHIFT;
109 private static final int MSG_BIOMETRIC_ERROR = 42 << MSG_SHIFT;
110 private static final int MSG_BIOMETRIC_HIDE = 43 << MSG_SHIFT;
Beverlyae79ab92017-12-11 09:20:02 -0500111 private static final int MSG_SHOW_CHARGING_ANIMATION = 44 << MSG_SHIFT;
Matthew Ng9c3bce52018-02-01 22:00:31 +0000112 private static final int MSG_SHOW_PINNING_TOAST_ENTER_EXIT = 45 << MSG_SHIFT;
113 private static final int MSG_SHOW_PINNING_TOAST_ESCAPE = 46 << MSG_SHIFT;
Daniel Sandler328310c2011-09-23 15:56:52 -0400114
Jim Miller9a720f52012-05-30 03:19:43 -0700115 public static final int FLAG_EXCLUDE_NONE = 0;
116 public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
117 public static final int FLAG_EXCLUDE_RECENTS_PANEL = 1 << 1;
118 public static final int FLAG_EXCLUDE_NOTIFICATION_PANEL = 1 << 2;
119 public static final int FLAG_EXCLUDE_INPUT_METHODS_PANEL = 1 << 3;
120 public static final int FLAG_EXCLUDE_COMPAT_MODE_PANEL = 1 << 4;
121
Jason Monkb605fec2014-05-02 17:04:10 -0400122 private static final String SHOW_IME_SWITCHER_KEY = "showImeSwitcherKey";
123
Jason Monk07473ce2016-01-05 14:59:19 -0500124 private final Object mLock = new Object();
Jason Monk49fa0162017-01-11 09:21:56 -0500125 private ArrayList<Callbacks> mCallbacks = new ArrayList<>();
Jason Monkb5b092012017-01-05 11:35:34 -0500126 private Handler mHandler = new H(Looper.getMainLooper());
Charles Chenf3d295c2018-11-30 18:15:21 +0800127 /** A map of display id - disable flag pair */
128 private SparseArray<Pair<Integer, Integer>> mDisplayDisabled = new SparseArray<>();
Joe Onorato0cbda992010-05-02 16:28:15 -0700129
130 /**
131 * These methods are called back on the main thread.
132 */
133 public interface Callbacks {
Jason Monkb5b092012017-01-05 11:35:34 -0500134 default void setIcon(String slot, StatusBarIcon icon) { }
135 default void removeIcon(String slot) { }
Charles Chenf3d295c2018-11-30 18:15:21 +0800136
137 /**
138 * Called to notify that disable flags are updated.
139 * @see IStatusBar#disable(int, int, int).
140 *
141 * @param displayId The id of the display to notify.
142 * @param state1 The combination of following DISABLE_* flags:
143 * @param state2 The combination of following DISABLE2_* flags:
144 * @param animate {@code true} to show animations.
145 */
146 default void disable(int displayId, @DisableFlags int state1, @Disable2Flags int state2,
147 boolean animate) { }
Jason Monkb5b092012017-01-05 11:35:34 -0500148 default void animateExpandNotificationsPanel() { }
Jason Monk297c04e2018-08-23 17:16:59 -0400149 default void animateCollapsePanels(int flags, boolean force) { }
Anthony Chen9ad00e02017-05-12 15:53:36 -0700150 default void togglePanel() { }
Jason Monkb5b092012017-01-05 11:35:34 -0500151 default void animateExpandSettingsPanel(String obj) { }
Charles Chenf3d295c2018-11-30 18:15:21 +0800152
153 /**
154 * Called to notify visibility flag changes.
155 * @see IStatusBar#setSystemUiVisibility(int, int, int, int, int, Rect, Rect).
156 *
157 * @param displayId The id of the display to notify.
158 * @param vis The visibility flags except SYSTEM_UI_FLAG_LIGHT_STATUS_BAR which will
159 * be reported separately in fullscreenStackVis and dockedStackVis.
160 * @param fullscreenStackVis The flags which only apply in the region of the fullscreen
161 * stack, which is currently only SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.
162 * @param dockedStackVis The flags that only apply in the region of the docked stack, which
163 * is currently only SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.
164 * @param mask Which flags to change.
165 * @param fullscreenStackBounds The current bounds of the fullscreen stack, in screen
166 * coordinates.
167 * @param dockedStackBounds The current bounds of the docked stack, in screen coordinates.
168 */
169 default void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
Jason Monkb5b092012017-01-05 11:35:34 -0500170 int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
171 }
Charles Chenf3d295c2018-11-30 18:15:21 +0800172
173 /**
174 * Called to notify top app window changes.
175 * @see IStatusBar#topAppWindowChanged(int, boolean)
176 *
177 * @param displayId The id of the display to notify.
178 * @param visible {@code true} to show menu button.
179 */
180 default void topAppWindowChanged(int displayId, boolean visible) { }
181
182 /**
183 * Called to notify IME window status changes.
184 *
185 * @param displayId The id of the display to notify.
186 * @param token IME token.
187 * @param vis IME visibility.
188 * @param backDisposition Disposition mode of back button. It should be one of below flags:
189 * @param showImeSwitcher {@code true} to show IME switch button.
190 */
191 default void setImeWindowStatus(int displayId, IBinder token, int vis,
192 @BackDispositionMode int backDisposition, boolean showImeSwitcher) { }
Winson Chungdff7a732017-12-11 12:17:06 -0800193 default void showRecentApps(boolean triggeredFromAltTab) { }
Jason Monkb5b092012017-01-05 11:35:34 -0500194 default void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { }
195 default void toggleRecentApps() { }
196 default void toggleSplitScreen() { }
197 default void preloadRecentApps() { }
198 default void dismissKeyboardShortcutsMenu() { }
199 default void toggleKeyboardShortcutsMenu(int deviceId) { }
200 default void cancelPreloadRecentApps() { }
Charles Chenf3d295c2018-11-30 18:15:21 +0800201
202 /**
203 * Called to notify window state changes.
204 * @see IStatusBar#setWindowState(int, int, int)
205 *
206 * @param displayId The id of the display to notify.
207 * @param window Window type. It should be one of {@link StatusBarManager#WINDOW_STATUS_BAR}
208 * or {@link StatusBarManager#WINDOW_NAVIGATION_BAR}
209 * @param state Window visible state.
210 */
211 default void setWindowState(int displayId, @WindowType int window,
212 @WindowVisibleState int state) { }
Jason Monkb5b092012017-01-05 11:35:34 -0500213 default void showScreenPinningRequest(int taskId) { }
Charles Chenf3d295c2018-11-30 18:15:21 +0800214
215 /**
216 * Called to notify System UI that an application transition is pending.
217 * @see IStatusBar#appTransitionPending(int).
218 *
219 * @param displayId The id of the display to notify.
220 * @param forced {@code true} to force transition pending.
221 */
222 default void appTransitionPending(int displayId, boolean forced) { }
223
224 /**
225 * Called to notify System UI that an application transition is canceled.
226 * @see IStatusBar#appTransitionCancelled(int).
227 *
228 * @param displayId The id of the display to notify.
229 */
230 default void appTransitionCancelled(int displayId) { }
231
232 /**
233 * Called to notify System UI that an application transition is starting.
234 * @see IStatusBar#appTransitionStarting(int, long, long).
235 *
236 * @param displayId The id of the display to notify.
237 * @param startTime Transition start time.
238 * @param duration Transition duration.
239 * @param forced {@code true} to force transition pending.
240 */
241 default void appTransitionStarting(
242 int displayId, long startTime, long duration, boolean forced) { }
243
244 /**
245 * Called to notify System UI that an application transition is finished.
246 * @see IStatusBar#appTransitionFinished(int)
247 *
248 * @param displayId The id of the display to notify.
249 */
250 default void appTransitionFinished(int displayId) { }
Jason Monkb5b092012017-01-05 11:35:34 -0500251 default void showAssistDisclosure() { }
252 default void startAssist(Bundle args) { }
253 default void onCameraLaunchGestureDetected(int source) { }
Winson Chungac52f282017-03-30 14:44:52 -0700254 default void showPictureInPictureMenu() { }
Selim Cinek3a49ba22017-08-10 11:17:39 -0700255 default void setTopAppHidesStatusBar(boolean topAppHidesStatusBar) { }
Jason Monk7e53f202016-01-28 10:40:20 -0500256
Jason Monkb5b092012017-01-05 11:35:34 -0500257 default void addQsTile(ComponentName tile) { }
258 default void remQsTile(ComponentName tile) { }
259 default void clickTile(ComponentName tile) { }
Jim Miller07e03842016-06-22 15:18:13 -0700260
Philip Quinnc3a503d2017-07-18 23:23:41 -0700261 default void handleSystemKey(int arg1) { }
Matthew Ng9c3bce52018-02-01 22:00:31 +0000262 default void showPinningEnterExitToast(boolean entering) { }
263 default void showPinningEscapeToast() { }
Jason Monk361915c2017-03-21 20:33:59 -0400264 default void handleShowGlobalActionsMenu() { }
Jason Monkb4302182017-08-04 13:39:17 -0400265 default void handleShowShutdownUi(boolean isReboot, String reason) { }
Mike Digman93f08342017-11-24 21:46:53 -0800266
Beverlyac32c9a2018-01-31 16:10:41 -0500267 default void showWirelessChargingAnimation(int batteryLevel) { }
Beverlyae79ab92017-12-11 09:20:02 -0500268
Mike Digmane0777312018-01-19 12:41:51 -0800269 default void onRotationProposal(int rotation, boolean isValid) { }
Kevin Chynaae4a152018-01-18 11:48:09 -0800270
Kevin Chyn23289ef2018-11-28 16:32:36 -0800271 default void showBiometricDialog(Bundle bundle, IBiometricServiceReceiverInternal receiver,
Kevin Chyn1b9f8df2018-11-12 19:04:55 -0800272 int type, boolean requireConfirmation, int userId) { }
Kevin Chyne1912712019-01-04 14:22:34 -0800273 default void onBiometricAuthenticated(boolean authenticated) { }
Kevin Chyne9275662018-07-23 16:42:06 -0700274 default void onBiometricHelp(String message) { }
275 default void onBiometricError(String error) { }
276 default void hideBiometricDialog() { }
Joe Onorato0cbda992010-05-02 16:28:15 -0700277 }
278
Jason Monkb5b092012017-01-05 11:35:34 -0500279 @VisibleForTesting
Charles Chenf3d295c2018-11-30 18:15:21 +0800280 public CommandQueue(Context context) {
281 context.getSystemService(DisplayManager.class).registerDisplayListener(this, mHandler);
282 // We always have default display.
283 setDisabled(DEFAULT_DISPLAY, DISABLE_NONE, DISABLE2_NONE);
Jason Monk297c04e2018-08-23 17:16:59 -0400284 }
285
Charles Chenf3d295c2018-11-30 18:15:21 +0800286 @Override
287 public void onDisplayAdded(int displayId) { }
288
289 @Override
290 public void onDisplayRemoved(int displayId) {
291 synchronized (mLock) {
292 mDisplayDisabled.remove(displayId);
293 }
294 }
295
296 @Override
297 public void onDisplayChanged(int displayId) { }
298
299 // TODO(b/118592525): add multi-display support if needed.
Jason Monk297c04e2018-08-23 17:16:59 -0400300 public boolean panelsEnabled() {
Charles Chenf3d295c2018-11-30 18:15:21 +0800301 final int disabled1 = getDisabled1(DEFAULT_DISPLAY);
302 final int disabled2 = getDisabled2(DEFAULT_DISPLAY);
303 return (disabled1 & StatusBarManager.DISABLE_EXPAND) == 0
304 && (disabled2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) == 0
Jason Monk297c04e2018-08-23 17:16:59 -0400305 && !ONLY_CORE_APPS;
Jason Monkb5b092012017-01-05 11:35:34 -0500306 }
307
Jason Monkd7c98552018-12-04 11:14:50 -0500308 public void addCallback(Callbacks callbacks) {
Jason Monk49fa0162017-01-11 09:21:56 -0500309 mCallbacks.add(callbacks);
Charles Chenf3d295c2018-11-30 18:15:21 +0800310 // TODO(b/117478341): find a better way to pass disable flags by display.
311 for (int i = 0; i < mDisplayDisabled.size(); i++) {
312 int displayId = mDisplayDisabled.keyAt(i);
313 int disabled1 = getDisabled1(displayId);
314 int disabled2 = getDisabled2(displayId);
315 callbacks.disable(displayId, disabled1, disabled2, false /* animate */);
316 }
Jason Monk49fa0162017-01-11 09:21:56 -0500317 }
318
Jason Monkd7c98552018-12-04 11:14:50 -0500319 public void removeCallback(Callbacks callbacks) {
Jason Monk49fa0162017-01-11 09:21:56 -0500320 mCallbacks.remove(callbacks);
Joe Onorato0cbda992010-05-02 16:28:15 -0700321 }
322
Jason Monk07473ce2016-01-05 14:59:19 -0500323 public void setIcon(String slot, StatusBarIcon icon) {
324 synchronized (mLock) {
325 // don't coalesce these
326 mHandler.obtainMessage(MSG_ICON, OP_SET_ICON, 0,
327 new Pair<String, StatusBarIcon>(slot, icon)).sendToTarget();
Joe Onorato0cbda992010-05-02 16:28:15 -0700328 }
329 }
330
Jason Monk07473ce2016-01-05 14:59:19 -0500331 public void removeIcon(String slot) {
332 synchronized (mLock) {
333 // don't coalesce these
334 mHandler.obtainMessage(MSG_ICON, OP_REMOVE_ICON, 0, slot).sendToTarget();
Joe Onorato0cbda992010-05-02 16:28:15 -0700335 }
336 }
337
Charles Chenf3d295c2018-11-30 18:15:21 +0800338 /**
339 * Called to notify that disable flags are updated.
340 * @see Callbacks#disable(int, int, int, boolean).
341 */
342 public void disable(int displayId, @DisableFlags int state1, @Disable2Flags int state2,
343 boolean animate) {
Jason Monk07473ce2016-01-05 14:59:19 -0500344 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800345 setDisabled(displayId, state1, state2);
Joe Onoratof3f0e052010-05-14 18:49:29 -0700346 mHandler.removeMessages(MSG_DISABLE);
Charles Chenf3d295c2018-11-30 18:15:21 +0800347 final SomeArgs args = SomeArgs.obtain();
348 args.argi1 = displayId;
349 args.argi2 = state1;
350 args.argi3 = state2;
351 args.argi4 = animate ? 1 : 0;
352 Message msg = mHandler.obtainMessage(MSG_DISABLE, args);
Jason Monk3d3e99c2017-04-20 11:26:36 -0400353 if (Looper.myLooper() == mHandler.getLooper()) {
354 // If its the right looper execute immediately so hides can be handled quickly.
355 mHandler.handleMessage(msg);
356 msg.recycle();
357 } else {
358 msg.sendToTarget();
359 }
Joe Onoratof3f0e052010-05-14 18:49:29 -0700360 }
361 }
362
Charles Chen24e7a9f2018-11-21 11:59:07 +0800363 @Override
Charles Chenf3d295c2018-11-30 18:15:21 +0800364 public void disable(int displayId, @DisableFlags int state1, @Disable2Flags int state2) {
365 disable(displayId, state1, state2, true);
Jason Monk1e5ba5d2017-02-14 15:48:57 -0500366 }
367
Charles Chenf3d295c2018-11-30 18:15:21 +0800368 /**
369 * Apply current disable flags by {@link CommandQueue#disable(int, int, int, boolean)}.
370 *
371 * @param displayId The id of the display to notify.
372 * @param animate {@code true} to show animations.
373 */
374 public void recomputeDisableFlags(int displayId, boolean animate) {
375 int disabled1 = getDisabled1(displayId);
376 int disabled2 = getDisabled2(displayId);
377 disable(displayId, disabled1, disabled2, animate);
378 }
379
380 private void setDisabled(int displayId, int disabled1, int disabled2) {
381 mDisplayDisabled.put(displayId, new Pair<>(disabled1, disabled2));
382 }
383
384 private int getDisabled1(int displayId) {
385 return getDisabled(displayId).first;
386 }
387
388 private int getDisabled2(int displayId) {
389 return getDisabled(displayId).second;
390 }
391
392 private Pair<Integer, Integer> getDisabled(int displayId) {
393 Pair<Integer, Integer> disablePair = mDisplayDisabled.get(displayId);
394 if (disablePair == null) {
395 disablePair = new Pair<>(DISABLE_NONE, DISABLE2_NONE);
396 mDisplayDisabled.put(displayId, disablePair);
397 }
398 return disablePair;
Jason Monk00659ba2017-03-03 10:28:45 -0500399 }
400
Daniel Sandler11cf1782012-09-27 14:03:08 -0400401 public void animateExpandNotificationsPanel() {
Jason Monk07473ce2016-01-05 14:59:19 -0500402 synchronized (mLock) {
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700403 mHandler.removeMessages(MSG_EXPAND_NOTIFICATIONS);
404 mHandler.sendEmptyMessage(MSG_EXPAND_NOTIFICATIONS);
Joe Onorato4762c2d2010-05-17 15:42:59 -0700405 }
406 }
407
Daniel Sandler11cf1782012-09-27 14:03:08 -0400408 public void animateCollapsePanels() {
Jason Monk07473ce2016-01-05 14:59:19 -0500409 synchronized (mLock) {
Daniel Sandler11cf1782012-09-27 14:03:08 -0400410 mHandler.removeMessages(MSG_COLLAPSE_PANELS);
Jason Monk9c7844c2017-01-18 15:21:53 -0500411 mHandler.obtainMessage(MSG_COLLAPSE_PANELS, 0, 0).sendToTarget();
412 }
413 }
414
Jason Monk297c04e2018-08-23 17:16:59 -0400415 public void animateCollapsePanels(int flags, boolean force) {
Jason Monk9c7844c2017-01-18 15:21:53 -0500416 synchronized (mLock) {
417 mHandler.removeMessages(MSG_COLLAPSE_PANELS);
Jason Monk297c04e2018-08-23 17:16:59 -0400418 mHandler.obtainMessage(MSG_COLLAPSE_PANELS, flags, force ? 1 : 0).sendToTarget();
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700419 }
Jim Miller9a720f52012-05-30 03:19:43 -0700420 }
421
Anthony Chen9ad00e02017-05-12 15:53:36 -0700422 public void togglePanel() {
423 synchronized (mLock) {
424 mHandler.removeMessages(MSG_TOGGLE_PANEL);
425 mHandler.obtainMessage(MSG_TOGGLE_PANEL, 0, 0).sendToTarget();
426 }
427 }
428
Jason Monka9927322015-12-13 16:22:37 -0500429 public void animateExpandSettingsPanel(String subPanel) {
Jason Monk07473ce2016-01-05 14:59:19 -0500430 synchronized (mLock) {
Daniel Sandler11cf1782012-09-27 14:03:08 -0400431 mHandler.removeMessages(MSG_EXPAND_SETTINGS);
Jason Monka9927322015-12-13 16:22:37 -0500432 mHandler.obtainMessage(MSG_EXPAND_SETTINGS, subPanel).sendToTarget();
Joe Onorato4762c2d2010-05-17 15:42:59 -0700433 }
434 }
435
Charles Chen24e7a9f2018-11-21 11:59:07 +0800436 @Override
437 public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
438 int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
Jason Monk07473ce2016-01-05 14:59:19 -0500439 synchronized (mLock) {
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700440 // Don't coalesce these, since it might have one time flags set such as
441 // STATUS_BAR_UNHIDE which might get lost.
Jorim Jaggi86905582016-02-09 21:36:09 -0800442 SomeArgs args = SomeArgs.obtain();
Charles Chenf3d295c2018-11-30 18:15:21 +0800443 args.argi1 = displayId;
444 args.argi2 = vis;
445 args.argi3 = fullscreenStackVis;
446 args.argi4 = dockedStackVis;
447 args.argi5 = mask;
Jorim Jaggi86905582016-02-09 21:36:09 -0800448 args.arg1 = fullscreenStackBounds;
449 args.arg2 = dockedStackBounds;
450 mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY, args).sendToTarget();
Joe Onorato93056472010-09-10 10:30:46 -0400451 }
452 }
453
Charles Chen24e7a9f2018-11-21 11:59:07 +0800454 @Override
455 public void topAppWindowChanged(int displayId, boolean menuVisible) {
Jason Monk07473ce2016-01-05 14:59:19 -0500456 synchronized (mLock) {
Dianne Hackborn7d049322011-06-14 15:00:32 -0700457 mHandler.removeMessages(MSG_TOP_APP_WINDOW_CHANGED);
Charles Chenf3d295c2018-11-30 18:15:21 +0800458 mHandler.obtainMessage(MSG_TOP_APP_WINDOW_CHANGED,
459 displayId, menuVisible ? 1 : 0, null).sendToTarget();
Daniel Sandlere02d8082010-10-08 15:13:22 -0400460 }
461 }
462
Charles Chen24e7a9f2018-11-21 11:59:07 +0800463 @Override
464 public void setImeWindowStatus(int displayId, IBinder token, int vis, int backDisposition,
Jason Monkb605fec2014-05-02 17:04:10 -0400465 boolean showImeSwitcher) {
Jason Monk07473ce2016-01-05 14:59:19 -0500466 synchronized (mLock) {
satok06487a52010-10-29 11:37:18 +0900467 mHandler.removeMessages(MSG_SHOW_IME_BUTTON);
Charles Chenf3d295c2018-11-30 18:15:21 +0800468 SomeArgs args = SomeArgs.obtain();
469 args.argi1 = displayId;
470 args.argi2 = vis;
471 args.argi3 = backDisposition;
472 args.argi4 = showImeSwitcher ? 1 : 0;
473 args.arg1 = token;
474 Message m = mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, args);
Jason Monkb605fec2014-05-02 17:04:10 -0400475 m.sendToTarget();
satok06487a52010-10-29 11:37:18 +0900476 }
477 }
478
Winson Chungdff7a732017-12-11 12:17:06 -0800479 public void showRecentApps(boolean triggeredFromAltTab) {
Jason Monk07473ce2016-01-05 14:59:19 -0500480 synchronized (mLock) {
Winson Chung1e8d71b2014-05-16 17:05:22 -0700481 mHandler.removeMessages(MSG_SHOW_RECENT_APPS);
Winson Chungdff7a732017-12-11 12:17:06 -0800482 mHandler.obtainMessage(MSG_SHOW_RECENT_APPS, triggeredFromAltTab ? 1 : 0, 0,
483 null).sendToTarget();
Winson Chung1e8d71b2014-05-16 17:05:22 -0700484 }
485 }
486
Winson Chungcdcd4872014-08-05 18:00:13 -0700487 public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
Jason Monk07473ce2016-01-05 14:59:19 -0500488 synchronized (mLock) {
Winson Chung1e8d71b2014-05-16 17:05:22 -0700489 mHandler.removeMessages(MSG_HIDE_RECENT_APPS);
Winson Chung6cb485f2014-05-19 10:30:43 -0700490 mHandler.obtainMessage(MSG_HIDE_RECENT_APPS,
Winson Chungcdcd4872014-08-05 18:00:13 -0700491 triggeredFromAltTab ? 1 : 0, triggeredFromHomeKey ? 1 : 0,
492 null).sendToTarget();
Winson Chung1e8d71b2014-05-16 17:05:22 -0700493 }
494 }
495
Phil Weaver315c34e2016-02-19 15:12:29 -0800496 public void toggleSplitScreen() {
497 synchronized (mLock) {
498 mHandler.removeMessages(MSG_TOGGLE_APP_SPLIT_SCREEN);
499 mHandler.obtainMessage(MSG_TOGGLE_APP_SPLIT_SCREEN, 0, 0, null).sendToTarget();
500 }
501 }
502
Michael Jurka3b1fc472011-06-13 10:54:40 -0700503 public void toggleRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500504 synchronized (mLock) {
Michael Jurka3b1fc472011-06-13 10:54:40 -0700505 mHandler.removeMessages(MSG_TOGGLE_RECENT_APPS);
Jorim Jaggi6b460382017-05-13 23:16:44 +0200506 Message msg = mHandler.obtainMessage(MSG_TOGGLE_RECENT_APPS, 0, 0, null);
507 msg.setAsynchronous(true);
508 msg.sendToTarget();
Michael Jurka3b1fc472011-06-13 10:54:40 -0700509 }
510 }
511
Michael Jurka7f2668c2012-03-27 07:49:52 -0700512 public void preloadRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500513 synchronized (mLock) {
Michael Jurka7f2668c2012-03-27 07:49:52 -0700514 mHandler.removeMessages(MSG_PRELOAD_RECENT_APPS);
515 mHandler.obtainMessage(MSG_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
516 }
517 }
518
519 public void cancelPreloadRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500520 synchronized (mLock) {
Michael Jurka7f2668c2012-03-27 07:49:52 -0700521 mHandler.removeMessages(MSG_CANCEL_PRELOAD_RECENT_APPS);
522 mHandler.obtainMessage(MSG_CANCEL_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
523 }
524 }
525
Clara Bayarrif2debb12015-07-10 14:47:17 +0100526 @Override
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +0100527 public void dismissKeyboardShortcutsMenu() {
528 synchronized (mLock) {
529 mHandler.removeMessages(MSG_DISMISS_KEYBOARD_SHORTCUTS);
530 mHandler.obtainMessage(MSG_DISMISS_KEYBOARD_SHORTCUTS).sendToTarget();
531 }
532 }
533
534 @Override
Clara Bayarri4e850ff2016-03-02 11:12:32 -0800535 public void toggleKeyboardShortcutsMenu(int deviceId) {
Jason Monk07473ce2016-01-05 14:59:19 -0500536 synchronized (mLock) {
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000537 mHandler.removeMessages(MSG_TOGGLE_KEYBOARD_SHORTCUTS);
Clara Bayarri4e850ff2016-03-02 11:12:32 -0800538 mHandler.obtainMessage(MSG_TOGGLE_KEYBOARD_SHORTCUTS, deviceId, 0).sendToTarget();
Clara Bayarrif2debb12015-07-10 14:47:17 +0100539 }
540 }
541
Jaewan Kimc552b042016-01-18 16:08:45 +0900542 @Override
Winson Chungac52f282017-03-30 14:44:52 -0700543 public void showPictureInPictureMenu() {
Jaewan Kimc552b042016-01-18 16:08:45 +0900544 synchronized (mLock) {
Winson Chungac52f282017-03-30 14:44:52 -0700545 mHandler.removeMessages(MSG_SHOW_PICTURE_IN_PICTURE_MENU);
546 mHandler.obtainMessage(MSG_SHOW_PICTURE_IN_PICTURE_MENU).sendToTarget();
Jaewan Kimc552b042016-01-18 16:08:45 +0900547 }
548 }
549
Charles Chen24e7a9f2018-11-21 11:59:07 +0800550 @Override
551 public void setWindowState(int displayId, int window, int state) {
Jason Monk07473ce2016-01-05 14:59:19 -0500552 synchronized (mLock) {
John Spurlock5b9145b2013-08-20 15:13:47 -0400553 // don't coalesce these
Charles Chenf3d295c2018-11-30 18:15:21 +0800554 mHandler.obtainMessage(MSG_SET_WINDOW_STATE, displayId, window, state).sendToTarget();
John Spurlock97642182013-07-29 17:58:39 -0400555 }
556 }
557
Andrii Kulian0f051f52016-04-14 00:41:51 -0700558 public void showScreenPinningRequest(int taskId) {
Jason Monk07473ce2016-01-05 14:59:19 -0500559 synchronized (mLock) {
Andrii Kulian0f051f52016-04-14 00:41:51 -0700560 mHandler.obtainMessage(MSG_SHOW_SCREEN_PIN_REQUEST, taskId, 0, null)
561 .sendToTarget();
Jason Monk5565cb42014-09-12 10:59:21 -0400562 }
563 }
564
Charles Chen24e7a9f2018-11-21 11:59:07 +0800565 @Override
566 public void appTransitionPending(int displayId) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800567 appTransitionPending(displayId, false /* forced */);
Jason Monkaa573e92017-01-27 17:00:29 -0500568 }
569
Charles Chenf3d295c2018-11-30 18:15:21 +0800570 /**
571 * Called to notify System UI that an application transition is pending.
572 * @see Callbacks#appTransitionPending(int, boolean)
573 */
574 public void appTransitionPending(int displayId, boolean forced) {
Jason Monk07473ce2016-01-05 14:59:19 -0500575 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800576 mHandler.obtainMessage(MSG_APP_TRANSITION_PENDING, displayId, forced ? 1 : 0)
577 .sendToTarget();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100578 }
579 }
580
Charles Chen24e7a9f2018-11-21 11:59:07 +0800581 @Override
582 public void appTransitionCancelled(int displayId) {
Jason Monk07473ce2016-01-05 14:59:19 -0500583 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800584 mHandler.obtainMessage(MSG_APP_TRANSITION_CANCELLED, displayId).sendToTarget();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100585 }
586 }
587
Charles Chen24e7a9f2018-11-21 11:59:07 +0800588 @Override
589 public void appTransitionStarting(int displayId, long startTime, long duration) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800590 appTransitionStarting(displayId, startTime, duration, false /* forced */);
Jason Monkaa573e92017-01-27 17:00:29 -0500591 }
592
Charles Chenf3d295c2018-11-30 18:15:21 +0800593 /**
594 * Called to notify System UI that an application transition is starting.
595 * @see Callbacks#appTransitionStarting(int, long, long, boolean).
596 */
597 public void appTransitionStarting(int displayId, long startTime, long duration,
598 boolean forced) {
Jason Monk07473ce2016-01-05 14:59:19 -0500599 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800600 final SomeArgs args = SomeArgs.obtain();
601 args.argi1 = displayId;
602 args.argi2 = forced ? 1 : 0;
603 args.arg1 = startTime;
604 args.arg2 = duration;
605 mHandler.obtainMessage(MSG_APP_TRANSITION_STARTING, args).sendToTarget();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100606 }
607 }
608
Jorim Jaggi2adba072016-03-03 13:43:39 +0100609 @Override
Charles Chen24e7a9f2018-11-21 11:59:07 +0800610 public void appTransitionFinished(int displayId) {
Jorim Jaggi2adba072016-03-03 13:43:39 +0100611 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800612 mHandler.obtainMessage(MSG_APP_TRANSITION_FINISHED, displayId).sendToTarget();
Jorim Jaggi2adba072016-03-03 13:43:39 +0100613 }
614 }
615
Adrian Roos4f43dc02015-06-17 16:43:38 -0700616 public void showAssistDisclosure() {
Jason Monk07473ce2016-01-05 14:59:19 -0500617 synchronized (mLock) {
Adrian Roos4f43dc02015-06-17 16:43:38 -0700618 mHandler.removeMessages(MSG_ASSIST_DISCLOSURE);
619 mHandler.obtainMessage(MSG_ASSIST_DISCLOSURE).sendToTarget();
620 }
621 }
622
Jorim Jaggi165ce062015-07-06 16:18:11 -0700623 public void startAssist(Bundle args) {
Jason Monk07473ce2016-01-05 14:59:19 -0500624 synchronized (mLock) {
Jorim Jaggi165ce062015-07-06 16:18:11 -0700625 mHandler.removeMessages(MSG_START_ASSIST);
626 mHandler.obtainMessage(MSG_START_ASSIST, args).sendToTarget();
627 }
628 }
629
Selim Cinek372d1bd2015-08-14 13:19:37 -0700630 @Override
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700631 public void onCameraLaunchGestureDetected(int source) {
Jason Monk07473ce2016-01-05 14:59:19 -0500632 synchronized (mLock) {
Selim Cinek372d1bd2015-08-14 13:19:37 -0700633 mHandler.removeMessages(MSG_CAMERA_LAUNCH_GESTURE);
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700634 mHandler.obtainMessage(MSG_CAMERA_LAUNCH_GESTURE, source, 0).sendToTarget();
Selim Cinek372d1bd2015-08-14 13:19:37 -0700635 }
636 }
637
Jason Monk7e53f202016-01-28 10:40:20 -0500638 @Override
639 public void addQsTile(ComponentName tile) {
640 synchronized (mLock) {
641 mHandler.obtainMessage(MSG_ADD_QS_TILE, tile).sendToTarget();
642 }
643 }
644
645 @Override
646 public void remQsTile(ComponentName tile) {
647 synchronized (mLock) {
648 mHandler.obtainMessage(MSG_REMOVE_QS_TILE, tile).sendToTarget();
649 }
650 }
651
652 @Override
653 public void clickQsTile(ComponentName tile) {
654 synchronized (mLock) {
655 mHandler.obtainMessage(MSG_CLICK_QS_TILE, tile).sendToTarget();
656 }
657 }
658
Jim Miller07e03842016-06-22 15:18:13 -0700659 @Override
Philip Quinnc3a503d2017-07-18 23:23:41 -0700660 public void handleSystemKey(int key) {
Jim Miller07e03842016-06-22 15:18:13 -0700661 synchronized (mLock) {
Philip Quinnc3a503d2017-07-18 23:23:41 -0700662 mHandler.obtainMessage(MSG_HANDLE_SYSTEM_KEY, key, 0).sendToTarget();
Jim Miller07e03842016-06-22 15:18:13 -0700663 }
664 }
665
Jason Monk361915c2017-03-21 20:33:59 -0400666 @Override
Matthew Ng9c3bce52018-02-01 22:00:31 +0000667 public void showPinningEnterExitToast(boolean entering) {
668 synchronized (mLock) {
669 mHandler.obtainMessage(MSG_SHOW_PINNING_TOAST_ENTER_EXIT, entering).sendToTarget();
670 }
671 }
672
673 @Override
674 public void showPinningEscapeToast() {
675 synchronized (mLock) {
676 mHandler.obtainMessage(MSG_SHOW_PINNING_TOAST_ESCAPE).sendToTarget();
677 }
678 }
679
680
681 @Override
Jason Monk361915c2017-03-21 20:33:59 -0400682 public void showGlobalActionsMenu() {
683 synchronized (mLock) {
684 mHandler.removeMessages(MSG_SHOW_GLOBAL_ACTIONS);
685 mHandler.obtainMessage(MSG_SHOW_GLOBAL_ACTIONS).sendToTarget();
686 }
687 }
688
Jason Monkb4302182017-08-04 13:39:17 -0400689 @Override
Selim Cinek3a49ba22017-08-10 11:17:39 -0700690 public void setTopAppHidesStatusBar(boolean hidesStatusBar) {
691 mHandler.removeMessages(MSG_SET_TOP_APP_HIDES_STATUS_BAR);
692 mHandler.obtainMessage(MSG_SET_TOP_APP_HIDES_STATUS_BAR, hidesStatusBar ? 1 : 0, 0)
693 .sendToTarget();
694 }
695
696 @Override
Jason Monkb4302182017-08-04 13:39:17 -0400697 public void showShutdownUi(boolean isReboot, String reason) {
698 synchronized (mLock) {
699 mHandler.removeMessages(MSG_SHOW_SHUTDOWN_UI);
700 mHandler.obtainMessage(MSG_SHOW_SHUTDOWN_UI, isReboot ? 1 : 0, 0, reason)
701 .sendToTarget();
702 }
703 }
704
Mike Digman93f08342017-11-24 21:46:53 -0800705 @Override
Beverlyac32c9a2018-01-31 16:10:41 -0500706 public void showWirelessChargingAnimation(int batteryLevel) {
Beverlyae79ab92017-12-11 09:20:02 -0500707 mHandler.removeMessages(MSG_SHOW_CHARGING_ANIMATION);
708 mHandler.obtainMessage(MSG_SHOW_CHARGING_ANIMATION, batteryLevel, 0)
709 .sendToTarget();
710 }
711
712 @Override
Mike Digmane0777312018-01-19 12:41:51 -0800713 public void onProposedRotationChanged(int rotation, boolean isValid) {
Mike Digman93f08342017-11-24 21:46:53 -0800714 synchronized (mLock) {
715 mHandler.removeMessages(MSG_ROTATION_PROPOSAL);
Mike Digmane0777312018-01-19 12:41:51 -0800716 mHandler.obtainMessage(MSG_ROTATION_PROPOSAL, rotation, isValid ? 1 : 0,
Mike Digman93f08342017-11-24 21:46:53 -0800717 null).sendToTarget();
718 }
719 }
720
Kevin Chynaae4a152018-01-18 11:48:09 -0800721 @Override
Kevin Chyn23289ef2018-11-28 16:32:36 -0800722 public void showBiometricDialog(Bundle bundle, IBiometricServiceReceiverInternal receiver,
723 int type, boolean requireConfirmation, int userId) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800724 synchronized (mLock) {
725 SomeArgs args = SomeArgs.obtain();
726 args.arg1 = bundle;
727 args.arg2 = receiver;
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700728 args.argi1 = type;
Kevin Chyn6cf54e82018-09-18 19:13:27 -0700729 args.arg3 = requireConfirmation;
Kevin Chyn1b9f8df2018-11-12 19:04:55 -0800730 args.argi2 = userId;
Kevin Chyne9275662018-07-23 16:42:06 -0700731 mHandler.obtainMessage(MSG_BIOMETRIC_SHOW, args)
Kevin Chynaae4a152018-01-18 11:48:09 -0800732 .sendToTarget();
733 }
734 }
735
736 @Override
Kevin Chyne1912712019-01-04 14:22:34 -0800737 public void onBiometricAuthenticated(boolean authenticated) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800738 synchronized (mLock) {
Kevin Chyne1912712019-01-04 14:22:34 -0800739 mHandler.obtainMessage(MSG_BIOMETRIC_AUTHENTICATED, authenticated).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800740 }
741 }
742
743 @Override
Kevin Chyne9275662018-07-23 16:42:06 -0700744 public void onBiometricHelp(String message) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800745 synchronized (mLock) {
Kevin Chyne9275662018-07-23 16:42:06 -0700746 mHandler.obtainMessage(MSG_BIOMETRIC_HELP, message).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800747 }
748 }
749
750 @Override
Kevin Chyne9275662018-07-23 16:42:06 -0700751 public void onBiometricError(String error) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800752 synchronized (mLock) {
Kevin Chyne9275662018-07-23 16:42:06 -0700753 mHandler.obtainMessage(MSG_BIOMETRIC_ERROR, error).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800754 }
755 }
756
757 @Override
Kevin Chyne9275662018-07-23 16:42:06 -0700758 public void hideBiometricDialog() {
Kevin Chynaae4a152018-01-18 11:48:09 -0800759 synchronized (mLock) {
Kevin Chyne9275662018-07-23 16:42:06 -0700760 mHandler.obtainMessage(MSG_BIOMETRIC_HIDE).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800761 }
762 }
763
Joe Onorato0cbda992010-05-02 16:28:15 -0700764 private final class H extends Handler {
Jason Monkb5b092012017-01-05 11:35:34 -0500765 private H(Looper l) {
766 super(l);
767 }
768
Joe Onorato0cbda992010-05-02 16:28:15 -0700769 public void handleMessage(Message msg) {
Joe Onoratof3f0e052010-05-14 18:49:29 -0700770 final int what = msg.what & MSG_MASK;
Joe Onorato66d7d012010-05-14 10:05:10 -0700771 switch (what) {
Joe Onorato0cbda992010-05-02 16:28:15 -0700772 case MSG_ICON: {
Joe Onorato0cbda992010-05-02 16:28:15 -0700773 switch (msg.arg1) {
774 case OP_SET_ICON: {
Jason Monk07473ce2016-01-05 14:59:19 -0500775 Pair<String, StatusBarIcon> p = (Pair<String, StatusBarIcon>) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500776 for (int i = 0; i < mCallbacks.size(); i++) {
777 mCallbacks.get(i).setIcon(p.first, p.second);
Jason Monkb5b092012017-01-05 11:35:34 -0500778 }
Joe Onorato0cbda992010-05-02 16:28:15 -0700779 break;
780 }
781 case OP_REMOVE_ICON:
Jason Monk49fa0162017-01-11 09:21:56 -0500782 for (int i = 0; i < mCallbacks.size(); i++) {
783 mCallbacks.get(i).removeIcon((String) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500784 }
Joe Onorato0cbda992010-05-02 16:28:15 -0700785 break;
786 }
787 break;
Joe Onoratof3f0e052010-05-14 18:49:29 -0700788 }
789 case MSG_DISABLE:
Charles Chenf3d295c2018-11-30 18:15:21 +0800790 SomeArgs args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500791 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800792 mCallbacks.get(i).disable(args.argi1, args.argi2, args.argi3,
793 args.argi4 != 0 /* animate */);
Jason Monkb5b092012017-01-05 11:35:34 -0500794 }
Joe Onoratof3f0e052010-05-14 18:49:29 -0700795 break;
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700796 case MSG_EXPAND_NOTIFICATIONS:
Jason Monk49fa0162017-01-11 09:21:56 -0500797 for (int i = 0; i < mCallbacks.size(); i++) {
798 mCallbacks.get(i).animateExpandNotificationsPanel();
Jason Monkb5b092012017-01-05 11:35:34 -0500799 }
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700800 break;
Daniel Sandler11cf1782012-09-27 14:03:08 -0400801 case MSG_COLLAPSE_PANELS:
Jason Monk49fa0162017-01-11 09:21:56 -0500802 for (int i = 0; i < mCallbacks.size(); i++) {
Jason Monk297c04e2018-08-23 17:16:59 -0400803 mCallbacks.get(i).animateCollapsePanels(msg.arg1, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500804 }
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700805 break;
Anthony Chen9ad00e02017-05-12 15:53:36 -0700806 case MSG_TOGGLE_PANEL:
807 for (int i = 0; i < mCallbacks.size(); i++) {
808 mCallbacks.get(i).togglePanel();
809 }
810 break;
Daniel Sandler11cf1782012-09-27 14:03:08 -0400811 case MSG_EXPAND_SETTINGS:
Jason Monk49fa0162017-01-11 09:21:56 -0500812 for (int i = 0; i < mCallbacks.size(); i++) {
813 mCallbacks.get(i).animateExpandSettingsPanel((String) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500814 }
Joe Onorato93056472010-09-10 10:30:46 -0400815 break;
Daniel Sandler60ee2562011-07-22 12:34:33 -0400816 case MSG_SET_SYSTEMUI_VISIBILITY:
Charles Chenf3d295c2018-11-30 18:15:21 +0800817 args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500818 for (int i = 0; i < mCallbacks.size(); i++) {
819 mCallbacks.get(i).setSystemUiVisibility(args.argi1, args.argi2, args.argi3,
Charles Chenf3d295c2018-11-30 18:15:21 +0800820 args.argi4, args.argi5, (Rect) args.arg1, (Rect) args.arg2);
Jason Monkb5b092012017-01-05 11:35:34 -0500821 }
Jorim Jaggi86905582016-02-09 21:36:09 -0800822 args.recycle();
Joe Onorato93056472010-09-10 10:30:46 -0400823 break;
Dianne Hackborn7d049322011-06-14 15:00:32 -0700824 case MSG_TOP_APP_WINDOW_CHANGED:
Jason Monk49fa0162017-01-11 09:21:56 -0500825 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800826 mCallbacks.get(i).topAppWindowChanged(msg.arg1, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500827 }
Daniel Sandlere02d8082010-10-08 15:13:22 -0400828 break;
satok06487a52010-10-29 11:37:18 +0900829 case MSG_SHOW_IME_BUTTON:
Charles Chenf3d295c2018-11-30 18:15:21 +0800830 args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500831 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800832 mCallbacks.get(i).setImeWindowStatus(args.argi1, (IBinder) args.arg1,
833 args.argi2, args.argi3, args.argi4 != 0 /* showImeSwitcher */);
Jason Monkb5b092012017-01-05 11:35:34 -0500834 }
satok06487a52010-10-29 11:37:18 +0900835 break;
Winson Chung1e8d71b2014-05-16 17:05:22 -0700836 case MSG_SHOW_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500837 for (int i = 0; i < mCallbacks.size(); i++) {
Winson Chungdff7a732017-12-11 12:17:06 -0800838 mCallbacks.get(i).showRecentApps(msg.arg1 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500839 }
Winson Chung1e8d71b2014-05-16 17:05:22 -0700840 break;
841 case MSG_HIDE_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500842 for (int i = 0; i < mCallbacks.size(); i++) {
843 mCallbacks.get(i).hideRecentApps(msg.arg1 != 0, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500844 }
Winson Chung1e8d71b2014-05-16 17:05:22 -0700845 break;
Michael Jurka3b1fc472011-06-13 10:54:40 -0700846 case MSG_TOGGLE_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500847 for (int i = 0; i < mCallbacks.size(); i++) {
848 mCallbacks.get(i).toggleRecentApps();
Jason Monkb5b092012017-01-05 11:35:34 -0500849 }
Michael Jurka3b1fc472011-06-13 10:54:40 -0700850 break;
Michael Jurka7f2668c2012-03-27 07:49:52 -0700851 case MSG_PRELOAD_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500852 for (int i = 0; i < mCallbacks.size(); i++) {
853 mCallbacks.get(i).preloadRecentApps();
Jason Monkb5b092012017-01-05 11:35:34 -0500854 }
Michael Jurka7f2668c2012-03-27 07:49:52 -0700855 break;
856 case MSG_CANCEL_PRELOAD_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500857 for (int i = 0; i < mCallbacks.size(); i++) {
858 mCallbacks.get(i).cancelPreloadRecentApps();
Jason Monkb5b092012017-01-05 11:35:34 -0500859 }
Michael Jurka7f2668c2012-03-27 07:49:52 -0700860 break;
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +0100861 case MSG_DISMISS_KEYBOARD_SHORTCUTS:
Jason Monk49fa0162017-01-11 09:21:56 -0500862 for (int i = 0; i < mCallbacks.size(); i++) {
863 mCallbacks.get(i).dismissKeyboardShortcutsMenu();
Jason Monkb5b092012017-01-05 11:35:34 -0500864 }
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +0100865 break;
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000866 case MSG_TOGGLE_KEYBOARD_SHORTCUTS:
Jason Monk49fa0162017-01-11 09:21:56 -0500867 for (int i = 0; i < mCallbacks.size(); i++) {
868 mCallbacks.get(i).toggleKeyboardShortcutsMenu(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500869 }
Clara Bayarrif2debb12015-07-10 14:47:17 +0100870 break;
John Spurlock97642182013-07-29 17:58:39 -0400871 case MSG_SET_WINDOW_STATE:
Jason Monk49fa0162017-01-11 09:21:56 -0500872 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800873 mCallbacks.get(i).setWindowState(msg.arg1, msg.arg2, (int) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500874 }
John Spurlock97642182013-07-29 17:58:39 -0400875 break;
Jason Monk5565cb42014-09-12 10:59:21 -0400876 case MSG_SHOW_SCREEN_PIN_REQUEST:
Jason Monk49fa0162017-01-11 09:21:56 -0500877 for (int i = 0; i < mCallbacks.size(); i++) {
878 mCallbacks.get(i).showScreenPinningRequest(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500879 }
Jason Monk5565cb42014-09-12 10:59:21 -0400880 break;
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100881 case MSG_APP_TRANSITION_PENDING:
Jason Monk49fa0162017-01-11 09:21:56 -0500882 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800883 mCallbacks.get(i).appTransitionPending(msg.arg1, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500884 }
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100885 break;
886 case MSG_APP_TRANSITION_CANCELLED:
Jason Monk49fa0162017-01-11 09:21:56 -0500887 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800888 mCallbacks.get(i).appTransitionCancelled(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500889 }
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100890 break;
891 case MSG_APP_TRANSITION_STARTING:
Charles Chenf3d295c2018-11-30 18:15:21 +0800892 args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500893 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800894 mCallbacks.get(i).appTransitionStarting(args.argi1, (long) args.arg1,
895 (long) args.arg2, args.argi2 != 0 /* forced */);
Jason Monkb5b092012017-01-05 11:35:34 -0500896 }
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100897 break;
Jorim Jaggi2adba072016-03-03 13:43:39 +0100898 case MSG_APP_TRANSITION_FINISHED:
Jason Monk49fa0162017-01-11 09:21:56 -0500899 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800900 mCallbacks.get(i).appTransitionFinished(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500901 }
Jorim Jaggi2adba072016-03-03 13:43:39 +0100902 break;
Adrian Roos4f43dc02015-06-17 16:43:38 -0700903 case MSG_ASSIST_DISCLOSURE:
Jason Monk49fa0162017-01-11 09:21:56 -0500904 for (int i = 0; i < mCallbacks.size(); i++) {
905 mCallbacks.get(i).showAssistDisclosure();
Jason Monkb5b092012017-01-05 11:35:34 -0500906 }
Adrian Roos4f43dc02015-06-17 16:43:38 -0700907 break;
Jorim Jaggi165ce062015-07-06 16:18:11 -0700908 case MSG_START_ASSIST:
Jason Monk49fa0162017-01-11 09:21:56 -0500909 for (int i = 0; i < mCallbacks.size(); i++) {
910 mCallbacks.get(i).startAssist((Bundle) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500911 }
Jorim Jaggi165ce062015-07-06 16:18:11 -0700912 break;
Selim Cinek372d1bd2015-08-14 13:19:37 -0700913 case MSG_CAMERA_LAUNCH_GESTURE:
Jason Monk49fa0162017-01-11 09:21:56 -0500914 for (int i = 0; i < mCallbacks.size(); i++) {
915 mCallbacks.get(i).onCameraLaunchGestureDetected(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500916 }
Selim Cinek372d1bd2015-08-14 13:19:37 -0700917 break;
Winson Chungac52f282017-03-30 14:44:52 -0700918 case MSG_SHOW_PICTURE_IN_PICTURE_MENU:
Jason Monk49fa0162017-01-11 09:21:56 -0500919 for (int i = 0; i < mCallbacks.size(); i++) {
Winson Chungac52f282017-03-30 14:44:52 -0700920 mCallbacks.get(i).showPictureInPictureMenu();
Jason Monkb5b092012017-01-05 11:35:34 -0500921 }
Jaewan Kimc552b042016-01-18 16:08:45 +0900922 break;
Jason Monk7e53f202016-01-28 10:40:20 -0500923 case MSG_ADD_QS_TILE:
Jason Monk49fa0162017-01-11 09:21:56 -0500924 for (int i = 0; i < mCallbacks.size(); i++) {
925 mCallbacks.get(i).addQsTile((ComponentName) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500926 }
Jason Monk7e53f202016-01-28 10:40:20 -0500927 break;
928 case MSG_REMOVE_QS_TILE:
Jason Monk49fa0162017-01-11 09:21:56 -0500929 for (int i = 0; i < mCallbacks.size(); i++) {
930 mCallbacks.get(i).remQsTile((ComponentName) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500931 }
Jason Monk7e53f202016-01-28 10:40:20 -0500932 break;
933 case MSG_CLICK_QS_TILE:
Jason Monk49fa0162017-01-11 09:21:56 -0500934 for (int i = 0; i < mCallbacks.size(); i++) {
935 mCallbacks.get(i).clickTile((ComponentName) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500936 }
Jason Monk7e53f202016-01-28 10:40:20 -0500937 break;
Phil Weaver315c34e2016-02-19 15:12:29 -0800938 case MSG_TOGGLE_APP_SPLIT_SCREEN:
Jason Monk49fa0162017-01-11 09:21:56 -0500939 for (int i = 0; i < mCallbacks.size(); i++) {
940 mCallbacks.get(i).toggleSplitScreen();
Jason Monkb5b092012017-01-05 11:35:34 -0500941 }
Phil Weaver315c34e2016-02-19 15:12:29 -0800942 break;
Philip Quinnc3a503d2017-07-18 23:23:41 -0700943 case MSG_HANDLE_SYSTEM_KEY:
Jason Monk49fa0162017-01-11 09:21:56 -0500944 for (int i = 0; i < mCallbacks.size(); i++) {
Philip Quinnc3a503d2017-07-18 23:23:41 -0700945 mCallbacks.get(i).handleSystemKey(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500946 }
Jim Miller07e03842016-06-22 15:18:13 -0700947 break;
Jason Monk361915c2017-03-21 20:33:59 -0400948 case MSG_SHOW_GLOBAL_ACTIONS:
949 for (int i = 0; i < mCallbacks.size(); i++) {
950 mCallbacks.get(i).handleShowGlobalActionsMenu();
951 }
952 break;
Jason Monkb4302182017-08-04 13:39:17 -0400953 case MSG_SHOW_SHUTDOWN_UI:
954 for (int i = 0; i < mCallbacks.size(); i++) {
955 mCallbacks.get(i).handleShowShutdownUi(msg.arg1 != 0, (String) msg.obj);
956 }
957 break;
Selim Cinek3a49ba22017-08-10 11:17:39 -0700958 case MSG_SET_TOP_APP_HIDES_STATUS_BAR:
959 for (int i = 0; i < mCallbacks.size(); i++) {
960 mCallbacks.get(i).setTopAppHidesStatusBar(msg.arg1 != 0);
961 }
962 break;
Mike Digman93f08342017-11-24 21:46:53 -0800963 case MSG_ROTATION_PROPOSAL:
964 for (int i = 0; i < mCallbacks.size(); i++) {
Mike Digmane0777312018-01-19 12:41:51 -0800965 mCallbacks.get(i).onRotationProposal(msg.arg1, msg.arg2 != 0);
Mike Digman93f08342017-11-24 21:46:53 -0800966 }
967 break;
Kevin Chyne9275662018-07-23 16:42:06 -0700968 case MSG_BIOMETRIC_SHOW:
969 mHandler.removeMessages(MSG_BIOMETRIC_ERROR);
970 mHandler.removeMessages(MSG_BIOMETRIC_HELP);
971 mHandler.removeMessages(MSG_BIOMETRIC_AUTHENTICATED);
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700972 SomeArgs someArgs = (SomeArgs) msg.obj;
Kevin Chynaae4a152018-01-18 11:48:09 -0800973 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -0700974 mCallbacks.get(i).showBiometricDialog(
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700975 (Bundle) someArgs.arg1,
Kevin Chyn23289ef2018-11-28 16:32:36 -0800976 (IBiometricServiceReceiverInternal) someArgs.arg2,
Kevin Chyn1b9f8df2018-11-12 19:04:55 -0800977 someArgs.argi1 /* type */,
978 (boolean) someArgs.arg3 /* requireConfirmation */,
979 someArgs.argi2 /* userId */);
Kevin Chynaae4a152018-01-18 11:48:09 -0800980 }
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700981 someArgs.recycle();
Kevin Chynaae4a152018-01-18 11:48:09 -0800982 break;
Kevin Chyne9275662018-07-23 16:42:06 -0700983 case MSG_BIOMETRIC_AUTHENTICATED:
Kevin Chynaae4a152018-01-18 11:48:09 -0800984 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne1912712019-01-04 14:22:34 -0800985 mCallbacks.get(i).onBiometricAuthenticated((boolean) msg.obj);
Kevin Chynaae4a152018-01-18 11:48:09 -0800986 }
987 break;
Kevin Chyne9275662018-07-23 16:42:06 -0700988 case MSG_BIOMETRIC_HELP:
Kevin Chynaae4a152018-01-18 11:48:09 -0800989 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -0700990 mCallbacks.get(i).onBiometricHelp((String) msg.obj);
Kevin Chynaae4a152018-01-18 11:48:09 -0800991 }
992 break;
Kevin Chyne9275662018-07-23 16:42:06 -0700993 case MSG_BIOMETRIC_ERROR:
Kevin Chynaae4a152018-01-18 11:48:09 -0800994 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -0700995 mCallbacks.get(i).onBiometricError((String) msg.obj);
Kevin Chynaae4a152018-01-18 11:48:09 -0800996 }
997 break;
Kevin Chyne9275662018-07-23 16:42:06 -0700998 case MSG_BIOMETRIC_HIDE:
Kevin Chynaae4a152018-01-18 11:48:09 -0800999 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -07001000 mCallbacks.get(i).hideBiometricDialog();
Kevin Chynaae4a152018-01-18 11:48:09 -08001001 }
Beverlyae79ab92017-12-11 09:20:02 -05001002 break;
1003 case MSG_SHOW_CHARGING_ANIMATION:
1004 for (int i = 0; i < mCallbacks.size(); i++) {
Beverlyac32c9a2018-01-31 16:10:41 -05001005 mCallbacks.get(i).showWirelessChargingAnimation(msg.arg1);
Beverlyae79ab92017-12-11 09:20:02 -05001006 }
1007 break;
Matthew Ng9c3bce52018-02-01 22:00:31 +00001008 case MSG_SHOW_PINNING_TOAST_ENTER_EXIT:
1009 for (int i = 0; i < mCallbacks.size(); i++) {
1010 mCallbacks.get(i).showPinningEnterExitToast((Boolean) msg.obj);
1011 }
1012 break;
1013 case MSG_SHOW_PINNING_TOAST_ESCAPE:
1014 for (int i = 0; i < mCallbacks.size(); i++) {
1015 mCallbacks.get(i).showPinningEscapeToast();
1016 }
1017 break;
Joe Onorato0cbda992010-05-02 16:28:15 -07001018 }
1019 }
1020 }
Jason Monkb5b092012017-01-05 11:35:34 -05001021
1022 // Need this class since CommandQueue already extends IStatusBar.Stub, so CommandQueueStart
1023 // is needed so it can extend SystemUI.
1024 public static class CommandQueueStart extends SystemUI {
1025 @Override
1026 public void start() {
Charles Chenf3d295c2018-11-30 18:15:21 +08001027 putComponent(CommandQueue.class, new CommandQueue(mContext));
Jason Monkb5b092012017-01-05 11:35:34 -05001028 }
1029 }
Joe Onorato0cbda992010-05-02 16:28:15 -07001030}