blob: 06600541da71a8fc5c331de4c663026b2d3de141 [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
Sudheer Shankadc589ac2016-11-10 15:30:17 -080019import android.app.ActivityManager;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020020import android.app.IActivityManager;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010021import android.content.Context;
22import android.content.pm.ActivityInfo;
23import android.content.res.Resources;
24import android.graphics.PixelFormat;
Wale Ogunwale6ce0fb82016-12-13 14:24:00 -080025import android.os.Binder;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020026import android.os.RemoteException;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010027import android.os.SystemProperties;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020028import android.os.Trace;
29import android.util.Log;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010030import android.view.Gravity;
31import android.view.View;
32import android.view.ViewGroup;
33import android.view.WindowManager;
34
35import com.android.keyguard.R;
Jorim Jaggi6b88cdf2014-12-22 20:56:50 +010036import com.android.systemui.keyguard.KeyguardViewMediator;
Jorim Jaggiecbab362014-04-23 16:13:15 +020037import com.android.systemui.statusbar.BaseStatusBar;
Adrian Roosd28ccd72016-01-06 15:23:14 +010038import com.android.systemui.statusbar.RemoteInputController;
Jorim Jaggiecbab362014-04-23 16:13:15 +020039import com.android.systemui.statusbar.StatusBarState;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010040
Selim Cinek7025f262015-07-13 16:22:48 -070041import java.io.FileDescriptor;
42import java.io.PrintWriter;
Selim Cinek6a1bd2b2015-06-02 16:02:41 +020043import java.lang.reflect.Field;
44
Jorim Jaggi5cf17872014-03-26 18:31:48 +010045/**
46 * Encapsulates all logic for the status bar window state management.
47 */
Adrian Roosd28ccd72016-01-06 15:23:14 +010048public class StatusBarWindowManager implements RemoteInputController.Callback {
Jorim Jaggi5cf17872014-03-26 18:31:48 +010049
Jorim Jaggif6782ee2016-07-22 11:40:00 +020050 private static final String TAG = "StatusBarWindowManager";
51
Jorim Jaggi5cf17872014-03-26 18:31:48 +010052 private final Context mContext;
53 private final WindowManager mWindowManager;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020054 private final IActivityManager mActivityManager;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010055 private View mStatusBarView;
56 private WindowManager.LayoutParams mLp;
Jorim Jaggi95e89ca2014-11-24 20:12:50 +010057 private WindowManager.LayoutParams mLpChanged;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020058 private boolean mHasTopUi;
59 private boolean mHasTopUiChanged;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010060 private int mBarHeight;
61 private final boolean mKeyguardScreenRotation;
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -070062 private final float mScreenBrightnessDoze;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010063 private final State mCurrentState = new State();
64
65 public StatusBarWindowManager(Context context) {
66 mContext = context;
67 mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Sudheer Shankadc589ac2016-11-10 15:30:17 -080068 mActivityManager = ActivityManager.getService();
Jorim Jaggi5cf17872014-03-26 18:31:48 +010069 mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation();
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -070070 mScreenBrightnessDoze = mContext.getResources().getInteger(
71 com.android.internal.R.integer.config_screenBrightnessDoze) / 255f;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010072 }
73
74 private boolean shouldEnableKeyguardScreenRotation() {
75 Resources res = mContext.getResources();
76 return SystemProperties.getBoolean("lockscreen.rot_override", false)
77 || res.getBoolean(R.bool.config_enableLockScreenRotation);
78 }
79
80 /**
81 * Adds the status bar view to the window manager.
82 *
83 * @param statusBarView The view to add.
84 * @param barHeight The height of the status bar in collapsed state.
85 */
86 public void add(View statusBarView, int barHeight) {
87
88 // Now that the status bar window encompasses the sliding panel and its
89 // translucent backdrop, the entire thing is made TRANSLUCENT and is
90 // hardware-accelerated.
91 mLp = new WindowManager.LayoutParams(
92 ViewGroup.LayoutParams.MATCH_PARENT,
93 barHeight,
94 WindowManager.LayoutParams.TYPE_STATUS_BAR,
95 WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
96 | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
97 | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
98 | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
Adrian Roosea562512014-05-05 13:33:03 +020099 | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100100 PixelFormat.TRANSLUCENT);
Wale Ogunwale6ce0fb82016-12-13 14:24:00 -0800101 mLp.token = new Binder();
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100102 mLp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
Jorim Jaggi76aaef52014-05-08 19:16:49 +0200103 mLp.gravity = Gravity.TOP;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100104 mLp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100105 mLp.setTitle("StatusBar");
106 mLp.packageName = mContext.getPackageName();
107 mStatusBarView = statusBarView;
108 mBarHeight = barHeight;
109 mWindowManager.addView(mStatusBarView, mLp);
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100110 mLpChanged = new WindowManager.LayoutParams();
111 mLpChanged.copyFrom(mLp);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100112 }
113
114 private void applyKeyguardFlags(State state) {
115 if (state.keyguardShowing) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100116 mLpChanged.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100117 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100118 mLpChanged.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100119 }
Adrian Roosd5c2db62016-03-08 16:11:31 -0800120
121 if (state.keyguardShowing && !state.backdropShowing) {
122 mLpChanged.flags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
123 } else {
124 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
125 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100126 }
127
128 private void adjustScreenOrientation(State state) {
Jorim Jaggica36cf72014-04-17 20:36:15 +0200129 if (state.isKeyguardShowingAndNotOccluded()) {
130 if (mKeyguardScreenRotation) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100131 mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
Jorim Jaggica36cf72014-04-17 20:36:15 +0200132 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100133 mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
Jorim Jaggica36cf72014-04-17 20:36:15 +0200134 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100135 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100136 mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100137 }
138 }
139
140 private void applyFocusableFlag(State state) {
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700141 boolean panelFocusable = state.statusBarFocusable && state.panelExpanded;
Jorim Jaggibb336692016-11-15 15:24:26 -0800142 if (state.bouncerShowing && (state.keyguardOccluded || state.keyguardNeedsInput)
143 || BaseStatusBar.ENABLE_REMOTE_INPUT && state.remoteInputActive) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100144 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
145 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700146 } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100147 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
148 mLpChanged.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100149 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100150 mLpChanged.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
151 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100152 }
Adrian Roosdc5b4532016-01-06 20:49:41 +0100153
Adrian Roos5153d4a2016-03-22 10:01:56 -0700154 mLpChanged.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100155 }
156
157 private void applyHeight(State state) {
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200158 boolean expanded = isExpanded(state);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100159 if (expanded) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100160 mLpChanged.height = ViewGroup.LayoutParams.MATCH_PARENT;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100161 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100162 mLpChanged.height = mBarHeight;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100163 }
164 }
165
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200166 private boolean isExpanded(State state) {
167 return !state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded()
168 || state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
169 || state.headsUpShowing);
170 }
171
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200172 private void applyFitsSystemWindows(State state) {
Adrian Roosa5d6cd02016-07-27 15:12:40 -0700173 boolean fitsSystemWindows = !state.isKeyguardShowingAndNotOccluded();
174 if (mStatusBarView.getFitsSystemWindows() != fitsSystemWindows) {
175 mStatusBarView.setFitsSystemWindows(fitsSystemWindows);
176 mStatusBarView.requestApplyInsets();
177 }
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200178 }
179
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100180 private void applyUserActivityTimeout(State state) {
Jorim Jaggiecbab362014-04-23 16:13:15 +0200181 if (state.isKeyguardShowingAndNotOccluded()
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200182 && state.statusBarState == StatusBarState.KEYGUARD
183 && !state.qsExpanded) {
Jorim Jaggi6b88cdf2014-12-22 20:56:50 +0100184 mLpChanged.userActivityTimeout = KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100185 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100186 mLpChanged.userActivityTimeout = -1;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100187 }
188 }
189
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200190 private void applyInputFeatures(State state) {
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200191 if (state.isKeyguardShowingAndNotOccluded()
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200192 && state.statusBarState == StatusBarState.KEYGUARD
Vadim Tryshev6069c402016-03-09 14:24:29 -0800193 && !state.qsExpanded && !state.forceUserActivity) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100194 mLpChanged.inputFeatures |=
195 WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200196 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100197 mLpChanged.inputFeatures &=
198 ~WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200199 }
200 }
201
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100202 private void apply(State state) {
203 applyKeyguardFlags(state);
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700204 applyForceStatusBarVisibleFlag(state);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100205 applyFocusableFlag(state);
206 adjustScreenOrientation(state);
207 applyHeight(state);
208 applyUserActivityTimeout(state);
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200209 applyInputFeatures(state);
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200210 applyFitsSystemWindows(state);
Selim Cineka59ecc32015-04-07 10:51:49 -0700211 applyModalFlag(state);
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700212 applyBrightness(state);
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200213 applyHasTopUi(state);
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100214 if (mLp.copyFrom(mLpChanged) != 0) {
215 mWindowManager.updateViewLayout(mStatusBarView, mLp);
216 }
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200217 if (mHasTopUi != mHasTopUiChanged) {
218 try {
219 mActivityManager.setHasTopUi(mHasTopUiChanged);
220 } catch (RemoteException e) {
221 Log.e(TAG, "Failed to call setHasTopUi", e);
222 }
223 mHasTopUi = mHasTopUiChanged;
224 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100225 }
226
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700227 private void applyForceStatusBarVisibleFlag(State state) {
228 if (state.forceStatusBarVisible) {
229 mLpChanged.privateFlags |= WindowManager
230 .LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
231 } else {
232 mLpChanged.privateFlags &= ~WindowManager
233 .LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
234 }
235 }
236
Selim Cineka59ecc32015-04-07 10:51:49 -0700237 private void applyModalFlag(State state) {
238 if (state.headsUpShowing) {
239 mLpChanged.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
240 } else {
241 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
242 }
243 }
244
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700245 private void applyBrightness(State state) {
246 if (state.forceDozeBrightness) {
247 mLpChanged.screenBrightness = mScreenBrightnessDoze;
248 } else {
249 mLpChanged.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
250 }
251 }
252
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200253 private void applyHasTopUi(State state) {
254 mHasTopUiChanged = isExpanded(state);
255 }
256
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100257 public void setKeyguardShowing(boolean showing) {
258 mCurrentState.keyguardShowing = showing;
259 apply(mCurrentState);
260 }
261
262 public void setKeyguardOccluded(boolean occluded) {
263 mCurrentState.keyguardOccluded = occluded;
264 apply(mCurrentState);
265 }
266
267 public void setKeyguardNeedsInput(boolean needsInput) {
268 mCurrentState.keyguardNeedsInput = needsInput;
269 apply(mCurrentState);
270 }
271
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700272 public void setPanelVisible(boolean visible) {
273 mCurrentState.panelVisible = visible;
274 mCurrentState.statusBarFocusable = visible;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100275 apply(mCurrentState);
276 }
277
278 public void setStatusBarFocusable(boolean focusable) {
279 mCurrentState.statusBarFocusable = focusable;
280 apply(mCurrentState);
281 }
282
Jorim Jaggi5fd4d052014-05-13 22:50:20 +0200283 public void setBouncerShowing(boolean showing) {
284 mCurrentState.bouncerShowing = showing;
285 apply(mCurrentState);
286 }
287
Adrian Roosd5c2db62016-03-08 16:11:31 -0800288 public void setBackdropShowing(boolean showing) {
289 mCurrentState.backdropShowing = showing;
290 apply(mCurrentState);
291 }
292
Jorim Jaggie29b2db2014-05-30 23:17:03 +0200293 public void setKeyguardFadingAway(boolean keyguardFadingAway) {
294 mCurrentState.keyguardFadingAway = keyguardFadingAway;
295 apply(mCurrentState);
296 }
297
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200298 public void setQsExpanded(boolean expanded) {
299 mCurrentState.qsExpanded = expanded;
300 apply(mCurrentState);
301 }
302
Vadim Tryshev6069c402016-03-09 14:24:29 -0800303 public void setForceUserActivity(boolean forceUserActivity) {
304 mCurrentState.forceUserActivity = forceUserActivity;
305 apply(mCurrentState);
306 }
307
Selim Cinekb8f09cf2015-03-16 17:09:28 -0700308 public void setHeadsUpShowing(boolean showing) {
309 mCurrentState.headsUpShowing = showing;
310 apply(mCurrentState);
311 }
312
Jorim Jaggiecbab362014-04-23 16:13:15 +0200313 /**
314 * @param state The {@link StatusBarState} of the status bar.
315 */
316 public void setStatusBarState(int state) {
317 mCurrentState.statusBarState = state;
318 apply(mCurrentState);
319 }
320
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700321 public void setForceStatusBarVisible(boolean forceStatusBarVisible) {
322 mCurrentState.forceStatusBarVisible = forceStatusBarVisible;
323 apply(mCurrentState);
324 }
325
Selim Cinek737bff32015-05-08 16:08:35 -0700326 /**
327 * Force the window to be collapsed, even if it should theoretically be expanded.
328 * Used for when a heads-up comes in but we still need to wait for the touchable regions to
329 * be computed.
330 */
331 public void setForceWindowCollapsed(boolean force) {
332 mCurrentState.forceCollapsed = force;
333 apply(mCurrentState);
334 }
335
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700336 public void setPanelExpanded(boolean isExpanded) {
337 mCurrentState.panelExpanded = isExpanded;
338 apply(mCurrentState);
339 }
340
Adrian Roosd28ccd72016-01-06 15:23:14 +0100341 @Override
342 public void onRemoteInputActive(boolean remoteInputActive) {
Adrian Roos1c0ca502015-10-07 12:20:42 -0700343 mCurrentState.remoteInputActive = remoteInputActive;
344 apply(mCurrentState);
345 }
346
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700347 /**
348 * Set whether the screen brightness is forced to the value we use for doze mode by the status
349 * bar window.
350 */
351 public void setForceDozeBrightness(boolean forceDozeBrightness) {
352 mCurrentState.forceDozeBrightness = forceDozeBrightness;
353 apply(mCurrentState);
354 }
355
Jorim Jaggi11c62e12016-04-05 20:41:21 -0700356 public void setBarHeight(int barHeight) {
357 mBarHeight = barHeight;
358 apply(mCurrentState);
359 }
360
Selim Cinek7025f262015-07-13 16:22:48 -0700361 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
362 pw.println("StatusBarWindowManager state:");
363 pw.println(mCurrentState);
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200364 }
365
Adrian Roosd5c2db62016-03-08 16:11:31 -0800366 public boolean isShowingWallpaper() {
367 return !mCurrentState.backdropShowing;
368 }
369
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100370 private static class State {
371 boolean keyguardShowing;
372 boolean keyguardOccluded;
373 boolean keyguardNeedsInput;
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700374 boolean panelVisible;
375 boolean panelExpanded;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100376 boolean statusBarFocusable;
Jorim Jaggi5fd4d052014-05-13 22:50:20 +0200377 boolean bouncerShowing;
Jorim Jaggie29b2db2014-05-30 23:17:03 +0200378 boolean keyguardFadingAway;
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200379 boolean qsExpanded;
Selim Cinekb8f09cf2015-03-16 17:09:28 -0700380 boolean headsUpShowing;
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700381 boolean forceStatusBarVisible;
Selim Cinek737bff32015-05-08 16:08:35 -0700382 boolean forceCollapsed;
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700383 boolean forceDozeBrightness;
Vadim Tryshev6069c402016-03-09 14:24:29 -0800384 boolean forceUserActivity;
Adrian Roosd5c2db62016-03-08 16:11:31 -0800385 boolean backdropShowing;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100386
Jorim Jaggiecbab362014-04-23 16:13:15 +0200387 /**
388 * The {@link BaseStatusBar} state from the status bar.
389 */
390 int statusBarState;
391
Adrian Roos1c0ca502015-10-07 12:20:42 -0700392 boolean remoteInputActive;
393
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100394 private boolean isKeyguardShowingAndNotOccluded() {
395 return keyguardShowing && !keyguardOccluded;
396 }
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200397
398 @Override
399 public String toString() {
400 StringBuilder result = new StringBuilder();
401 String newLine = "\n";
402 result.append("Window State {");
403 result.append(newLine);
404
405 Field[] fields = this.getClass().getDeclaredFields();
406
407 // Print field names paired with their values
408 for (Field field : fields) {
409 result.append(" ");
410 try {
411 result.append(field.getName());
412 result.append(": ");
413 //requires access to private field:
414 result.append(field.get(this));
415 } catch (IllegalAccessException ex) {
416 }
417 result.append(newLine);
418 }
419 result.append("}");
420
421 return result.toString();
422 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100423 }
424}