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
Change-Id: I1c877af7658781c32cddb2bb819013f1037409de
This commit is contained in:
Peter_Liang
2021-12-07 15:11:20 +08:00
committed by PETER LIANG
parent 22d2a97dd8
commit 053a3e313a

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;
@@ -3623,7 +3624,7 @@ public class SettingsProvider extends ContentProvider {
}
private final class UpgradeController {
private static final int SETTINGS_VERSION = 207;
private static final int SETTINGS_VERSION = 208;
private final int mUserId;
@@ -5472,6 +5473,30 @@ public class SettingsProvider extends ContentProvider {
currentVersion = 207;
}
if (currentVersion == 207) {
// Version 207: 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 = 208;
}
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {