From 4cb34cc0c2a9987679b6d24857ca3c57876a2f2d Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Fri, 16 Jul 2021 22:03:35 -0700 Subject: [PATCH] Update recents onboarding logic - Remove quickscrub tips - Add additional checks on nav mode Fixes: 180248278 Test: manual Change-Id: I1661bb1b63167c508c6164a1a4ef8fe31a9749e5 --- packages/SystemUI/res/values/strings.xml | 2 - .../shared/system/LauncherEventUtil.java | 1 - .../src/com/android/systemui/Prefs.java | 6 - .../systemui/recents/RecentsOnboarding.java | 120 ++---------------- 4 files changed, 12 insertions(+), 117 deletions(-) diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index c4e9ff818df1d..55b6c9ab55390 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1008,8 +1008,6 @@ Swipe up to switch apps - - Drag right to quickly switch apps Toggle Overview diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/LauncherEventUtil.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/LauncherEventUtil.java index eed9580e22136..4959fb7ddfdb6 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/LauncherEventUtil.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/LauncherEventUtil.java @@ -24,6 +24,5 @@ public class LauncherEventUtil { // Constants for the Target (View) public static final int RECENTS_SWIPE_UP_ONBOARDING_TIP = 0; - public static final int RECENTS_QUICK_SCRUB_ONBOARDING_TIP = 1; } diff --git a/packages/SystemUI/src/com/android/systemui/Prefs.java b/packages/SystemUI/src/com/android/systemui/Prefs.java index 782cd29b0179a..cf56eb16b373a 100644 --- a/packages/SystemUI/src/com/android/systemui/Prefs.java +++ b/packages/SystemUI/src/com/android/systemui/Prefs.java @@ -65,8 +65,6 @@ public final class Prefs { Key.QS_LONG_PRESS_TOOLTIP_SHOWN_COUNT, Key.SEEN_MULTI_USER, Key.HAS_SEEN_RECENTS_SWIPE_UP_ONBOARDING, - Key.HAS_SEEN_RECENTS_QUICK_SCRUB_ONBOARDING, - Key.OVERVIEW_OPENED_COUNT, Key.OVERVIEW_OPENED_FROM_HOME_COUNT, Key.SEEN_RINGER_GUIDANCE_COUNT, Key.QS_HAS_TURNED_OFF_MOBILE_DATA, @@ -109,14 +107,10 @@ public final class Prefs { */ String QS_LONG_PRESS_TOOLTIP_SHOWN_COUNT = "QsLongPressTooltipShownCount"; String SEEN_MULTI_USER = "HasSeenMultiUser"; - String OVERVIEW_OPENED_COUNT = "OverviewOpenedCount"; String OVERVIEW_OPENED_FROM_HOME_COUNT = "OverviewOpenedFromHomeCount"; String HAS_SEEN_RECENTS_SWIPE_UP_ONBOARDING = "HasSeenRecentsSwipeUpOnboarding"; - String HAS_SEEN_RECENTS_QUICK_SCRUB_ONBOARDING = "HasSeenRecentsQuickScrubOnboarding"; String DISMISSED_RECENTS_SWIPE_UP_ONBOARDING_COUNT = "DismissedRecentsSwipeUpOnboardingCount"; - String HAS_DISMISSED_RECENTS_QUICK_SCRUB_ONBOARDING_ONCE = - "HasDismissedRecentsQuickScrubOnboardingOnce"; String SEEN_RINGER_GUIDANCE_COUNT = "RingerGuidanceCount"; String QS_TILE_SPECS_REVEALED = "QsTileSpecsRevealed"; String QS_HAS_TURNED_OFF_MOBILE_DATA = "QsHasTurnedOffMobileData"; diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java index 310ecbc01bf06..13da0f0224fcf 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java @@ -20,13 +20,9 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; import static com.android.systemui.Prefs.Key.DISMISSED_RECENTS_SWIPE_UP_ONBOARDING_COUNT; -import static com.android.systemui.Prefs.Key.HAS_DISMISSED_RECENTS_QUICK_SCRUB_ONBOARDING_ONCE; -import static com.android.systemui.Prefs.Key.HAS_SEEN_RECENTS_QUICK_SCRUB_ONBOARDING; import static com.android.systemui.Prefs.Key.HAS_SEEN_RECENTS_SWIPE_UP_ONBOARDING; -import static com.android.systemui.Prefs.Key.OVERVIEW_OPENED_COUNT; import static com.android.systemui.Prefs.Key.OVERVIEW_OPENED_FROM_HOME_COUNT; import static com.android.systemui.shared.system.LauncherEventUtil.DISMISS; -import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_QUICK_SCRUB_ONBOARDING_TIP; import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_SWIPE_UP_ONBOARDING_TIP; import static com.android.systemui.shared.system.LauncherEventUtil.VISIBLE; @@ -88,8 +84,6 @@ public class RecentsOnboarding { private static final long HIDE_DURATION_MS = 100; // Show swipe-up tips after opening overview from home this number of times. private static final int SWIPE_UP_SHOW_ON_OVERVIEW_OPENED_FROM_HOME_COUNT = 3; - // Show quick scrub tips after opening overview this number of times. - private static final int QUICK_SCRUB_SHOW_ON_OVERVIEW_OPENED_COUNT = 10; // Maximum number of dismissals while still showing swipe-up tips. private static final int MAX_DISMISSAL_ON_SWIPE_UP_SHOW = 2; // Number of dismissals for swipe-up tips when exponential backoff starts. @@ -119,9 +113,7 @@ public class RecentsOnboarding { private boolean mTaskListenerRegistered; private boolean mLayoutAttachedToWindow; private boolean mHasDismissedSwipeUpTip; - private boolean mHasDismissedQuickScrubTip; private int mNumAppsLaunchedSinceSwipeUpTipDismiss; - private int mOverviewOpenedCountSinceQuickScrubTipDismiss; private final TaskStackChangeListener mTaskListener = new TaskStackChangeListener() { private String mLastPackageName; @@ -137,6 +129,10 @@ public class RecentsOnboarding { } private void onAppLaunch() { + if (!isRecentsOnboardingEnabled()) { + onDisconnectedFromLauncher(); + return; + } ActivityManager.RunningTaskInfo info = ActivityManagerWrapper.getInstance() .getRunningTask(); if (info == null || info.baseActivity == null) { @@ -153,8 +149,7 @@ public class RecentsOnboarding { int activityType = info.configuration.windowConfiguration.getActivityType(); if (activityType == ACTIVITY_TYPE_STANDARD) { boolean alreadySeenSwipeUpOnboarding = hasSeenSwipeUpOnboarding(); - boolean alreadySeenQuickScrubsOnboarding = hasSeenQuickScrubOnboarding(); - if (alreadySeenSwipeUpOnboarding && alreadySeenQuickScrubsOnboarding) { + if (alreadySeenSwipeUpOnboarding) { onDisconnectedFromLauncher(); return; } @@ -188,22 +183,6 @@ public class RecentsOnboarding { notifyOnTip(VISIBLE, RECENTS_SWIPE_UP_ONBOARDING_TIP); } } - } else { - if (getOpenedOverviewCount() >= QUICK_SCRUB_SHOW_ON_OVERVIEW_OPENED_COUNT) { - if (mHasDismissedQuickScrubTip) { - if (mOverviewOpenedCountSinceQuickScrubTipDismiss - >= QUICK_SCRUB_SHOW_ON_OVERVIEW_OPENED_COUNT) { - mOverviewOpenedCountSinceQuickScrubTipDismiss = 0; - shouldLog = show(R.string.recents_quick_scrub_onboarding); - } - } else { - shouldLog = show(R.string.recents_quick_scrub_onboarding); - } - if (shouldLog) { - notifyOnTip(VISIBLE, RECENTS_QUICK_SCRUB_ONBOARDING_TIP); - } - } - } } else { hide(false); @@ -221,27 +200,12 @@ public class RecentsOnboarding { if (fromHome) { incrementOpenedOverviewFromHomeCount(); } - incrementOpenedOverviewCount(); - - if (getOpenedOverviewCount() >= QUICK_SCRUB_SHOW_ON_OVERVIEW_OPENED_COUNT) { - if (mHasDismissedQuickScrubTip) { - mOverviewOpenedCountSinceQuickScrubTipDismiss++; - } - } } @Override public void onQuickStepStarted() { hide(true); } - - @Override - public void onQuickScrubStarted() { - boolean alreadySeenQuickScrubsOnboarding = hasSeenQuickScrubOnboarding(); - if (!alreadySeenQuickScrubsOnboarding) { - setHasSeenQuickScrubOnboarding(true); - } - } }; private final View.OnAttachStateChangeListener mOnAttachStateChangeListener @@ -258,8 +222,6 @@ public class RecentsOnboarding { mLayoutAttachedToWindow = true; if (view.getTag().equals(R.string.recents_swipe_up_onboarding)) { mHasDismissedSwipeUpTip = false; - } else { - mHasDismissedQuickScrubTip = false; } } } @@ -268,17 +230,6 @@ public class RecentsOnboarding { public void onViewDetachedFromWindow(View view) { if (view == mLayout) { mLayoutAttachedToWindow = false; - if (view.getTag().equals(R.string.recents_quick_scrub_onboarding)) { - mHasDismissedQuickScrubTip = true; - if (hasDismissedQuickScrubOnboardingOnce()) { - // If user dismisses the quick scrub tip twice, we consider user has seen it - // and do not show it again. - setHasSeenQuickScrubOnboarding(true); - } else { - setHasDismissedQuickScrubOnboardingOnce(true); - } - mOverviewOpenedCountSinceQuickScrubTipDismiss = 0; - } mBroadcastDispatcher.unregisterReceiver(mReceiver); } } @@ -314,8 +265,6 @@ public class RecentsOnboarding { setHasSeenSwipeUpOnboarding(true); } notifyOnTip(DISMISS, RECENTS_SWIPE_UP_ONBOARDING_TIP); - } else { - notifyOnTip(DISMISS, RECENTS_QUICK_SCRUB_ONBOARDING_TIP); } }); @@ -330,10 +279,7 @@ public class RecentsOnboarding { if (RESET_PREFS_FOR_DEBUG) { setHasSeenSwipeUpOnboarding(false); - setHasSeenQuickScrubOnboarding(false); setDismissedSwipeUpOnboardingCount(0); - setHasDismissedQuickScrubOnboardingOnce(false); - setOpenedOverviewCount(0); setOpenedOverviewFromHomeCount(0); } } @@ -353,11 +299,11 @@ public class RecentsOnboarding { } public void onConnectedToLauncher() { - if (!ONBOARDING_ENABLED || QuickStepContract.isGesturalMode(mNavBarMode)) { + if (!isRecentsOnboardingEnabled()) { return; } - if (hasSeenSwipeUpOnboarding() && hasSeenQuickScrubOnboarding()) { + if (hasSeenSwipeUpOnboarding()) { return; } @@ -372,7 +318,6 @@ public class RecentsOnboarding { } public void onDisconnectedFromLauncher() { - if (mOverviewProxyListenerRegistered) { mOverviewProxyService.removeCallback(mOverviewProxyListener); mOverviewProxyListenerRegistered = false; @@ -383,9 +328,7 @@ public class RecentsOnboarding { } mHasDismissedSwipeUpTip = false; - mHasDismissedQuickScrubTip = false; mNumAppsLaunchedSinceSwipeUpTipDismiss = 0; - mOverviewOpenedCountSinceQuickScrubTipDismiss = 0; hide(true); } @@ -472,16 +415,11 @@ public class RecentsOnboarding { pw.println(" mOverviewProxyListenerRegistered: " + mOverviewProxyListenerRegistered); pw.println(" mLayoutAttachedToWindow: " + mLayoutAttachedToWindow); pw.println(" mHasDismissedSwipeUpTip: " + mHasDismissedSwipeUpTip); - pw.println(" mHasDismissedQuickScrubTip: " + mHasDismissedQuickScrubTip); pw.println(" mNumAppsLaunchedSinceSwipeUpTipDismiss: " + mNumAppsLaunchedSinceSwipeUpTipDismiss); pw.println(" hasSeenSwipeUpOnboarding: " + hasSeenSwipeUpOnboarding()); - pw.println(" hasSeenQuickScrubOnboarding: " + hasSeenQuickScrubOnboarding()); pw.println(" getDismissedSwipeUpOnboardingCount: " + getDismissedSwipeUpOnboardingCount()); - pw.println(" hasDismissedQuickScrubOnboardingOnce: " - + hasDismissedQuickScrubOnboardingOnce()); - pw.println(" getOpenedOverviewCount: " + getOpenedOverviewCount()); pw.println(" getOpenedOverviewFromHomeCount: " + getOpenedOverviewFromHomeCount()); } @@ -501,25 +439,17 @@ public class RecentsOnboarding { return lp; } + private boolean isRecentsOnboardingEnabled() { + return ONBOARDING_ENABLED && !QuickStepContract.isGesturalMode(mNavBarMode); + } + private boolean hasSeenSwipeUpOnboarding() { return Prefs.getBoolean(mContext, HAS_SEEN_RECENTS_SWIPE_UP_ONBOARDING, false); } private void setHasSeenSwipeUpOnboarding(boolean hasSeenSwipeUpOnboarding) { Prefs.putBoolean(mContext, HAS_SEEN_RECENTS_SWIPE_UP_ONBOARDING, hasSeenSwipeUpOnboarding); - if (hasSeenSwipeUpOnboarding && hasSeenQuickScrubOnboarding()) { - onDisconnectedFromLauncher(); - } - } - - private boolean hasSeenQuickScrubOnboarding() { - return Prefs.getBoolean(mContext, HAS_SEEN_RECENTS_QUICK_SCRUB_ONBOARDING, false); - } - - private void setHasSeenQuickScrubOnboarding(boolean hasSeenQuickScrubOnboarding) { - Prefs.putBoolean(mContext, HAS_SEEN_RECENTS_QUICK_SCRUB_ONBOARDING, - hasSeenQuickScrubOnboarding); - if (hasSeenQuickScrubOnboarding && hasSeenSwipeUpOnboarding()) { + if (hasSeenSwipeUpOnboarding) { onDisconnectedFromLauncher(); } } @@ -533,16 +463,6 @@ public class RecentsOnboarding { dismissedSwipeUpOnboardingCount); } - private boolean hasDismissedQuickScrubOnboardingOnce() { - return Prefs.getBoolean(mContext, HAS_DISMISSED_RECENTS_QUICK_SCRUB_ONBOARDING_ONCE, false); - } - - private void setHasDismissedQuickScrubOnboardingOnce( - boolean hasDismissedQuickScrubOnboardingOnce) { - Prefs.putBoolean(mContext, HAS_DISMISSED_RECENTS_QUICK_SCRUB_ONBOARDING_ONCE, - hasDismissedQuickScrubOnboardingOnce); - } - private int getOpenedOverviewFromHomeCount() { return Prefs.getInt(mContext, OVERVIEW_OPENED_FROM_HOME_COUNT, 0); } @@ -559,22 +479,6 @@ public class RecentsOnboarding { Prefs.putInt(mContext, OVERVIEW_OPENED_FROM_HOME_COUNT, openedOverviewFromHomeCount); } - private int getOpenedOverviewCount() { - return Prefs.getInt(mContext, OVERVIEW_OPENED_COUNT, 0); - } - - private void incrementOpenedOverviewCount() { - int openedOverviewCount = getOpenedOverviewCount(); - if (openedOverviewCount >= QUICK_SCRUB_SHOW_ON_OVERVIEW_OPENED_COUNT) { - return; - } - setOpenedOverviewCount(openedOverviewCount + 1); - } - - private void setOpenedOverviewCount(int openedOverviewCount) { - Prefs.putInt(mContext, OVERVIEW_OPENED_COUNT, openedOverviewCount); - } - private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) {