Reset the settings key of the migration tooltips as enabled.

Root cause:
The users don't know how to remove the new floating menu on the
home screen when they upgrade from R to S.

Goals:
Show the tooltip for the users to guide them to settings page when they
upgrade to the S_MR version. They
could adjust the mode configuration as “gesture mode” to solve it based on the feature b/190563948.

Bug: 207354119
Test: manual test
Merged-In: I1c877af7658781c32cddb2bb819013f1037409de
Change-Id: Ia3685dfa36e8f571b2d0268af2616aecb56fc90b
This commit is contained in:
Peter_Liang
2021-12-07 01:33:31 +08:00
committed by PETER LIANG
parent fb1aca8138
commit ec99fb3cb3

View File

@@ -25,6 +25,7 @@ import static android.provider.Settings.Config.SYNC_DISABLED_MODE_UNTIL_REBOOT;
import static android.provider.Settings.SET_ALL_RESULT_DISABLED;
import static android.provider.Settings.SET_ALL_RESULT_FAILURE;
import static android.provider.Settings.SET_ALL_RESULT_SUCCESS;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
import static android.provider.Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_MAGNIFICATION_CONTROLLER;
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON_OVERLAY;
@@ -3585,7 +3586,7 @@ public class SettingsProvider extends ContentProvider {
}
private final class UpgradeController {
private static final int SETTINGS_VERSION = 204;
private static final int SETTINGS_VERSION = 205;
private final int mUserId;
@@ -5227,6 +5228,30 @@ public class SettingsProvider extends ContentProvider {
currentVersion = 204;
}
if (currentVersion == 204) {
// Version 204: Reset the
// Secure#ACCESSIBILITY_FLOATING_MENU_MIGRATION_TOOLTIP_PROMPT as enabled
// status for showing the tooltips.
final SettingsState secureSettings = getSecureSettingsLocked(userId);
final Setting accessibilityButtonMode = secureSettings.getSettingLocked(
Secure.ACCESSIBILITY_BUTTON_MODE);
if (!accessibilityButtonMode.isNull()
&& accessibilityButtonMode.getValue().equals(
String.valueOf(ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU))) {
if (isGestureNavigateEnabled()
&& hasValueInA11yButtonTargets(secureSettings)) {
secureSettings.insertSettingLocked(
Secure.ACCESSIBILITY_FLOATING_MENU_MIGRATION_TOOLTIP_PROMPT,
/* enabled */ "1",
/* tag= */ null,
/* makeDefault= */ false,
SettingsState.SYSTEM_PACKAGE_NAME);
}
}
currentVersion = 205;
}
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {