From 2f996492fff2e2c0e63eb2c5a079bdbbd2af2fb0 Mon Sep 17 00:00:00 2001 From: "Priyanka Advani (xWF)" Date: Thu, 21 Nov 2024 18:57:44 +0000 Subject: [PATCH] Revert "Use flag to control the hierarchy tree changes" This reverts commit 34ea3dc0751d7ea52b2d4bb531567a84243b07c1. Reason for revert: Droidmonitor created revert due to b/380258772. Will be verifying through ABTD before submission. Change-Id: Ife4707fba00b52ade53eb6dc2f4bcd7a466afe0f --- res/values/strings.xml | 14 +- res/xml/language_and_input.xml | 139 ++++++++++++++++++ res/xml/language_settings.xml | 69 --------- .../ManageAppLocalePreferenceController.java | 42 ------ ...ewManageAppLocalePreferenceController.java | 43 ------ ...reLanguagesSettingsCategoryController.java | 38 ----- .../NewTermsOfAddressController.java | 76 ---------- .../TermsOfAddressCategoryController.java | 5 +- .../NewFirstDayOfWeekController.java | 73 --------- .../NewNumberingSystemController.java | 88 ----------- ...NewRegionalFooterPreferenceController.java | 81 ---------- .../NewTemperatureUnitController.java | 74 ---------- ...RegionalPreferencesCategoryController.java | 38 ----- .../RegionalPreferencesController.java | 4 - .../RegionalPreferencesEntriesFragment.java | 12 +- .../TermsOfAddressCategoryControllerTest.java | 4 - .../FirstDayOfWeekControllerTest.java | 6 - .../NumberingSystemControllerTest.java | 5 - .../TemperatureUnitControllerTest.java | 6 - 19 files changed, 147 insertions(+), 670 deletions(-) create mode 100644 res/xml/language_and_input.xml delete mode 100644 src/com/android/settings/applications/appinfo/ManageAppLocalePreferenceController.java delete mode 100644 src/com/android/settings/applications/appinfo/NewManageAppLocalePreferenceController.java delete mode 100644 src/com/android/settings/language/MoreLanguagesSettingsCategoryController.java delete mode 100644 src/com/android/settings/localepicker/NewTermsOfAddressController.java delete mode 100644 src/com/android/settings/regionalpreferences/NewFirstDayOfWeekController.java delete mode 100644 src/com/android/settings/regionalpreferences/NewNumberingSystemController.java delete mode 100644 src/com/android/settings/regionalpreferences/NewRegionalFooterPreferenceController.java delete mode 100644 src/com/android/settings/regionalpreferences/NewTemperatureUnitController.java delete mode 100644 src/com/android/settings/regionalpreferences/RegionalPreferencesCategoryController.java diff --git a/res/values/strings.xml b/res/values/strings.xml index 232799ae467..8b5e63f4329 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -387,6 +387,12 @@ Preferred Language + + App languages + + + Set the language for each app + App language @@ -453,14 +459,6 @@ Let apps know your regional preferences so they can personalize your experience. Apps will use your regional preferences where possible. - - More language settings - - App languages - - Set the language for each app - - Regional preferences Temperature diff --git a/res/xml/language_and_input.xml b/res/xml/language_and_input.xml new file mode 100644 index 00000000000..1848f86ce4e --- /dev/null +++ b/res/xml/language_and_input.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml index 7983b05da5b..7618399db97 100644 --- a/res/xml/language_settings.xml +++ b/res/xml/language_settings.xml @@ -28,7 +28,6 @@ android:title="@string/system_language" android:fragment="com.android.settings.localepicker.LocaleListEditor" settings:controller="com.android.settings.language.PhoneLanguagePreferenceController" /> - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/android/settings/applications/appinfo/ManageAppLocalePreferenceController.java b/src/com/android/settings/applications/appinfo/ManageAppLocalePreferenceController.java deleted file mode 100644 index 60cb8be16fe..00000000000 --- a/src/com/android/settings/applications/appinfo/ManageAppLocalePreferenceController.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.applications.appinfo; - -import android.content.Context; - -import androidx.annotation.NonNull; - -import com.android.settings.core.BasePreferenceController; -import com.android.settings.flags.Flags; - -/** - * A controller to update current locale information of application - * and a entry to launch {@link ManageApplications}. - */ -public class ManageAppLocalePreferenceController extends BasePreferenceController { - public ManageAppLocalePreferenceController(@NonNull Context context, @NonNull String key) { - super(context, key); - } - - @Override - public int getAvailabilityStatus() { - if (!Flags.regionalPreferencesApiEnabled()) { - return AVAILABLE; - } - return CONDITIONALLY_UNAVAILABLE; - } -} diff --git a/src/com/android/settings/applications/appinfo/NewManageAppLocalePreferenceController.java b/src/com/android/settings/applications/appinfo/NewManageAppLocalePreferenceController.java deleted file mode 100644 index 00daab6b9a5..00000000000 --- a/src/com/android/settings/applications/appinfo/NewManageAppLocalePreferenceController.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.applications.appinfo; - -import android.content.Context; - -import androidx.annotation.NonNull; - -import com.android.settings.core.BasePreferenceController; -import com.android.settings.flags.Flags; - -/** - * A controller to update current locale information of application - * and a entry to launch {@link ManageApplications}. - */ -public class NewManageAppLocalePreferenceController extends BasePreferenceController { - - public NewManageAppLocalePreferenceController(@NonNull Context context, @NonNull String key) { - super(context, key); - } - - @Override - public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - return AVAILABLE; - } - return CONDITIONALLY_UNAVAILABLE; - } -} diff --git a/src/com/android/settings/language/MoreLanguagesSettingsCategoryController.java b/src/com/android/settings/language/MoreLanguagesSettingsCategoryController.java deleted file mode 100644 index b174ae0ceb7..00000000000 --- a/src/com/android/settings/language/MoreLanguagesSettingsCategoryController.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.settings.language; - -import android.content.Context; - -import androidx.annotation.NonNull; - -import com.android.settings.flags.Flags; -import com.android.settings.widget.PreferenceCategoryController; - -public class MoreLanguagesSettingsCategoryController extends PreferenceCategoryController { - - public MoreLanguagesSettingsCategoryController(@NonNull Context context, @NonNull String key) { - super(context, key); - } - - @Override - public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - return AVAILABLE; - } - return CONDITIONALLY_UNAVAILABLE; - } -} diff --git a/src/com/android/settings/localepicker/NewTermsOfAddressController.java b/src/com/android/settings/localepicker/NewTermsOfAddressController.java deleted file mode 100644 index fe92405f1a1..00000000000 --- a/src/com/android/settings/localepicker/NewTermsOfAddressController.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.localepicker; - -import android.content.Context; -import android.os.LocaleList; - -import androidx.annotation.NonNull; - -import com.android.internal.app.LocaleStore; -import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.flags.Flags; - -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -public class NewTermsOfAddressController extends BasePreferenceController { - - public NewTermsOfAddressController(@NonNull Context context, @NonNull String preferenceKey) { - super(context, preferenceKey); - } - - @Override - public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - if (Flags.termsOfAddressEnabled()) { - return checkAvailabilityStatus(); - } - } - return CONDITIONALLY_UNAVAILABLE; - } - - private int checkAvailabilityStatus() { - // If language is not available for system language, or if ToA does not apply to - // system language, we will hide it. - final Locale defaultLocale = Locale.getDefault(); - LocaleStore.LocaleInfo localeInfo = LocaleStore.getLocaleInfo(defaultLocale); - final List supportedLanguageList = Arrays.asList( - mContext.getResources().getStringArray( - R.array.terms_of_address_supported_languages)); - final List notSupportedLocaleList = Arrays.asList( - mContext.getResources().getStringArray( - R.array.terms_of_address_unsupported_locales)); - - final Locale locale = localeInfo.getLocale().stripExtensions(); - final String language = locale.getLanguage(); - final String localeTag = locale.toLanguageTag(); - - // Supported locales: - // 1. All French is supported except fr-CA. - // 2. QA language en-XA (LTR pseudo locale), ar_XB (RTL pseudo locale). - if ((supportedLanguageList.contains(language) - && !notSupportedLocaleList.contains(localeTag)) - || LocaleList.isPseudoLocale(locale)) { - return AVAILABLE; - } - - return CONDITIONALLY_UNAVAILABLE; - } -} diff --git a/src/com/android/settings/localepicker/TermsOfAddressCategoryController.java b/src/com/android/settings/localepicker/TermsOfAddressCategoryController.java index 1e2fbef7e83..01168c7ff7b 100644 --- a/src/com/android/settings/localepicker/TermsOfAddressCategoryController.java +++ b/src/com/android/settings/localepicker/TermsOfAddressCategoryController.java @@ -20,6 +20,7 @@ import static com.android.settings.flags.Flags.termsOfAddressEnabled; import android.content.Context; import android.os.LocaleList; +import android.text.TextUtils; import android.util.Log; import androidx.preference.PreferenceCategory; @@ -27,7 +28,6 @@ import androidx.preference.PreferenceScreen; import com.android.internal.app.LocaleStore; import com.android.settings.R; -import com.android.settings.flags.Flags; import com.android.settings.widget.PreferenceCategoryController; import java.util.Arrays; @@ -64,9 +64,6 @@ public class TermsOfAddressCategoryController extends PreferenceCategoryControll @Override public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - return CONDITIONALLY_UNAVAILABLE; - } if (!termsOfAddressEnabled()) { return CONDITIONALLY_UNAVAILABLE; diff --git a/src/com/android/settings/regionalpreferences/NewFirstDayOfWeekController.java b/src/com/android/settings/regionalpreferences/NewFirstDayOfWeekController.java deleted file mode 100644 index aa691ed0b45..00000000000 --- a/src/com/android/settings/regionalpreferences/NewFirstDayOfWeekController.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.regionalpreferences; - -import android.content.Context; -import android.provider.Settings; - -import androidx.annotation.NonNull; -import androidx.core.text.util.LocalePreferences; - -import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.flags.Flags; - -import java.util.Locale; - -/** A controller for the entry of First Day of Week's page */ -public class NewFirstDayOfWeekController extends BasePreferenceController { - - public NewFirstDayOfWeekController(@NonNull Context context, @NonNull String preferenceKey) { - super(context, preferenceKey); - } - - /** - * @return {@link AvailabilityStatus} for the Setting. This status is used to determine if the - * Setting should be shown or disabled in Settings. Further, it can be used to produce - * appropriate error / warning Slice in the case of unavailability. - *

- * The status is used for the convenience methods: {@link #isAvailable()}, {@link - * #isSupported()} - *

- * The inherited class doesn't need to check work profile if android:forWork="true" is set in - * preference xml. - */ - @Override - public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - return AVAILABLE; - } - return CONDITIONALLY_UNAVAILABLE; - } - - @Override - public CharSequence getSummary() { - String record = Settings.System.getString( - mContext.getContentResolver(), Settings.System.LOCALE_PREFERENCES); - String result = ""; - if (record != null) { - result = LocalePreferences.getFirstDayOfWeek(Locale.forLanguageTag(record), false); - } - - if (result.isEmpty()) { - result = LocalePreferences.getFirstDayOfWeek(false); - } - return result.isEmpty() - ? mContext.getString(R.string.default_string_of_regional_preference) - : RegionalPreferencesDataUtils.dayConverter(mContext, result); - } -} diff --git a/src/com/android/settings/regionalpreferences/NewNumberingSystemController.java b/src/com/android/settings/regionalpreferences/NewNumberingSystemController.java deleted file mode 100644 index 429d1f35503..00000000000 --- a/src/com/android/settings/regionalpreferences/NewNumberingSystemController.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.regionalpreferences; - -import android.content.Context; -import android.os.LocaleList; - -import androidx.annotation.NonNull; - -import com.android.internal.app.LocaleStore; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.flags.Flags; -import com.android.settings.localepicker.LocaleFeatureProviderImpl; - -import java.util.HashSet; -import java.util.Locale; -import java.util.Set; - -/** A controller for the entry of Numbering System's page */ -public class NewNumberingSystemController extends BasePreferenceController { - private static final String TAG = NewNumberingSystemController.class.getSimpleName(); - - private LocaleList mLocaleList; - public NewNumberingSystemController(@NonNull Context context, @NonNull String preferenceKey) { - super(context, preferenceKey); - // Initialize the supported languages to LocaleInfos - LocaleStore.fillCache(context); - mLocaleList = getNumberingSystemLocale(); - } - - /** - * @return {@link AvailabilityStatus} for the Setting. This status is used to determine if the - * Setting should be shown or disabled in Settings. Further, it can be used to produce - * appropriate error / warning Slice in the case of unavailability. - *

- * The status is used for the convenience methods: {@link #isAvailable()}, {@link - * #isSupported()} - *

- * The inherited class doesn't need to check work profile if android:forWork="true" is set in - * preference xml. - */ - @Override - public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - return mLocaleList.isEmpty() ? CONDITIONALLY_UNAVAILABLE : AVAILABLE; - } - return CONDITIONALLY_UNAVAILABLE; - } - - private static LocaleList getNumberingSystemLocale() { - LocaleList localeList = LocaleList.getDefault(); - Set localesHasNumberingSystems = new HashSet<>(); - for (int i = 0; i < localeList.size(); i++) { - Locale locale = localeList.get(i); - LocaleStore.LocaleInfo localeInfo = LocaleStore.getLocaleInfo(locale); - if (localeInfo.hasNumberingSystems()) { - localesHasNumberingSystems.add(locale); - } - } - return convertToLocaleList(localesHasNumberingSystems); - } - - private static LocaleList convertToLocaleList(Set locales) { - if (locales.isEmpty()) { - return LocaleList.getEmptyLocaleList(); - } - return new LocaleList(locales.stream().toArray(Locale[]::new)); - } - - @Override - public CharSequence getSummary() { - return new LocaleFeatureProviderImpl().getLocaleNames(getNumberingSystemLocale()); - } -} diff --git a/src/com/android/settings/regionalpreferences/NewRegionalFooterPreferenceController.java b/src/com/android/settings/regionalpreferences/NewRegionalFooterPreferenceController.java deleted file mode 100644 index 9c800de82c8..00000000000 --- a/src/com/android/settings/regionalpreferences/NewRegionalFooterPreferenceController.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.regionalpreferences; - -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -import androidx.annotation.NonNull; -import androidx.annotation.VisibleForTesting; -import androidx.preference.PreferenceScreen; - -import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.flags.Flags; -import com.android.settingslib.HelpUtils; -import com.android.settingslib.widget.FooterPreference; - -/** - * Preference controller for regional preference footer. - */ -public class NewRegionalFooterPreferenceController extends BasePreferenceController { - - private static final String TAG = "NewRegionalFooterPreferenceController"; - - public NewRegionalFooterPreferenceController(@NonNull Context context, @NonNull String key) { - super(context, key); - } - - @Override - public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - return AVAILABLE_UNSEARCHABLE; - } - - - return CONDITIONALLY_UNAVAILABLE; - } - - @Override - public void displayPreference(@NonNull PreferenceScreen screen) { - super.displayPreference(screen); - FooterPreference footerPreference = screen.findPreference(getPreferenceKey()); - setupFooterPreference(footerPreference); - } - - @VisibleForTesting - void setupFooterPreference(FooterPreference footerPreference) { - if (footerPreference != null) { - footerPreference.setLearnMoreAction(v -> openLocaleLearnMoreLink()); - footerPreference.setLearnMoreText(mContext.getString( - R.string.desc_regional_pref_footer_learn_more)); - } - } - - private void openLocaleLearnMoreLink() { - Intent intent = HelpUtils.getHelpIntent( - mContext, - mContext.getString(R.string.regional_pref_footer_learn_more_link), - mContext.getClass().getName()); - if (intent != null) { - mContext.startActivity(intent); - } else { - Log.w(TAG, "HelpIntent is null"); - } - } -} diff --git a/src/com/android/settings/regionalpreferences/NewTemperatureUnitController.java b/src/com/android/settings/regionalpreferences/NewTemperatureUnitController.java deleted file mode 100644 index 7d3dc3e59c6..00000000000 --- a/src/com/android/settings/regionalpreferences/NewTemperatureUnitController.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.regionalpreferences; - -import android.content.Context; -import android.provider.Settings; - -import androidx.annotation.NonNull; -import androidx.core.text.util.LocalePreferences; - -import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.flags.Flags; - -import java.util.Locale; - -/** A controller for the entry of Temperature units' page */ -public class NewTemperatureUnitController extends BasePreferenceController { - private static final String TAG = NewTemperatureUnitController.class.getSimpleName(); - public NewTemperatureUnitController(@NonNull Context context, @NonNull String preferenceKey) { - super(context, preferenceKey); - } - - /** - * @return {@link AvailabilityStatus} for the Setting. This status is used to determine if the - * Setting should be shown or disabled in Settings. Further, it can be used to produce - * appropriate error / warning Slice in the case of unavailability. - *

- * The status is used for the convenience methods: {@link #isAvailable()}, {@link - * #isSupported()} - *

- * The inherited class doesn't need to check work profile if android:forWork="true" is set in - * preference xml. - */ - @Override - public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - return AVAILABLE; - } - return CONDITIONALLY_UNAVAILABLE; - } - - @Override - public CharSequence getSummary() { - String record = Settings.System.getString( - mContext.getContentResolver(), Settings.System.LOCALE_PREFERENCES); - String result = ""; - if (record != null) { - result = LocalePreferences.getTemperatureUnit(Locale.forLanguageTag(record), false); - } - - if (result.isEmpty()) { - result = LocalePreferences.getTemperatureUnit(false); - } - - return result.isEmpty() - ? mContext.getString(R.string.default_string_of_regional_preference) - : RegionalPreferencesDataUtils.temperatureUnitsConverter(mContext, result); - } -} diff --git a/src/com/android/settings/regionalpreferences/RegionalPreferencesCategoryController.java b/src/com/android/settings/regionalpreferences/RegionalPreferencesCategoryController.java deleted file mode 100644 index ad524a4ed3c..00000000000 --- a/src/com/android/settings/regionalpreferences/RegionalPreferencesCategoryController.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.regionalpreferences; - -import android.content.Context; - -import androidx.annotation.NonNull; - -import com.android.settings.flags.Flags; -import com.android.settings.widget.PreferenceCategoryController; - -public class RegionalPreferencesCategoryController extends PreferenceCategoryController { - public RegionalPreferencesCategoryController(@NonNull Context context, @NonNull String key) { - super(context, key); - } - - @Override - public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - return AVAILABLE; - } - return CONDITIONALLY_UNAVAILABLE; - } -} diff --git a/src/com/android/settings/regionalpreferences/RegionalPreferencesController.java b/src/com/android/settings/regionalpreferences/RegionalPreferencesController.java index f194659c00b..5e5fc9d2175 100644 --- a/src/com/android/settings/regionalpreferences/RegionalPreferencesController.java +++ b/src/com/android/settings/regionalpreferences/RegionalPreferencesController.java @@ -20,7 +20,6 @@ import android.content.Context; import android.os.SystemProperties; import com.android.settings.core.BasePreferenceController; -import com.android.settings.flags.Flags; /** A controller for the entry of Regional preferences */ public class RegionalPreferencesController extends BasePreferenceController { @@ -43,9 +42,6 @@ public class RegionalPreferencesController extends BasePreferenceController { */ @Override public int getAvailabilityStatus() { - if (Flags.regionalPreferencesApiEnabled()) { - return CONDITIONALLY_UNAVAILABLE; - } return SystemProperties.getBoolean(FEATURE_PROPERTY, true) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE; } diff --git a/src/com/android/settings/regionalpreferences/RegionalPreferencesEntriesFragment.java b/src/com/android/settings/regionalpreferences/RegionalPreferencesEntriesFragment.java index 8b1e749ef79..848febcf2d2 100644 --- a/src/com/android/settings/regionalpreferences/RegionalPreferencesEntriesFragment.java +++ b/src/com/android/settings/regionalpreferences/RegionalPreferencesEntriesFragment.java @@ -17,11 +17,9 @@ package com.android.settings.regionalpreferences; import android.app.settings.SettingsEnums; -import android.content.Context; import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; -import com.android.settings.flags.Flags; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.search.SearchIndexable; @@ -57,13 +55,5 @@ public class RegionalPreferencesEntriesFragment extends DashboardFragment { } public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.regional_preference_main_page) { - @Override - protected boolean isPageSearchEnabled(Context context) { - if (Flags.regionalPreferencesApiEnabled()) { - return false; - } - return true; - } - }; + new BaseSearchIndexProvider(R.xml.regional_preference_main_page); } diff --git a/tests/unit/src/com/android/settings/localepicker/TermsOfAddressCategoryControllerTest.java b/tests/unit/src/com/android/settings/localepicker/TermsOfAddressCategoryControllerTest.java index ed878f48f2b..b025abdf06a 100644 --- a/tests/unit/src/com/android/settings/localepicker/TermsOfAddressCategoryControllerTest.java +++ b/tests/unit/src/com/android/settings/localepicker/TermsOfAddressCategoryControllerTest.java @@ -24,13 +24,10 @@ import static org.mockito.Mockito.spy; import android.content.Context; import android.os.Looper; -import android.platform.test.annotations.DisableFlags; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.android.settings.flags.Flags; - import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -68,7 +65,6 @@ public class TermsOfAddressCategoryControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getAvailabilityStatus_returnAvailable() { Locale.setDefault(Locale.forLanguageTag("fr-FR")); diff --git a/tests/unit/src/com/android/settings/regionalpreferences/FirstDayOfWeekControllerTest.java b/tests/unit/src/com/android/settings/regionalpreferences/FirstDayOfWeekControllerTest.java index 759b356cfab..062aef8393a 100644 --- a/tests/unit/src/com/android/settings/regionalpreferences/FirstDayOfWeekControllerTest.java +++ b/tests/unit/src/com/android/settings/regionalpreferences/FirstDayOfWeekControllerTest.java @@ -19,12 +19,10 @@ package com.android.settings.regionalpreferences; import static org.junit.Assert.assertEquals; import android.content.Context; -import android.platform.test.annotations.DisableFlags; import android.provider.Settings; import androidx.test.core.app.ApplicationProvider; -import com.android.settings.flags.Flags; import com.android.settings.testutils.ResourcesUtils; import org.junit.After; @@ -56,7 +54,6 @@ public class FirstDayOfWeekControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getSummary_hasProviderValue_resultIsWed() { RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "und-u-fw-wed"); @@ -67,7 +64,6 @@ public class FirstDayOfWeekControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getSummary_hasProviderValue_resultIsSat() { RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "und-u-fw-sat"); @@ -78,7 +74,6 @@ public class FirstDayOfWeekControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getSummary_noProviderValueButHasDefaultLocaleWithSubtag_resultIsSat() { RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, ""); Locale.setDefault(Locale.forLanguageTag("en-US-u-fw-sat")); @@ -90,7 +85,6 @@ public class FirstDayOfWeekControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getSummary_noProviderValueAndDefaultLocaleWithoutSubtag_resultIsdefault() { RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, ""); Locale.setDefault(Locale.forLanguageTag("en-US")); diff --git a/tests/unit/src/com/android/settings/regionalpreferences/NumberingSystemControllerTest.java b/tests/unit/src/com/android/settings/regionalpreferences/NumberingSystemControllerTest.java index bb745a6fb28..6a95bb95826 100644 --- a/tests/unit/src/com/android/settings/regionalpreferences/NumberingSystemControllerTest.java +++ b/tests/unit/src/com/android/settings/regionalpreferences/NumberingSystemControllerTest.java @@ -23,12 +23,9 @@ import static org.junit.Assert.assertEquals; import android.content.Context; import android.os.LocaleList; -import android.platform.test.annotations.DisableFlags; import androidx.test.core.app.ApplicationProvider; -import com.android.settings.flags.Flags; - import org.junit.Before; import org.junit.Test; @@ -42,7 +39,6 @@ public class NumberingSystemControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getAvailabilityStatus_noLocale_unavailable() { LocaleList.setDefault(LocaleList.forLanguageTags("en-US,zh-Hant-TW")); mController = new NumberingSystemController(mApplicationContext, "key"); @@ -53,7 +49,6 @@ public class NumberingSystemControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getAvailabilityStatus_hasLocaleWithNumberingSystems_available() { // ar-JO has different numbering system. LocaleList.setDefault(LocaleList.forLanguageTags("en-US,zh-Hant-TW,ar-JO")); diff --git a/tests/unit/src/com/android/settings/regionalpreferences/TemperatureUnitControllerTest.java b/tests/unit/src/com/android/settings/regionalpreferences/TemperatureUnitControllerTest.java index fb05dfaedb4..aa652cab1f4 100644 --- a/tests/unit/src/com/android/settings/regionalpreferences/TemperatureUnitControllerTest.java +++ b/tests/unit/src/com/android/settings/regionalpreferences/TemperatureUnitControllerTest.java @@ -19,12 +19,10 @@ package com.android.settings.regionalpreferences; import static org.junit.Assert.assertEquals; import android.content.Context; -import android.platform.test.annotations.DisableFlags; import android.provider.Settings; import androidx.test.core.app.ApplicationProvider; -import com.android.settings.flags.Flags; import com.android.settings.testutils.ResourcesUtils; import org.junit.After; @@ -56,7 +54,6 @@ public class TemperatureUnitControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getSummary_hasProviderValue_resultIsCelsius() { RegionalPreferenceTestUtils.setSettingsProviderContent( mApplicationContext, "und-u-mu-celsius"); @@ -68,7 +65,6 @@ public class TemperatureUnitControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getSummary_hasProviderValue_resultIsFahrenheit() { RegionalPreferenceTestUtils.setSettingsProviderContent( mApplicationContext, "und-u-mu-fahrenhe"); @@ -80,7 +76,6 @@ public class TemperatureUnitControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getSummary_noProviderValueButHasDefaultLocaleWithSubtag_resultIsFahrenheit() { RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, ""); Locale.setDefault(Locale.forLanguageTag("en-US-u-mu-fahrenhe")); @@ -92,7 +87,6 @@ public class TemperatureUnitControllerTest { } @Test - @DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED) public void getSummary_noProviderValueAndDefaultLocaleWithoutSubtag_resultIsDefault() { RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, ""); Locale.setDefault(Locale.forLanguageTag("en-US"));