diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 01d75e88a17..6e22780c3d7 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,5 +1,6 @@
[Hook Scripts]
-checkcolor_hook = ${REPO_ROOT}/prebuilts/checkcolor/checkcolor.py -p .
+# TODO(b/377902600): Re-enable this hook once it is fixed.
+#checkcolor_hook = ${REPO_ROOT}/prebuilts/checkcolor/checkcolor.py -p .
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
diff --git a/aconfig/settings_biometrics_integration_declarations.aconfig b/aconfig/settings_biometrics_integration_declarations.aconfig
index 8168c85d394..cc756c6d587 100644
--- a/aconfig/settings_biometrics_integration_declarations.aconfig
+++ b/aconfig/settings_biometrics_integration_declarations.aconfig
@@ -41,3 +41,14 @@ flag {
description: "This flag controls whether the onboarding education settings UX should be enabled"
bug: "370940762"
}
+
+flag {
+ name: "biometric_onboarding_education"
+ namespace: "biometrics_integration"
+ description: "This flag controls whether the onboarding education settings UX should be enabled"
+ bug: "370940762"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4d51512d29f..2de7e883dfb 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -470,6 +470,8 @@
Region preference
Type language name
+
+ More language settings
@@ -3048,7 +3050,7 @@
Modes settings
- Even dimmer
+ Extra dim
Allow device to go dimmer than usual
@@ -12302,8 +12304,10 @@
Can’t turn on %1$s
To turn on %1$s, first end the satellite connection
-
+
Satellite connectivity
+
+ Satellite connectivity
diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml
index fb79346b3b8..f9f423e5ca5 100644
--- a/res/xml/language_settings.xml
+++ b/res/xml/language_settings.xml
@@ -28,12 +28,13 @@
android:title="@string/system_language"
android:fragment="com.android.settings.localepicker.LocaleListEditor"
settings:controller="com.android.settings.language.PhoneLanguagePreferenceController" />
+
+ settings:controller="com.android.settings.applications.appinfo.AppsLocalePreferenceController">
@@ -48,6 +49,22 @@
+
+
+
+
+
+
mInvisibleProfiles = Collections.emptySet();
private final AtomicReference> mAdditionalInvisibleProfiles =
@@ -378,6 +381,16 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
return result;
}
+ private boolean isCurrentDeviceInOrByPassAllowList() {
+ if (!SystemProperties.getBoolean(LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY, true)) {
+ return false;
+ }
+ return SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false)
+ || isModelNameInAllowList(
+ BluetoothUtils.getStringMetaData(
+ mCachedDevice.getDevice(), METADATA_MODEL_NAME));
+ }
+
/**
* Disable the Le Audio profile for each of the Le Audio devices.
*
@@ -389,6 +402,11 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
return;
}
+ mMetricsFeatureProvider.action(
+ mContext,
+ SettingsEnums.ACTION_BLUETOOTH_PROFILE_LE_AUDIO_OFF,
+ isCurrentDeviceInOrByPassAllowList());
+
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
LocalBluetoothProfile broadcastAssistant =
mProfileManager.getLeAudioBroadcastAssistantProfile();
@@ -427,6 +445,11 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
return;
}
+ mMetricsFeatureProvider.action(
+ mContext,
+ SettingsEnums.ACTION_BLUETOOTH_PROFILE_LE_AUDIO_ON,
+ isCurrentDeviceInOrByPassAllowList());
+
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
Log.i(TAG, "Disabling classic audio profiles because dual mode is disabled");
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getA2dpProfile());
diff --git a/src/com/android/settings/language/MoreLanguagesSettingsCategoryController.java b/src/com/android/settings/language/MoreLanguagesSettingsCategoryController.java
new file mode 100644
index 00000000000..3f2f9d77737
--- /dev/null
+++ b/src/com/android/settings/language/MoreLanguagesSettingsCategoryController.java
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+/**
+ * Controller for the "More language settings" category in the Language & region settings.
+ */
+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/network/telephony/SatelliteSettingPreferenceController.java b/src/com/android/settings/network/telephony/SatelliteSettingPreferenceController.java
index 9ca0294ebe6..efdd9cb9ca5 100644
--- a/src/com/android/settings/network/telephony/SatelliteSettingPreferenceController.java
+++ b/src/com/android/settings/network/telephony/SatelliteSettingPreferenceController.java
@@ -86,6 +86,7 @@ public class SatelliteSettingPreferenceController extends
@Override
public void displayPreference(@NonNull PreferenceScreen screen) {
super.displayPreference(screen);
+ updateState(screen.findPreference(getPreferenceKey()));
}
@Override
diff --git a/src/com/android/settings/network/telephony/SatelliteSettingsPreferenceCategoryController.java b/src/com/android/settings/network/telephony/SatelliteSettingsPreferenceCategoryController.java
index 951d9ca34d0..688e7b4e239 100644
--- a/src/com/android/settings/network/telephony/SatelliteSettingsPreferenceCategoryController.java
+++ b/src/com/android/settings/network/telephony/SatelliteSettingsPreferenceCategoryController.java
@@ -16,55 +16,120 @@
package com.android.settings.network.telephony;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
+
import android.content.Context;
-import android.os.PersistableBundle;
-import android.telephony.CarrierConfigManager;
-import android.telephony.satellite.SatelliteManager;
+import android.telephony.TelephonyCallback;
+import android.telephony.TelephonyManager;
+import android.telephony.satellite.NtnSignalStrength;
import android.util.Log;
-import com.android.internal.telephony.flags.Flags;
-import com.android.settings.network.CarrierConfigCache;
+import androidx.annotation.NonNull;
+import androidx.annotation.VisibleForTesting;
+import androidx.lifecycle.DefaultLifecycleObserver;
+import androidx.lifecycle.LifecycleOwner;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceScreen;
-/** Preference controller for Satellite functions in mobile network settings.*/
+import com.android.settings.R;
+
+import java.util.List;
+
+/** Preference controller for Satellite functions in mobile network settings. */
public class SatelliteSettingsPreferenceCategoryController
- extends TelephonyBasePreferenceController {
+ extends TelephonyBasePreferenceController implements DefaultLifecycleObserver {
private static final String TAG = "SatelliteSettingsPrefCategoryCon";
- private CarrierConfigCache mCarrierConfigCache;
- private SatelliteManager mSatelliteManager;
+ private PreferenceCategory mPreferenceCategory;
+ private TelephonyManager mTelephonyManager = null;
+
+ @VisibleForTesting
+ final CarrierRoamingNtnModeCallback mCarrierRoamingNtnModeCallback =
+ new CarrierRoamingNtnModeCallback();
public SatelliteSettingsPreferenceCategoryController(Context context, String key) {
super(context, key);
- mCarrierConfigCache = CarrierConfigCache.getInstance(context);
- mSatelliteManager = context.getSystemService(SatelliteManager.class);
+ setAvailabilityStatus(UNSUPPORTED_ON_DEVICE);
+ mTelephonyManager = context.getSystemService(TelephonyManager.class);
}
/**
* Set subId for Satellite Settings category .
+ *
* @param subId subscription ID.
*/
public void init(int subId) {
Log.d(TAG, "init(), subId=" + subId);
mSubId = subId;
+ mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ mPreferenceCategory = screen.findPreference(getPreferenceKey());
+ if (mPreferenceCategory.getPreferenceCount() > 0) {
+ for (int i = 0; i < mPreferenceCategory.getPreferenceCount(); i++) {
+ if (mPreferenceCategory.getPreference(i).isVisible()) {
+ setAvailabilityStatus(AVAILABLE_UNSEARCHABLE);
+ break;
+ }
+ }
+ }
}
@Override
public int getAvailabilityStatus(int subId) {
- if (!Flags.carrierEnabledSatelliteFlag()) {
- Log.d(TAG, "getAvailabilityStatus(" + subId + ") : carrierEnabledSatelliteFlag "
- + "is disabled");
- return UNSUPPORTED_ON_DEVICE;
+ return isAvailable() ? AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE;
+ }
+
+ @Override
+ public void onResume(@NonNull LifecycleOwner owner) {
+ mTelephonyManager.registerTelephonyCallback(mContext.getMainExecutor(),
+ mCarrierRoamingNtnModeCallback);
+ }
+
+ @Override
+ public void onPause(@NonNull LifecycleOwner owner) {
+ mTelephonyManager.unregisterTelephonyCallback(mCarrierRoamingNtnModeCallback);
+ }
+
+ @VisibleForTesting
+ class CarrierRoamingNtnModeCallback extends TelephonyCallback implements
+ TelephonyCallback.CarrierRoamingNtnModeListener {
+ @Override
+ public void onCarrierRoamingNtnAvailableServicesChanged(List availableServices) {
+ CarrierRoamingNtnModeListener.super.onCarrierRoamingNtnAvailableServicesChanged(
+ availableServices);
+ boolean isSmsAvailable = availableServices.contains(SERVICE_TYPE_SMS);
+ boolean isDataAvailable = availableServices.contains(SERVICE_TYPE_DATA);
+ Log.i(TAG, "isSmsAvailable : " + isSmsAvailable
+ + " / isDataAvailable " + isDataAvailable);
+ if (mPreferenceCategory == null) {
+ Log.d(TAG, "Satellite preference category is not initialized yet");
+ return;
+ }
+ if (isDataAvailable) {
+ mPreferenceCategory.setTitle(R.string.category_title_satellite_connectivity);
+ } else if (isSmsAvailable) {
+ mPreferenceCategory.setTitle(R.string.satellite_setting_title);
+ }
}
- if (mSatelliteManager == null) {
- Log.d(TAG, "getAvailabilityStatus(" + subId + ") : SatelliteManager is null");
- return UNSUPPORTED_ON_DEVICE;
+ @Override
+ public void onCarrierRoamingNtnEligibleStateChanged(boolean eligible) {
+ // Do nothing
}
- final PersistableBundle carrierConfig = mCarrierConfigCache.getConfigForSubId(subId);
- final boolean isSatelliteAttachSupported = carrierConfig.getBoolean(
- CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL);
+ @Override
+ public void onCarrierRoamingNtnModeChanged(boolean active) {
+ // Do nothing
+ }
- return isSatelliteAttachSupported ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+ @Override
+ public void onCarrierRoamingNtnSignalStrengthChanged(NtnSignalStrength ntnSignalStrength) {
+ // Do nothing
+ }
}
}
diff --git a/tests/unit/src/com/android/settings/network/telephony/SatelliteSettingsPreferenceCategoryControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/SatelliteSettingsPreferenceCategoryControllerTest.java
index 3b6e9434ba8..52c317996d5 100644
--- a/tests/unit/src/com/android/settings/network/telephony/SatelliteSettingsPreferenceCategoryControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/SatelliteSettingsPreferenceCategoryControllerTest.java
@@ -16,38 +16,37 @@
package com.android.settings.network.telephony;
-import static com.android.settings.core.BasePreferenceController.AVAILABLE;
-import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
import android.content.Context;
import android.os.Looper;
-import android.os.PersistableBundle;
-import android.platform.test.annotations.DisableFlags;
-import android.platform.test.annotations.EnableFlags;
-import android.platform.test.flag.junit.SetFlagsRule;
-import android.telephony.CarrierConfigManager;
-import android.telephony.satellite.SatelliteManager;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceManager;
+import androidx.preference.PreferenceScreen;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import com.android.internal.telephony.flags.Flags;
-import com.android.settings.network.CarrierConfigCache;
+import com.android.settings.R;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
+import java.util.List;
+
@RunWith(AndroidJUnit4.class)
public class SatelliteSettingsPreferenceCategoryControllerTest {
private static final String KEY = "key";
@@ -55,16 +54,9 @@ public class SatelliteSettingsPreferenceCategoryControllerTest {
@Rule
public final MockitoRule mMockitoRule = MockitoJUnit.rule();
- @Rule
- public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
-
- @Mock
- private CarrierConfigCache mCarrierConfigCache;
private Context mContext = null;
- private SatelliteManager mSatelliteManager = null;
private SatelliteSettingsPreferenceCategoryController mController = null;
- private PersistableBundle mCarrierConfig = new PersistableBundle();
@Before
public void setUp() {
@@ -72,25 +64,38 @@ public class SatelliteSettingsPreferenceCategoryControllerTest {
Looper.prepare();
}
mContext = spy(ApplicationProvider.getApplicationContext());
- mSatelliteManager = new SatelliteManager(mContext);
- CarrierConfigCache.setTestInstance(mContext, mCarrierConfigCache);
- when(mContext.getSystemService(SatelliteManager.class)).thenReturn(mSatelliteManager);
mController = new SatelliteSettingsPreferenceCategoryController(mContext, KEY);
}
@Test
- @DisableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
- public void getAvailabilityStatus_featureDisabled_returnUnsupport() {
+ public void getAvailabilityStatus_default_returnUnsupported() {
int result = mController.getAvailabilityStatus(TEST_SUB_ID);
-
assertThat(result).isEqualTo(UNSUPPORTED_ON_DEVICE);
}
@Test
- @EnableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
- public void getAvailabilityStatus_noSatellite_returnUnsupport() {
- when(mContext.getSystemService(SatelliteManager.class)).thenReturn(null);
- mController = new SatelliteSettingsPreferenceCategoryController(mContext, KEY);
+ public void getAvailabilityStatus_hasAvailablePreference_returnAvailableUnsearchable() {
+ PreferenceManager preferenceManager = new PreferenceManager(mContext);
+ PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
+ PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
+ preferenceCategory.setKey(KEY);
+ preferenceScreen.addPreference(preferenceCategory);
+ preferenceCategory.addPreference(new Preference(mContext));
+ mController.displayPreference(preferenceScreen);
+
+ int result = mController.getAvailabilityStatus(TEST_SUB_ID);
+
+ assertThat(result).isEqualTo(AVAILABLE_UNSEARCHABLE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_noAvailablePreference_returnUnsupported() {
+ PreferenceManager preferenceManager = new PreferenceManager(mContext);
+ PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
+ PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
+ preferenceCategory.setKey(KEY);
+ preferenceScreen.addPreference(preferenceCategory);
+ mController.displayPreference(preferenceScreen);
int result = mController.getAvailabilityStatus(TEST_SUB_ID);
@@ -98,30 +103,37 @@ public class SatelliteSettingsPreferenceCategoryControllerTest {
}
@Test
- @EnableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
- public void getAvailabilityStatus_carrierIsNotSupport_returnUnavailable() {
- when(mContext.getSystemService(SatelliteManager.class)).thenReturn(null);
- mCarrierConfig.putBoolean(
- CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
- false);
- when(mCarrierConfigCache.getConfigForSubId(TEST_SUB_ID)).thenReturn(mCarrierConfig);
+ public void setPreferenceTitle_hasDataService_showConnectivity() {
+ PreferenceManager preferenceManager = new PreferenceManager(mContext);
+ PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
+ PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
+ preferenceCategory.setKey(KEY);
+ preferenceScreen.addPreference(preferenceCategory);
+ preferenceCategory.addPreference(new Preference(mContext));
+ mController.displayPreference(preferenceScreen);
- int result = mController.getAvailabilityStatus(TEST_SUB_ID);
+ mController.mCarrierRoamingNtnModeCallback.onCarrierRoamingNtnAvailableServicesChanged(
+ List.of(SERVICE_TYPE_DATA));
- assertThat(result).isEqualTo(CONDITIONALLY_UNAVAILABLE);
+ assertThat(preferenceCategory.getTitle()).isEqualTo(
+ mContext.getString(R.string.satellite_setting_connectivity));
}
+
@Test
- @EnableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
- public void getAvailabilityStatus_carrierIsSupport_returnAvailable() {
- when(mContext.getSystemService(SatelliteManager.class)).thenReturn(null);
- mCarrierConfig.putBoolean(
- CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
- true);
- when(mCarrierConfigCache.getConfigForSubId(TEST_SUB_ID)).thenReturn(mCarrierConfig);
+ public void setPreferenceTitle_hasSmsService_showMessaging() {
+ PreferenceManager preferenceManager = new PreferenceManager(mContext);
+ PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
+ PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
+ preferenceCategory.setKey(KEY);
+ preferenceScreen.addPreference(preferenceCategory);
+ preferenceCategory.addPreference(new Preference(mContext));
+ mController.displayPreference(preferenceScreen);
- int result = mController.getAvailabilityStatus(TEST_SUB_ID);
+ mController.mCarrierRoamingNtnModeCallback.onCarrierRoamingNtnAvailableServicesChanged(
+ List.of(SERVICE_TYPE_SMS));
- assertThat(result).isEqualTo(AVAILABLE);
+ assertThat(preferenceCategory.getTitle()).isEqualTo(
+ mContext.getString(R.string.satellite_setting_title));
}
}