blob: e85b147f7a3452120b5359cd4699a8a57041a698 [file] [log] [blame]
Jorim Jaggi5cf17872014-03-26 18:31:48 +01001/*
2 * Copyright (C) 2014 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
17package com.android.systemui.statusbar.phone;
18
Adrian Roos7b54b072018-03-08 12:52:22 +010019import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
20
Lucas Dupin8968f6a2019-08-09 17:41:15 -070021import static com.android.systemui.DejankUtils.whitelistIpcs;
Eliot Courtneye77edea2017-11-15 14:25:21 +090022import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENABLE_REMOTE_INPUT;
23
Sudheer Shankadc589ac2016-11-10 15:30:17 -080024import android.app.ActivityManager;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020025import android.app.IActivityManager;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010026import android.content.Context;
27import android.content.pm.ActivityInfo;
28import android.content.res.Resources;
29import android.graphics.PixelFormat;
Wale Ogunwale6ce0fb82016-12-13 14:24:00 -080030import android.os.Binder;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020031import android.os.RemoteException;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010032import android.os.SystemProperties;
Lucas Dupine25c4872019-07-29 13:51:35 -070033import android.os.Trace;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020034import android.util.Log;
Lucas Dupine25c4872019-07-29 13:51:35 -070035import android.view.Display;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010036import android.view.Gravity;
37import android.view.View;
38import android.view.ViewGroup;
39import android.view.WindowManager;
Jorim Jaggif12ec0f2017-08-23 16:14:10 +020040import android.view.WindowManager.LayoutParams;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010041
Lucas Dupina3e36272018-08-21 13:22:33 -070042import com.android.internal.annotations.VisibleForTesting;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010043import com.android.keyguard.R;
Jason Monk1fd3fc32018-08-14 17:20:09 -040044import com.android.systemui.Dependency;
Jason Monk421a9412017-02-06 09:15:21 -080045import com.android.systemui.Dumpable;
Jason Monke59dc402018-08-16 12:05:01 -040046import com.android.systemui.colorextraction.SysuiColorExtractor;
Jorim Jaggi6b88cdf2014-12-22 20:56:50 +010047import com.android.systemui.keyguard.KeyguardViewMediator;
Beverly8fdb5332019-02-04 14:29:49 -050048import com.android.systemui.plugins.statusbar.StatusBarStateController;
49import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
Jason Monke59dc402018-08-16 12:05:01 -040050import com.android.systemui.statusbar.RemoteInputController.Callback;
Jorim Jaggiecbab362014-04-23 16:13:15 +020051import com.android.systemui.statusbar.StatusBarState;
Beverly8fdb5332019-02-04 14:29:49 -050052import com.android.systemui.statusbar.SysuiStatusBarStateController;
Jason Monke59dc402018-08-16 12:05:01 -040053import com.android.systemui.statusbar.policy.ConfigurationController;
54import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010055
Winson Chungdc0eca62019-06-13 22:37:31 -070056import com.google.android.collect.Lists;
Beverly8adbd1e2019-07-25 14:27:17 -040057
Selim Cinek7025f262015-07-13 16:22:48 -070058import java.io.FileDescriptor;
59import java.io.PrintWriter;
Winson Chungdc0eca62019-06-13 22:37:31 -070060import java.lang.ref.WeakReference;
Selim Cinek6a1bd2b2015-06-02 16:02:41 +020061import java.lang.reflect.Field;
Winson Chungdc0eca62019-06-13 22:37:31 -070062import java.util.ArrayList;
Lucas Dupine25c4872019-07-29 13:51:35 -070063import java.util.Arrays;
Beverly8adbd1e2019-07-25 14:27:17 -040064
Jason Monk196d6392018-12-20 13:25:34 -050065import javax.inject.Inject;
66import javax.inject.Singleton;
67
Jorim Jaggi5cf17872014-03-26 18:31:48 +010068/**
69 * Encapsulates all logic for the status bar window state management.
70 */
Jason Monk196d6392018-12-20 13:25:34 -050071@Singleton
Jason Monke59dc402018-08-16 12:05:01 -040072public class StatusBarWindowController implements Callback, Dumpable, ConfigurationListener {
Jorim Jaggi5cf17872014-03-26 18:31:48 +010073
Lucas Dupin1a8588d2018-08-21 12:18:47 -070074 private static final String TAG = "StatusBarWindowController";
Jorim Jaggif6782ee2016-07-22 11:40:00 +020075
Jorim Jaggi5cf17872014-03-26 18:31:48 +010076 private final Context mContext;
77 private final WindowManager mWindowManager;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020078 private final IActivityManager mActivityManager;
Lucas Dupin7517b5d2017-08-22 12:51:25 -070079 private final DozeParameters mDozeParameters;
Steve Elliottff2c0d92019-07-30 15:09:54 -040080 private final LayoutParams mLpChanged;
Lucas Dupin42ebe542019-01-22 09:45:09 -080081 private final boolean mKeyguardScreenRotation;
Lucas Dupine90fead2019-06-12 16:22:41 -070082 private final long mLockScreenDisplayTimeout;
Lucas Dupine25c4872019-07-29 13:51:35 -070083 private final Display.Mode mKeyguardDisplayMode;
84 private final KeyguardBypassController mKeyguardBypassController;
Mady Mellord1c78b262018-11-06 18:04:40 -080085 private ViewGroup mStatusBarView;
Steve Elliottff2c0d92019-07-30 15:09:54 -040086 private LayoutParams mLp;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020087 private boolean mHasTopUi;
88 private boolean mHasTopUiChanged;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010089 private int mBarHeight;
Adrian Roos3e23eb52017-07-07 15:58:57 +020090 private float mScreenBrightnessDoze;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010091 private final State mCurrentState = new State();
Jason Monk421a9412017-02-06 09:15:21 -080092 private OtherwisedCollapsedListener mListener;
Beverly4ec838b2019-05-29 11:34:45 -040093 private ForcePluginOpenListener mForcePluginOpenListener;
Winson Chungdc0eca62019-06-13 22:37:31 -070094 private final ArrayList<WeakReference<StatusBarWindowCallback>>
95 mCallbacks = Lists.newArrayList();
Jorim Jaggi5cf17872014-03-26 18:31:48 +010096
Jason Monke59dc402018-08-16 12:05:01 -040097 private final SysuiColorExtractor mColorExtractor = Dependency.get(SysuiColorExtractor.class);
Jason Monk1fd3fc32018-08-14 17:20:09 -040098
Jason Monk196d6392018-12-20 13:25:34 -050099 @Inject
Lucas Dupine25c4872019-07-29 13:51:35 -0700100 public StatusBarWindowController(Context context,
101 StatusBarStateController statusBarStateController,
102 ConfigurationController configurationController,
103 KeyguardBypassController keyguardBypassController) {
Lucas Dupina3e36272018-08-21 13:22:33 -0700104 this(context, context.getSystemService(WindowManager.class), ActivityManager.getService(),
Lucas Dupine25c4872019-07-29 13:51:35 -0700105 DozeParameters.getInstance(context), statusBarStateController,
106 configurationController, keyguardBypassController);
Lucas Dupina3e36272018-08-21 13:22:33 -0700107 }
108
109 @VisibleForTesting
Mady Mellorebdbbb92018-11-15 14:36:48 -0800110 public StatusBarWindowController(Context context, WindowManager windowManager,
Lucas Dupine25c4872019-07-29 13:51:35 -0700111 IActivityManager activityManager, DozeParameters dozeParameters,
112 StatusBarStateController statusBarStateController,
113 ConfigurationController configurationController,
114 KeyguardBypassController keyguardBypassController) {
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100115 mContext = context;
Lucas Dupina3e36272018-08-21 13:22:33 -0700116 mWindowManager = windowManager;
117 mActivityManager = activityManager;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100118 mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation();
Lucas Dupina3e36272018-08-21 13:22:33 -0700119 mDozeParameters = dozeParameters;
Lucas Dupin7517b5d2017-08-22 12:51:25 -0700120 mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze();
Steve Elliottff2c0d92019-07-30 15:09:54 -0400121 mLpChanged = new LayoutParams();
Lucas Dupine25c4872019-07-29 13:51:35 -0700122 mKeyguardBypassController = keyguardBypassController;
Lucas Dupine90fead2019-06-12 16:22:41 -0700123 mLockScreenDisplayTimeout = context.getResources()
124 .getInteger(R.integer.config_lockScreenDisplayTimeout);
Lucas Dupine25c4872019-07-29 13:51:35 -0700125 ((SysuiStatusBarStateController) statusBarStateController)
Beverly8fdb5332019-02-04 14:29:49 -0500126 .addCallback(mStateListener,
127 SysuiStatusBarStateController.RANK_STATUS_BAR_WINDOW_CONTROLLER);
Lucas Dupine25c4872019-07-29 13:51:35 -0700128 configurationController.addCallback(this);
129
130 Display.Mode[] supportedModes = context.getDisplay().getSupportedModes();
131 Display.Mode currentMode = context.getDisplay().getMode();
132 // Running on the highest frame rate available can be expensive.
133 // Let's specify a preferred refresh rate, and allow higher FPS only when we
134 // know that we're not falsing (because we unlocked.)
135 int keyguardRefreshRate = context.getResources()
136 .getInteger(R.integer.config_keyguardRefreshRate);
137 // Find supported display mode with the same resolution and requested refresh rate.
138 mKeyguardDisplayMode = Arrays.stream(supportedModes).filter(mode ->
139 (int) mode.getRefreshRate() == keyguardRefreshRate
140 && mode.getPhysicalWidth() == currentMode.getPhysicalWidth()
141 && mode.getPhysicalHeight() == currentMode.getPhysicalHeight())
142 .findFirst().orElse(null);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100143 }
144
Winson Chungdc0eca62019-06-13 22:37:31 -0700145 /**
146 * Register to receive notifications about status bar window state changes.
147 */
148 public void registerCallback(StatusBarWindowCallback callback) {
149 // Prevent adding duplicate callbacks
150 for (int i = 0; i < mCallbacks.size(); i++) {
151 if (mCallbacks.get(i).get() == callback) {
152 return;
153 }
154 }
155 mCallbacks.add(new WeakReference<StatusBarWindowCallback>(callback));
156 }
157
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100158 private boolean shouldEnableKeyguardScreenRotation() {
159 Resources res = mContext.getResources();
160 return SystemProperties.getBoolean("lockscreen.rot_override", false)
161 || res.getBoolean(R.bool.config_enableLockScreenRotation);
162 }
163
164 /**
165 * Adds the status bar view to the window manager.
166 *
167 * @param statusBarView The view to add.
168 * @param barHeight The height of the status bar in collapsed state.
169 */
Mady Mellord1c78b262018-11-06 18:04:40 -0800170 public void add(ViewGroup statusBarView, int barHeight) {
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100171
172 // Now that the status bar window encompasses the sliding panel and its
173 // translucent backdrop, the entire thing is made TRANSLUCENT and is
174 // hardware-accelerated.
Steve Elliottff2c0d92019-07-30 15:09:54 -0400175 mLp = new LayoutParams(
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100176 ViewGroup.LayoutParams.MATCH_PARENT,
177 barHeight,
Steve Elliottff2c0d92019-07-30 15:09:54 -0400178 LayoutParams.TYPE_STATUS_BAR,
179 LayoutParams.FLAG_NOT_FOCUSABLE
180 | LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
181 | LayoutParams.FLAG_SPLIT_TOUCH
182 | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
183 | LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100184 PixelFormat.TRANSLUCENT);
Wale Ogunwale6ce0fb82016-12-13 14:24:00 -0800185 mLp.token = new Binder();
Jorim Jaggi76aaef52014-05-08 19:16:49 +0200186 mLp.gravity = Gravity.TOP;
Steve Elliottff2c0d92019-07-30 15:09:54 -0400187 mLp.softInputMode = LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100188 mLp.setTitle("StatusBar");
189 mLp.packageName = mContext.getPackageName();
Adrian Roos7b54b072018-03-08 12:52:22 +0100190 mLp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100191 mStatusBarView = statusBarView;
192 mBarHeight = barHeight;
193 mWindowManager.addView(mStatusBarView, mLp);
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100194 mLpChanged.copyFrom(mLp);
Lucas Dupinfdbfc542018-09-17 15:56:09 -0700195 onThemeChanged();
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100196 }
197
Mady Mellord1c78b262018-11-06 18:04:40 -0800198 public ViewGroup getStatusBarView() {
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800199 return mStatusBarView;
200 }
201
Adrian Roos3e23eb52017-07-07 15:58:57 +0200202 public void setDozeScreenBrightness(int value) {
203 mScreenBrightnessDoze = value / 255f;
204 }
205
Jason Monke59dc402018-08-16 12:05:01 -0400206 private void setKeyguardDark(boolean dark) {
Lucas Dupin987f1932017-05-13 21:02:52 -0700207 int vis = mStatusBarView.getSystemUiVisibility();
208 if (dark) {
209 vis = vis | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
210 vis = vis | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
211 } else {
212 vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
213 vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
214 }
215 mStatusBarView.setSystemUiVisibility(vis);
216 }
217
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100218 private void applyKeyguardFlags(State state) {
219 if (state.keyguardShowing) {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400220 mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_KEYGUARD;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100221 } else {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400222 mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_KEYGUARD;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100223 }
Adrian Roosd5c2db62016-03-08 16:11:31 -0800224
Lucas Dupin16cfe452018-02-08 13:14:50 -0800225 final boolean scrimsOccludingWallpaper =
226 state.scrimsVisibility == ScrimController.VISIBILITY_FULLY_OPAQUE;
Lucas Dupin47a65c72018-02-15 14:16:18 -0800227 final boolean keyguardOrAod = state.keyguardShowing
228 || (state.dozing && mDozeParameters.getAlwaysOn());
Selim Cinekdbf172e2018-08-08 18:31:45 +0000229 if (keyguardOrAod && !state.backdropShowing && !scrimsOccludingWallpaper) {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400230 mLpChanged.flags |= LayoutParams.FLAG_SHOW_WALLPAPER;
Adrian Roosd5c2db62016-03-08 16:11:31 -0800231 } else {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400232 mLpChanged.flags &= ~LayoutParams.FLAG_SHOW_WALLPAPER;
Adrian Roosd5c2db62016-03-08 16:11:31 -0800233 }
Lucas Dupina3e36272018-08-21 13:22:33 -0700234
235 if (state.dozing) {
Philip P. Moltmann66ce2382018-10-09 13:46:11 -0700236 mLpChanged.privateFlags |= LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
Lucas Dupina3e36272018-08-21 13:22:33 -0700237 } else {
Philip P. Moltmann66ce2382018-10-09 13:46:11 -0700238 mLpChanged.privateFlags &= ~LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
Lucas Dupina3e36272018-08-21 13:22:33 -0700239 }
Lucas Dupine25c4872019-07-29 13:51:35 -0700240
241 if (mKeyguardDisplayMode != null) {
242 boolean bypassOnKeyguard = mKeyguardBypassController.getBypassEnabled()
243 && state.statusBarState == StatusBarState.KEYGUARD && !state.keyguardFadingAway
244 && !state.keyguardGoingAway;
245 if (state.dozing || bypassOnKeyguard) {
246 mLpChanged.preferredDisplayModeId = mKeyguardDisplayMode.getModeId();
247 } else {
248 mLpChanged.preferredDisplayModeId = 0;
249 }
250 Trace.setCounter("display_mode_id", mLpChanged.preferredDisplayModeId);
251 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100252 }
253
254 private void adjustScreenOrientation(State state) {
Adrian Roos82069442017-06-28 19:37:24 +0200255 if (state.isKeyguardShowingAndNotOccluded() || state.dozing) {
Jorim Jaggica36cf72014-04-17 20:36:15 +0200256 if (mKeyguardScreenRotation) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100257 mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
Jorim Jaggica36cf72014-04-17 20:36:15 +0200258 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100259 mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
Jorim Jaggica36cf72014-04-17 20:36:15 +0200260 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100261 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100262 mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100263 }
264 }
265
266 private void applyFocusableFlag(State state) {
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700267 boolean panelFocusable = state.statusBarFocusable && state.panelExpanded;
Jorim Jaggibb336692016-11-15 15:24:26 -0800268 if (state.bouncerShowing && (state.keyguardOccluded || state.keyguardNeedsInput)
Issei Suzukiac9fcb72019-02-04 17:45:57 +0100269 || ENABLE_REMOTE_INPUT && state.remoteInputActive
270 || state.bubbleExpanded) {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400271 mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
272 mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
Matt Caseya0966b52019-05-15 18:49:37 -0400273 } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400274 mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
275 mLpChanged.flags |= LayoutParams.FLAG_ALT_FOCUSABLE_IM;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100276 } else {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400277 mLpChanged.flags |= LayoutParams.FLAG_NOT_FOCUSABLE;
278 mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100279 }
Adrian Roosdc5b4532016-01-06 20:49:41 +0100280
Steve Elliottff2c0d92019-07-30 15:09:54 -0400281 mLpChanged.softInputMode = LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100282 }
283
Tiger Huanga90dea42018-08-03 17:20:17 +0800284 private void applyForceShowNavigationFlag(State state) {
285 if (state.panelExpanded || state.bouncerShowing
Tiger Huang34046012018-06-29 15:26:52 +0800286 || ENABLE_REMOTE_INPUT && state.remoteInputActive) {
Tiger Huanga90dea42018-08-03 17:20:17 +0800287 mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
Tiger Huang34046012018-06-29 15:26:52 +0800288 } else {
Tiger Huanga90dea42018-08-03 17:20:17 +0800289 mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
Tiger Huang34046012018-06-29 15:26:52 +0800290 }
291 }
292
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100293 private void applyHeight(State state) {
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200294 boolean expanded = isExpanded(state);
Jason Monk421a9412017-02-06 09:15:21 -0800295 if (state.forcePluginOpen) {
Lucas Dupin42ebe542019-01-22 09:45:09 -0800296 if (mListener != null) {
297 mListener.setWouldOtherwiseCollapse(expanded);
298 }
Jason Monk421a9412017-02-06 09:15:21 -0800299 expanded = true;
300 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100301 if (expanded) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100302 mLpChanged.height = ViewGroup.LayoutParams.MATCH_PARENT;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100303 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100304 mLpChanged.height = mBarHeight;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100305 }
306 }
307
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200308 private boolean isExpanded(State state) {
309 return !state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded()
310 || state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
Matt Caseya0966b52019-05-15 18:49:37 -0400311 || state.headsUpShowing || state.bubblesShowing
Lucas Dupin82aa1632017-12-13 00:13:57 -0800312 || state.scrimsVisibility != ScrimController.VISIBILITY_FULLY_TRANSPARENT);
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200313 }
314
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200315 private void applyFitsSystemWindows(State state) {
Adrian Roosa5d6cd02016-07-27 15:12:40 -0700316 boolean fitsSystemWindows = !state.isKeyguardShowingAndNotOccluded();
Lucas Dupin42ebe542019-01-22 09:45:09 -0800317 if (mStatusBarView != null && mStatusBarView.getFitsSystemWindows() != fitsSystemWindows) {
Adrian Roosa5d6cd02016-07-27 15:12:40 -0700318 mStatusBarView.setFitsSystemWindows(fitsSystemWindows);
319 mStatusBarView.requestApplyInsets();
320 }
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200321 }
322
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100323 private void applyUserActivityTimeout(State state) {
Jorim Jaggiecbab362014-04-23 16:13:15 +0200324 if (state.isKeyguardShowingAndNotOccluded()
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200325 && state.statusBarState == StatusBarState.KEYGUARD
326 && !state.qsExpanded) {
Lucas Dupine90fead2019-06-12 16:22:41 -0700327 mLpChanged.userActivityTimeout = state.bouncerShowing
328 ? KeyguardViewMediator.AWAKE_INTERVAL_BOUNCER_MS : mLockScreenDisplayTimeout;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100329 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100330 mLpChanged.userActivityTimeout = -1;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100331 }
332 }
333
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200334 private void applyInputFeatures(State state) {
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200335 if (state.isKeyguardShowingAndNotOccluded()
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200336 && state.statusBarState == StatusBarState.KEYGUARD
Vadim Tryshev6069c402016-03-09 14:24:29 -0800337 && !state.qsExpanded && !state.forceUserActivity) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100338 mLpChanged.inputFeatures |=
Steve Elliottff2c0d92019-07-30 15:09:54 -0400339 LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200340 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100341 mLpChanged.inputFeatures &=
Steve Elliottff2c0d92019-07-30 15:09:54 -0400342 ~LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200343 }
344 }
345
Peiyong Lin75045382019-03-04 19:22:33 -0800346 private void applyStatusBarColorSpaceAgnosticFlag(State state) {
347 if (!isExpanded(state)) {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400348 mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
Peiyong Lin75045382019-03-04 19:22:33 -0800349 } else {
350 mLpChanged.privateFlags &=
Steve Elliottff2c0d92019-07-30 15:09:54 -0400351 ~LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
Peiyong Lin75045382019-03-04 19:22:33 -0800352 }
353 }
354
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100355 private void apply(State state) {
356 applyKeyguardFlags(state);
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700357 applyForceStatusBarVisibleFlag(state);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100358 applyFocusableFlag(state);
Tiger Huanga90dea42018-08-03 17:20:17 +0800359 applyForceShowNavigationFlag(state);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100360 adjustScreenOrientation(state);
361 applyHeight(state);
362 applyUserActivityTimeout(state);
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200363 applyInputFeatures(state);
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200364 applyFitsSystemWindows(state);
Selim Cineka59ecc32015-04-07 10:51:49 -0700365 applyModalFlag(state);
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700366 applyBrightness(state);
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200367 applyHasTopUi(state);
Hyunyoung Songc1647ea2018-08-20 12:23:46 -0700368 applyNotTouchable(state);
Peiyong Lin75045382019-03-04 19:22:33 -0800369 applyStatusBarColorSpaceAgnosticFlag(state);
Lucas Dupin42ebe542019-01-22 09:45:09 -0800370 if (mLp != null && mLp.copyFrom(mLpChanged) != 0) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100371 mWindowManager.updateViewLayout(mStatusBarView, mLp);
372 }
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200373 if (mHasTopUi != mHasTopUiChanged) {
Lucas Dupin8968f6a2019-08-09 17:41:15 -0700374 whitelistIpcs(() -> {
375 try {
376 mActivityManager.setHasTopUi(mHasTopUiChanged);
377 } catch (RemoteException e) {
378 Log.e(TAG, "Failed to call setHasTopUi", e);
379 }
380 mHasTopUi = mHasTopUiChanged;
381 });
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200382 }
Winson Chungdc0eca62019-06-13 22:37:31 -0700383 notifyStateChangedCallbacks();
Winson Chung7bbeb452019-06-04 10:25:50 -0700384 }
385
Winson Chungdc0eca62019-06-13 22:37:31 -0700386 public void notifyStateChangedCallbacks() {
387 for (int i = 0; i < mCallbacks.size(); i++) {
388 StatusBarWindowCallback cb = mCallbacks.get(i).get();
389 if (cb != null) {
390 cb.onStateChanged(mCurrentState.keyguardShowing,
391 mCurrentState.keyguardOccluded,
392 mCurrentState.bouncerShowing);
393 }
394 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100395 }
396
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700397 private void applyForceStatusBarVisibleFlag(State state) {
Beverly8adbd1e2019-07-25 14:27:17 -0400398 if (state.forceStatusBarVisible || state.forcePluginOpen) {
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700399 mLpChanged.privateFlags |= WindowManager
400 .LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
401 } else {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400402 mLpChanged.privateFlags
403 &= ~LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700404 }
405 }
406
Selim Cineka59ecc32015-04-07 10:51:49 -0700407 private void applyModalFlag(State state) {
408 if (state.headsUpShowing) {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400409 mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCH_MODAL;
Selim Cineka59ecc32015-04-07 10:51:49 -0700410 } else {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400411 mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCH_MODAL;
Selim Cineka59ecc32015-04-07 10:51:49 -0700412 }
413 }
414
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700415 private void applyBrightness(State state) {
416 if (state.forceDozeBrightness) {
417 mLpChanged.screenBrightness = mScreenBrightnessDoze;
418 } else {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400419 mLpChanged.screenBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700420 }
421 }
422
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200423 private void applyHasTopUi(State state) {
Steve Elliottff2c0d92019-07-30 15:09:54 -0400424 mHasTopUiChanged = state.forceHasTopUi || isExpanded(state);
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200425 }
426
Hyunyoung Songc1647ea2018-08-20 12:23:46 -0700427 private void applyNotTouchable(State state) {
428 if (state.notTouchable) {
429 mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCHABLE;
430 } else {
431 mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCHABLE;
432 }
433 }
434
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100435 public void setKeyguardShowing(boolean showing) {
436 mCurrentState.keyguardShowing = showing;
437 apply(mCurrentState);
438 }
439
440 public void setKeyguardOccluded(boolean occluded) {
441 mCurrentState.keyguardOccluded = occluded;
442 apply(mCurrentState);
443 }
444
445 public void setKeyguardNeedsInput(boolean needsInput) {
446 mCurrentState.keyguardNeedsInput = needsInput;
447 apply(mCurrentState);
448 }
449
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700450 public void setPanelVisible(boolean visible) {
451 mCurrentState.panelVisible = visible;
452 mCurrentState.statusBarFocusable = visible;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100453 apply(mCurrentState);
454 }
455
456 public void setStatusBarFocusable(boolean focusable) {
457 mCurrentState.statusBarFocusable = focusable;
458 apply(mCurrentState);
459 }
460
Jorim Jaggi5fd4d052014-05-13 22:50:20 +0200461 public void setBouncerShowing(boolean showing) {
462 mCurrentState.bouncerShowing = showing;
463 apply(mCurrentState);
464 }
465
Adrian Roosd5c2db62016-03-08 16:11:31 -0800466 public void setBackdropShowing(boolean showing) {
467 mCurrentState.backdropShowing = showing;
468 apply(mCurrentState);
469 }
470
Jorim Jaggie29b2db2014-05-30 23:17:03 +0200471 public void setKeyguardFadingAway(boolean keyguardFadingAway) {
472 mCurrentState.keyguardFadingAway = keyguardFadingAway;
473 apply(mCurrentState);
474 }
475
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200476 public void setQsExpanded(boolean expanded) {
477 mCurrentState.qsExpanded = expanded;
478 apply(mCurrentState);
479 }
480
Vadim Tryshev6069c402016-03-09 14:24:29 -0800481 public void setForceUserActivity(boolean forceUserActivity) {
482 mCurrentState.forceUserActivity = forceUserActivity;
483 apply(mCurrentState);
484 }
485
Lucas Dupin82aa1632017-12-13 00:13:57 -0800486 public void setScrimsVisibility(int scrimsVisibility) {
487 mCurrentState.scrimsVisibility = scrimsVisibility;
Adrian Roosa5c63222017-07-27 16:33:39 +0200488 apply(mCurrentState);
489 }
490
Selim Cinekb8f09cf2015-03-16 17:09:28 -0700491 public void setHeadsUpShowing(boolean showing) {
492 mCurrentState.headsUpShowing = showing;
493 apply(mCurrentState);
494 }
495
Lucas Dupin7517b5d2017-08-22 12:51:25 -0700496 public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
497 mCurrentState.wallpaperSupportsAmbientMode = supportsAmbientMode;
498 apply(mCurrentState);
499 }
500
Jorim Jaggiecbab362014-04-23 16:13:15 +0200501 /**
Jason Monk1fd3fc32018-08-14 17:20:09 -0400502 * @param state The {@link StatusBarStateController} of the status bar.
Jorim Jaggiecbab362014-04-23 16:13:15 +0200503 */
Jason Monk1fd3fc32018-08-14 17:20:09 -0400504 private void setStatusBarState(int state) {
Jorim Jaggiecbab362014-04-23 16:13:15 +0200505 mCurrentState.statusBarState = state;
506 apply(mCurrentState);
507 }
508
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700509 public void setForceStatusBarVisible(boolean forceStatusBarVisible) {
510 mCurrentState.forceStatusBarVisible = forceStatusBarVisible;
511 apply(mCurrentState);
512 }
513
Selim Cinek737bff32015-05-08 16:08:35 -0700514 /**
515 * Force the window to be collapsed, even if it should theoretically be expanded.
516 * Used for when a heads-up comes in but we still need to wait for the touchable regions to
517 * be computed.
518 */
519 public void setForceWindowCollapsed(boolean force) {
520 mCurrentState.forceCollapsed = force;
521 apply(mCurrentState);
522 }
523
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700524 public void setPanelExpanded(boolean isExpanded) {
525 mCurrentState.panelExpanded = isExpanded;
526 apply(mCurrentState);
527 }
528
Adrian Roosd28ccd72016-01-06 15:23:14 +0100529 @Override
530 public void onRemoteInputActive(boolean remoteInputActive) {
Adrian Roos1c0ca502015-10-07 12:20:42 -0700531 mCurrentState.remoteInputActive = remoteInputActive;
532 apply(mCurrentState);
533 }
534
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700535 /**
536 * Set whether the screen brightness is forced to the value we use for doze mode by the status
537 * bar window.
538 */
539 public void setForceDozeBrightness(boolean forceDozeBrightness) {
540 mCurrentState.forceDozeBrightness = forceDozeBrightness;
541 apply(mCurrentState);
542 }
543
Adrian Roos67cca742017-04-13 16:52:51 -0700544 public void setDozing(boolean dozing) {
545 mCurrentState.dozing = dozing;
546 apply(mCurrentState);
547 }
548
Jorim Jaggi11c62e12016-04-05 20:41:21 -0700549 public void setBarHeight(int barHeight) {
550 mBarHeight = barHeight;
551 apply(mCurrentState);
552 }
553
Jason Monk421a9412017-02-06 09:15:21 -0800554 public void setForcePluginOpen(boolean forcePluginOpen) {
555 mCurrentState.forcePluginOpen = forcePluginOpen;
556 apply(mCurrentState);
Beverly4ec838b2019-05-29 11:34:45 -0400557 if (mForcePluginOpenListener != null) {
558 mForcePluginOpenListener.onChange(forcePluginOpen);
559 }
560 }
561
562 /**
563 * The forcePluginOpen state for the status bar.
564 */
565 public boolean getForcePluginOpen() {
566 return mCurrentState.forcePluginOpen;
Jason Monk421a9412017-02-06 09:15:21 -0800567 }
568
Hyunyoung Songc1647ea2018-08-20 12:23:46 -0700569 public void setNotTouchable(boolean notTouchable) {
570 mCurrentState.notTouchable = notTouchable;
571 apply(mCurrentState);
572 }
573
Mady Mellord1c78b262018-11-06 18:04:40 -0800574 /**
575 * Sets whether there are bubbles showing on the screen.
576 */
577 public void setBubblesShowing(boolean bubblesShowing) {
578 mCurrentState.bubblesShowing = bubblesShowing;
579 apply(mCurrentState);
580 }
581
582 /**
583 * The bubbles showing state for the status bar.
584 */
585 public boolean getBubblesShowing() {
586 return mCurrentState.bubblesShowing;
587 }
588
Issei Suzukiac9fcb72019-02-04 17:45:57 +0100589 /**
590 * Sets if there is a bubble being expanded on the screen.
591 */
592 public void setBubbleExpanded(boolean bubbleExpanded) {
593 mCurrentState.bubbleExpanded = bubbleExpanded;
594 apply(mCurrentState);
595 }
596
597 /**
Mady Mellor390bff42019-04-05 15:09:01 -0700598 * Whether the bubble is shown in expanded state for the status bar.
Issei Suzukiac9fcb72019-02-04 17:45:57 +0100599 */
600 public boolean getBubbleExpanded() {
601 return mCurrentState.bubbleExpanded;
602 }
603
Mady Mellor390bff42019-04-05 15:09:01 -0700604 /**
605 * Whether the status bar panel is expanded or not.
606 */
607 public boolean getPanelExpanded() {
608 return mCurrentState.panelExpanded;
609 }
610
Jason Monk421a9412017-02-06 09:15:21 -0800611 public void setStateListener(OtherwisedCollapsedListener listener) {
612 mListener = listener;
613 }
614
Beverly4ec838b2019-05-29 11:34:45 -0400615 public void setForcePluginOpenListener(ForcePluginOpenListener listener) {
616 mForcePluginOpenListener = listener;
617 }
618
Selim Cinek7025f262015-07-13 16:22:48 -0700619 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
Lucas Dupine25c4872019-07-29 13:51:35 -0700620 pw.println("StatusBarWindowController:");
621 pw.println(" mKeyguardDisplayMode=" + mKeyguardDisplayMode);
Selim Cinek7025f262015-07-13 16:22:48 -0700622 pw.println(mCurrentState);
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200623 }
624
Adrian Roosd5c2db62016-03-08 16:11:31 -0800625 public boolean isShowingWallpaper() {
626 return !mCurrentState.backdropShowing;
627 }
628
Jason Monke59dc402018-08-16 12:05:01 -0400629 @Override
630 public void onThemeChanged() {
Lucas Dupinfdbfc542018-09-17 15:56:09 -0700631 if (mStatusBarView == null) {
632 return;
633 }
634
Lucas Dupin89233c42019-06-10 18:00:22 -0700635 final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
Jason Monke59dc402018-08-16 12:05:01 -0400636 // Make sure we have the correct navbar/statusbar colors.
637 setKeyguardDark(useDarkText);
638 }
639
Lucas Dupine25c4872019-07-29 13:51:35 -0700640 /**
641 * When keyguard will be dismissed but didn't start animation yet.
642 */
643 public void setKeyguardGoingAway(boolean goingAway) {
644 mCurrentState.keyguardGoingAway = goingAway;
645 apply(mCurrentState);
646 }
647
Steve Elliottff2c0d92019-07-30 15:09:54 -0400648 public boolean getForceHasTopUi() {
649 return mCurrentState.forceHasTopUi;
650 }
651
652 public void setForceHasTopUi(boolean forceHasTopUi) {
653 mCurrentState.forceHasTopUi = forceHasTopUi;
654 apply(mCurrentState);
655 }
656
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100657 private static class State {
658 boolean keyguardShowing;
659 boolean keyguardOccluded;
660 boolean keyguardNeedsInput;
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700661 boolean panelVisible;
662 boolean panelExpanded;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100663 boolean statusBarFocusable;
Jorim Jaggi5fd4d052014-05-13 22:50:20 +0200664 boolean bouncerShowing;
Jorim Jaggie29b2db2014-05-30 23:17:03 +0200665 boolean keyguardFadingAway;
Lucas Dupine25c4872019-07-29 13:51:35 -0700666 boolean keyguardGoingAway;
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200667 boolean qsExpanded;
Selim Cinekb8f09cf2015-03-16 17:09:28 -0700668 boolean headsUpShowing;
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700669 boolean forceStatusBarVisible;
Selim Cinek737bff32015-05-08 16:08:35 -0700670 boolean forceCollapsed;
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700671 boolean forceDozeBrightness;
Vadim Tryshev6069c402016-03-09 14:24:29 -0800672 boolean forceUserActivity;
Adrian Roosd5c2db62016-03-08 16:11:31 -0800673 boolean backdropShowing;
Lucas Dupin7517b5d2017-08-22 12:51:25 -0700674 boolean wallpaperSupportsAmbientMode;
Hyunyoung Songc1647ea2018-08-20 12:23:46 -0700675 boolean notTouchable;
Mady Mellord1c78b262018-11-06 18:04:40 -0800676 boolean bubblesShowing;
Issei Suzukiac9fcb72019-02-04 17:45:57 +0100677 boolean bubbleExpanded;
Steve Elliottff2c0d92019-07-30 15:09:54 -0400678 boolean forceHasTopUi;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100679
Jorim Jaggiecbab362014-04-23 16:13:15 +0200680 /**
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500681 * The {@link StatusBar} state from the status bar.
Jorim Jaggiecbab362014-04-23 16:13:15 +0200682 */
683 int statusBarState;
684
Adrian Roos1c0ca502015-10-07 12:20:42 -0700685 boolean remoteInputActive;
Jason Monk421a9412017-02-06 09:15:21 -0800686 boolean forcePluginOpen;
Adrian Roos67cca742017-04-13 16:52:51 -0700687 boolean dozing;
Lucas Dupin82aa1632017-12-13 00:13:57 -0800688 int scrimsVisibility;
Adrian Roos1c0ca502015-10-07 12:20:42 -0700689
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100690 private boolean isKeyguardShowingAndNotOccluded() {
691 return keyguardShowing && !keyguardOccluded;
692 }
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200693
694 @Override
695 public String toString() {
696 StringBuilder result = new StringBuilder();
697 String newLine = "\n";
698 result.append("Window State {");
699 result.append(newLine);
700
701 Field[] fields = this.getClass().getDeclaredFields();
702
703 // Print field names paired with their values
704 for (Field field : fields) {
705 result.append(" ");
706 try {
707 result.append(field.getName());
708 result.append(": ");
709 //requires access to private field:
710 result.append(field.get(this));
711 } catch (IllegalAccessException ex) {
712 }
713 result.append(newLine);
714 }
715 result.append("}");
716
717 return result.toString();
718 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100719 }
Jason Monk421a9412017-02-06 09:15:21 -0800720
Evan Laird878c8532018-10-15 15:54:29 -0400721 private final StateListener mStateListener = new StateListener() {
722 @Override
723 public void onStateChanged(int newState) {
724 setStatusBarState(newState);
725 }
726
727 @Override
728 public void onDozingChanged(boolean isDozing) {
729 setDozing(isDozing);
730 }
731 };
732
Jason Monk421a9412017-02-06 09:15:21 -0800733 /**
734 * Custom listener to pipe data back to plugins about whether or not the status bar would be
735 * collapsed if not for the plugin.
736 * TODO: Find cleaner way to do this.
737 */
738 public interface OtherwisedCollapsedListener {
739 void setWouldOtherwiseCollapse(boolean otherwiseCollapse);
740 }
Beverly4ec838b2019-05-29 11:34:45 -0400741
742 /**
743 * Listener to indicate forcePluginOpen has changed
744 */
745 public interface ForcePluginOpenListener {
746 /**
747 * Called when mState.forcePluginOpen is changed
748 */
749 void onChange(boolean forceOpen);
750 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100751}