blob: 015085205460ba578bfce5a4bba8051900fa14d6 [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;
Charles Chen3dedec32019-01-24 22:19:37 +0800114 private static final int MSG_DISPLAY_READY = 47 << MSG_SHIFT;
Daniel Sandler328310c2011-09-23 15:56:52 -0400115
Jim Miller9a720f52012-05-30 03:19:43 -0700116 public static final int FLAG_EXCLUDE_NONE = 0;
117 public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
118 public static final int FLAG_EXCLUDE_RECENTS_PANEL = 1 << 1;
119 public static final int FLAG_EXCLUDE_NOTIFICATION_PANEL = 1 << 2;
120 public static final int FLAG_EXCLUDE_INPUT_METHODS_PANEL = 1 << 3;
121 public static final int FLAG_EXCLUDE_COMPAT_MODE_PANEL = 1 << 4;
122
Jason Monkb605fec2014-05-02 17:04:10 -0400123 private static final String SHOW_IME_SWITCHER_KEY = "showImeSwitcherKey";
124
Jason Monk07473ce2016-01-05 14:59:19 -0500125 private final Object mLock = new Object();
Jason Monk49fa0162017-01-11 09:21:56 -0500126 private ArrayList<Callbacks> mCallbacks = new ArrayList<>();
Jason Monkb5b092012017-01-05 11:35:34 -0500127 private Handler mHandler = new H(Looper.getMainLooper());
Charles Chenf3d295c2018-11-30 18:15:21 +0800128 /** A map of display id - disable flag pair */
129 private SparseArray<Pair<Integer, Integer>> mDisplayDisabled = new SparseArray<>();
Joe Onorato0cbda992010-05-02 16:28:15 -0700130
131 /**
132 * These methods are called back on the main thread.
133 */
134 public interface Callbacks {
Jason Monkb5b092012017-01-05 11:35:34 -0500135 default void setIcon(String slot, StatusBarIcon icon) { }
136 default void removeIcon(String slot) { }
Charles Chenf3d295c2018-11-30 18:15:21 +0800137
138 /**
139 * Called to notify that disable flags are updated.
140 * @see IStatusBar#disable(int, int, int).
141 *
142 * @param displayId The id of the display to notify.
143 * @param state1 The combination of following DISABLE_* flags:
144 * @param state2 The combination of following DISABLE2_* flags:
145 * @param animate {@code true} to show animations.
146 */
147 default void disable(int displayId, @DisableFlags int state1, @Disable2Flags int state2,
148 boolean animate) { }
Jason Monkb5b092012017-01-05 11:35:34 -0500149 default void animateExpandNotificationsPanel() { }
Jason Monk297c04e2018-08-23 17:16:59 -0400150 default void animateCollapsePanels(int flags, boolean force) { }
Anthony Chen9ad00e02017-05-12 15:53:36 -0700151 default void togglePanel() { }
Jason Monkb5b092012017-01-05 11:35:34 -0500152 default void animateExpandSettingsPanel(String obj) { }
Charles Chenf3d295c2018-11-30 18:15:21 +0800153
154 /**
155 * Called to notify visibility flag changes.
156 * @see IStatusBar#setSystemUiVisibility(int, int, int, int, int, Rect, Rect).
157 *
158 * @param displayId The id of the display to notify.
159 * @param vis The visibility flags except SYSTEM_UI_FLAG_LIGHT_STATUS_BAR which will
160 * be reported separately in fullscreenStackVis and dockedStackVis.
161 * @param fullscreenStackVis The flags which only apply in the region of the fullscreen
162 * stack, which is currently only SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.
163 * @param dockedStackVis The flags that only apply in the region of the docked stack, which
164 * is currently only SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.
165 * @param mask Which flags to change.
166 * @param fullscreenStackBounds The current bounds of the fullscreen stack, in screen
167 * coordinates.
168 * @param dockedStackBounds The current bounds of the docked stack, in screen coordinates.
169 */
170 default void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
Jason Monkb5b092012017-01-05 11:35:34 -0500171 int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
172 }
Charles Chenf3d295c2018-11-30 18:15:21 +0800173
174 /**
175 * Called to notify top app window changes.
176 * @see IStatusBar#topAppWindowChanged(int, boolean)
177 *
178 * @param displayId The id of the display to notify.
179 * @param visible {@code true} to show menu button.
180 */
181 default void topAppWindowChanged(int displayId, boolean visible) { }
182
183 /**
184 * Called to notify IME window status changes.
185 *
186 * @param displayId The id of the display to notify.
187 * @param token IME token.
188 * @param vis IME visibility.
189 * @param backDisposition Disposition mode of back button. It should be one of below flags:
190 * @param showImeSwitcher {@code true} to show IME switch button.
191 */
192 default void setImeWindowStatus(int displayId, IBinder token, int vis,
193 @BackDispositionMode int backDisposition, boolean showImeSwitcher) { }
Winson Chungdff7a732017-12-11 12:17:06 -0800194 default void showRecentApps(boolean triggeredFromAltTab) { }
Jason Monkb5b092012017-01-05 11:35:34 -0500195 default void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { }
196 default void toggleRecentApps() { }
197 default void toggleSplitScreen() { }
198 default void preloadRecentApps() { }
199 default void dismissKeyboardShortcutsMenu() { }
200 default void toggleKeyboardShortcutsMenu(int deviceId) { }
201 default void cancelPreloadRecentApps() { }
Charles Chenf3d295c2018-11-30 18:15:21 +0800202
203 /**
204 * Called to notify window state changes.
205 * @see IStatusBar#setWindowState(int, int, int)
206 *
207 * @param displayId The id of the display to notify.
208 * @param window Window type. It should be one of {@link StatusBarManager#WINDOW_STATUS_BAR}
209 * or {@link StatusBarManager#WINDOW_NAVIGATION_BAR}
210 * @param state Window visible state.
211 */
212 default void setWindowState(int displayId, @WindowType int window,
213 @WindowVisibleState int state) { }
Jason Monkb5b092012017-01-05 11:35:34 -0500214 default void showScreenPinningRequest(int taskId) { }
Charles Chenf3d295c2018-11-30 18:15:21 +0800215
216 /**
217 * Called to notify System UI that an application transition is pending.
218 * @see IStatusBar#appTransitionPending(int).
219 *
220 * @param displayId The id of the display to notify.
221 * @param forced {@code true} to force transition pending.
222 */
223 default void appTransitionPending(int displayId, boolean forced) { }
224
225 /**
226 * Called to notify System UI that an application transition is canceled.
227 * @see IStatusBar#appTransitionCancelled(int).
228 *
229 * @param displayId The id of the display to notify.
230 */
231 default void appTransitionCancelled(int displayId) { }
232
233 /**
234 * Called to notify System UI that an application transition is starting.
235 * @see IStatusBar#appTransitionStarting(int, long, long).
236 *
237 * @param displayId The id of the display to notify.
238 * @param startTime Transition start time.
239 * @param duration Transition duration.
240 * @param forced {@code true} to force transition pending.
241 */
242 default void appTransitionStarting(
243 int displayId, long startTime, long duration, boolean forced) { }
244
245 /**
246 * Called to notify System UI that an application transition is finished.
247 * @see IStatusBar#appTransitionFinished(int)
248 *
249 * @param displayId The id of the display to notify.
250 */
251 default void appTransitionFinished(int displayId) { }
Jason Monkb5b092012017-01-05 11:35:34 -0500252 default void showAssistDisclosure() { }
253 default void startAssist(Bundle args) { }
254 default void onCameraLaunchGestureDetected(int source) { }
Winson Chungac52f282017-03-30 14:44:52 -0700255 default void showPictureInPictureMenu() { }
Selim Cinek3a49ba22017-08-10 11:17:39 -0700256 default void setTopAppHidesStatusBar(boolean topAppHidesStatusBar) { }
Jason Monk7e53f202016-01-28 10:40:20 -0500257
Jason Monkb5b092012017-01-05 11:35:34 -0500258 default void addQsTile(ComponentName tile) { }
259 default void remQsTile(ComponentName tile) { }
260 default void clickTile(ComponentName tile) { }
Jim Miller07e03842016-06-22 15:18:13 -0700261
Philip Quinnc3a503d2017-07-18 23:23:41 -0700262 default void handleSystemKey(int arg1) { }
Matthew Ng9c3bce52018-02-01 22:00:31 +0000263 default void showPinningEnterExitToast(boolean entering) { }
264 default void showPinningEscapeToast() { }
Jason Monk361915c2017-03-21 20:33:59 -0400265 default void handleShowGlobalActionsMenu() { }
Jason Monkb4302182017-08-04 13:39:17 -0400266 default void handleShowShutdownUi(boolean isReboot, String reason) { }
Mike Digman93f08342017-11-24 21:46:53 -0800267
Beverlyac32c9a2018-01-31 16:10:41 -0500268 default void showWirelessChargingAnimation(int batteryLevel) { }
Beverlyae79ab92017-12-11 09:20:02 -0500269
Mike Digmane0777312018-01-19 12:41:51 -0800270 default void onRotationProposal(int rotation, boolean isValid) { }
Kevin Chynaae4a152018-01-18 11:48:09 -0800271
Kevin Chyn23289ef2018-11-28 16:32:36 -0800272 default void showBiometricDialog(Bundle bundle, IBiometricServiceReceiverInternal receiver,
Kevin Chyn1b9f8df2018-11-12 19:04:55 -0800273 int type, boolean requireConfirmation, int userId) { }
Kevin Chyne1912712019-01-04 14:22:34 -0800274 default void onBiometricAuthenticated(boolean authenticated) { }
Kevin Chyne9275662018-07-23 16:42:06 -0700275 default void onBiometricHelp(String message) { }
276 default void onBiometricError(String error) { }
277 default void hideBiometricDialog() { }
Charles Chen3dedec32019-01-24 22:19:37 +0800278
279 /**
280 * @see IStatusBar#onDisplayReady(int)
281 */
282 default void onDisplayReady(int displayId) { }
Joe Onorato0cbda992010-05-02 16:28:15 -0700283 }
284
Jason Monkb5b092012017-01-05 11:35:34 -0500285 @VisibleForTesting
Charles Chenf3d295c2018-11-30 18:15:21 +0800286 public CommandQueue(Context context) {
287 context.getSystemService(DisplayManager.class).registerDisplayListener(this, mHandler);
288 // We always have default display.
289 setDisabled(DEFAULT_DISPLAY, DISABLE_NONE, DISABLE2_NONE);
Jason Monk297c04e2018-08-23 17:16:59 -0400290 }
291
Charles Chenf3d295c2018-11-30 18:15:21 +0800292 @Override
293 public void onDisplayAdded(int displayId) { }
294
295 @Override
296 public void onDisplayRemoved(int displayId) {
297 synchronized (mLock) {
298 mDisplayDisabled.remove(displayId);
299 }
300 }
301
302 @Override
303 public void onDisplayChanged(int displayId) { }
304
305 // TODO(b/118592525): add multi-display support if needed.
Jason Monk297c04e2018-08-23 17:16:59 -0400306 public boolean panelsEnabled() {
Charles Chenf3d295c2018-11-30 18:15:21 +0800307 final int disabled1 = getDisabled1(DEFAULT_DISPLAY);
308 final int disabled2 = getDisabled2(DEFAULT_DISPLAY);
309 return (disabled1 & StatusBarManager.DISABLE_EXPAND) == 0
310 && (disabled2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) == 0
Jason Monk297c04e2018-08-23 17:16:59 -0400311 && !ONLY_CORE_APPS;
Jason Monkb5b092012017-01-05 11:35:34 -0500312 }
313
Jason Monkd7c98552018-12-04 11:14:50 -0500314 public void addCallback(Callbacks callbacks) {
Jason Monk49fa0162017-01-11 09:21:56 -0500315 mCallbacks.add(callbacks);
Charles Chenf3d295c2018-11-30 18:15:21 +0800316 // TODO(b/117478341): find a better way to pass disable flags by display.
317 for (int i = 0; i < mDisplayDisabled.size(); i++) {
318 int displayId = mDisplayDisabled.keyAt(i);
319 int disabled1 = getDisabled1(displayId);
320 int disabled2 = getDisabled2(displayId);
321 callbacks.disable(displayId, disabled1, disabled2, false /* animate */);
322 }
Jason Monk49fa0162017-01-11 09:21:56 -0500323 }
324
Jason Monkd7c98552018-12-04 11:14:50 -0500325 public void removeCallback(Callbacks callbacks) {
Jason Monk49fa0162017-01-11 09:21:56 -0500326 mCallbacks.remove(callbacks);
Joe Onorato0cbda992010-05-02 16:28:15 -0700327 }
328
Jason Monk07473ce2016-01-05 14:59:19 -0500329 public void setIcon(String slot, StatusBarIcon icon) {
330 synchronized (mLock) {
331 // don't coalesce these
332 mHandler.obtainMessage(MSG_ICON, OP_SET_ICON, 0,
333 new Pair<String, StatusBarIcon>(slot, icon)).sendToTarget();
Joe Onorato0cbda992010-05-02 16:28:15 -0700334 }
335 }
336
Jason Monk07473ce2016-01-05 14:59:19 -0500337 public void removeIcon(String slot) {
338 synchronized (mLock) {
339 // don't coalesce these
340 mHandler.obtainMessage(MSG_ICON, OP_REMOVE_ICON, 0, slot).sendToTarget();
Joe Onorato0cbda992010-05-02 16:28:15 -0700341 }
342 }
343
Charles Chenf3d295c2018-11-30 18:15:21 +0800344 /**
345 * Called to notify that disable flags are updated.
346 * @see Callbacks#disable(int, int, int, boolean).
347 */
348 public void disable(int displayId, @DisableFlags int state1, @Disable2Flags int state2,
349 boolean animate) {
Jason Monk07473ce2016-01-05 14:59:19 -0500350 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800351 setDisabled(displayId, state1, state2);
Joe Onoratof3f0e052010-05-14 18:49:29 -0700352 mHandler.removeMessages(MSG_DISABLE);
Charles Chenf3d295c2018-11-30 18:15:21 +0800353 final SomeArgs args = SomeArgs.obtain();
354 args.argi1 = displayId;
355 args.argi2 = state1;
356 args.argi3 = state2;
357 args.argi4 = animate ? 1 : 0;
358 Message msg = mHandler.obtainMessage(MSG_DISABLE, args);
Jason Monk3d3e99c2017-04-20 11:26:36 -0400359 if (Looper.myLooper() == mHandler.getLooper()) {
360 // If its the right looper execute immediately so hides can be handled quickly.
361 mHandler.handleMessage(msg);
362 msg.recycle();
363 } else {
364 msg.sendToTarget();
365 }
Joe Onoratof3f0e052010-05-14 18:49:29 -0700366 }
367 }
368
Charles Chen24e7a9f2018-11-21 11:59:07 +0800369 @Override
Charles Chenf3d295c2018-11-30 18:15:21 +0800370 public void disable(int displayId, @DisableFlags int state1, @Disable2Flags int state2) {
371 disable(displayId, state1, state2, true);
Jason Monk1e5ba5d2017-02-14 15:48:57 -0500372 }
373
Charles Chenf3d295c2018-11-30 18:15:21 +0800374 /**
375 * Apply current disable flags by {@link CommandQueue#disable(int, int, int, boolean)}.
376 *
377 * @param displayId The id of the display to notify.
378 * @param animate {@code true} to show animations.
379 */
380 public void recomputeDisableFlags(int displayId, boolean animate) {
381 int disabled1 = getDisabled1(displayId);
382 int disabled2 = getDisabled2(displayId);
383 disable(displayId, disabled1, disabled2, animate);
384 }
385
386 private void setDisabled(int displayId, int disabled1, int disabled2) {
387 mDisplayDisabled.put(displayId, new Pair<>(disabled1, disabled2));
388 }
389
390 private int getDisabled1(int displayId) {
391 return getDisabled(displayId).first;
392 }
393
394 private int getDisabled2(int displayId) {
395 return getDisabled(displayId).second;
396 }
397
398 private Pair<Integer, Integer> getDisabled(int displayId) {
399 Pair<Integer, Integer> disablePair = mDisplayDisabled.get(displayId);
400 if (disablePair == null) {
401 disablePair = new Pair<>(DISABLE_NONE, DISABLE2_NONE);
402 mDisplayDisabled.put(displayId, disablePair);
403 }
404 return disablePair;
Jason Monk00659ba2017-03-03 10:28:45 -0500405 }
406
Daniel Sandler11cf1782012-09-27 14:03:08 -0400407 public void animateExpandNotificationsPanel() {
Jason Monk07473ce2016-01-05 14:59:19 -0500408 synchronized (mLock) {
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700409 mHandler.removeMessages(MSG_EXPAND_NOTIFICATIONS);
410 mHandler.sendEmptyMessage(MSG_EXPAND_NOTIFICATIONS);
Joe Onorato4762c2d2010-05-17 15:42:59 -0700411 }
412 }
413
Daniel Sandler11cf1782012-09-27 14:03:08 -0400414 public void animateCollapsePanels() {
Jason Monk07473ce2016-01-05 14:59:19 -0500415 synchronized (mLock) {
Daniel Sandler11cf1782012-09-27 14:03:08 -0400416 mHandler.removeMessages(MSG_COLLAPSE_PANELS);
Jason Monk9c7844c2017-01-18 15:21:53 -0500417 mHandler.obtainMessage(MSG_COLLAPSE_PANELS, 0, 0).sendToTarget();
418 }
419 }
420
Jason Monk297c04e2018-08-23 17:16:59 -0400421 public void animateCollapsePanels(int flags, boolean force) {
Jason Monk9c7844c2017-01-18 15:21:53 -0500422 synchronized (mLock) {
423 mHandler.removeMessages(MSG_COLLAPSE_PANELS);
Jason Monk297c04e2018-08-23 17:16:59 -0400424 mHandler.obtainMessage(MSG_COLLAPSE_PANELS, flags, force ? 1 : 0).sendToTarget();
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700425 }
Jim Miller9a720f52012-05-30 03:19:43 -0700426 }
427
Anthony Chen9ad00e02017-05-12 15:53:36 -0700428 public void togglePanel() {
429 synchronized (mLock) {
430 mHandler.removeMessages(MSG_TOGGLE_PANEL);
431 mHandler.obtainMessage(MSG_TOGGLE_PANEL, 0, 0).sendToTarget();
432 }
433 }
434
Jason Monka9927322015-12-13 16:22:37 -0500435 public void animateExpandSettingsPanel(String subPanel) {
Jason Monk07473ce2016-01-05 14:59:19 -0500436 synchronized (mLock) {
Daniel Sandler11cf1782012-09-27 14:03:08 -0400437 mHandler.removeMessages(MSG_EXPAND_SETTINGS);
Jason Monka9927322015-12-13 16:22:37 -0500438 mHandler.obtainMessage(MSG_EXPAND_SETTINGS, subPanel).sendToTarget();
Joe Onorato4762c2d2010-05-17 15:42:59 -0700439 }
440 }
441
Charles Chen24e7a9f2018-11-21 11:59:07 +0800442 @Override
443 public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
444 int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
Jason Monk07473ce2016-01-05 14:59:19 -0500445 synchronized (mLock) {
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700446 // Don't coalesce these, since it might have one time flags set such as
447 // STATUS_BAR_UNHIDE which might get lost.
Jorim Jaggi86905582016-02-09 21:36:09 -0800448 SomeArgs args = SomeArgs.obtain();
Charles Chenf3d295c2018-11-30 18:15:21 +0800449 args.argi1 = displayId;
450 args.argi2 = vis;
451 args.argi3 = fullscreenStackVis;
452 args.argi4 = dockedStackVis;
453 args.argi5 = mask;
Jorim Jaggi86905582016-02-09 21:36:09 -0800454 args.arg1 = fullscreenStackBounds;
455 args.arg2 = dockedStackBounds;
456 mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY, args).sendToTarget();
Joe Onorato93056472010-09-10 10:30:46 -0400457 }
458 }
459
Charles Chen24e7a9f2018-11-21 11:59:07 +0800460 @Override
461 public void topAppWindowChanged(int displayId, boolean menuVisible) {
Jason Monk07473ce2016-01-05 14:59:19 -0500462 synchronized (mLock) {
Dianne Hackborn7d049322011-06-14 15:00:32 -0700463 mHandler.removeMessages(MSG_TOP_APP_WINDOW_CHANGED);
Charles Chenf3d295c2018-11-30 18:15:21 +0800464 mHandler.obtainMessage(MSG_TOP_APP_WINDOW_CHANGED,
465 displayId, menuVisible ? 1 : 0, null).sendToTarget();
Daniel Sandlere02d8082010-10-08 15:13:22 -0400466 }
467 }
468
Charles Chen24e7a9f2018-11-21 11:59:07 +0800469 @Override
470 public void setImeWindowStatus(int displayId, IBinder token, int vis, int backDisposition,
Jason Monkb605fec2014-05-02 17:04:10 -0400471 boolean showImeSwitcher) {
Jason Monk07473ce2016-01-05 14:59:19 -0500472 synchronized (mLock) {
satok06487a52010-10-29 11:37:18 +0900473 mHandler.removeMessages(MSG_SHOW_IME_BUTTON);
Charles Chenf3d295c2018-11-30 18:15:21 +0800474 SomeArgs args = SomeArgs.obtain();
475 args.argi1 = displayId;
476 args.argi2 = vis;
477 args.argi3 = backDisposition;
478 args.argi4 = showImeSwitcher ? 1 : 0;
479 args.arg1 = token;
480 Message m = mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, args);
Jason Monkb605fec2014-05-02 17:04:10 -0400481 m.sendToTarget();
satok06487a52010-10-29 11:37:18 +0900482 }
483 }
484
Winson Chungdff7a732017-12-11 12:17:06 -0800485 public void showRecentApps(boolean triggeredFromAltTab) {
Jason Monk07473ce2016-01-05 14:59:19 -0500486 synchronized (mLock) {
Winson Chung1e8d71b2014-05-16 17:05:22 -0700487 mHandler.removeMessages(MSG_SHOW_RECENT_APPS);
Winson Chungdff7a732017-12-11 12:17:06 -0800488 mHandler.obtainMessage(MSG_SHOW_RECENT_APPS, triggeredFromAltTab ? 1 : 0, 0,
489 null).sendToTarget();
Winson Chung1e8d71b2014-05-16 17:05:22 -0700490 }
491 }
492
Winson Chungcdcd4872014-08-05 18:00:13 -0700493 public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
Jason Monk07473ce2016-01-05 14:59:19 -0500494 synchronized (mLock) {
Winson Chung1e8d71b2014-05-16 17:05:22 -0700495 mHandler.removeMessages(MSG_HIDE_RECENT_APPS);
Winson Chung6cb485f2014-05-19 10:30:43 -0700496 mHandler.obtainMessage(MSG_HIDE_RECENT_APPS,
Winson Chungcdcd4872014-08-05 18:00:13 -0700497 triggeredFromAltTab ? 1 : 0, triggeredFromHomeKey ? 1 : 0,
498 null).sendToTarget();
Winson Chung1e8d71b2014-05-16 17:05:22 -0700499 }
500 }
501
Phil Weaver315c34e2016-02-19 15:12:29 -0800502 public void toggleSplitScreen() {
503 synchronized (mLock) {
504 mHandler.removeMessages(MSG_TOGGLE_APP_SPLIT_SCREEN);
505 mHandler.obtainMessage(MSG_TOGGLE_APP_SPLIT_SCREEN, 0, 0, null).sendToTarget();
506 }
507 }
508
Michael Jurka3b1fc472011-06-13 10:54:40 -0700509 public void toggleRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500510 synchronized (mLock) {
Michael Jurka3b1fc472011-06-13 10:54:40 -0700511 mHandler.removeMessages(MSG_TOGGLE_RECENT_APPS);
Jorim Jaggi6b460382017-05-13 23:16:44 +0200512 Message msg = mHandler.obtainMessage(MSG_TOGGLE_RECENT_APPS, 0, 0, null);
513 msg.setAsynchronous(true);
514 msg.sendToTarget();
Michael Jurka3b1fc472011-06-13 10:54:40 -0700515 }
516 }
517
Michael Jurka7f2668c2012-03-27 07:49:52 -0700518 public void preloadRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500519 synchronized (mLock) {
Michael Jurka7f2668c2012-03-27 07:49:52 -0700520 mHandler.removeMessages(MSG_PRELOAD_RECENT_APPS);
521 mHandler.obtainMessage(MSG_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
522 }
523 }
524
525 public void cancelPreloadRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500526 synchronized (mLock) {
Michael Jurka7f2668c2012-03-27 07:49:52 -0700527 mHandler.removeMessages(MSG_CANCEL_PRELOAD_RECENT_APPS);
528 mHandler.obtainMessage(MSG_CANCEL_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
529 }
530 }
531
Clara Bayarrif2debb12015-07-10 14:47:17 +0100532 @Override
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +0100533 public void dismissKeyboardShortcutsMenu() {
534 synchronized (mLock) {
535 mHandler.removeMessages(MSG_DISMISS_KEYBOARD_SHORTCUTS);
536 mHandler.obtainMessage(MSG_DISMISS_KEYBOARD_SHORTCUTS).sendToTarget();
537 }
538 }
539
540 @Override
Clara Bayarri4e850ff2016-03-02 11:12:32 -0800541 public void toggleKeyboardShortcutsMenu(int deviceId) {
Jason Monk07473ce2016-01-05 14:59:19 -0500542 synchronized (mLock) {
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000543 mHandler.removeMessages(MSG_TOGGLE_KEYBOARD_SHORTCUTS);
Clara Bayarri4e850ff2016-03-02 11:12:32 -0800544 mHandler.obtainMessage(MSG_TOGGLE_KEYBOARD_SHORTCUTS, deviceId, 0).sendToTarget();
Clara Bayarrif2debb12015-07-10 14:47:17 +0100545 }
546 }
547
Jaewan Kimc552b042016-01-18 16:08:45 +0900548 @Override
Winson Chungac52f282017-03-30 14:44:52 -0700549 public void showPictureInPictureMenu() {
Jaewan Kimc552b042016-01-18 16:08:45 +0900550 synchronized (mLock) {
Winson Chungac52f282017-03-30 14:44:52 -0700551 mHandler.removeMessages(MSG_SHOW_PICTURE_IN_PICTURE_MENU);
552 mHandler.obtainMessage(MSG_SHOW_PICTURE_IN_PICTURE_MENU).sendToTarget();
Jaewan Kimc552b042016-01-18 16:08:45 +0900553 }
554 }
555
Charles Chen24e7a9f2018-11-21 11:59:07 +0800556 @Override
557 public void setWindowState(int displayId, int window, int state) {
Jason Monk07473ce2016-01-05 14:59:19 -0500558 synchronized (mLock) {
John Spurlock5b9145b2013-08-20 15:13:47 -0400559 // don't coalesce these
Charles Chenf3d295c2018-11-30 18:15:21 +0800560 mHandler.obtainMessage(MSG_SET_WINDOW_STATE, displayId, window, state).sendToTarget();
John Spurlock97642182013-07-29 17:58:39 -0400561 }
562 }
563
Andrii Kulian0f051f52016-04-14 00:41:51 -0700564 public void showScreenPinningRequest(int taskId) {
Jason Monk07473ce2016-01-05 14:59:19 -0500565 synchronized (mLock) {
Andrii Kulian0f051f52016-04-14 00:41:51 -0700566 mHandler.obtainMessage(MSG_SHOW_SCREEN_PIN_REQUEST, taskId, 0, null)
567 .sendToTarget();
Jason Monk5565cb42014-09-12 10:59:21 -0400568 }
569 }
570
Charles Chen24e7a9f2018-11-21 11:59:07 +0800571 @Override
572 public void appTransitionPending(int displayId) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800573 appTransitionPending(displayId, false /* forced */);
Jason Monkaa573e92017-01-27 17:00:29 -0500574 }
575
Charles Chenf3d295c2018-11-30 18:15:21 +0800576 /**
577 * Called to notify System UI that an application transition is pending.
578 * @see Callbacks#appTransitionPending(int, boolean)
579 */
580 public void appTransitionPending(int displayId, boolean forced) {
Jason Monk07473ce2016-01-05 14:59:19 -0500581 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800582 mHandler.obtainMessage(MSG_APP_TRANSITION_PENDING, displayId, forced ? 1 : 0)
583 .sendToTarget();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100584 }
585 }
586
Charles Chen24e7a9f2018-11-21 11:59:07 +0800587 @Override
588 public void appTransitionCancelled(int displayId) {
Jason Monk07473ce2016-01-05 14:59:19 -0500589 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800590 mHandler.obtainMessage(MSG_APP_TRANSITION_CANCELLED, displayId).sendToTarget();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100591 }
592 }
593
Charles Chen24e7a9f2018-11-21 11:59:07 +0800594 @Override
595 public void appTransitionStarting(int displayId, long startTime, long duration) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800596 appTransitionStarting(displayId, startTime, duration, false /* forced */);
Jason Monkaa573e92017-01-27 17:00:29 -0500597 }
598
Charles Chenf3d295c2018-11-30 18:15:21 +0800599 /**
600 * Called to notify System UI that an application transition is starting.
601 * @see Callbacks#appTransitionStarting(int, long, long, boolean).
602 */
603 public void appTransitionStarting(int displayId, long startTime, long duration,
604 boolean forced) {
Jason Monk07473ce2016-01-05 14:59:19 -0500605 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800606 final SomeArgs args = SomeArgs.obtain();
607 args.argi1 = displayId;
608 args.argi2 = forced ? 1 : 0;
609 args.arg1 = startTime;
610 args.arg2 = duration;
611 mHandler.obtainMessage(MSG_APP_TRANSITION_STARTING, args).sendToTarget();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100612 }
613 }
614
Jorim Jaggi2adba072016-03-03 13:43:39 +0100615 @Override
Charles Chen24e7a9f2018-11-21 11:59:07 +0800616 public void appTransitionFinished(int displayId) {
Jorim Jaggi2adba072016-03-03 13:43:39 +0100617 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800618 mHandler.obtainMessage(MSG_APP_TRANSITION_FINISHED, displayId).sendToTarget();
Jorim Jaggi2adba072016-03-03 13:43:39 +0100619 }
620 }
621
Adrian Roos4f43dc02015-06-17 16:43:38 -0700622 public void showAssistDisclosure() {
Jason Monk07473ce2016-01-05 14:59:19 -0500623 synchronized (mLock) {
Adrian Roos4f43dc02015-06-17 16:43:38 -0700624 mHandler.removeMessages(MSG_ASSIST_DISCLOSURE);
625 mHandler.obtainMessage(MSG_ASSIST_DISCLOSURE).sendToTarget();
626 }
627 }
628
Jorim Jaggi165ce062015-07-06 16:18:11 -0700629 public void startAssist(Bundle args) {
Jason Monk07473ce2016-01-05 14:59:19 -0500630 synchronized (mLock) {
Jorim Jaggi165ce062015-07-06 16:18:11 -0700631 mHandler.removeMessages(MSG_START_ASSIST);
632 mHandler.obtainMessage(MSG_START_ASSIST, args).sendToTarget();
633 }
634 }
635
Selim Cinek372d1bd2015-08-14 13:19:37 -0700636 @Override
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700637 public void onCameraLaunchGestureDetected(int source) {
Jason Monk07473ce2016-01-05 14:59:19 -0500638 synchronized (mLock) {
Selim Cinek372d1bd2015-08-14 13:19:37 -0700639 mHandler.removeMessages(MSG_CAMERA_LAUNCH_GESTURE);
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700640 mHandler.obtainMessage(MSG_CAMERA_LAUNCH_GESTURE, source, 0).sendToTarget();
Selim Cinek372d1bd2015-08-14 13:19:37 -0700641 }
642 }
643
Jason Monk7e53f202016-01-28 10:40:20 -0500644 @Override
645 public void addQsTile(ComponentName tile) {
646 synchronized (mLock) {
647 mHandler.obtainMessage(MSG_ADD_QS_TILE, tile).sendToTarget();
648 }
649 }
650
651 @Override
652 public void remQsTile(ComponentName tile) {
653 synchronized (mLock) {
654 mHandler.obtainMessage(MSG_REMOVE_QS_TILE, tile).sendToTarget();
655 }
656 }
657
658 @Override
659 public void clickQsTile(ComponentName tile) {
660 synchronized (mLock) {
661 mHandler.obtainMessage(MSG_CLICK_QS_TILE, tile).sendToTarget();
662 }
663 }
664
Jim Miller07e03842016-06-22 15:18:13 -0700665 @Override
Philip Quinnc3a503d2017-07-18 23:23:41 -0700666 public void handleSystemKey(int key) {
Jim Miller07e03842016-06-22 15:18:13 -0700667 synchronized (mLock) {
Philip Quinnc3a503d2017-07-18 23:23:41 -0700668 mHandler.obtainMessage(MSG_HANDLE_SYSTEM_KEY, key, 0).sendToTarget();
Jim Miller07e03842016-06-22 15:18:13 -0700669 }
670 }
671
Jason Monk361915c2017-03-21 20:33:59 -0400672 @Override
Matthew Ng9c3bce52018-02-01 22:00:31 +0000673 public void showPinningEnterExitToast(boolean entering) {
674 synchronized (mLock) {
675 mHandler.obtainMessage(MSG_SHOW_PINNING_TOAST_ENTER_EXIT, entering).sendToTarget();
676 }
677 }
678
679 @Override
680 public void showPinningEscapeToast() {
681 synchronized (mLock) {
682 mHandler.obtainMessage(MSG_SHOW_PINNING_TOAST_ESCAPE).sendToTarget();
683 }
684 }
685
686
687 @Override
Jason Monk361915c2017-03-21 20:33:59 -0400688 public void showGlobalActionsMenu() {
689 synchronized (mLock) {
690 mHandler.removeMessages(MSG_SHOW_GLOBAL_ACTIONS);
691 mHandler.obtainMessage(MSG_SHOW_GLOBAL_ACTIONS).sendToTarget();
692 }
693 }
694
Jason Monkb4302182017-08-04 13:39:17 -0400695 @Override
Selim Cinek3a49ba22017-08-10 11:17:39 -0700696 public void setTopAppHidesStatusBar(boolean hidesStatusBar) {
697 mHandler.removeMessages(MSG_SET_TOP_APP_HIDES_STATUS_BAR);
698 mHandler.obtainMessage(MSG_SET_TOP_APP_HIDES_STATUS_BAR, hidesStatusBar ? 1 : 0, 0)
699 .sendToTarget();
700 }
701
702 @Override
Jason Monkb4302182017-08-04 13:39:17 -0400703 public void showShutdownUi(boolean isReboot, String reason) {
704 synchronized (mLock) {
705 mHandler.removeMessages(MSG_SHOW_SHUTDOWN_UI);
706 mHandler.obtainMessage(MSG_SHOW_SHUTDOWN_UI, isReboot ? 1 : 0, 0, reason)
707 .sendToTarget();
708 }
709 }
710
Mike Digman93f08342017-11-24 21:46:53 -0800711 @Override
Beverlyac32c9a2018-01-31 16:10:41 -0500712 public void showWirelessChargingAnimation(int batteryLevel) {
Beverlyae79ab92017-12-11 09:20:02 -0500713 mHandler.removeMessages(MSG_SHOW_CHARGING_ANIMATION);
714 mHandler.obtainMessage(MSG_SHOW_CHARGING_ANIMATION, batteryLevel, 0)
715 .sendToTarget();
716 }
717
718 @Override
Mike Digmane0777312018-01-19 12:41:51 -0800719 public void onProposedRotationChanged(int rotation, boolean isValid) {
Mike Digman93f08342017-11-24 21:46:53 -0800720 synchronized (mLock) {
721 mHandler.removeMessages(MSG_ROTATION_PROPOSAL);
Mike Digmane0777312018-01-19 12:41:51 -0800722 mHandler.obtainMessage(MSG_ROTATION_PROPOSAL, rotation, isValid ? 1 : 0,
Mike Digman93f08342017-11-24 21:46:53 -0800723 null).sendToTarget();
724 }
725 }
726
Kevin Chynaae4a152018-01-18 11:48:09 -0800727 @Override
Kevin Chyn23289ef2018-11-28 16:32:36 -0800728 public void showBiometricDialog(Bundle bundle, IBiometricServiceReceiverInternal receiver,
729 int type, boolean requireConfirmation, int userId) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800730 synchronized (mLock) {
731 SomeArgs args = SomeArgs.obtain();
732 args.arg1 = bundle;
733 args.arg2 = receiver;
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700734 args.argi1 = type;
Kevin Chyn6cf54e82018-09-18 19:13:27 -0700735 args.arg3 = requireConfirmation;
Kevin Chyn1b9f8df2018-11-12 19:04:55 -0800736 args.argi2 = userId;
Kevin Chyne9275662018-07-23 16:42:06 -0700737 mHandler.obtainMessage(MSG_BIOMETRIC_SHOW, args)
Kevin Chynaae4a152018-01-18 11:48:09 -0800738 .sendToTarget();
739 }
740 }
741
742 @Override
Kevin Chyne1912712019-01-04 14:22:34 -0800743 public void onBiometricAuthenticated(boolean authenticated) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800744 synchronized (mLock) {
Kevin Chyne1912712019-01-04 14:22:34 -0800745 mHandler.obtainMessage(MSG_BIOMETRIC_AUTHENTICATED, authenticated).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800746 }
747 }
748
749 @Override
Kevin Chyne9275662018-07-23 16:42:06 -0700750 public void onBiometricHelp(String message) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800751 synchronized (mLock) {
Kevin Chyne9275662018-07-23 16:42:06 -0700752 mHandler.obtainMessage(MSG_BIOMETRIC_HELP, message).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800753 }
754 }
755
756 @Override
Kevin Chyne9275662018-07-23 16:42:06 -0700757 public void onBiometricError(String error) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800758 synchronized (mLock) {
Kevin Chyne9275662018-07-23 16:42:06 -0700759 mHandler.obtainMessage(MSG_BIOMETRIC_ERROR, error).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800760 }
761 }
762
763 @Override
Kevin Chyne9275662018-07-23 16:42:06 -0700764 public void hideBiometricDialog() {
Kevin Chynaae4a152018-01-18 11:48:09 -0800765 synchronized (mLock) {
Kevin Chyne9275662018-07-23 16:42:06 -0700766 mHandler.obtainMessage(MSG_BIOMETRIC_HIDE).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800767 }
768 }
769
Charles Chen3dedec32019-01-24 22:19:37 +0800770 @Override
771 public void onDisplayReady(int displayId) {
772 synchronized (mLock) {
773 mHandler.obtainMessage(MSG_DISPLAY_READY, displayId, 0).sendToTarget();
774 }
775 }
776
Joe Onorato0cbda992010-05-02 16:28:15 -0700777 private final class H extends Handler {
Jason Monkb5b092012017-01-05 11:35:34 -0500778 private H(Looper l) {
779 super(l);
780 }
781
Joe Onorato0cbda992010-05-02 16:28:15 -0700782 public void handleMessage(Message msg) {
Joe Onoratof3f0e052010-05-14 18:49:29 -0700783 final int what = msg.what & MSG_MASK;
Joe Onorato66d7d012010-05-14 10:05:10 -0700784 switch (what) {
Joe Onorato0cbda992010-05-02 16:28:15 -0700785 case MSG_ICON: {
Joe Onorato0cbda992010-05-02 16:28:15 -0700786 switch (msg.arg1) {
787 case OP_SET_ICON: {
Jason Monk07473ce2016-01-05 14:59:19 -0500788 Pair<String, StatusBarIcon> p = (Pair<String, StatusBarIcon>) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500789 for (int i = 0; i < mCallbacks.size(); i++) {
790 mCallbacks.get(i).setIcon(p.first, p.second);
Jason Monkb5b092012017-01-05 11:35:34 -0500791 }
Joe Onorato0cbda992010-05-02 16:28:15 -0700792 break;
793 }
794 case OP_REMOVE_ICON:
Jason Monk49fa0162017-01-11 09:21:56 -0500795 for (int i = 0; i < mCallbacks.size(); i++) {
796 mCallbacks.get(i).removeIcon((String) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500797 }
Joe Onorato0cbda992010-05-02 16:28:15 -0700798 break;
799 }
800 break;
Joe Onoratof3f0e052010-05-14 18:49:29 -0700801 }
802 case MSG_DISABLE:
Charles Chenf3d295c2018-11-30 18:15:21 +0800803 SomeArgs args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500804 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800805 mCallbacks.get(i).disable(args.argi1, args.argi2, args.argi3,
806 args.argi4 != 0 /* animate */);
Jason Monkb5b092012017-01-05 11:35:34 -0500807 }
Joe Onoratof3f0e052010-05-14 18:49:29 -0700808 break;
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700809 case MSG_EXPAND_NOTIFICATIONS:
Jason Monk49fa0162017-01-11 09:21:56 -0500810 for (int i = 0; i < mCallbacks.size(); i++) {
811 mCallbacks.get(i).animateExpandNotificationsPanel();
Jason Monkb5b092012017-01-05 11:35:34 -0500812 }
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700813 break;
Daniel Sandler11cf1782012-09-27 14:03:08 -0400814 case MSG_COLLAPSE_PANELS:
Jason Monk49fa0162017-01-11 09:21:56 -0500815 for (int i = 0; i < mCallbacks.size(); i++) {
Jason Monk297c04e2018-08-23 17:16:59 -0400816 mCallbacks.get(i).animateCollapsePanels(msg.arg1, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500817 }
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700818 break;
Anthony Chen9ad00e02017-05-12 15:53:36 -0700819 case MSG_TOGGLE_PANEL:
820 for (int i = 0; i < mCallbacks.size(); i++) {
821 mCallbacks.get(i).togglePanel();
822 }
823 break;
Daniel Sandler11cf1782012-09-27 14:03:08 -0400824 case MSG_EXPAND_SETTINGS:
Jason Monk49fa0162017-01-11 09:21:56 -0500825 for (int i = 0; i < mCallbacks.size(); i++) {
826 mCallbacks.get(i).animateExpandSettingsPanel((String) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500827 }
Joe Onorato93056472010-09-10 10:30:46 -0400828 break;
Daniel Sandler60ee2562011-07-22 12:34:33 -0400829 case MSG_SET_SYSTEMUI_VISIBILITY:
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++) {
832 mCallbacks.get(i).setSystemUiVisibility(args.argi1, args.argi2, args.argi3,
Charles Chenf3d295c2018-11-30 18:15:21 +0800833 args.argi4, args.argi5, (Rect) args.arg1, (Rect) args.arg2);
Jason Monkb5b092012017-01-05 11:35:34 -0500834 }
Jorim Jaggi86905582016-02-09 21:36:09 -0800835 args.recycle();
Joe Onorato93056472010-09-10 10:30:46 -0400836 break;
Dianne Hackborn7d049322011-06-14 15:00:32 -0700837 case MSG_TOP_APP_WINDOW_CHANGED:
Jason Monk49fa0162017-01-11 09:21:56 -0500838 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800839 mCallbacks.get(i).topAppWindowChanged(msg.arg1, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500840 }
Daniel Sandlere02d8082010-10-08 15:13:22 -0400841 break;
satok06487a52010-10-29 11:37:18 +0900842 case MSG_SHOW_IME_BUTTON:
Charles Chenf3d295c2018-11-30 18:15:21 +0800843 args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500844 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800845 mCallbacks.get(i).setImeWindowStatus(args.argi1, (IBinder) args.arg1,
846 args.argi2, args.argi3, args.argi4 != 0 /* showImeSwitcher */);
Jason Monkb5b092012017-01-05 11:35:34 -0500847 }
satok06487a52010-10-29 11:37:18 +0900848 break;
Winson Chung1e8d71b2014-05-16 17:05:22 -0700849 case MSG_SHOW_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500850 for (int i = 0; i < mCallbacks.size(); i++) {
Winson Chungdff7a732017-12-11 12:17:06 -0800851 mCallbacks.get(i).showRecentApps(msg.arg1 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500852 }
Winson Chung1e8d71b2014-05-16 17:05:22 -0700853 break;
854 case MSG_HIDE_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500855 for (int i = 0; i < mCallbacks.size(); i++) {
856 mCallbacks.get(i).hideRecentApps(msg.arg1 != 0, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500857 }
Winson Chung1e8d71b2014-05-16 17:05:22 -0700858 break;
Michael Jurka3b1fc472011-06-13 10:54:40 -0700859 case MSG_TOGGLE_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500860 for (int i = 0; i < mCallbacks.size(); i++) {
861 mCallbacks.get(i).toggleRecentApps();
Jason Monkb5b092012017-01-05 11:35:34 -0500862 }
Michael Jurka3b1fc472011-06-13 10:54:40 -0700863 break;
Michael Jurka7f2668c2012-03-27 07:49:52 -0700864 case MSG_PRELOAD_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500865 for (int i = 0; i < mCallbacks.size(); i++) {
866 mCallbacks.get(i).preloadRecentApps();
Jason Monkb5b092012017-01-05 11:35:34 -0500867 }
Michael Jurka7f2668c2012-03-27 07:49:52 -0700868 break;
869 case MSG_CANCEL_PRELOAD_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500870 for (int i = 0; i < mCallbacks.size(); i++) {
871 mCallbacks.get(i).cancelPreloadRecentApps();
Jason Monkb5b092012017-01-05 11:35:34 -0500872 }
Michael Jurka7f2668c2012-03-27 07:49:52 -0700873 break;
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +0100874 case MSG_DISMISS_KEYBOARD_SHORTCUTS:
Jason Monk49fa0162017-01-11 09:21:56 -0500875 for (int i = 0; i < mCallbacks.size(); i++) {
876 mCallbacks.get(i).dismissKeyboardShortcutsMenu();
Jason Monkb5b092012017-01-05 11:35:34 -0500877 }
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +0100878 break;
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000879 case MSG_TOGGLE_KEYBOARD_SHORTCUTS:
Jason Monk49fa0162017-01-11 09:21:56 -0500880 for (int i = 0; i < mCallbacks.size(); i++) {
881 mCallbacks.get(i).toggleKeyboardShortcutsMenu(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500882 }
Clara Bayarrif2debb12015-07-10 14:47:17 +0100883 break;
John Spurlock97642182013-07-29 17:58:39 -0400884 case MSG_SET_WINDOW_STATE:
Jason Monk49fa0162017-01-11 09:21:56 -0500885 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800886 mCallbacks.get(i).setWindowState(msg.arg1, msg.arg2, (int) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500887 }
John Spurlock97642182013-07-29 17:58:39 -0400888 break;
Jason Monk5565cb42014-09-12 10:59:21 -0400889 case MSG_SHOW_SCREEN_PIN_REQUEST:
Jason Monk49fa0162017-01-11 09:21:56 -0500890 for (int i = 0; i < mCallbacks.size(); i++) {
891 mCallbacks.get(i).showScreenPinningRequest(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500892 }
Jason Monk5565cb42014-09-12 10:59:21 -0400893 break;
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100894 case MSG_APP_TRANSITION_PENDING:
Jason Monk49fa0162017-01-11 09:21:56 -0500895 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800896 mCallbacks.get(i).appTransitionPending(msg.arg1, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500897 }
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100898 break;
899 case MSG_APP_TRANSITION_CANCELLED:
Jason Monk49fa0162017-01-11 09:21:56 -0500900 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800901 mCallbacks.get(i).appTransitionCancelled(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500902 }
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100903 break;
904 case MSG_APP_TRANSITION_STARTING:
Charles Chenf3d295c2018-11-30 18:15:21 +0800905 args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500906 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800907 mCallbacks.get(i).appTransitionStarting(args.argi1, (long) args.arg1,
908 (long) args.arg2, args.argi2 != 0 /* forced */);
Jason Monkb5b092012017-01-05 11:35:34 -0500909 }
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100910 break;
Jorim Jaggi2adba072016-03-03 13:43:39 +0100911 case MSG_APP_TRANSITION_FINISHED:
Jason Monk49fa0162017-01-11 09:21:56 -0500912 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800913 mCallbacks.get(i).appTransitionFinished(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500914 }
Jorim Jaggi2adba072016-03-03 13:43:39 +0100915 break;
Adrian Roos4f43dc02015-06-17 16:43:38 -0700916 case MSG_ASSIST_DISCLOSURE:
Jason Monk49fa0162017-01-11 09:21:56 -0500917 for (int i = 0; i < mCallbacks.size(); i++) {
918 mCallbacks.get(i).showAssistDisclosure();
Jason Monkb5b092012017-01-05 11:35:34 -0500919 }
Adrian Roos4f43dc02015-06-17 16:43:38 -0700920 break;
Jorim Jaggi165ce062015-07-06 16:18:11 -0700921 case MSG_START_ASSIST:
Jason Monk49fa0162017-01-11 09:21:56 -0500922 for (int i = 0; i < mCallbacks.size(); i++) {
923 mCallbacks.get(i).startAssist((Bundle) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500924 }
Jorim Jaggi165ce062015-07-06 16:18:11 -0700925 break;
Selim Cinek372d1bd2015-08-14 13:19:37 -0700926 case MSG_CAMERA_LAUNCH_GESTURE:
Jason Monk49fa0162017-01-11 09:21:56 -0500927 for (int i = 0; i < mCallbacks.size(); i++) {
928 mCallbacks.get(i).onCameraLaunchGestureDetected(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500929 }
Selim Cinek372d1bd2015-08-14 13:19:37 -0700930 break;
Winson Chungac52f282017-03-30 14:44:52 -0700931 case MSG_SHOW_PICTURE_IN_PICTURE_MENU:
Jason Monk49fa0162017-01-11 09:21:56 -0500932 for (int i = 0; i < mCallbacks.size(); i++) {
Winson Chungac52f282017-03-30 14:44:52 -0700933 mCallbacks.get(i).showPictureInPictureMenu();
Jason Monkb5b092012017-01-05 11:35:34 -0500934 }
Jaewan Kimc552b042016-01-18 16:08:45 +0900935 break;
Jason Monk7e53f202016-01-28 10:40:20 -0500936 case MSG_ADD_QS_TILE:
Jason Monk49fa0162017-01-11 09:21:56 -0500937 for (int i = 0; i < mCallbacks.size(); i++) {
938 mCallbacks.get(i).addQsTile((ComponentName) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500939 }
Jason Monk7e53f202016-01-28 10:40:20 -0500940 break;
941 case MSG_REMOVE_QS_TILE:
Jason Monk49fa0162017-01-11 09:21:56 -0500942 for (int i = 0; i < mCallbacks.size(); i++) {
943 mCallbacks.get(i).remQsTile((ComponentName) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500944 }
Jason Monk7e53f202016-01-28 10:40:20 -0500945 break;
946 case MSG_CLICK_QS_TILE:
Jason Monk49fa0162017-01-11 09:21:56 -0500947 for (int i = 0; i < mCallbacks.size(); i++) {
948 mCallbacks.get(i).clickTile((ComponentName) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500949 }
Jason Monk7e53f202016-01-28 10:40:20 -0500950 break;
Phil Weaver315c34e2016-02-19 15:12:29 -0800951 case MSG_TOGGLE_APP_SPLIT_SCREEN:
Jason Monk49fa0162017-01-11 09:21:56 -0500952 for (int i = 0; i < mCallbacks.size(); i++) {
953 mCallbacks.get(i).toggleSplitScreen();
Jason Monkb5b092012017-01-05 11:35:34 -0500954 }
Phil Weaver315c34e2016-02-19 15:12:29 -0800955 break;
Philip Quinnc3a503d2017-07-18 23:23:41 -0700956 case MSG_HANDLE_SYSTEM_KEY:
Jason Monk49fa0162017-01-11 09:21:56 -0500957 for (int i = 0; i < mCallbacks.size(); i++) {
Philip Quinnc3a503d2017-07-18 23:23:41 -0700958 mCallbacks.get(i).handleSystemKey(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500959 }
Jim Miller07e03842016-06-22 15:18:13 -0700960 break;
Jason Monk361915c2017-03-21 20:33:59 -0400961 case MSG_SHOW_GLOBAL_ACTIONS:
962 for (int i = 0; i < mCallbacks.size(); i++) {
963 mCallbacks.get(i).handleShowGlobalActionsMenu();
964 }
965 break;
Jason Monkb4302182017-08-04 13:39:17 -0400966 case MSG_SHOW_SHUTDOWN_UI:
967 for (int i = 0; i < mCallbacks.size(); i++) {
968 mCallbacks.get(i).handleShowShutdownUi(msg.arg1 != 0, (String) msg.obj);
969 }
970 break;
Selim Cinek3a49ba22017-08-10 11:17:39 -0700971 case MSG_SET_TOP_APP_HIDES_STATUS_BAR:
972 for (int i = 0; i < mCallbacks.size(); i++) {
973 mCallbacks.get(i).setTopAppHidesStatusBar(msg.arg1 != 0);
974 }
975 break;
Mike Digman93f08342017-11-24 21:46:53 -0800976 case MSG_ROTATION_PROPOSAL:
977 for (int i = 0; i < mCallbacks.size(); i++) {
Mike Digmane0777312018-01-19 12:41:51 -0800978 mCallbacks.get(i).onRotationProposal(msg.arg1, msg.arg2 != 0);
Mike Digman93f08342017-11-24 21:46:53 -0800979 }
980 break;
Kevin Chyne9275662018-07-23 16:42:06 -0700981 case MSG_BIOMETRIC_SHOW:
982 mHandler.removeMessages(MSG_BIOMETRIC_ERROR);
983 mHandler.removeMessages(MSG_BIOMETRIC_HELP);
984 mHandler.removeMessages(MSG_BIOMETRIC_AUTHENTICATED);
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700985 SomeArgs someArgs = (SomeArgs) msg.obj;
Kevin Chynaae4a152018-01-18 11:48:09 -0800986 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -0700987 mCallbacks.get(i).showBiometricDialog(
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700988 (Bundle) someArgs.arg1,
Kevin Chyn23289ef2018-11-28 16:32:36 -0800989 (IBiometricServiceReceiverInternal) someArgs.arg2,
Kevin Chyn1b9f8df2018-11-12 19:04:55 -0800990 someArgs.argi1 /* type */,
991 (boolean) someArgs.arg3 /* requireConfirmation */,
992 someArgs.argi2 /* userId */);
Kevin Chynaae4a152018-01-18 11:48:09 -0800993 }
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700994 someArgs.recycle();
Kevin Chynaae4a152018-01-18 11:48:09 -0800995 break;
Kevin Chyne9275662018-07-23 16:42:06 -0700996 case MSG_BIOMETRIC_AUTHENTICATED:
Kevin Chynaae4a152018-01-18 11:48:09 -0800997 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne1912712019-01-04 14:22:34 -0800998 mCallbacks.get(i).onBiometricAuthenticated((boolean) msg.obj);
Kevin Chynaae4a152018-01-18 11:48:09 -0800999 }
1000 break;
Kevin Chyne9275662018-07-23 16:42:06 -07001001 case MSG_BIOMETRIC_HELP:
Kevin Chynaae4a152018-01-18 11:48:09 -08001002 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -07001003 mCallbacks.get(i).onBiometricHelp((String) msg.obj);
Kevin Chynaae4a152018-01-18 11:48:09 -08001004 }
1005 break;
Kevin Chyne9275662018-07-23 16:42:06 -07001006 case MSG_BIOMETRIC_ERROR:
Kevin Chynaae4a152018-01-18 11:48:09 -08001007 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -07001008 mCallbacks.get(i).onBiometricError((String) msg.obj);
Kevin Chynaae4a152018-01-18 11:48:09 -08001009 }
1010 break;
Kevin Chyne9275662018-07-23 16:42:06 -07001011 case MSG_BIOMETRIC_HIDE:
Kevin Chynaae4a152018-01-18 11:48:09 -08001012 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -07001013 mCallbacks.get(i).hideBiometricDialog();
Kevin Chynaae4a152018-01-18 11:48:09 -08001014 }
Beverlyae79ab92017-12-11 09:20:02 -05001015 break;
1016 case MSG_SHOW_CHARGING_ANIMATION:
1017 for (int i = 0; i < mCallbacks.size(); i++) {
Beverlyac32c9a2018-01-31 16:10:41 -05001018 mCallbacks.get(i).showWirelessChargingAnimation(msg.arg1);
Beverlyae79ab92017-12-11 09:20:02 -05001019 }
1020 break;
Matthew Ng9c3bce52018-02-01 22:00:31 +00001021 case MSG_SHOW_PINNING_TOAST_ENTER_EXIT:
1022 for (int i = 0; i < mCallbacks.size(); i++) {
1023 mCallbacks.get(i).showPinningEnterExitToast((Boolean) msg.obj);
1024 }
1025 break;
1026 case MSG_SHOW_PINNING_TOAST_ESCAPE:
1027 for (int i = 0; i < mCallbacks.size(); i++) {
1028 mCallbacks.get(i).showPinningEscapeToast();
1029 }
1030 break;
Charles Chen3dedec32019-01-24 22:19:37 +08001031 case MSG_DISPLAY_READY:
1032 for (int i = 0; i < mCallbacks.size(); i++) {
1033 mCallbacks.get(i).onDisplayReady(msg.arg1);
1034 }
1035 break;
Joe Onorato0cbda992010-05-02 16:28:15 -07001036 }
1037 }
1038 }
Jason Monkb5b092012017-01-05 11:35:34 -05001039
1040 // Need this class since CommandQueue already extends IStatusBar.Stub, so CommandQueueStart
1041 // is needed so it can extend SystemUI.
1042 public static class CommandQueueStart extends SystemUI {
1043 @Override
1044 public void start() {
Charles Chenf3d295c2018-11-30 18:15:21 +08001045 putComponent(CommandQueue.class, new CommandQueue(mContext));
Jason Monkb5b092012017-01-05 11:35:34 -05001046 }
1047 }
Joe Onorato0cbda992010-05-02 16:28:15 -07001048}