Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e0751ba authored by yzj's avatar yzj
Browse files

Add settings for wear sysui package name and main activity name.

Bug: 196073945
Fix: 196073945
Test: manual test
Change-Id: I753b3b98b32f889d2b13f688e4e34a1d610ac584
parent 45d0f4b8
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -16918,6 +16918,21 @@ public final class Settings {
             * @hide
             */
            public static final String WRIST_ORIENTATION_MODE = "wear_wrist_orientation_mode";
            /**
             * Setting indicating the name of the Wear OS app package containing the device's sysui.
             *
             * @hide
             */
            public static final String CLOCKWORK_SYSUI_PACKAGE = "clockwork_sysui_package";
            /**
             * Setting indicating the name of the main activity of the Wear OS sysui.
             *
             * @hide
             */
            public static final String CLOCKWORK_SYSUI_MAIN_ACTIVITY =
                    "clockwork_sysui_main_activity";
        }
    }
+6 −0
Original line number Diff line number Diff line
@@ -5174,4 +5174,10 @@
         This flag should be enabled only when the product does not have any UI to toggle airplane
         mode like automotive devices.-->
    <bool name="config_autoResetAirplaneMode">false</bool>

    <!-- Wear OS: the name of the package containing the device's sysui. -->
    <string name="config_wearSysUiPackage" translatable="false"/>

    <!-- Wear OS: the name of the main activity of the device's sysui. -->
    <string name="config_wearSysUiMainActivity" translatable="false"/>
</resources>
+3 −0
Original line number Diff line number Diff line
@@ -4469,4 +4469,7 @@
  <java-symbol type="fraction" name="global_actions_horizontal_padding_percentage" />
  <java-symbol type="drawable" name="global_actions_item_red_background" />
  <java-symbol type="color" name="wear_material_grey_900" />

  <java-symbol type="string" name="config_wearSysUiPackage"/>
  <java-symbol type="string" name="config_wearSysUiMainActivity"/>
</resources>
+209 −203
Original line number Diff line number Diff line
@@ -5194,8 +5194,8 @@ public class SettingsProvider extends ContentProvider {

                if (currentVersion == 203) {
                    // Version 203: initialize entries migrated from wear settings provide.
                        initGlobalSettingsDefaultValForWearLocked(Global.Wearable.HAS_PAY_TOKENS,
                                false);
                    initGlobalSettingsDefaultValForWearLocked(
                            Global.Wearable.HAS_PAY_TOKENS, false);
                    initGlobalSettingsDefaultValForWearLocked(
                            Global.Wearable.GMS_CHECKIN_TIMEOUT_MIN, 6);
                    initGlobalSettingsDefaultValForWearLocked(
@@ -5205,8 +5205,8 @@ public class SettingsProvider extends ContentProvider {
                                    .getBoolean(R.bool.def_wearable_hotwordDetectionEnabled));
                    initGlobalSettingsDefaultValForWearLocked(
                            Global.Wearable.SMART_REPLIES_ENABLED, false);
                        Setting locationMode = getSecureSettingsLocked(userId)
                                                        .getSettingLocked(Secure.LOCATION_MODE);
                    Setting locationMode =
                            getSecureSettingsLocked(userId).getSettingLocked(Secure.LOCATION_MODE);
                    initGlobalSettingsDefaultValForWearLocked(
                            Global.Wearable.OBTAIN_PAIRED_DEVICE_LOCATION,
                            !locationMode.isNull()
@@ -5251,8 +5251,7 @@ public class SettingsProvider extends ContentProvider {
                                    .getResources()
                                    .getBoolean(R.bool.def_wearable_upDownGesturesEnabled));
                    initGlobalSettingsDefaultValForWearLocked(
                                Global.Wearable.SETUP_SKIPPED,
                                Global.Wearable.SETUP_SKIPPED_UNKNOWN);
                            Global.Wearable.SETUP_SKIPPED, Global.Wearable.SETUP_SKIPPED_UNKNOWN);
                    initGlobalSettingsDefaultValForWearLocked(
                            Global.Wearable.LAST_CALL_FORWARD_ACTION,
                            Global.Wearable.CALL_FORWARD_NO_LAST_ACTION);
@@ -5273,10 +5272,8 @@ public class SettingsProvider extends ContentProvider {
                            getContext()
                                    .getResources()
                                    .getInteger(
                                                R.integer
                                                        .def_wearable_squareScreenCornerRoundness));
                        initGlobalSettingsDefaultValForWearLocked(
                                Global.Wearable.BUTTON_SET, false);
                                            R.integer.def_wearable_squareScreenCornerRoundness));
                    initGlobalSettingsDefaultValForWearLocked(Global.Wearable.BUTTON_SET, false);
                    initGlobalSettingsDefaultValForWearLocked(
                            Global.Wearable.SIDE_BUTTON,
                            getContext()
@@ -5287,18 +5284,14 @@ public class SettingsProvider extends ContentProvider {
                            Long.parseLong(
                                    getContext()
                                            .getResources()
                                                .getString(
                                                        R.string.def_wearable_androidWearVersion)));
                                            .getString(R.string.def_wearable_androidWearVersion)));
                    final int editionGlobal = 1;
                    final int editionLocal = 2;
                        boolean isLe =
                                getContext().getPackageManager().hasSystemFeature("cn.google");
                    boolean isLe = getContext().getPackageManager().hasSystemFeature("cn.google");
                    initGlobalSettingsDefaultValForWearLocked(
                                Global.Wearable.SYSTEM_EDITION,
                                isLe ? editionLocal : editionGlobal);
                            Global.Wearable.SYSTEM_EDITION, isLe ? editionLocal : editionGlobal);
                    initGlobalSettingsDefaultValForWearLocked(
                                Global.Wearable.SYSTEM_CAPABILITIES,
                                getWearSystemCapabilities(isLe));
                            Global.Wearable.SYSTEM_CAPABILITIES, getWearSystemCapabilities(isLe));
                    initGlobalSettingsDefaultValForWearLocked(
                            Global.Wearable.WEAR_PLATFORM_MR_NUMBER,
                            SystemProperties.getInt("ro.cw_build.platform_mr", 0));
@@ -5316,8 +5309,7 @@ public class SettingsProvider extends ContentProvider {
                            Settings.Global.Wearable.MOBILE_SIGNAL_DETECTOR,
                            getContext()
                                    .getResources()
                                        .getBoolean(
                                                R.bool.def_wearable_mobileSignalDetectorAllowed));
                                    .getBoolean(R.bool.def_wearable_mobileSignalDetectorAllowed));
                    initGlobalSettingsDefaultValForWearLocked(
                            Global.Wearable.AMBIENT_ENABLED,
                            getContext()
@@ -5364,15 +5356,13 @@ public class SettingsProvider extends ContentProvider {
                            Settings.Global.Wearable.HFP_CLIENT_UNSET);
                    Setting disabledProfileSetting =
                            getGlobalSettingsLocked()
                                        .getSettingLocked(
                                                Settings.Global.BLUETOOTH_DISABLED_PROFILES);
                                    .getSettingLocked(Settings.Global.BLUETOOTH_DISABLED_PROFILES);
                    final long disabledProfileSettingValue =
                            disabledProfileSetting.isNull()
                                    ? 0
                                    : Long.parseLong(disabledProfileSetting.getValue());
                    final boolean isHfpClientProfileEnabled =
                                (disabledProfileSettingValue
                                                & (1 << BluetoothProfile.HEADSET_CLIENT))
                            (disabledProfileSettingValue & (1 << BluetoothProfile.HEADSET_CLIENT))
                                    == 0;
                    initGlobalSettingsDefaultValForWearLocked(
                            Settings.Global.Wearable.HFP_CLIENT_PROFILE_ENABLED,
@@ -5395,7 +5385,23 @@ public class SettingsProvider extends ContentProvider {
                            Settings.Global.Wearable.BURN_IN_PROTECTION_ENABLED,
                            defaultBurnInProtectionEnabled || forceBurnInProtection);

                        // TODO(b/164398026): add necessary initialization logic for all entries.
                    initGlobalSettingsDefaultValForWearLocked(
                            Settings.Global.Wearable.CLOCKWORK_SYSUI_PACKAGE,
                            getContext()
                                    .getResources()
                                    .getString(
                                            com.android.internal.R.string.config_wearSysUiPackage));
                    initGlobalSettingsDefaultValForWearLocked(
                            Settings.Global.Wearable.CLOCKWORK_SYSUI_MAIN_ACTIVITY,
                            getContext()
                                    .getResources()
                                    .getString(
                                            com.android
                                                    .internal
                                                    .R
                                                    .string
                                                    .config_wearSysUiMainActivity));

                    currentVersion = 204;
                }

+3 −1
Original line number Diff line number Diff line
@@ -667,7 +667,9 @@ public class SettingsBackupTest {
                    Settings.Global.Wearable.UNGAZE_ENABLED,
                    Settings.Global.Wearable.WEAR_ACTIVITY_AUTO_RESUME_TIMEOUT_MS,
                    Settings.Global.Wearable.BURN_IN_PROTECTION_ENABLED,
                    Settings.Global.Wearable.WRIST_ORIENTATION_MODE);
                    Settings.Global.Wearable.WRIST_ORIENTATION_MODE,
                    Settings.Global.Wearable.CLOCKWORK_SYSUI_PACKAGE,
                    Settings.Global.Wearable.CLOCKWORK_SYSUI_MAIN_ACTIVITY);

    private static final Set<String> BACKUP_DENY_LIST_SECURE_SETTINGS =
             newHashSet(