diff options
author | Jon Miranda <jonmiranda@google.com> | 2017-07-19 16:07:01 -0700 |
---|---|---|
committer | Jon Miranda <jonmiranda@google.com> | 2017-07-20 11:10:07 -0700 |
commit | 7fda285cf0edcae469c82dee977c9e2d485ea184 (patch) | |
tree | dbbb6ab5d302a4c24717ad37d656fdef1361cc83 /src | |
parent | 5360b6ee4f3016f38e244607c9ddb835bdfdf2fb (diff) | |
download | android_packages_apps_Trebuchet-7fda285cf0edcae469c82dee977c9e2d485ea184.tar.gz android_packages_apps_Trebuchet-7fda285cf0edcae469c82dee977c9e2d485ea184.tar.bz2 android_packages_apps_Trebuchet-7fda285cf0edcae469c82dee977c9e2d485ea184.zip |
Update when Launcher's scrim should fade.
* Scrim will fade first time the user starts Launcher (unlocks device).
* Scrim will fade if resuming from a screen off and Launcher is in
the foreground.
Bug: 63801668
Change-Id: I4465765fe5a0f81c2f4dec715f9f5a24a309fc1b
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index fe459bb0d..ad9466314 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -274,6 +274,7 @@ public class Launcher extends BaseActivity private boolean mHasFocus = false; private ObjectAnimator mScrimAnimator; + private boolean mShouldFadeInScrim; private PopupDataProvider mPopupDataProvider; @@ -467,8 +468,12 @@ public class Launcher extends BaseActivity mLauncherCallbacks.onCreate(savedInstanceState); } - // Listen for broadcasts screen off - registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF)); + // Listen for broadcasts + IntentFilter filter = new IntentFilter(); + filter.addAction(Intent.ACTION_SCREEN_OFF); + filter.addAction(Intent.ACTION_USER_PRESENT); // When the device wakes up + keyguard is gone + registerReceiver(mReceiver, filter); + mShouldFadeInScrim = true; getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW, Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText)); @@ -906,7 +911,7 @@ public class Launcher extends BaseActivity NotificationListener.setNotificationsChangedListener(mPopupDataProvider); } - if (mIsResumeFromActionScreenOff && mDragLayer.getBackground() != null) { + if (mShouldFadeInScrim && mDragLayer.getBackground() != null) { if (mScrimAnimator != null) { mScrimAnimator.cancel(); } @@ -923,6 +928,7 @@ public class Launcher extends BaseActivity mScrimAnimator.setStartDelay(getWindow().getTransitionBackgroundFadeDuration()); mScrimAnimator.start(); } + mShouldFadeInScrim = false; } @Override @@ -1534,6 +1540,11 @@ public class Launcher extends BaseActivity } } mIsResumeFromActionScreenOff = true; + mShouldFadeInScrim = true; + } else if (Intent.ACTION_USER_PRESENT.equals(action)) { + // ACTION_USER_PRESENT is sent after onStart/onResume. This covers the case where + // the user unlocked and the Launcher is not in the foreground. + mShouldFadeInScrim = false; } } }; |