blob: 16999b2f454f92fe0106f89a97f3ed812f1a1e71 [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.util.Log;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010029import android.view.Gravity;
30import android.view.View;
31import android.view.ViewGroup;
32import android.view.WindowManager;
33
34import com.android.keyguard.R;
Jorim Jaggi6b88cdf2014-12-22 20:56:50 +010035import com.android.systemui.keyguard.KeyguardViewMediator;
Adrian Roosd28ccd72016-01-06 15:23:14 +010036import com.android.systemui.statusbar.RemoteInputController;
Jorim Jaggiecbab362014-04-23 16:13:15 +020037import com.android.systemui.statusbar.StatusBarState;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010038
Selim Cinek7025f262015-07-13 16:22:48 -070039import java.io.FileDescriptor;
40import java.io.PrintWriter;
Selim Cinek6a1bd2b2015-06-02 16:02:41 +020041import java.lang.reflect.Field;
42
Jorim Jaggi5cf17872014-03-26 18:31:48 +010043/**
44 * Encapsulates all logic for the status bar window state management.
45 */
Adrian Roosd28ccd72016-01-06 15:23:14 +010046public class StatusBarWindowManager implements RemoteInputController.Callback {
Jorim Jaggi5cf17872014-03-26 18:31:48 +010047
Jorim Jaggif6782ee2016-07-22 11:40:00 +020048 private static final String TAG = "StatusBarWindowManager";
49
Jorim Jaggi5cf17872014-03-26 18:31:48 +010050 private final Context mContext;
51 private final WindowManager mWindowManager;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020052 private final IActivityManager mActivityManager;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010053 private View mStatusBarView;
54 private WindowManager.LayoutParams mLp;
Jorim Jaggi95e89ca2014-11-24 20:12:50 +010055 private WindowManager.LayoutParams mLpChanged;
Jorim Jaggif6782ee2016-07-22 11:40:00 +020056 private boolean mHasTopUi;
57 private boolean mHasTopUiChanged;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010058 private int mBarHeight;
59 private final boolean mKeyguardScreenRotation;
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -070060 private final float mScreenBrightnessDoze;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010061 private final State mCurrentState = new State();
62
63 public StatusBarWindowManager(Context context) {
64 mContext = context;
65 mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Sudheer Shankadc589ac2016-11-10 15:30:17 -080066 mActivityManager = ActivityManager.getService();
Jorim Jaggi5cf17872014-03-26 18:31:48 +010067 mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation();
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -070068 mScreenBrightnessDoze = mContext.getResources().getInteger(
69 com.android.internal.R.integer.config_screenBrightnessDoze) / 255f;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010070 }
71
72 private boolean shouldEnableKeyguardScreenRotation() {
73 Resources res = mContext.getResources();
74 return SystemProperties.getBoolean("lockscreen.rot_override", false)
75 || res.getBoolean(R.bool.config_enableLockScreenRotation);
76 }
77
78 /**
79 * Adds the status bar view to the window manager.
80 *
81 * @param statusBarView The view to add.
82 * @param barHeight The height of the status bar in collapsed state.
83 */
84 public void add(View statusBarView, int barHeight) {
85
86 // Now that the status bar window encompasses the sliding panel and its
87 // translucent backdrop, the entire thing is made TRANSLUCENT and is
88 // hardware-accelerated.
89 mLp = new WindowManager.LayoutParams(
90 ViewGroup.LayoutParams.MATCH_PARENT,
91 barHeight,
92 WindowManager.LayoutParams.TYPE_STATUS_BAR,
93 WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
94 | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
95 | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
96 | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
Adrian Roosea562512014-05-05 13:33:03 +020097 | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi5cf17872014-03-26 18:31:48 +010098 PixelFormat.TRANSLUCENT);
Wale Ogunwale6ce0fb82016-12-13 14:24:00 -080099 mLp.token = new Binder();
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100100 mLp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
Jorim Jaggi76aaef52014-05-08 19:16:49 +0200101 mLp.gravity = Gravity.TOP;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100102 mLp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100103 mLp.setTitle("StatusBar");
104 mLp.packageName = mContext.getPackageName();
105 mStatusBarView = statusBarView;
106 mBarHeight = barHeight;
107 mWindowManager.addView(mStatusBarView, mLp);
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100108 mLpChanged = new WindowManager.LayoutParams();
109 mLpChanged.copyFrom(mLp);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100110 }
111
112 private void applyKeyguardFlags(State state) {
113 if (state.keyguardShowing) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100114 mLpChanged.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100115 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100116 mLpChanged.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100117 }
Adrian Roosd5c2db62016-03-08 16:11:31 -0800118
119 if (state.keyguardShowing && !state.backdropShowing) {
120 mLpChanged.flags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
121 } else {
122 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
123 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100124 }
125
126 private void adjustScreenOrientation(State state) {
Jorim Jaggica36cf72014-04-17 20:36:15 +0200127 if (state.isKeyguardShowingAndNotOccluded()) {
128 if (mKeyguardScreenRotation) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100129 mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
Jorim Jaggica36cf72014-04-17 20:36:15 +0200130 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100131 mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
Jorim Jaggica36cf72014-04-17 20:36:15 +0200132 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100133 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100134 mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100135 }
136 }
137
138 private void applyFocusableFlag(State state) {
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700139 boolean panelFocusable = state.statusBarFocusable && state.panelExpanded;
Jorim Jaggibb336692016-11-15 15:24:26 -0800140 if (state.bouncerShowing && (state.keyguardOccluded || state.keyguardNeedsInput)
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500141 || StatusBar.ENABLE_REMOTE_INPUT && state.remoteInputActive) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100142 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
143 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700144 } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100145 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
146 mLpChanged.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100147 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100148 mLpChanged.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
149 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100150 }
Adrian Roosdc5b4532016-01-06 20:49:41 +0100151
Adrian Roos5153d4a2016-03-22 10:01:56 -0700152 mLpChanged.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100153 }
154
155 private void applyHeight(State state) {
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200156 boolean expanded = isExpanded(state);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100157 if (expanded) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100158 mLpChanged.height = ViewGroup.LayoutParams.MATCH_PARENT;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100159 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100160 mLpChanged.height = mBarHeight;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100161 }
162 }
163
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200164 private boolean isExpanded(State state) {
165 return !state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded()
166 || state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
167 || state.headsUpShowing);
168 }
169
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200170 private void applyFitsSystemWindows(State state) {
Adrian Roosa5d6cd02016-07-27 15:12:40 -0700171 boolean fitsSystemWindows = !state.isKeyguardShowingAndNotOccluded();
172 if (mStatusBarView.getFitsSystemWindows() != fitsSystemWindows) {
173 mStatusBarView.setFitsSystemWindows(fitsSystemWindows);
174 mStatusBarView.requestApplyInsets();
175 }
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200176 }
177
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100178 private void applyUserActivityTimeout(State state) {
Jorim Jaggiecbab362014-04-23 16:13:15 +0200179 if (state.isKeyguardShowingAndNotOccluded()
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200180 && state.statusBarState == StatusBarState.KEYGUARD
181 && !state.qsExpanded) {
Jorim Jaggi6b88cdf2014-12-22 20:56:50 +0100182 mLpChanged.userActivityTimeout = KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100183 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100184 mLpChanged.userActivityTimeout = -1;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100185 }
186 }
187
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200188 private void applyInputFeatures(State state) {
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200189 if (state.isKeyguardShowingAndNotOccluded()
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200190 && state.statusBarState == StatusBarState.KEYGUARD
Vadim Tryshev6069c402016-03-09 14:24:29 -0800191 && !state.qsExpanded && !state.forceUserActivity) {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100192 mLpChanged.inputFeatures |=
193 WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200194 } else {
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100195 mLpChanged.inputFeatures &=
196 ~WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200197 }
198 }
199
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100200 private void apply(State state) {
201 applyKeyguardFlags(state);
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700202 applyForceStatusBarVisibleFlag(state);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100203 applyFocusableFlag(state);
204 adjustScreenOrientation(state);
205 applyHeight(state);
206 applyUserActivityTimeout(state);
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200207 applyInputFeatures(state);
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200208 applyFitsSystemWindows(state);
Selim Cineka59ecc32015-04-07 10:51:49 -0700209 applyModalFlag(state);
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700210 applyBrightness(state);
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200211 applyHasTopUi(state);
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100212 if (mLp.copyFrom(mLpChanged) != 0) {
213 mWindowManager.updateViewLayout(mStatusBarView, mLp);
214 }
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200215 if (mHasTopUi != mHasTopUiChanged) {
216 try {
217 mActivityManager.setHasTopUi(mHasTopUiChanged);
218 } catch (RemoteException e) {
219 Log.e(TAG, "Failed to call setHasTopUi", e);
220 }
221 mHasTopUi = mHasTopUiChanged;
222 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100223 }
224
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700225 private void applyForceStatusBarVisibleFlag(State state) {
226 if (state.forceStatusBarVisible) {
227 mLpChanged.privateFlags |= WindowManager
228 .LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
229 } else {
230 mLpChanged.privateFlags &= ~WindowManager
231 .LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
232 }
233 }
234
Selim Cineka59ecc32015-04-07 10:51:49 -0700235 private void applyModalFlag(State state) {
236 if (state.headsUpShowing) {
237 mLpChanged.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
238 } else {
239 mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
240 }
241 }
242
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700243 private void applyBrightness(State state) {
244 if (state.forceDozeBrightness) {
245 mLpChanged.screenBrightness = mScreenBrightnessDoze;
246 } else {
247 mLpChanged.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
248 }
249 }
250
Jorim Jaggif6782ee2016-07-22 11:40:00 +0200251 private void applyHasTopUi(State state) {
252 mHasTopUiChanged = isExpanded(state);
253 }
254
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100255 public void setKeyguardShowing(boolean showing) {
256 mCurrentState.keyguardShowing = showing;
257 apply(mCurrentState);
258 }
259
260 public void setKeyguardOccluded(boolean occluded) {
261 mCurrentState.keyguardOccluded = occluded;
262 apply(mCurrentState);
263 }
264
265 public void setKeyguardNeedsInput(boolean needsInput) {
266 mCurrentState.keyguardNeedsInput = needsInput;
267 apply(mCurrentState);
268 }
269
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700270 public void setPanelVisible(boolean visible) {
271 mCurrentState.panelVisible = visible;
272 mCurrentState.statusBarFocusable = visible;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100273 apply(mCurrentState);
274 }
275
276 public void setStatusBarFocusable(boolean focusable) {
277 mCurrentState.statusBarFocusable = focusable;
278 apply(mCurrentState);
279 }
280
Jorim Jaggi5fd4d052014-05-13 22:50:20 +0200281 public void setBouncerShowing(boolean showing) {
282 mCurrentState.bouncerShowing = showing;
283 apply(mCurrentState);
284 }
285
Adrian Roosd5c2db62016-03-08 16:11:31 -0800286 public void setBackdropShowing(boolean showing) {
287 mCurrentState.backdropShowing = showing;
288 apply(mCurrentState);
289 }
290
Jorim Jaggie29b2db2014-05-30 23:17:03 +0200291 public void setKeyguardFadingAway(boolean keyguardFadingAway) {
292 mCurrentState.keyguardFadingAway = keyguardFadingAway;
293 apply(mCurrentState);
294 }
295
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200296 public void setQsExpanded(boolean expanded) {
297 mCurrentState.qsExpanded = expanded;
298 apply(mCurrentState);
299 }
300
Vadim Tryshev6069c402016-03-09 14:24:29 -0800301 public void setForceUserActivity(boolean forceUserActivity) {
302 mCurrentState.forceUserActivity = forceUserActivity;
303 apply(mCurrentState);
304 }
305
Selim Cinekb8f09cf2015-03-16 17:09:28 -0700306 public void setHeadsUpShowing(boolean showing) {
307 mCurrentState.headsUpShowing = showing;
308 apply(mCurrentState);
309 }
310
Jorim Jaggiecbab362014-04-23 16:13:15 +0200311 /**
312 * @param state The {@link StatusBarState} of the status bar.
313 */
314 public void setStatusBarState(int state) {
315 mCurrentState.statusBarState = state;
316 apply(mCurrentState);
317 }
318
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700319 public void setForceStatusBarVisible(boolean forceStatusBarVisible) {
320 mCurrentState.forceStatusBarVisible = forceStatusBarVisible;
321 apply(mCurrentState);
322 }
323
Selim Cinek737bff32015-05-08 16:08:35 -0700324 /**
325 * Force the window to be collapsed, even if it should theoretically be expanded.
326 * Used for when a heads-up comes in but we still need to wait for the touchable regions to
327 * be computed.
328 */
329 public void setForceWindowCollapsed(boolean force) {
330 mCurrentState.forceCollapsed = force;
331 apply(mCurrentState);
332 }
333
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700334 public void setPanelExpanded(boolean isExpanded) {
335 mCurrentState.panelExpanded = isExpanded;
336 apply(mCurrentState);
337 }
338
Adrian Roosd28ccd72016-01-06 15:23:14 +0100339 @Override
340 public void onRemoteInputActive(boolean remoteInputActive) {
Adrian Roos1c0ca502015-10-07 12:20:42 -0700341 mCurrentState.remoteInputActive = remoteInputActive;
342 apply(mCurrentState);
343 }
344
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700345 /**
346 * Set whether the screen brightness is forced to the value we use for doze mode by the status
347 * bar window.
348 */
349 public void setForceDozeBrightness(boolean forceDozeBrightness) {
350 mCurrentState.forceDozeBrightness = forceDozeBrightness;
351 apply(mCurrentState);
352 }
353
Jorim Jaggi11c62e12016-04-05 20:41:21 -0700354 public void setBarHeight(int barHeight) {
355 mBarHeight = barHeight;
356 apply(mCurrentState);
357 }
358
Selim Cinek7025f262015-07-13 16:22:48 -0700359 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
360 pw.println("StatusBarWindowManager state:");
361 pw.println(mCurrentState);
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200362 }
363
Adrian Roosd5c2db62016-03-08 16:11:31 -0800364 public boolean isShowingWallpaper() {
365 return !mCurrentState.backdropShowing;
366 }
367
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100368 private static class State {
369 boolean keyguardShowing;
370 boolean keyguardOccluded;
371 boolean keyguardNeedsInput;
Selim Cinek4a21a7f2015-05-19 11:00:38 -0700372 boolean panelVisible;
373 boolean panelExpanded;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100374 boolean statusBarFocusable;
Jorim Jaggi5fd4d052014-05-13 22:50:20 +0200375 boolean bouncerShowing;
Jorim Jaggie29b2db2014-05-30 23:17:03 +0200376 boolean keyguardFadingAway;
Jorim Jaggib690f0d2014-07-03 23:25:44 +0200377 boolean qsExpanded;
Selim Cinekb8f09cf2015-03-16 17:09:28 -0700378 boolean headsUpShowing;
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -0700379 boolean forceStatusBarVisible;
Selim Cinek737bff32015-05-08 16:08:35 -0700380 boolean forceCollapsed;
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700381 boolean forceDozeBrightness;
Vadim Tryshev6069c402016-03-09 14:24:29 -0800382 boolean forceUserActivity;
Adrian Roosd5c2db62016-03-08 16:11:31 -0800383 boolean backdropShowing;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100384
Jorim Jaggiecbab362014-04-23 16:13:15 +0200385 /**
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500386 * The {@link StatusBar} state from the status bar.
Jorim Jaggiecbab362014-04-23 16:13:15 +0200387 */
388 int statusBarState;
389
Adrian Roos1c0ca502015-10-07 12:20:42 -0700390 boolean remoteInputActive;
391
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100392 private boolean isKeyguardShowingAndNotOccluded() {
393 return keyguardShowing && !keyguardOccluded;
394 }
Selim Cinek6a1bd2b2015-06-02 16:02:41 +0200395
396 @Override
397 public String toString() {
398 StringBuilder result = new StringBuilder();
399 String newLine = "\n";
400 result.append("Window State {");
401 result.append(newLine);
402
403 Field[] fields = this.getClass().getDeclaredFields();
404
405 // Print field names paired with their values
406 for (Field field : fields) {
407 result.append(" ");
408 try {
409 result.append(field.getName());
410 result.append(": ");
411 //requires access to private field:
412 result.append(field.get(this));
413 } catch (IllegalAccessException ex) {
414 }
415 result.append(newLine);
416 }
417 result.append("}");
418
419 return result.toString();
420 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100421 }
422}