mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Merge "Change the use of ScreenLifecycle to WakefulnessLifecycle." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
99cd75e9e3
@@ -1,17 +1,17 @@
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SCREEN_STATE_OFF;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_AWAKE;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISABLED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DOZING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DREAMING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_ON;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_STATE_MASK;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_WAKEFULNESS_MASK;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.WAKEFULNESS_ASLEEP;
|
||||
|
||||
import android.app.KeyguardManager;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TaskbarKeyguardController implements TaskbarControllers.LoggableTas
|
||||
| SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING | SYSUI_STATE_DEVICE_DOZING
|
||||
| SYSUI_STATE_OVERVIEW_DISABLED | SYSUI_STATE_HOME_DISABLED
|
||||
| SYSUI_STATE_BACK_DISABLED | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED
|
||||
| SYSUI_STATE_SCREEN_STATE_MASK;
|
||||
| SYSUI_STATE_WAKEFULNESS_MASK;
|
||||
|
||||
// If any of these SysUi flags (via QuickstepContract) is set, the device to be considered
|
||||
// locked.
|
||||
@@ -75,13 +75,13 @@ public class TaskbarKeyguardController implements TaskbarControllers.LoggableTas
|
||||
keyguardOccluded);
|
||||
updateIconsForBouncer();
|
||||
|
||||
boolean screenOffOrTransitioningOff = (systemUiStateFlags & SYSUI_STATE_SCREEN_ON) == 0;
|
||||
boolean closeFloatingViews = keyguardShowing || screenOffOrTransitioningOff;
|
||||
boolean asleepOrGoingToSleep = (systemUiStateFlags & SYSUI_STATE_AWAKE) == 0;
|
||||
boolean closeFloatingViews = keyguardShowing || asleepOrGoingToSleep;
|
||||
|
||||
if (closeFloatingViews) {
|
||||
// animate the closing of the views, unless the screen is already fully turned off.
|
||||
// animate the closing of the views, unless the screen is already asleep.
|
||||
boolean animateViewClosing =
|
||||
(systemUiStateFlags & SYSUI_STATE_SCREEN_STATE_MASK) != SCREEN_STATE_OFF;
|
||||
(systemUiStateFlags & SYSUI_STATE_WAKEFULNESS_MASK) != WAKEFULNESS_ASLEEP;
|
||||
AbstractFloatingView.closeOpenViews(mContext, animateViewClosing, TYPE_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HO
|
||||
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
|
||||
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
|
||||
import static com.android.systemui.animation.Interpolators.EMPHASIZED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_ON;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_AWAKE;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -81,17 +81,17 @@ public class TaskbarLauncherStateController {
|
||||
*
|
||||
* This is cleared as soon as the screen begins to transition off.
|
||||
*/
|
||||
private static final int FLAG_SCREEN_ON = 1 << 3;
|
||||
private static final int FLAG_AWAKE = 1 << 3;
|
||||
|
||||
/**
|
||||
* Captures whether the launcher was active at the time the FLAG_SCREEN_ON was cleared.
|
||||
* Always cleared when FLAG_SCREEN_ON is set.
|
||||
* Captures whether the launcher was active at the time the FLAG_AWAKE was cleared.
|
||||
* Always cleared when FLAG_AWAKE is set.
|
||||
* <p>
|
||||
* FLAG_RESUMED will be cleared when the screen is off, since all apps get paused at this point.
|
||||
* Thus, this flag indicates whether the launcher will be shown when the screen gets turned on
|
||||
* FLAG_RESUMED will be cleared when the device is asleep, since all apps get paused at this
|
||||
* point. Thus, this flag indicates whether the launcher will be shown when the device wakes up
|
||||
* again.
|
||||
*/
|
||||
private static final int FLAG_LAUNCHER_ACTIVE_AT_SCREEN_OFF = 1 << 4;
|
||||
private static final int FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE = 1 << 4;
|
||||
|
||||
/** Whether the device is currently locked. */
|
||||
private static final int FLAG_DEVICE_LOCKED = 1 << 5;
|
||||
@@ -265,15 +265,15 @@ public class TaskbarLauncherStateController {
|
||||
|
||||
/** SysUI flags updated, see QuickStepContract.SYSUI_STATE_* values. */
|
||||
public void updateStateForSysuiFlags(int systemUiStateFlags, boolean skipAnim) {
|
||||
final boolean prevScreenIsOn = hasAnyFlag(FLAG_SCREEN_ON);
|
||||
final boolean currScreenIsOn = hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_ON);
|
||||
final boolean prevIsAwake = hasAnyFlag(FLAG_AWAKE);
|
||||
final boolean currIsAwake = hasAnyFlag(systemUiStateFlags, SYSUI_STATE_AWAKE);
|
||||
|
||||
updateStateForFlag(FLAG_SCREEN_ON, currScreenIsOn);
|
||||
if (prevScreenIsOn != currScreenIsOn) {
|
||||
updateStateForFlag(FLAG_AWAKE, currIsAwake);
|
||||
if (prevIsAwake != currIsAwake) {
|
||||
// The screen is switching between on/off. When turning off, capture whether the
|
||||
// launcher is active and memoize this state.
|
||||
updateStateForFlag(FLAG_LAUNCHER_ACTIVE_AT_SCREEN_OFF,
|
||||
prevScreenIsOn && hasAnyFlag(FLAGS_LAUNCHER_ACTIVE));
|
||||
updateStateForFlag(FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE,
|
||||
prevIsAwake && hasAnyFlag(FLAGS_LAUNCHER_ACTIVE));
|
||||
}
|
||||
|
||||
boolean isDeviceLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED);
|
||||
@@ -377,7 +377,7 @@ public class TaskbarLauncherStateController {
|
||||
}
|
||||
}
|
||||
|
||||
if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER_ACTIVE | FLAG_SCREEN_ON)) {
|
||||
if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER_ACTIVE | FLAG_AWAKE)) {
|
||||
animatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
@@ -573,10 +573,10 @@ public class TaskbarLauncherStateController {
|
||||
|
||||
/** Whether the launcher is considered active. */
|
||||
private boolean isInLauncher() {
|
||||
if (hasAnyFlag(FLAG_SCREEN_ON)) {
|
||||
if (hasAnyFlag(FLAG_AWAKE)) {
|
||||
return hasAnyFlag(FLAGS_LAUNCHER_ACTIVE);
|
||||
} else {
|
||||
return hasAnyFlag(FLAG_LAUNCHER_ACTIVE_AT_SCREEN_OFF);
|
||||
return hasAnyFlag(FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -677,9 +677,9 @@ public class TaskbarLauncherStateController {
|
||||
appendFlag(result, flags, FLAG_TRANSITION_TO_RESUMED, "transition_to_resumed");
|
||||
appendFlag(result, flags, FLAG_LAUNCHER_IN_STATE_TRANSITION,
|
||||
"launcher_in_state_transition");
|
||||
appendFlag(result, flags, FLAG_SCREEN_ON, "screen_on");
|
||||
appendFlag(result, flags, FLAG_LAUNCHER_ACTIVE_AT_SCREEN_OFF,
|
||||
"launcher_active_at_screen_off");
|
||||
appendFlag(result, flags, FLAG_AWAKE, "awake");
|
||||
appendFlag(result, flags, FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE,
|
||||
"was_active_while_awake");
|
||||
appendFlag(result, flags, FLAG_DEVICE_LOCKED, "device_locked");
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user