diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java | 94 |
1 files changed, 92 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index a105f24..6992379 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -26,6 +26,7 @@ import android.content.ContentResolver; import android.app.ActivityManager; import android.app.StatusBarManager; import android.content.Context; +import android.content.SharedPreferences; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.content.res.Resources; @@ -39,6 +40,7 @@ import android.net.Uri; import android.os.Handler; import android.os.PowerManager; import android.os.RemoteException; +import android.preference.PreferenceManager; import android.util.AttributeSet; import android.util.MathUtils; import android.view.Display; @@ -111,6 +113,15 @@ public class NotificationPanelView extends PanelView implements private static final long SLIDE_PANEL_IN_ANIMATION_DURATION = 300; + private static final String KEY_USER_EXPANDED_NOTIFICATIONS_IN_KEYGUARD = + "user_expanded_notifications_in_keyguard"; + private static final String KEY_USER_INTERACTED_WITH_LLS = + "user_interacted_with_lls"; + private static final String KEY_USER_UNLOCKED = + "user_unlocked"; + private static final String KEY_USER_RETURNED_FROM_LLS = + "user_returned_from_lls"; + public static final long DOZE_ANIMATION_DURATION = 700; @@ -273,6 +284,12 @@ public class NotificationPanelView extends PanelView implements private TextView mKeyguardWeatherInfo; private WeatherControllerImpl mWeatherController; + // Keep track of common user interactions on the lock screen + private boolean mUserUnlocked; + private boolean mUserExpandedNotifications; + private boolean mUserInteractedWithLiveLockScreen; + private boolean mUserReturnedFromLiveLockScreen; + private enum SwipeLockedDirection { UNKNOWN, HORIZONTAL, @@ -301,6 +318,13 @@ public class NotificationPanelView extends PanelView implements mCanDismissKeyguard = false; mStatusBar.focusKeyguardExternalView(); mLiveLockscreenController.onLiveLockScreenFocusChanged(true /* hasFocus */); + if (!mUserInteractedWithLiveLockScreen) { + mUserInteractedWithLiveLockScreen = true; + saveUserInteractedWithLls(true); + } + if (!mUserReturnedFromLiveLockScreen) { + startShowNotificationsHintAnimation(); + } resetAlphaTranslation(); // Enables the left edge gesture to allow user // to return to keyguard @@ -400,6 +424,11 @@ public class NotificationPanelView extends PanelView implements display.getSize(point); mScreenHeight = point.y; mUnlockMethodCache = UnlockMethodCache.getInstance(context); + + mUserUnlocked = getUserUnlocked(); + mUserExpandedNotifications = getUserExpandedNotificationsInKeyguard(); + mUserInteractedWithLiveLockScreen = getUserInteractedWithLls(); + mUserReturnedFromLiveLockScreen = getUserReturnedFromLls(); } public void setStatusBar(PhoneStatusBar bar) { @@ -1354,8 +1383,13 @@ public class NotificationPanelView extends PanelView implements mCanDismissKeyguard = true; } - if (goingToFullShade || (oldState == StatusBarState.KEYGUARD - && statusBarState == StatusBarState.SHADE_LOCKED)) { + boolean keyguardToShadeLocked = oldState == StatusBarState.KEYGUARD + && statusBarState == StatusBarState.SHADE_LOCKED; + if (goingToFullShade || keyguardToShadeLocked) { + if (keyguardToShadeLocked && !mUserExpandedNotifications) { + mUserExpandedNotifications = true; + saveUserExpandedNotificationsInKeyguard(true); + } animateKeyguardStatusBarOut(); animateHeaderSlidingIn(); } else if (oldState == StatusBarState.SHADE_LOCKED @@ -1370,6 +1404,11 @@ public class NotificationPanelView extends PanelView implements mAfforanceHelper.updatePreviews(); } } + if (oldState != StatusBarState.SHADE && statusBarState == StatusBarState.SHADE && + !mUserUnlocked) { + mUserUnlocked = true; + saveUserUnlocked(true); + } if (statusBarState == StatusBarState.KEYGUARD || statusBarState == StatusBarState.SHADE_LOCKED) { updateDozingVisibilities(false /* animate */); @@ -2386,6 +2425,7 @@ public class NotificationPanelView extends PanelView implements } mHintAnimationRunning = true; mKeyguardBottomArea.expand(true); + mKeyguardBottomArea.getIndicationView().animate().cancel(); mAfforanceHelper.startHintAnimation(rightIcon, new Runnable() { @Override public void run() { @@ -2589,6 +2629,9 @@ public class NotificationPanelView extends PanelView implements public void onScreenTurningOn() { mKeyguardStatusView.refreshTime(); + startScreenOnHintAnimation(mLiveLockscreenController.isLiveLockScreenInteractive() && + !mUserInteractedWithLiveLockScreen, + !mUserUnlocked, !mUserExpandedNotifications); } @Override @@ -2974,5 +3017,52 @@ public class NotificationPanelView extends PanelView implements animator.addUpdateListener(mSlideInAnimationListener); animator.addListener(mSlideInAnimationListener); animator.start(); + + if (!mUserReturnedFromLiveLockScreen) { + mUserReturnedFromLiveLockScreen = true; + saveUserReturnedFromLls(true); + } + } + + private void saveBooleanSharedPreference(String key, boolean value) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); + prefs.edit().putBoolean(key, value).apply(); + } + + private boolean getSharedPreferenceBoolean(String key, boolean defValue) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); + return prefs.getBoolean(key, defValue); + } + + private void saveUserExpandedNotificationsInKeyguard(boolean expanded) { + saveBooleanSharedPreference(KEY_USER_EXPANDED_NOTIFICATIONS_IN_KEYGUARD, expanded); + } + + private boolean getUserExpandedNotificationsInKeyguard() { + return getSharedPreferenceBoolean(KEY_USER_EXPANDED_NOTIFICATIONS_IN_KEYGUARD, false); + } + + private void saveUserInteractedWithLls(boolean interacted) { + saveBooleanSharedPreference(KEY_USER_INTERACTED_WITH_LLS, interacted); + } + + private boolean getUserInteractedWithLls() { + return getSharedPreferenceBoolean(KEY_USER_INTERACTED_WITH_LLS, false); + } + + private void saveUserUnlocked(boolean unlocked) { + saveBooleanSharedPreference(KEY_USER_UNLOCKED, unlocked); + } + + private boolean getUserUnlocked() { + return getSharedPreferenceBoolean(KEY_USER_UNLOCKED, false); + } + + private void saveUserReturnedFromLls(boolean revealed) { + saveBooleanSharedPreference(KEY_USER_RETURNED_FROM_LLS, revealed); + } + + private boolean getUserReturnedFromLls() { + return getSharedPreferenceBoolean(KEY_USER_RETURNED_FROM_LLS, false); } } |