blob: 295abcbcfd1764d80ea713d25cb6a555adb964f7 [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 /**
Riddle Hsucf33f1c2019-02-18 21:20:51 +0800280 * @see IStatusBar#onDisplayReady(int)
281 */
Charles Chen3dedec32019-01-24 22:19:37 +0800282 default void onDisplayReady(int displayId) { }
Riddle Hsucf33f1c2019-02-18 21:20:51 +0800283 /**
284 * @see DisplayManager.DisplayListener#onDisplayRemoved(int)
285 */
286 default void onDisplayRemoved(int displayId) { }
Joe Onorato0cbda992010-05-02 16:28:15 -0700287 }
288
Jason Monkb5b092012017-01-05 11:35:34 -0500289 @VisibleForTesting
Charles Chenf3d295c2018-11-30 18:15:21 +0800290 public CommandQueue(Context context) {
291 context.getSystemService(DisplayManager.class).registerDisplayListener(this, mHandler);
292 // We always have default display.
293 setDisabled(DEFAULT_DISPLAY, DISABLE_NONE, DISABLE2_NONE);
Jason Monk297c04e2018-08-23 17:16:59 -0400294 }
295
Charles Chenf3d295c2018-11-30 18:15:21 +0800296 @Override
297 public void onDisplayAdded(int displayId) { }
298
299 @Override
300 public void onDisplayRemoved(int displayId) {
301 synchronized (mLock) {
302 mDisplayDisabled.remove(displayId);
303 }
Riddle Hsucf33f1c2019-02-18 21:20:51 +0800304 // This callback is registered with {@link #mHandler} that already posts to run on main
305 // thread, so it is safe to dispatch directly.
306 for (int i = mCallbacks.size() - 1; i >= 0; i--) {
307 mCallbacks.get(i).onDisplayRemoved(displayId);
308 }
Charles Chenf3d295c2018-11-30 18:15:21 +0800309 }
310
311 @Override
312 public void onDisplayChanged(int displayId) { }
313
314 // TODO(b/118592525): add multi-display support if needed.
Jason Monk297c04e2018-08-23 17:16:59 -0400315 public boolean panelsEnabled() {
Charles Chenf3d295c2018-11-30 18:15:21 +0800316 final int disabled1 = getDisabled1(DEFAULT_DISPLAY);
317 final int disabled2 = getDisabled2(DEFAULT_DISPLAY);
318 return (disabled1 & StatusBarManager.DISABLE_EXPAND) == 0
319 && (disabled2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) == 0
Jason Monk297c04e2018-08-23 17:16:59 -0400320 && !ONLY_CORE_APPS;
Jason Monkb5b092012017-01-05 11:35:34 -0500321 }
322
Jason Monkd7c98552018-12-04 11:14:50 -0500323 public void addCallback(Callbacks callbacks) {
Jason Monk49fa0162017-01-11 09:21:56 -0500324 mCallbacks.add(callbacks);
Charles Chenf3d295c2018-11-30 18:15:21 +0800325 // TODO(b/117478341): find a better way to pass disable flags by display.
326 for (int i = 0; i < mDisplayDisabled.size(); i++) {
327 int displayId = mDisplayDisabled.keyAt(i);
328 int disabled1 = getDisabled1(displayId);
329 int disabled2 = getDisabled2(displayId);
330 callbacks.disable(displayId, disabled1, disabled2, false /* animate */);
331 }
Jason Monk49fa0162017-01-11 09:21:56 -0500332 }
333
Jason Monkd7c98552018-12-04 11:14:50 -0500334 public void removeCallback(Callbacks callbacks) {
Jason Monk49fa0162017-01-11 09:21:56 -0500335 mCallbacks.remove(callbacks);
Joe Onorato0cbda992010-05-02 16:28:15 -0700336 }
337
Jason Monk07473ce2016-01-05 14:59:19 -0500338 public void setIcon(String slot, StatusBarIcon icon) {
339 synchronized (mLock) {
340 // don't coalesce these
341 mHandler.obtainMessage(MSG_ICON, OP_SET_ICON, 0,
342 new Pair<String, StatusBarIcon>(slot, icon)).sendToTarget();
Joe Onorato0cbda992010-05-02 16:28:15 -0700343 }
344 }
345
Jason Monk07473ce2016-01-05 14:59:19 -0500346 public void removeIcon(String slot) {
347 synchronized (mLock) {
348 // don't coalesce these
349 mHandler.obtainMessage(MSG_ICON, OP_REMOVE_ICON, 0, slot).sendToTarget();
Joe Onorato0cbda992010-05-02 16:28:15 -0700350 }
351 }
352
Charles Chenf3d295c2018-11-30 18:15:21 +0800353 /**
354 * Called to notify that disable flags are updated.
355 * @see Callbacks#disable(int, int, int, boolean).
356 */
357 public void disable(int displayId, @DisableFlags int state1, @Disable2Flags int state2,
358 boolean animate) {
Jason Monk07473ce2016-01-05 14:59:19 -0500359 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800360 setDisabled(displayId, state1, state2);
Joe Onoratof3f0e052010-05-14 18:49:29 -0700361 mHandler.removeMessages(MSG_DISABLE);
Charles Chenf3d295c2018-11-30 18:15:21 +0800362 final SomeArgs args = SomeArgs.obtain();
363 args.argi1 = displayId;
364 args.argi2 = state1;
365 args.argi3 = state2;
366 args.argi4 = animate ? 1 : 0;
367 Message msg = mHandler.obtainMessage(MSG_DISABLE, args);
Jason Monk3d3e99c2017-04-20 11:26:36 -0400368 if (Looper.myLooper() == mHandler.getLooper()) {
369 // If its the right looper execute immediately so hides can be handled quickly.
370 mHandler.handleMessage(msg);
371 msg.recycle();
372 } else {
373 msg.sendToTarget();
374 }
Joe Onoratof3f0e052010-05-14 18:49:29 -0700375 }
376 }
377
Charles Chen24e7a9f2018-11-21 11:59:07 +0800378 @Override
Charles Chenf3d295c2018-11-30 18:15:21 +0800379 public void disable(int displayId, @DisableFlags int state1, @Disable2Flags int state2) {
380 disable(displayId, state1, state2, true);
Jason Monk1e5ba5d2017-02-14 15:48:57 -0500381 }
382
Charles Chenf3d295c2018-11-30 18:15:21 +0800383 /**
384 * Apply current disable flags by {@link CommandQueue#disable(int, int, int, boolean)}.
385 *
386 * @param displayId The id of the display to notify.
387 * @param animate {@code true} to show animations.
388 */
389 public void recomputeDisableFlags(int displayId, boolean animate) {
390 int disabled1 = getDisabled1(displayId);
391 int disabled2 = getDisabled2(displayId);
392 disable(displayId, disabled1, disabled2, animate);
393 }
394
395 private void setDisabled(int displayId, int disabled1, int disabled2) {
396 mDisplayDisabled.put(displayId, new Pair<>(disabled1, disabled2));
397 }
398
399 private int getDisabled1(int displayId) {
400 return getDisabled(displayId).first;
401 }
402
403 private int getDisabled2(int displayId) {
404 return getDisabled(displayId).second;
405 }
406
407 private Pair<Integer, Integer> getDisabled(int displayId) {
408 Pair<Integer, Integer> disablePair = mDisplayDisabled.get(displayId);
409 if (disablePair == null) {
410 disablePair = new Pair<>(DISABLE_NONE, DISABLE2_NONE);
411 mDisplayDisabled.put(displayId, disablePair);
412 }
413 return disablePair;
Jason Monk00659ba2017-03-03 10:28:45 -0500414 }
415
Daniel Sandler11cf1782012-09-27 14:03:08 -0400416 public void animateExpandNotificationsPanel() {
Jason Monk07473ce2016-01-05 14:59:19 -0500417 synchronized (mLock) {
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700418 mHandler.removeMessages(MSG_EXPAND_NOTIFICATIONS);
419 mHandler.sendEmptyMessage(MSG_EXPAND_NOTIFICATIONS);
Joe Onorato4762c2d2010-05-17 15:42:59 -0700420 }
421 }
422
Daniel Sandler11cf1782012-09-27 14:03:08 -0400423 public void animateCollapsePanels() {
Jason Monk07473ce2016-01-05 14:59:19 -0500424 synchronized (mLock) {
Daniel Sandler11cf1782012-09-27 14:03:08 -0400425 mHandler.removeMessages(MSG_COLLAPSE_PANELS);
Jason Monk9c7844c2017-01-18 15:21:53 -0500426 mHandler.obtainMessage(MSG_COLLAPSE_PANELS, 0, 0).sendToTarget();
427 }
428 }
429
Jason Monk297c04e2018-08-23 17:16:59 -0400430 public void animateCollapsePanels(int flags, boolean force) {
Jason Monk9c7844c2017-01-18 15:21:53 -0500431 synchronized (mLock) {
432 mHandler.removeMessages(MSG_COLLAPSE_PANELS);
Jason Monk297c04e2018-08-23 17:16:59 -0400433 mHandler.obtainMessage(MSG_COLLAPSE_PANELS, flags, force ? 1 : 0).sendToTarget();
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700434 }
Jim Miller9a720f52012-05-30 03:19:43 -0700435 }
436
Anthony Chen9ad00e02017-05-12 15:53:36 -0700437 public void togglePanel() {
438 synchronized (mLock) {
439 mHandler.removeMessages(MSG_TOGGLE_PANEL);
440 mHandler.obtainMessage(MSG_TOGGLE_PANEL, 0, 0).sendToTarget();
441 }
442 }
443
Jason Monka9927322015-12-13 16:22:37 -0500444 public void animateExpandSettingsPanel(String subPanel) {
Jason Monk07473ce2016-01-05 14:59:19 -0500445 synchronized (mLock) {
Daniel Sandler11cf1782012-09-27 14:03:08 -0400446 mHandler.removeMessages(MSG_EXPAND_SETTINGS);
Jason Monka9927322015-12-13 16:22:37 -0500447 mHandler.obtainMessage(MSG_EXPAND_SETTINGS, subPanel).sendToTarget();
Joe Onorato4762c2d2010-05-17 15:42:59 -0700448 }
449 }
450
Charles Chen24e7a9f2018-11-21 11:59:07 +0800451 @Override
452 public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
453 int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
Jason Monk07473ce2016-01-05 14:59:19 -0500454 synchronized (mLock) {
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700455 // Don't coalesce these, since it might have one time flags set such as
456 // STATUS_BAR_UNHIDE which might get lost.
Jorim Jaggi86905582016-02-09 21:36:09 -0800457 SomeArgs args = SomeArgs.obtain();
Charles Chenf3d295c2018-11-30 18:15:21 +0800458 args.argi1 = displayId;
459 args.argi2 = vis;
460 args.argi3 = fullscreenStackVis;
461 args.argi4 = dockedStackVis;
462 args.argi5 = mask;
Jorim Jaggi86905582016-02-09 21:36:09 -0800463 args.arg1 = fullscreenStackBounds;
464 args.arg2 = dockedStackBounds;
465 mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY, args).sendToTarget();
Joe Onorato93056472010-09-10 10:30:46 -0400466 }
467 }
468
Charles Chen24e7a9f2018-11-21 11:59:07 +0800469 @Override
470 public void topAppWindowChanged(int displayId, boolean menuVisible) {
Jason Monk07473ce2016-01-05 14:59:19 -0500471 synchronized (mLock) {
Dianne Hackborn7d049322011-06-14 15:00:32 -0700472 mHandler.removeMessages(MSG_TOP_APP_WINDOW_CHANGED);
Charles Chenf3d295c2018-11-30 18:15:21 +0800473 mHandler.obtainMessage(MSG_TOP_APP_WINDOW_CHANGED,
474 displayId, menuVisible ? 1 : 0, null).sendToTarget();
Daniel Sandlere02d8082010-10-08 15:13:22 -0400475 }
476 }
477
Charles Chen24e7a9f2018-11-21 11:59:07 +0800478 @Override
479 public void setImeWindowStatus(int displayId, IBinder token, int vis, int backDisposition,
Jason Monkb605fec2014-05-02 17:04:10 -0400480 boolean showImeSwitcher) {
Jason Monk07473ce2016-01-05 14:59:19 -0500481 synchronized (mLock) {
satok06487a52010-10-29 11:37:18 +0900482 mHandler.removeMessages(MSG_SHOW_IME_BUTTON);
Charles Chenf3d295c2018-11-30 18:15:21 +0800483 SomeArgs args = SomeArgs.obtain();
484 args.argi1 = displayId;
485 args.argi2 = vis;
486 args.argi3 = backDisposition;
487 args.argi4 = showImeSwitcher ? 1 : 0;
488 args.arg1 = token;
489 Message m = mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, args);
Jason Monkb605fec2014-05-02 17:04:10 -0400490 m.sendToTarget();
satok06487a52010-10-29 11:37:18 +0900491 }
492 }
493
Winson Chungdff7a732017-12-11 12:17:06 -0800494 public void showRecentApps(boolean triggeredFromAltTab) {
Jason Monk07473ce2016-01-05 14:59:19 -0500495 synchronized (mLock) {
Winson Chung1e8d71b2014-05-16 17:05:22 -0700496 mHandler.removeMessages(MSG_SHOW_RECENT_APPS);
Winson Chungdff7a732017-12-11 12:17:06 -0800497 mHandler.obtainMessage(MSG_SHOW_RECENT_APPS, triggeredFromAltTab ? 1 : 0, 0,
498 null).sendToTarget();
Winson Chung1e8d71b2014-05-16 17:05:22 -0700499 }
500 }
501
Winson Chungcdcd4872014-08-05 18:00:13 -0700502 public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
Jason Monk07473ce2016-01-05 14:59:19 -0500503 synchronized (mLock) {
Winson Chung1e8d71b2014-05-16 17:05:22 -0700504 mHandler.removeMessages(MSG_HIDE_RECENT_APPS);
Winson Chung6cb485f2014-05-19 10:30:43 -0700505 mHandler.obtainMessage(MSG_HIDE_RECENT_APPS,
Winson Chungcdcd4872014-08-05 18:00:13 -0700506 triggeredFromAltTab ? 1 : 0, triggeredFromHomeKey ? 1 : 0,
507 null).sendToTarget();
Winson Chung1e8d71b2014-05-16 17:05:22 -0700508 }
509 }
510
Phil Weaver315c34e2016-02-19 15:12:29 -0800511 public void toggleSplitScreen() {
512 synchronized (mLock) {
513 mHandler.removeMessages(MSG_TOGGLE_APP_SPLIT_SCREEN);
514 mHandler.obtainMessage(MSG_TOGGLE_APP_SPLIT_SCREEN, 0, 0, null).sendToTarget();
515 }
516 }
517
Michael Jurka3b1fc472011-06-13 10:54:40 -0700518 public void toggleRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500519 synchronized (mLock) {
Michael Jurka3b1fc472011-06-13 10:54:40 -0700520 mHandler.removeMessages(MSG_TOGGLE_RECENT_APPS);
Jorim Jaggi6b460382017-05-13 23:16:44 +0200521 Message msg = mHandler.obtainMessage(MSG_TOGGLE_RECENT_APPS, 0, 0, null);
522 msg.setAsynchronous(true);
523 msg.sendToTarget();
Michael Jurka3b1fc472011-06-13 10:54:40 -0700524 }
525 }
526
Michael Jurka7f2668c2012-03-27 07:49:52 -0700527 public void preloadRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500528 synchronized (mLock) {
Michael Jurka7f2668c2012-03-27 07:49:52 -0700529 mHandler.removeMessages(MSG_PRELOAD_RECENT_APPS);
530 mHandler.obtainMessage(MSG_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
531 }
532 }
533
534 public void cancelPreloadRecentApps() {
Jason Monk07473ce2016-01-05 14:59:19 -0500535 synchronized (mLock) {
Michael Jurka7f2668c2012-03-27 07:49:52 -0700536 mHandler.removeMessages(MSG_CANCEL_PRELOAD_RECENT_APPS);
537 mHandler.obtainMessage(MSG_CANCEL_PRELOAD_RECENT_APPS, 0, 0, null).sendToTarget();
538 }
539 }
540
Clara Bayarrif2debb12015-07-10 14:47:17 +0100541 @Override
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +0100542 public void dismissKeyboardShortcutsMenu() {
543 synchronized (mLock) {
544 mHandler.removeMessages(MSG_DISMISS_KEYBOARD_SHORTCUTS);
545 mHandler.obtainMessage(MSG_DISMISS_KEYBOARD_SHORTCUTS).sendToTarget();
546 }
547 }
548
549 @Override
Clara Bayarri4e850ff2016-03-02 11:12:32 -0800550 public void toggleKeyboardShortcutsMenu(int deviceId) {
Jason Monk07473ce2016-01-05 14:59:19 -0500551 synchronized (mLock) {
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000552 mHandler.removeMessages(MSG_TOGGLE_KEYBOARD_SHORTCUTS);
Clara Bayarri4e850ff2016-03-02 11:12:32 -0800553 mHandler.obtainMessage(MSG_TOGGLE_KEYBOARD_SHORTCUTS, deviceId, 0).sendToTarget();
Clara Bayarrif2debb12015-07-10 14:47:17 +0100554 }
555 }
556
Jaewan Kimc552b042016-01-18 16:08:45 +0900557 @Override
Winson Chungac52f282017-03-30 14:44:52 -0700558 public void showPictureInPictureMenu() {
Jaewan Kimc552b042016-01-18 16:08:45 +0900559 synchronized (mLock) {
Winson Chungac52f282017-03-30 14:44:52 -0700560 mHandler.removeMessages(MSG_SHOW_PICTURE_IN_PICTURE_MENU);
561 mHandler.obtainMessage(MSG_SHOW_PICTURE_IN_PICTURE_MENU).sendToTarget();
Jaewan Kimc552b042016-01-18 16:08:45 +0900562 }
563 }
564
Charles Chen24e7a9f2018-11-21 11:59:07 +0800565 @Override
566 public void setWindowState(int displayId, int window, int state) {
Jason Monk07473ce2016-01-05 14:59:19 -0500567 synchronized (mLock) {
John Spurlock5b9145b2013-08-20 15:13:47 -0400568 // don't coalesce these
Charles Chenf3d295c2018-11-30 18:15:21 +0800569 mHandler.obtainMessage(MSG_SET_WINDOW_STATE, displayId, window, state).sendToTarget();
John Spurlock97642182013-07-29 17:58:39 -0400570 }
571 }
572
Andrii Kulian0f051f52016-04-14 00:41:51 -0700573 public void showScreenPinningRequest(int taskId) {
Jason Monk07473ce2016-01-05 14:59:19 -0500574 synchronized (mLock) {
Andrii Kulian0f051f52016-04-14 00:41:51 -0700575 mHandler.obtainMessage(MSG_SHOW_SCREEN_PIN_REQUEST, taskId, 0, null)
576 .sendToTarget();
Jason Monk5565cb42014-09-12 10:59:21 -0400577 }
578 }
579
Charles Chen24e7a9f2018-11-21 11:59:07 +0800580 @Override
581 public void appTransitionPending(int displayId) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800582 appTransitionPending(displayId, false /* forced */);
Jason Monkaa573e92017-01-27 17:00:29 -0500583 }
584
Charles Chenf3d295c2018-11-30 18:15:21 +0800585 /**
586 * Called to notify System UI that an application transition is pending.
587 * @see Callbacks#appTransitionPending(int, boolean)
588 */
589 public void appTransitionPending(int displayId, boolean forced) {
Jason Monk07473ce2016-01-05 14:59:19 -0500590 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800591 mHandler.obtainMessage(MSG_APP_TRANSITION_PENDING, displayId, forced ? 1 : 0)
592 .sendToTarget();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100593 }
594 }
595
Charles Chen24e7a9f2018-11-21 11:59:07 +0800596 @Override
597 public void appTransitionCancelled(int displayId) {
Jason Monk07473ce2016-01-05 14:59:19 -0500598 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800599 mHandler.obtainMessage(MSG_APP_TRANSITION_CANCELLED, displayId).sendToTarget();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100600 }
601 }
602
Charles Chen24e7a9f2018-11-21 11:59:07 +0800603 @Override
604 public void appTransitionStarting(int displayId, long startTime, long duration) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800605 appTransitionStarting(displayId, startTime, duration, false /* forced */);
Jason Monkaa573e92017-01-27 17:00:29 -0500606 }
607
Charles Chenf3d295c2018-11-30 18:15:21 +0800608 /**
609 * Called to notify System UI that an application transition is starting.
610 * @see Callbacks#appTransitionStarting(int, long, long, boolean).
611 */
612 public void appTransitionStarting(int displayId, long startTime, long duration,
613 boolean forced) {
Jason Monk07473ce2016-01-05 14:59:19 -0500614 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800615 final SomeArgs args = SomeArgs.obtain();
616 args.argi1 = displayId;
617 args.argi2 = forced ? 1 : 0;
618 args.arg1 = startTime;
619 args.arg2 = duration;
620 mHandler.obtainMessage(MSG_APP_TRANSITION_STARTING, args).sendToTarget();
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100621 }
622 }
623
Jorim Jaggi2adba072016-03-03 13:43:39 +0100624 @Override
Charles Chen24e7a9f2018-11-21 11:59:07 +0800625 public void appTransitionFinished(int displayId) {
Jorim Jaggi2adba072016-03-03 13:43:39 +0100626 synchronized (mLock) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800627 mHandler.obtainMessage(MSG_APP_TRANSITION_FINISHED, displayId).sendToTarget();
Jorim Jaggi2adba072016-03-03 13:43:39 +0100628 }
629 }
630
Adrian Roos4f43dc02015-06-17 16:43:38 -0700631 public void showAssistDisclosure() {
Jason Monk07473ce2016-01-05 14:59:19 -0500632 synchronized (mLock) {
Adrian Roos4f43dc02015-06-17 16:43:38 -0700633 mHandler.removeMessages(MSG_ASSIST_DISCLOSURE);
634 mHandler.obtainMessage(MSG_ASSIST_DISCLOSURE).sendToTarget();
635 }
636 }
637
Jorim Jaggi165ce062015-07-06 16:18:11 -0700638 public void startAssist(Bundle args) {
Jason Monk07473ce2016-01-05 14:59:19 -0500639 synchronized (mLock) {
Jorim Jaggi165ce062015-07-06 16:18:11 -0700640 mHandler.removeMessages(MSG_START_ASSIST);
641 mHandler.obtainMessage(MSG_START_ASSIST, args).sendToTarget();
642 }
643 }
644
Selim Cinek372d1bd2015-08-14 13:19:37 -0700645 @Override
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700646 public void onCameraLaunchGestureDetected(int source) {
Jason Monk07473ce2016-01-05 14:59:19 -0500647 synchronized (mLock) {
Selim Cinek372d1bd2015-08-14 13:19:37 -0700648 mHandler.removeMessages(MSG_CAMERA_LAUNCH_GESTURE);
Jorim Jaggi40aa8812015-09-23 12:59:22 -0700649 mHandler.obtainMessage(MSG_CAMERA_LAUNCH_GESTURE, source, 0).sendToTarget();
Selim Cinek372d1bd2015-08-14 13:19:37 -0700650 }
651 }
652
Jason Monk7e53f202016-01-28 10:40:20 -0500653 @Override
654 public void addQsTile(ComponentName tile) {
655 synchronized (mLock) {
656 mHandler.obtainMessage(MSG_ADD_QS_TILE, tile).sendToTarget();
657 }
658 }
659
660 @Override
661 public void remQsTile(ComponentName tile) {
662 synchronized (mLock) {
663 mHandler.obtainMessage(MSG_REMOVE_QS_TILE, tile).sendToTarget();
664 }
665 }
666
667 @Override
668 public void clickQsTile(ComponentName tile) {
669 synchronized (mLock) {
670 mHandler.obtainMessage(MSG_CLICK_QS_TILE, tile).sendToTarget();
671 }
672 }
673
Jim Miller07e03842016-06-22 15:18:13 -0700674 @Override
Philip Quinnc3a503d2017-07-18 23:23:41 -0700675 public void handleSystemKey(int key) {
Jim Miller07e03842016-06-22 15:18:13 -0700676 synchronized (mLock) {
Philip Quinnc3a503d2017-07-18 23:23:41 -0700677 mHandler.obtainMessage(MSG_HANDLE_SYSTEM_KEY, key, 0).sendToTarget();
Jim Miller07e03842016-06-22 15:18:13 -0700678 }
679 }
680
Jason Monk361915c2017-03-21 20:33:59 -0400681 @Override
Matthew Ng9c3bce52018-02-01 22:00:31 +0000682 public void showPinningEnterExitToast(boolean entering) {
683 synchronized (mLock) {
684 mHandler.obtainMessage(MSG_SHOW_PINNING_TOAST_ENTER_EXIT, entering).sendToTarget();
685 }
686 }
687
688 @Override
689 public void showPinningEscapeToast() {
690 synchronized (mLock) {
691 mHandler.obtainMessage(MSG_SHOW_PINNING_TOAST_ESCAPE).sendToTarget();
692 }
693 }
694
695
696 @Override
Jason Monk361915c2017-03-21 20:33:59 -0400697 public void showGlobalActionsMenu() {
698 synchronized (mLock) {
699 mHandler.removeMessages(MSG_SHOW_GLOBAL_ACTIONS);
700 mHandler.obtainMessage(MSG_SHOW_GLOBAL_ACTIONS).sendToTarget();
701 }
702 }
703
Jason Monkb4302182017-08-04 13:39:17 -0400704 @Override
Selim Cinek3a49ba22017-08-10 11:17:39 -0700705 public void setTopAppHidesStatusBar(boolean hidesStatusBar) {
706 mHandler.removeMessages(MSG_SET_TOP_APP_HIDES_STATUS_BAR);
707 mHandler.obtainMessage(MSG_SET_TOP_APP_HIDES_STATUS_BAR, hidesStatusBar ? 1 : 0, 0)
708 .sendToTarget();
709 }
710
711 @Override
Jason Monkb4302182017-08-04 13:39:17 -0400712 public void showShutdownUi(boolean isReboot, String reason) {
713 synchronized (mLock) {
714 mHandler.removeMessages(MSG_SHOW_SHUTDOWN_UI);
715 mHandler.obtainMessage(MSG_SHOW_SHUTDOWN_UI, isReboot ? 1 : 0, 0, reason)
716 .sendToTarget();
717 }
718 }
719
Mike Digman93f08342017-11-24 21:46:53 -0800720 @Override
Beverlyac32c9a2018-01-31 16:10:41 -0500721 public void showWirelessChargingAnimation(int batteryLevel) {
Beverlyae79ab92017-12-11 09:20:02 -0500722 mHandler.removeMessages(MSG_SHOW_CHARGING_ANIMATION);
723 mHandler.obtainMessage(MSG_SHOW_CHARGING_ANIMATION, batteryLevel, 0)
724 .sendToTarget();
725 }
726
727 @Override
Mike Digmane0777312018-01-19 12:41:51 -0800728 public void onProposedRotationChanged(int rotation, boolean isValid) {
Mike Digman93f08342017-11-24 21:46:53 -0800729 synchronized (mLock) {
730 mHandler.removeMessages(MSG_ROTATION_PROPOSAL);
Mike Digmane0777312018-01-19 12:41:51 -0800731 mHandler.obtainMessage(MSG_ROTATION_PROPOSAL, rotation, isValid ? 1 : 0,
Mike Digman93f08342017-11-24 21:46:53 -0800732 null).sendToTarget();
733 }
734 }
735
Kevin Chynaae4a152018-01-18 11:48:09 -0800736 @Override
Kevin Chyn23289ef2018-11-28 16:32:36 -0800737 public void showBiometricDialog(Bundle bundle, IBiometricServiceReceiverInternal receiver,
738 int type, boolean requireConfirmation, int userId) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800739 synchronized (mLock) {
740 SomeArgs args = SomeArgs.obtain();
741 args.arg1 = bundle;
742 args.arg2 = receiver;
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700743 args.argi1 = type;
Kevin Chyn6cf54e82018-09-18 19:13:27 -0700744 args.arg3 = requireConfirmation;
Kevin Chyn1b9f8df2018-11-12 19:04:55 -0800745 args.argi2 = userId;
Kevin Chyne9275662018-07-23 16:42:06 -0700746 mHandler.obtainMessage(MSG_BIOMETRIC_SHOW, args)
Kevin Chynaae4a152018-01-18 11:48:09 -0800747 .sendToTarget();
748 }
749 }
750
751 @Override
Kevin Chyne1912712019-01-04 14:22:34 -0800752 public void onBiometricAuthenticated(boolean authenticated) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800753 synchronized (mLock) {
Kevin Chyne1912712019-01-04 14:22:34 -0800754 mHandler.obtainMessage(MSG_BIOMETRIC_AUTHENTICATED, authenticated).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800755 }
756 }
757
758 @Override
Kevin Chyne9275662018-07-23 16:42:06 -0700759 public void onBiometricHelp(String message) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800760 synchronized (mLock) {
Kevin Chyne9275662018-07-23 16:42:06 -0700761 mHandler.obtainMessage(MSG_BIOMETRIC_HELP, message).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800762 }
763 }
764
765 @Override
Kevin Chyne9275662018-07-23 16:42:06 -0700766 public void onBiometricError(String error) {
Kevin Chynaae4a152018-01-18 11:48:09 -0800767 synchronized (mLock) {
Kevin Chyne9275662018-07-23 16:42:06 -0700768 mHandler.obtainMessage(MSG_BIOMETRIC_ERROR, error).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800769 }
770 }
771
772 @Override
Kevin Chyne9275662018-07-23 16:42:06 -0700773 public void hideBiometricDialog() {
Kevin Chynaae4a152018-01-18 11:48:09 -0800774 synchronized (mLock) {
Kevin Chyne9275662018-07-23 16:42:06 -0700775 mHandler.obtainMessage(MSG_BIOMETRIC_HIDE).sendToTarget();
Kevin Chynaae4a152018-01-18 11:48:09 -0800776 }
777 }
778
Charles Chen3dedec32019-01-24 22:19:37 +0800779 @Override
780 public void onDisplayReady(int displayId) {
781 synchronized (mLock) {
782 mHandler.obtainMessage(MSG_DISPLAY_READY, displayId, 0).sendToTarget();
783 }
784 }
785
Joe Onorato0cbda992010-05-02 16:28:15 -0700786 private final class H extends Handler {
Jason Monkb5b092012017-01-05 11:35:34 -0500787 private H(Looper l) {
788 super(l);
789 }
790
Joe Onorato0cbda992010-05-02 16:28:15 -0700791 public void handleMessage(Message msg) {
Joe Onoratof3f0e052010-05-14 18:49:29 -0700792 final int what = msg.what & MSG_MASK;
Joe Onorato66d7d012010-05-14 10:05:10 -0700793 switch (what) {
Joe Onorato0cbda992010-05-02 16:28:15 -0700794 case MSG_ICON: {
Joe Onorato0cbda992010-05-02 16:28:15 -0700795 switch (msg.arg1) {
796 case OP_SET_ICON: {
Jason Monk07473ce2016-01-05 14:59:19 -0500797 Pair<String, StatusBarIcon> p = (Pair<String, StatusBarIcon>) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500798 for (int i = 0; i < mCallbacks.size(); i++) {
799 mCallbacks.get(i).setIcon(p.first, p.second);
Jason Monkb5b092012017-01-05 11:35:34 -0500800 }
Joe Onorato0cbda992010-05-02 16:28:15 -0700801 break;
802 }
803 case OP_REMOVE_ICON:
Jason Monk49fa0162017-01-11 09:21:56 -0500804 for (int i = 0; i < mCallbacks.size(); i++) {
805 mCallbacks.get(i).removeIcon((String) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500806 }
Joe Onorato0cbda992010-05-02 16:28:15 -0700807 break;
808 }
809 break;
Joe Onoratof3f0e052010-05-14 18:49:29 -0700810 }
811 case MSG_DISABLE:
Charles Chenf3d295c2018-11-30 18:15:21 +0800812 SomeArgs args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500813 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800814 mCallbacks.get(i).disable(args.argi1, args.argi2, args.argi3,
815 args.argi4 != 0 /* animate */);
Jason Monkb5b092012017-01-05 11:35:34 -0500816 }
Joe Onoratof3f0e052010-05-14 18:49:29 -0700817 break;
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700818 case MSG_EXPAND_NOTIFICATIONS:
Jason Monk49fa0162017-01-11 09:21:56 -0500819 for (int i = 0; i < mCallbacks.size(); i++) {
820 mCallbacks.get(i).animateExpandNotificationsPanel();
Jason Monkb5b092012017-01-05 11:35:34 -0500821 }
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700822 break;
Daniel Sandler11cf1782012-09-27 14:03:08 -0400823 case MSG_COLLAPSE_PANELS:
Jason Monk49fa0162017-01-11 09:21:56 -0500824 for (int i = 0; i < mCallbacks.size(); i++) {
Jason Monk297c04e2018-08-23 17:16:59 -0400825 mCallbacks.get(i).animateCollapsePanels(msg.arg1, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500826 }
Svetoslav Ganove20a1772012-09-25 16:07:46 -0700827 break;
Anthony Chen9ad00e02017-05-12 15:53:36 -0700828 case MSG_TOGGLE_PANEL:
829 for (int i = 0; i < mCallbacks.size(); i++) {
830 mCallbacks.get(i).togglePanel();
831 }
832 break;
Daniel Sandler11cf1782012-09-27 14:03:08 -0400833 case MSG_EXPAND_SETTINGS:
Jason Monk49fa0162017-01-11 09:21:56 -0500834 for (int i = 0; i < mCallbacks.size(); i++) {
835 mCallbacks.get(i).animateExpandSettingsPanel((String) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500836 }
Joe Onorato93056472010-09-10 10:30:46 -0400837 break;
Daniel Sandler60ee2562011-07-22 12:34:33 -0400838 case MSG_SET_SYSTEMUI_VISIBILITY:
Charles Chenf3d295c2018-11-30 18:15:21 +0800839 args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500840 for (int i = 0; i < mCallbacks.size(); i++) {
841 mCallbacks.get(i).setSystemUiVisibility(args.argi1, args.argi2, args.argi3,
Charles Chenf3d295c2018-11-30 18:15:21 +0800842 args.argi4, args.argi5, (Rect) args.arg1, (Rect) args.arg2);
Jason Monkb5b092012017-01-05 11:35:34 -0500843 }
Jorim Jaggi86905582016-02-09 21:36:09 -0800844 args.recycle();
Joe Onorato93056472010-09-10 10:30:46 -0400845 break;
Dianne Hackborn7d049322011-06-14 15:00:32 -0700846 case MSG_TOP_APP_WINDOW_CHANGED:
Jason Monk49fa0162017-01-11 09:21:56 -0500847 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800848 mCallbacks.get(i).topAppWindowChanged(msg.arg1, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500849 }
Daniel Sandlere02d8082010-10-08 15:13:22 -0400850 break;
satok06487a52010-10-29 11:37:18 +0900851 case MSG_SHOW_IME_BUTTON:
Charles Chenf3d295c2018-11-30 18:15:21 +0800852 args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500853 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800854 mCallbacks.get(i).setImeWindowStatus(args.argi1, (IBinder) args.arg1,
855 args.argi2, args.argi3, args.argi4 != 0 /* showImeSwitcher */);
Jason Monkb5b092012017-01-05 11:35:34 -0500856 }
satok06487a52010-10-29 11:37:18 +0900857 break;
Winson Chung1e8d71b2014-05-16 17:05:22 -0700858 case MSG_SHOW_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500859 for (int i = 0; i < mCallbacks.size(); i++) {
Winson Chungdff7a732017-12-11 12:17:06 -0800860 mCallbacks.get(i).showRecentApps(msg.arg1 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500861 }
Winson Chung1e8d71b2014-05-16 17:05:22 -0700862 break;
863 case MSG_HIDE_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500864 for (int i = 0; i < mCallbacks.size(); i++) {
865 mCallbacks.get(i).hideRecentApps(msg.arg1 != 0, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500866 }
Winson Chung1e8d71b2014-05-16 17:05:22 -0700867 break;
Michael Jurka3b1fc472011-06-13 10:54:40 -0700868 case MSG_TOGGLE_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500869 for (int i = 0; i < mCallbacks.size(); i++) {
870 mCallbacks.get(i).toggleRecentApps();
Jason Monkb5b092012017-01-05 11:35:34 -0500871 }
Michael Jurka3b1fc472011-06-13 10:54:40 -0700872 break;
Michael Jurka7f2668c2012-03-27 07:49:52 -0700873 case MSG_PRELOAD_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500874 for (int i = 0; i < mCallbacks.size(); i++) {
875 mCallbacks.get(i).preloadRecentApps();
Jason Monkb5b092012017-01-05 11:35:34 -0500876 }
Michael Jurka7f2668c2012-03-27 07:49:52 -0700877 break;
878 case MSG_CANCEL_PRELOAD_RECENT_APPS:
Jason Monk49fa0162017-01-11 09:21:56 -0500879 for (int i = 0; i < mCallbacks.size(); i++) {
880 mCallbacks.get(i).cancelPreloadRecentApps();
Jason Monkb5b092012017-01-05 11:35:34 -0500881 }
Michael Jurka7f2668c2012-03-27 07:49:52 -0700882 break;
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +0100883 case MSG_DISMISS_KEYBOARD_SHORTCUTS:
Jason Monk49fa0162017-01-11 09:21:56 -0500884 for (int i = 0; i < mCallbacks.size(); i++) {
885 mCallbacks.get(i).dismissKeyboardShortcutsMenu();
Jason Monkb5b092012017-01-05 11:35:34 -0500886 }
Andrei Stingaceanu0bf096f2016-04-14 18:11:57 +0100887 break;
Andrei Stingaceanuc22ab792016-01-07 12:39:38 +0000888 case MSG_TOGGLE_KEYBOARD_SHORTCUTS:
Jason Monk49fa0162017-01-11 09:21:56 -0500889 for (int i = 0; i < mCallbacks.size(); i++) {
890 mCallbacks.get(i).toggleKeyboardShortcutsMenu(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500891 }
Clara Bayarrif2debb12015-07-10 14:47:17 +0100892 break;
John Spurlock97642182013-07-29 17:58:39 -0400893 case MSG_SET_WINDOW_STATE:
Jason Monk49fa0162017-01-11 09:21:56 -0500894 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800895 mCallbacks.get(i).setWindowState(msg.arg1, msg.arg2, (int) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500896 }
John Spurlock97642182013-07-29 17:58:39 -0400897 break;
Jason Monk5565cb42014-09-12 10:59:21 -0400898 case MSG_SHOW_SCREEN_PIN_REQUEST:
Jason Monk49fa0162017-01-11 09:21:56 -0500899 for (int i = 0; i < mCallbacks.size(); i++) {
900 mCallbacks.get(i).showScreenPinningRequest(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500901 }
Jason Monk5565cb42014-09-12 10:59:21 -0400902 break;
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100903 case MSG_APP_TRANSITION_PENDING:
Jason Monk49fa0162017-01-11 09:21:56 -0500904 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800905 mCallbacks.get(i).appTransitionPending(msg.arg1, msg.arg2 != 0);
Jason Monkb5b092012017-01-05 11:35:34 -0500906 }
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100907 break;
908 case MSG_APP_TRANSITION_CANCELLED:
Jason Monk49fa0162017-01-11 09:21:56 -0500909 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800910 mCallbacks.get(i).appTransitionCancelled(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500911 }
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100912 break;
913 case MSG_APP_TRANSITION_STARTING:
Charles Chenf3d295c2018-11-30 18:15:21 +0800914 args = (SomeArgs) msg.obj;
Jason Monk49fa0162017-01-11 09:21:56 -0500915 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800916 mCallbacks.get(i).appTransitionStarting(args.argi1, (long) args.arg1,
917 (long) args.arg2, args.argi2 != 0 /* forced */);
Jason Monkb5b092012017-01-05 11:35:34 -0500918 }
Jorim Jaggi24bec7c2015-02-04 12:40:14 +0100919 break;
Jorim Jaggi2adba072016-03-03 13:43:39 +0100920 case MSG_APP_TRANSITION_FINISHED:
Jason Monk49fa0162017-01-11 09:21:56 -0500921 for (int i = 0; i < mCallbacks.size(); i++) {
Charles Chenf3d295c2018-11-30 18:15:21 +0800922 mCallbacks.get(i).appTransitionFinished(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500923 }
Jorim Jaggi2adba072016-03-03 13:43:39 +0100924 break;
Adrian Roos4f43dc02015-06-17 16:43:38 -0700925 case MSG_ASSIST_DISCLOSURE:
Jason Monk49fa0162017-01-11 09:21:56 -0500926 for (int i = 0; i < mCallbacks.size(); i++) {
927 mCallbacks.get(i).showAssistDisclosure();
Jason Monkb5b092012017-01-05 11:35:34 -0500928 }
Adrian Roos4f43dc02015-06-17 16:43:38 -0700929 break;
Jorim Jaggi165ce062015-07-06 16:18:11 -0700930 case MSG_START_ASSIST:
Jason Monk49fa0162017-01-11 09:21:56 -0500931 for (int i = 0; i < mCallbacks.size(); i++) {
932 mCallbacks.get(i).startAssist((Bundle) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500933 }
Jorim Jaggi165ce062015-07-06 16:18:11 -0700934 break;
Selim Cinek372d1bd2015-08-14 13:19:37 -0700935 case MSG_CAMERA_LAUNCH_GESTURE:
Jason Monk49fa0162017-01-11 09:21:56 -0500936 for (int i = 0; i < mCallbacks.size(); i++) {
937 mCallbacks.get(i).onCameraLaunchGestureDetected(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500938 }
Selim Cinek372d1bd2015-08-14 13:19:37 -0700939 break;
Winson Chungac52f282017-03-30 14:44:52 -0700940 case MSG_SHOW_PICTURE_IN_PICTURE_MENU:
Jason Monk49fa0162017-01-11 09:21:56 -0500941 for (int i = 0; i < mCallbacks.size(); i++) {
Winson Chungac52f282017-03-30 14:44:52 -0700942 mCallbacks.get(i).showPictureInPictureMenu();
Jason Monkb5b092012017-01-05 11:35:34 -0500943 }
Jaewan Kimc552b042016-01-18 16:08:45 +0900944 break;
Jason Monk7e53f202016-01-28 10:40:20 -0500945 case MSG_ADD_QS_TILE:
Jason Monk49fa0162017-01-11 09:21:56 -0500946 for (int i = 0; i < mCallbacks.size(); i++) {
947 mCallbacks.get(i).addQsTile((ComponentName) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500948 }
Jason Monk7e53f202016-01-28 10:40:20 -0500949 break;
950 case MSG_REMOVE_QS_TILE:
Jason Monk49fa0162017-01-11 09:21:56 -0500951 for (int i = 0; i < mCallbacks.size(); i++) {
952 mCallbacks.get(i).remQsTile((ComponentName) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500953 }
Jason Monk7e53f202016-01-28 10:40:20 -0500954 break;
955 case MSG_CLICK_QS_TILE:
Jason Monk49fa0162017-01-11 09:21:56 -0500956 for (int i = 0; i < mCallbacks.size(); i++) {
957 mCallbacks.get(i).clickTile((ComponentName) msg.obj);
Jason Monkb5b092012017-01-05 11:35:34 -0500958 }
Jason Monk7e53f202016-01-28 10:40:20 -0500959 break;
Phil Weaver315c34e2016-02-19 15:12:29 -0800960 case MSG_TOGGLE_APP_SPLIT_SCREEN:
Jason Monk49fa0162017-01-11 09:21:56 -0500961 for (int i = 0; i < mCallbacks.size(); i++) {
962 mCallbacks.get(i).toggleSplitScreen();
Jason Monkb5b092012017-01-05 11:35:34 -0500963 }
Phil Weaver315c34e2016-02-19 15:12:29 -0800964 break;
Philip Quinnc3a503d2017-07-18 23:23:41 -0700965 case MSG_HANDLE_SYSTEM_KEY:
Jason Monk49fa0162017-01-11 09:21:56 -0500966 for (int i = 0; i < mCallbacks.size(); i++) {
Philip Quinnc3a503d2017-07-18 23:23:41 -0700967 mCallbacks.get(i).handleSystemKey(msg.arg1);
Jason Monkb5b092012017-01-05 11:35:34 -0500968 }
Jim Miller07e03842016-06-22 15:18:13 -0700969 break;
Jason Monk361915c2017-03-21 20:33:59 -0400970 case MSG_SHOW_GLOBAL_ACTIONS:
971 for (int i = 0; i < mCallbacks.size(); i++) {
972 mCallbacks.get(i).handleShowGlobalActionsMenu();
973 }
974 break;
Jason Monkb4302182017-08-04 13:39:17 -0400975 case MSG_SHOW_SHUTDOWN_UI:
976 for (int i = 0; i < mCallbacks.size(); i++) {
977 mCallbacks.get(i).handleShowShutdownUi(msg.arg1 != 0, (String) msg.obj);
978 }
979 break;
Selim Cinek3a49ba22017-08-10 11:17:39 -0700980 case MSG_SET_TOP_APP_HIDES_STATUS_BAR:
981 for (int i = 0; i < mCallbacks.size(); i++) {
982 mCallbacks.get(i).setTopAppHidesStatusBar(msg.arg1 != 0);
983 }
984 break;
Mike Digman93f08342017-11-24 21:46:53 -0800985 case MSG_ROTATION_PROPOSAL:
986 for (int i = 0; i < mCallbacks.size(); i++) {
Mike Digmane0777312018-01-19 12:41:51 -0800987 mCallbacks.get(i).onRotationProposal(msg.arg1, msg.arg2 != 0);
Mike Digman93f08342017-11-24 21:46:53 -0800988 }
989 break;
Kevin Chyne9275662018-07-23 16:42:06 -0700990 case MSG_BIOMETRIC_SHOW:
991 mHandler.removeMessages(MSG_BIOMETRIC_ERROR);
992 mHandler.removeMessages(MSG_BIOMETRIC_HELP);
993 mHandler.removeMessages(MSG_BIOMETRIC_AUTHENTICATED);
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700994 SomeArgs someArgs = (SomeArgs) msg.obj;
Kevin Chynaae4a152018-01-18 11:48:09 -0800995 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -0700996 mCallbacks.get(i).showBiometricDialog(
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -0700997 (Bundle) someArgs.arg1,
Kevin Chyn23289ef2018-11-28 16:32:36 -0800998 (IBiometricServiceReceiverInternal) someArgs.arg2,
Kevin Chyn1b9f8df2018-11-12 19:04:55 -0800999 someArgs.argi1 /* type */,
1000 (boolean) someArgs.arg3 /* requireConfirmation */,
1001 someArgs.argi2 /* userId */);
Kevin Chynaae4a152018-01-18 11:48:09 -08001002 }
Kevin Chyn5a2ff5d2018-08-29 19:07:30 -07001003 someArgs.recycle();
Kevin Chynaae4a152018-01-18 11:48:09 -08001004 break;
Kevin Chyne9275662018-07-23 16:42:06 -07001005 case MSG_BIOMETRIC_AUTHENTICATED:
Kevin Chynaae4a152018-01-18 11:48:09 -08001006 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne1912712019-01-04 14:22:34 -08001007 mCallbacks.get(i).onBiometricAuthenticated((boolean) msg.obj);
Kevin Chynaae4a152018-01-18 11:48:09 -08001008 }
1009 break;
Kevin Chyne9275662018-07-23 16:42:06 -07001010 case MSG_BIOMETRIC_HELP:
Kevin Chynaae4a152018-01-18 11:48:09 -08001011 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -07001012 mCallbacks.get(i).onBiometricHelp((String) msg.obj);
Kevin Chynaae4a152018-01-18 11:48:09 -08001013 }
1014 break;
Kevin Chyne9275662018-07-23 16:42:06 -07001015 case MSG_BIOMETRIC_ERROR:
Kevin Chynaae4a152018-01-18 11:48:09 -08001016 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -07001017 mCallbacks.get(i).onBiometricError((String) msg.obj);
Kevin Chynaae4a152018-01-18 11:48:09 -08001018 }
1019 break;
Kevin Chyne9275662018-07-23 16:42:06 -07001020 case MSG_BIOMETRIC_HIDE:
Kevin Chynaae4a152018-01-18 11:48:09 -08001021 for (int i = 0; i < mCallbacks.size(); i++) {
Kevin Chyne9275662018-07-23 16:42:06 -07001022 mCallbacks.get(i).hideBiometricDialog();
Kevin Chynaae4a152018-01-18 11:48:09 -08001023 }
Beverlyae79ab92017-12-11 09:20:02 -05001024 break;
1025 case MSG_SHOW_CHARGING_ANIMATION:
1026 for (int i = 0; i < mCallbacks.size(); i++) {
Beverlyac32c9a2018-01-31 16:10:41 -05001027 mCallbacks.get(i).showWirelessChargingAnimation(msg.arg1);
Beverlyae79ab92017-12-11 09:20:02 -05001028 }
1029 break;
Matthew Ng9c3bce52018-02-01 22:00:31 +00001030 case MSG_SHOW_PINNING_TOAST_ENTER_EXIT:
1031 for (int i = 0; i < mCallbacks.size(); i++) {
1032 mCallbacks.get(i).showPinningEnterExitToast((Boolean) msg.obj);
1033 }
1034 break;
1035 case MSG_SHOW_PINNING_TOAST_ESCAPE:
1036 for (int i = 0; i < mCallbacks.size(); i++) {
1037 mCallbacks.get(i).showPinningEscapeToast();
1038 }
1039 break;
Charles Chen3dedec32019-01-24 22:19:37 +08001040 case MSG_DISPLAY_READY:
1041 for (int i = 0; i < mCallbacks.size(); i++) {
1042 mCallbacks.get(i).onDisplayReady(msg.arg1);
1043 }
1044 break;
Joe Onorato0cbda992010-05-02 16:28:15 -07001045 }
1046 }
1047 }
Jason Monkb5b092012017-01-05 11:35:34 -05001048
1049 // Need this class since CommandQueue already extends IStatusBar.Stub, so CommandQueueStart
1050 // is needed so it can extend SystemUI.
1051 public static class CommandQueueStart extends SystemUI {
1052 @Override
1053 public void start() {
Charles Chenf3d295c2018-11-30 18:15:21 +08001054 putComponent(CommandQueue.class, new CommandQueue(mContext));
Jason Monkb5b092012017-01-05 11:35:34 -05001055 }
1056 }
Joe Onorato0cbda992010-05-02 16:28:15 -07001057}