Merge "Explicitly keep default constructor in rules without members" into main
diff --git a/aconfig/Android.bp b/aconfig/Android.bp
index 8be93f0..768db02 100644
--- a/aconfig/Android.bp
+++ b/aconfig/Android.bp
@@ -6,7 +6,7 @@
aconfig_declarations {
name: "aconfig_settings_flags",
package: "com.android.settings.flags",
- container: "system",
+ container: "system_ext",
srcs: [
"*.aconfig",
"catalyst/*.aconfig",
@@ -21,7 +21,7 @@
aconfig_declarations {
name: "factory_reset_flags",
package: "com.android.settings.factory_reset",
- container: "system",
+ container: "system_ext",
srcs: ["factory_reset/*.aconfig"],
}
@@ -33,7 +33,7 @@
aconfig_declarations {
name: "media_drm_flags",
package: "com.android.settings.media_drm",
- container: "system",
+ container: "system_ext",
srcs: ["media_drm/*.aconfig"],
}
@@ -45,7 +45,7 @@
aconfig_declarations {
name: "accessibility_flags",
package: "com.android.settings.accessibility",
- container: "system",
+ container: "system_ext",
srcs: ["accessibility/*.aconfig"],
}
@@ -57,7 +57,7 @@
aconfig_declarations {
name: "development_settings_flags",
package: "com.android.settings.development",
- container: "system",
+ container: "system_ext",
srcs: [
"development/**/*.aconfig",
],
@@ -71,7 +71,7 @@
aconfig_declarations {
name: "keyboard_flags",
package: "com.android.settings.keyboard",
- container: "system",
+ container: "system_ext",
srcs: ["keyboard/*.aconfig"],
}
diff --git a/aconfig/accessibility/accessibility_flags.aconfig b/aconfig/accessibility/accessibility_flags.aconfig
index 4a741a1..1871172 100644
--- a/aconfig/accessibility/accessibility_flags.aconfig
+++ b/aconfig/accessibility/accessibility_flags.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.accessibility"
-container: "system"
+container: "system_ext"
# NOTE: Keep alphabetized to help limit merge conflicts from multiple simultaneous editors.
diff --git a/aconfig/catalyst/about_phone.aconfig b/aconfig/catalyst/about_phone.aconfig
index 5403b65..59a2228 100644
--- a/aconfig/catalyst/about_phone.aconfig
+++ b/aconfig/catalyst/about_phone.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "catalyst_legal_information"
diff --git a/aconfig/development/settings_core_flag_declarations.aconfig b/aconfig/development/settings_core_flag_declarations.aconfig
index fec67f6..45768f4 100644
--- a/aconfig/development/settings_core_flag_declarations.aconfig
+++ b/aconfig/development/settings_core_flag_declarations.aconfig
@@ -1,12 +1,5 @@
package: "com.android.settings.development"
-container: "system"
-
-flag {
- name: "a2dp_offload_codec_extensibility_settings"
- namespace: "bluetooth"
- description: "Feature flag for Bluetooth Audio Codec extensibility in Settings"
- bug: "323319530"
-}
+container: "system_ext"
flag {
name: "deprecate_list_activity"
diff --git a/aconfig/factory_reset/factory_reset_flag_declarations.aconfig b/aconfig/factory_reset/factory_reset_flag_declarations.aconfig
index 7feebf5..dc7d8d4 100644
--- a/aconfig/factory_reset/factory_reset_flag_declarations.aconfig
+++ b/aconfig/factory_reset/factory_reset_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.factory_reset"
-container: "system"
+container: "system_ext"
flag {
name: "enable_factory_reset_wizard"
diff --git a/aconfig/keyboard/settings_physical_keyboard_a11y_features.aconfig b/aconfig/keyboard/settings_physical_keyboard_a11y_features.aconfig
index 00c0b18..ca5cb8d 100644
--- a/aconfig/keyboard/settings_physical_keyboard_a11y_features.aconfig
+++ b/aconfig/keyboard/settings_physical_keyboard_a11y_features.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.keyboard"
-container: "system"
+container: "system_ext"
flag {
name: "keyboard_and_touchpad_a11y_new_page_enabled"
diff --git a/aconfig/media_drm/settings_mediadrm_flag_declarations.aconfig b/aconfig/media_drm/settings_mediadrm_flag_declarations.aconfig
index 3969b29..10579eb 100644
--- a/aconfig/media_drm/settings_mediadrm_flag_declarations.aconfig
+++ b/aconfig/media_drm/settings_mediadrm_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.media_drm"
-container: "system"
+container: "system_ext"
flag {
name: "force_l3_enabled"
diff --git a/aconfig/settings_accessibility_flag_declarations_legacy.aconfig b/aconfig/settings_accessibility_flag_declarations_legacy.aconfig
index 6e02bfe..d0e5850 100644
--- a/aconfig/settings_accessibility_flag_declarations_legacy.aconfig
+++ b/aconfig/settings_accessibility_flag_declarations_legacy.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
# NOTE: Don't add new accessibility flags here, since the package name doesn't follow
# the best practice for setting's feature flag go/settings-trunk-stable
diff --git a/aconfig/settings_biometrics_framework_flag_declarations.aconfig b/aconfig/settings_biometrics_framework_flag_declarations.aconfig
index 820786e..e81c68e 100644
--- a/aconfig/settings_biometrics_framework_flag_declarations.aconfig
+++ b/aconfig/settings_biometrics_framework_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "biometric_settings_provider"
diff --git a/aconfig/settings_biometrics_integration_declarations.aconfig b/aconfig/settings_biometrics_integration_declarations.aconfig
index ea3ac19..66d794b 100644
--- a/aconfig/settings_biometrics_integration_declarations.aconfig
+++ b/aconfig/settings_biometrics_integration_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "sfps_enroll_refinement"
diff --git a/aconfig/settings_bluetooth_declarations.aconfig b/aconfig/settings_bluetooth_declarations.aconfig
index 835a637..0c423b5 100644
--- a/aconfig/settings_bluetooth_declarations.aconfig
+++ b/aconfig/settings_bluetooth_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "enable_offload_bluetooth_operations_to_background_thread"
diff --git a/aconfig/settings_connecteddevice_flag_declarations.aconfig b/aconfig/settings_connecteddevice_flag_declarations.aconfig
index 8720260..ee0c233 100644
--- a/aconfig/settings_connecteddevice_flag_declarations.aconfig
+++ b/aconfig/settings_connecteddevice_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "rotation_connected_display_setting"
diff --git a/aconfig/settings_contacts_default_account_flag_declarations.aconfig b/aconfig/settings_contacts_default_account_flag_declarations.aconfig
index eb877af..621714d 100644
--- a/aconfig/settings_contacts_default_account_flag_declarations.aconfig
+++ b/aconfig/settings_contacts_default_account_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "enable_contacts_default_account_in_settings"
diff --git a/aconfig/settings_datetime_flag_declarations.aconfig b/aconfig/settings_datetime_flag_declarations.aconfig
index 3d9d8b3..dc3f1f4 100644
--- a/aconfig/settings_datetime_flag_declarations.aconfig
+++ b/aconfig/settings_datetime_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "datetime_feedback"
diff --git a/aconfig/settings_development_flag_declarations.aconfig b/aconfig/settings_development_flag_declarations.aconfig
index 318f862..b9a084f 100644
--- a/aconfig/settings_development_flag_declarations.aconfig
+++ b/aconfig/settings_development_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
# NOTE: Keep alphabetized to help limit merge conflicts from multiple simultaneous editors.
diff --git a/aconfig/settings_device_diagnostics_declarations.aconfig b/aconfig/settings_device_diagnostics_declarations.aconfig
index 7423f2b..90a12db 100644
--- a/aconfig/settings_device_diagnostics_declarations.aconfig
+++ b/aconfig/settings_device_diagnostics_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "enable_device_diagnostics_in_settings"
diff --git a/aconfig/settings_display_flag_declarations.aconfig b/aconfig/settings_display_flag_declarations.aconfig
index 9fe587b..52b9603 100644
--- a/aconfig/settings_display_flag_declarations.aconfig
+++ b/aconfig/settings_display_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "protect_screen_timeout_with_auth"
diff --git a/aconfig/settings_experience_flag_declarations.aconfig b/aconfig/settings_experience_flag_declarations.aconfig
index 17d0059..d5caccf 100644
--- a/aconfig/settings_experience_flag_declarations.aconfig
+++ b/aconfig/settings_experience_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "new_apn_page_enabled"
diff --git a/aconfig/settings_flag_declarations.aconfig b/aconfig/settings_flag_declarations.aconfig
index a9c7bd5..37a8798 100644
--- a/aconfig/settings_flag_declarations.aconfig
+++ b/aconfig/settings_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "show_factory_reset_cancel_button"
diff --git a/aconfig/settings_globalintl_flag_declarations.aconfig b/aconfig/settings_globalintl_flag_declarations.aconfig
index 12a61294..2f046d0 100644
--- a/aconfig/settings_globalintl_flag_declarations.aconfig
+++ b/aconfig/settings_globalintl_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "terms_of_address_enabled"
diff --git a/aconfig/settings_notification_flag_declarations.aconfig b/aconfig/settings_notification_flag_declarations.aconfig
index bdb6573..f2ef428 100644
--- a/aconfig/settings_notification_flag_declarations.aconfig
+++ b/aconfig/settings_notification_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "dedupe_dnd_settings_channels"
diff --git a/aconfig/settings_onboarding_experience_flag_declarations.aconfig b/aconfig/settings_onboarding_experience_flag_declarations.aconfig
index 8d58d40..830c101 100644
--- a/aconfig/settings_onboarding_experience_flag_declarations.aconfig
+++ b/aconfig/settings_onboarding_experience_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "enable_sound_backup"
diff --git a/aconfig/settings_perform_backup_tasks_flag_declarations.aconfig b/aconfig/settings_perform_backup_tasks_flag_declarations.aconfig
index 86bae9d..dcb876b 100644
--- a/aconfig/settings_perform_backup_tasks_flag_declarations.aconfig
+++ b/aconfig/settings_perform_backup_tasks_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "enable_perform_backup_tasks_in_settings"
diff --git a/aconfig/settings_security_flag_declarations.aconfig b/aconfig/settings_security_flag_declarations.aconfig
index 3684212..e27f835 100644
--- a/aconfig/settings_security_flag_declarations.aconfig
+++ b/aconfig/settings_security_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "protect_lock_after_timeout_with_auth"
diff --git a/aconfig/settings_telephony_flag_declarations.aconfig b/aconfig/settings_telephony_flag_declarations.aconfig
index dab1b45..c12de7a 100644
--- a/aconfig/settings_telephony_flag_declarations.aconfig
+++ b/aconfig/settings_telephony_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "remove_key_hide_enable_2g"
diff --git a/aconfig/settings_threadnetwork_flag_declarations.aconfig b/aconfig/settings_threadnetwork_flag_declarations.aconfig
index e5448a9..9966467 100644
--- a/aconfig/settings_threadnetwork_flag_declarations.aconfig
+++ b/aconfig/settings_threadnetwork_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "thread_settings_enabled"
diff --git a/aconfig/settings_voice_activation_apps_flag_declarations.aconfig b/aconfig/settings_voice_activation_apps_flag_declarations.aconfig
index d72e67f..9ca3525 100644
--- a/aconfig/settings_voice_activation_apps_flag_declarations.aconfig
+++ b/aconfig/settings_voice_activation_apps_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
flag {
name: "enable_voice_activation_apps_in_settings"
diff --git a/aconfig/settings_wifi_flag_declarations.aconfig b/aconfig/settings_wifi_flag_declarations.aconfig
index 67ed943..cb8007f 100644
--- a/aconfig/settings_wifi_flag_declarations.aconfig
+++ b/aconfig/settings_wifi_flag_declarations.aconfig
@@ -1,5 +1,5 @@
package: "com.android.settings.flags"
-container: "system"
+container: "system_ext"
# NOTE: Keep alphabetized to help limit merge conflicts from multiple simultaneous editors.
diff --git a/res/layout/bluetooth_audio_codec_dialog.xml b/res/layout/bluetooth_audio_codec_dialog.xml
deleted file mode 100644
index 3a260a6..0000000
--- a/res/layout/bluetooth_audio_codec_dialog.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-
-<ScrollView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="8dp">
-
- <RadioGroup
- android:id="@+id/bluetooth_audio_codec_radio_group"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/developer_option_dialog_margin_start">
-
- <include
- android:id="@+id/bluetooth_audio_codec_default"
- layout="@layout/preference_widget_dialog_radiobutton"/>
-
- <include
- android:id="@+id/bluetooth_audio_codec_sbc"
- layout="@layout/preference_widget_dialog_radiobutton"/>
-
- <include
- android:id="@+id/bluetooth_audio_codec_aac"
- layout="@layout/preference_widget_dialog_radiobutton"/>
-
- <include
- android:id="@+id/bluetooth_audio_codec_aptx"
- layout="@layout/preference_widget_dialog_radiobutton"/>
-
- <include
- android:id="@+id/bluetooth_audio_codec_aptx_hd"
- layout="@layout/preference_widget_dialog_radiobutton"/>
-
- <include
- android:id="@+id/bluetooth_audio_codec_ldac"
- layout="@layout/preference_widget_dialog_radiobutton"/>
-
- <include
- android:id="@+id/bluetooth_audio_codec_lc3"
- layout="@layout/preference_widget_dialog_radiobutton"/>
-
- <include
- android:id="@+id/bluetooth_audio_codec_opus"
- layout="@layout/preference_widget_dialog_radiobutton"/>
-
- </RadioGroup>
-
- <include
- android:id="@+id/bluetooth_audio_codec_help_info"
- layout="@layout/preference_widget_dialog_summary"/>
-
- </LinearLayout>
-
-</ScrollView>
-
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7e363e6..2366f3b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -13046,7 +13046,7 @@
<string name="thread_network_settings_learn_more">Learn more about Thread</string>
<!-- URL for Thread network settings learn more link [CHAR_LIMIT=NONE] -->
- <string name="thread_network_settings_learn_more_link" translatable="false">https://developers.home.google.com</string>
+ <string name="thread_network_settings_learn_more_link" translatable="false">https://support.google.com/android?p=thread_toggle</string>
<!-- Label for the camera use toggle [CHAR LIMIT=40] -->
<string name="camera_toggle_title">Camera access</string>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 7fa514c..2beb96d 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -429,14 +429,6 @@
android:key="bluetooth_hd_audio_settings"
android:title="@string/bluetooth_profile_a2dp_high_quality_unknown_codec"/>
- <com.android.settings.development.bluetooth.BluetoothCodecDialogPreference
- android:key="bluetooth_audio_codec_settings"
- android:title="@string/bluetooth_select_a2dp_codec_type"
- android:dialogTitle="@string/bluetooth_select_a2dp_codec_type_dialog_title"
- android:dialogLayout="@layout/bluetooth_audio_codec_dialog"
- android:positiveButtonText=""
- android:negativeButtonText="@string/dlg_ok"/>
-
<ListPreference
android:key="bluetooth_audio_codec_settings_list"
android:title="@string/bluetooth_select_a2dp_codec_type"
diff --git a/src/com/android/settings/accounts/OWNERS b/src/com/android/settings/accounts/OWNERS
new file mode 100644
index 0000000..8ddd950
--- /dev/null
+++ b/src/com/android/settings/accounts/OWNERS
@@ -0,0 +1,11 @@
+# Default reviewers for account settings.
+jcivelli@google.com
+aseemk@google.com
+dementyev@google.com
+
+# For CredMan related reviews.
+reemabajwa@google.com
+helenqin@google.com
+sgjerry@google.com
+jbabs@google.com
+leecam@google.com
\ No newline at end of file
diff --git a/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceController.java b/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceController.java
deleted file mode 100644
index 09f3871..0000000
--- a/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceController.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (C) 2017 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.development;
-
-import android.bluetooth.BluetoothA2dp;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothCodecConfig;
-import android.bluetooth.BluetoothCodecStatus;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothManager;
-import android.bluetooth.BluetoothProfile;
-import android.content.Context;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.ListPreference;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnDestroy;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-import java.util.List;
-
-public abstract class AbstractBluetoothA2dpPreferenceController extends
- DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
- PreferenceControllerMixin, BluetoothServiceConnectionListener, LifecycleObserver,
- OnDestroy {
-
- @VisibleForTesting
- static final int STREAMING_LABEL_ID =
- com.android.settingslib.R.string.bluetooth_select_a2dp_codec_streaming_label;
-
- protected final BluetoothA2dpConfigStore mBluetoothA2dpConfigStore;
- protected BluetoothA2dp mBluetoothA2dp;
- protected ListPreference mPreference;
- private final String[] mListValues;
- private final String[] mListSummaries;
-
- @VisibleForTesting
- BluetoothAdapter mBluetoothAdapter;
-
- public AbstractBluetoothA2dpPreferenceController(Context context, Lifecycle lifecycle,
- BluetoothA2dpConfigStore store) {
- super(context);
-
- mBluetoothA2dpConfigStore = store;
- mBluetoothAdapter = context.getSystemService(BluetoothManager.class).getAdapter();
- mListValues = getListValues();
- mListSummaries = getListSummaries();
-
- if (lifecycle != null) {
- lifecycle.addObserver(this);
- }
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
-
- mPreference = screen.findPreference(getPreferenceKey());
-
- // Set a default value because BluetoothCodecConfig is null initially.
- mPreference.setValue(mListValues[getDefaultIndex()]);
- mPreference.setSummary(mListSummaries[getDefaultIndex()]);
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- if (mBluetoothA2dp == null) {
- return false;
- }
-
- writeConfigurationValues(newValue);
-
- final BluetoothCodecConfig codecConfig = mBluetoothA2dpConfigStore.createCodecConfig();
- synchronized (mBluetoothA2dpConfigStore) {
- BluetoothDevice activeDevice = getA2dpActiveDevice();
- if (activeDevice == null) {
- return false;
- }
- setCodecConfigPreference(activeDevice, codecConfig);
- }
- // Because the setting is not persisted into permanent storage, we cannot call update state
- // here to update the preference.
- // Instead, we just assume it was set and update the preference here.
- final int index = mPreference.findIndexOfValue(newValue.toString());
- // We only want to append "Streaming" if not using default
- if (index == getDefaultIndex()) {
- mPreference.setSummary(mListSummaries[index]);
- } else {
- mPreference.setSummary(
- mContext.getResources().getString(STREAMING_LABEL_ID, mListSummaries[index]));
- }
- return true;
- }
-
- @Override
- public void updateState(Preference preference) {
- BluetoothDevice activeDevice = getA2dpActiveDevice();
- if (activeDevice == null || getCodecConfig(activeDevice) == null || mPreference == null) {
- return;
- }
-
- BluetoothCodecConfig codecConfig;
- synchronized (mBluetoothA2dpConfigStore) {
- codecConfig = getCodecConfig(activeDevice);
- }
-
- final int index = getCurrentA2dpSettingIndex(codecConfig);
- mPreference.setValue(mListValues[index]);
-
- // We only want to append "Streaming" if not using default
- if (index == getDefaultIndex()) {
- mPreference.setSummary(mListSummaries[index]);
- } else {
- mPreference.setSummary(
- mContext.getResources().getString(STREAMING_LABEL_ID, mListSummaries[index]));
- }
-
- writeConfigurationValues(mListValues[index]);
- }
-
- @Override
- public void onBluetoothServiceConnected(BluetoothA2dp bluetoothA2dp) {
- mBluetoothA2dp = bluetoothA2dp;
- updateState(mPreference);
- }
-
- @Override
- public void onBluetoothCodecUpdated() {
- // intentional no-op
- // We do not want to call update state here because the setting is not persisted in
- // permanent storage.
- }
-
- @Override
- public void onBluetoothServiceDisconnected() {
- mBluetoothA2dp = null;
- }
-
- @Override
- public void onDestroy() {
- mBluetoothA2dp = null;
- }
-
- /**
- * @return an array of string values that correspond to the current {@link ListPreference}.
- */
- protected abstract String[] getListValues();
-
- /**
- * @return an array of string summaries that correspond to the current {@link ListPreference}.
- */
- protected abstract String[] getListSummaries();
-
- /**
- * Updates the new value to the {@link BluetoothA2dpConfigStore} and the {@link BluetoothA2dp}.
- *
- * @param newValue the new setting value
- */
- protected abstract void writeConfigurationValues(Object newValue);
-
- /**
- * @return the current selected index for the {@link ListPreference}.
- */
- protected abstract int getCurrentA2dpSettingIndex(BluetoothCodecConfig config);
-
- /**
- * @return default setting index for the {@link ListPreference}.
- */
- protected abstract int getDefaultIndex();
-
- @VisibleForTesting
- void setCodecConfigPreference(BluetoothDevice device,
- BluetoothCodecConfig config) {
- BluetoothDevice bluetoothDevice =
- (device != null) ? device : getA2dpActiveDevice();
- if (bluetoothDevice == null) {
- return;
- }
- mBluetoothA2dp.setCodecConfigPreference(bluetoothDevice, config);
- }
-
- @VisibleForTesting
- BluetoothCodecConfig getCodecConfig(BluetoothDevice device) {
- if (mBluetoothA2dp != null) {
- BluetoothDevice bluetoothDevice =
- (device != null) ? device : getA2dpActiveDevice();
- if (bluetoothDevice == null) {
- return null;
- }
- BluetoothCodecStatus codecStatus = mBluetoothA2dp.getCodecStatus(bluetoothDevice);
- if (codecStatus != null) {
- return codecStatus.getCodecConfig();
- }
- }
- return null;
- }
-
- private BluetoothDevice getA2dpActiveDevice() {
- if (mBluetoothAdapter == null) {
- return null;
- }
- List<BluetoothDevice> activeDevices =
- mBluetoothAdapter.getActiveDevices(BluetoothProfile.A2DP);
- return (activeDevices.size() > 0) ? activeDevices.get(0) : null;
- }
-}
diff --git a/src/com/android/settings/development/BluetoothA2dpConfigStore.java b/src/com/android/settings/development/BluetoothA2dpConfigStore.java
index 0fef49f..ec4ec58 100644
--- a/src/com/android/settings/development/BluetoothA2dpConfigStore.java
+++ b/src/com/android/settings/development/BluetoothA2dpConfigStore.java
@@ -16,11 +16,9 @@
package com.android.settings.development;
-import android.annotation.FlaggedApi;
import android.bluetooth.BluetoothCodecConfig;
import android.bluetooth.BluetoothCodecType;
-import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/** Utility class for storing current Bluetooth A2DP profile values */
@@ -38,10 +36,6 @@
private long mCodecSpecific3Value;
private long mCodecSpecific4Value;
- public void setCodecType(int codecType) {
- mCodecTypeNative = codecType;
- }
-
public void setCodecType(@Nullable BluetoothCodecType codecType) {
mCodecType = codecType;
}
@@ -82,6 +76,7 @@
public BluetoothCodecConfig createCodecConfig() {
BluetoothCodecConfig.Builder builder = new BluetoothCodecConfig.Builder()
.setCodecPriority(mCodecPriority)
+ .setExtendedCodecType(mCodecType)
.setSampleRate(mSampleRate)
.setBitsPerSample(mBitsPerSample)
.setChannelMode(mChannelMode)
@@ -89,27 +84,6 @@
.setCodecSpecific2(mCodecSpecific2Value)
.setCodecSpecific3(mCodecSpecific3Value)
.setCodecSpecific4(mCodecSpecific4Value);
- if (Flags.a2dpOffloadCodecExtensibilitySettings()) {
- builder.setExtendedCodecType(mCodecType);
- } else {
- builder.setCodecType(mCodecTypeNative);
- }
return builder.build();
}
-
- /** Create codec config utilizing {@link BluetoothCodecType} */
- @FlaggedApi(Flags.FLAG_A2DP_OFFLOAD_CODEC_EXTENSIBILITY_SETTINGS)
- public @NonNull BluetoothCodecConfig createCodecConfigFromCodecType() {
- return new BluetoothCodecConfig.Builder()
- .setExtendedCodecType(mCodecType)
- .setCodecPriority(mCodecPriority)
- .setSampleRate(mSampleRate)
- .setBitsPerSample(mBitsPerSample)
- .setChannelMode(mChannelMode)
- .setCodecSpecific1(mCodecSpecific1Value)
- .setCodecSpecific2(mCodecSpecific2Value)
- .setCodecSpecific3(mCodecSpecific3Value)
- .setCodecSpecific4(mCodecSpecific4Value)
- .build();
- }
}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index d07d17d..b014152 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -67,7 +67,6 @@
import com.android.settings.development.bluetooth.AbstractBluetoothPreferenceController;
import com.android.settings.development.bluetooth.BluetoothBitPerSampleDialogPreferenceController;
import com.android.settings.development.bluetooth.BluetoothChannelModeDialogPreferenceController;
-import com.android.settings.development.bluetooth.BluetoothCodecDialogPreferenceController;
import com.android.settings.development.bluetooth.BluetoothCodecListPreferenceController;
import com.android.settings.development.bluetooth.BluetoothHDAudioPreferenceController;
import com.android.settings.development.bluetooth.BluetoothQualityDialogPreferenceController;
@@ -802,8 +801,6 @@
controllers.add(new AutofillCategoryController(context, lifecycle));
controllers.add(new AutofillLoggingLevelPreferenceController(context, lifecycle));
controllers.add(new AutofillResetOptionsPreferenceController(context));
- controllers.add(new BluetoothCodecDialogPreferenceController(context, lifecycle,
- bluetoothA2dpConfigStore, fragment));
controllers.add(
new BluetoothCodecListPreferenceController(
context, lifecycle, bluetoothA2dpConfigStore, fragment));
@@ -838,8 +835,7 @@
@Override
public void onBluetoothCodecChanged() {
for (AbstractPreferenceController controller : mPreferenceControllers) {
- if (controller instanceof AbstractBluetoothDialogPreferenceController
- && !(controller instanceof BluetoothCodecDialogPreferenceController)) {
+ if (controller instanceof AbstractBluetoothDialogPreferenceController) {
((AbstractBluetoothDialogPreferenceController) controller)
.onBluetoothCodecUpdated();
}
diff --git a/src/com/android/settings/development/PageAgnosticNotificationService.java b/src/com/android/settings/development/PageAgnosticNotificationService.java
index d33f1da..58c26df 100644
--- a/src/com/android/settings/development/PageAgnosticNotificationService.java
+++ b/src/com/android/settings/development/PageAgnosticNotificationService.java
@@ -36,7 +36,11 @@
"com.android.settings.development.PageAgnosticNotificationService";
public static final String INTENT_ACTION_DISMISSED =
"com.android.settings.development.NOTIFICATION_DISMISSED";
- private static final int NOTIFICATION_ID = 1;
+
+ // Updating the notification ID to avoid the notification being dismissed
+ // accidentally by other notifications. ID used is the bug id where this was
+ // reported.
+ private static final int NOTIFICATION_ID = 388678898;
static final int DISABLE_UPDATES_SETTING = 1;
diff --git a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
index ac42ee3..ea90b4f 100644
--- a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
@@ -118,7 +118,7 @@
if (config == null) {
return;
}
- mBluetoothA2dpConfigStore.setCodecType(config.getCodecType());
+ mBluetoothA2dpConfigStore.setCodecType(config.getExtendedCodecType());
mBluetoothA2dpConfigStore.setSampleRate(config.getSampleRate());
mBluetoothA2dpConfigStore.setBitsPerSample(config.getBitsPerSample());
mBluetoothA2dpConfigStore.setChannelMode(config.getChannelMode());
diff --git a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreference.java b/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreference.java
deleted file mode 100644
index 11cfd34..0000000
--- a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreference.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2019 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.development.bluetooth;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.RadioGroup;
-
-import com.android.settings.R;
-
-/**
- * Dialog preference to set the Bluetooth A2DP config of codec
- */
-public class BluetoothCodecDialogPreference extends BaseBluetoothDialogPreference implements
- RadioGroup.OnCheckedChangeListener {
-
- public BluetoothCodecDialogPreference(Context context) {
- super(context);
- initialize(context);
- }
-
- public BluetoothCodecDialogPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- initialize(context);
- }
-
- public BluetoothCodecDialogPreference(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- initialize(context);
- }
-
- public BluetoothCodecDialogPreference(Context context, AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- initialize(context);
- }
-
- @Override
- protected int getRadioButtonGroupId() {
- return R.id.bluetooth_audio_codec_radio_group;
- }
-
- private void initialize(Context context) {
- mRadioButtonIds.add(R.id.bluetooth_audio_codec_default);
- mRadioButtonIds.add(R.id.bluetooth_audio_codec_sbc);
- mRadioButtonIds.add(R.id.bluetooth_audio_codec_aac);
- mRadioButtonIds.add(R.id.bluetooth_audio_codec_aptx);
- mRadioButtonIds.add(R.id.bluetooth_audio_codec_aptx_hd);
- mRadioButtonIds.add(R.id.bluetooth_audio_codec_ldac);
- mRadioButtonIds.add(R.id.bluetooth_audio_codec_lc3);
- mRadioButtonIds.add(R.id.bluetooth_audio_codec_opus);
- String[] stringArray = context.getResources().getStringArray(
- com.android.settingslib.R.array.bluetooth_a2dp_codec_titles);
- for (int i = 0; i < stringArray.length; i++) {
- mRadioButtonStrings.add(stringArray[i]);
- }
- stringArray = context.getResources()
- .getStringArray(com.android.settingslib.R.array.bluetooth_a2dp_codec_summaries);
- for (int i = 0; i < stringArray.length; i++) {
- mSummaryStrings.add(stringArray[i]);
- }
- }
-}
diff --git a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java b/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java
deleted file mode 100644
index 6b29b8e..0000000
--- a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2019 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.development.bluetooth;
-
-import android.bluetooth.BluetoothA2dp;
-import android.bluetooth.BluetoothCodecConfig;
-import android.bluetooth.BluetoothDevice;
-import android.content.Context;
-import android.util.Log;
-
-import androidx.annotation.Nullable;
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.development.BluetoothA2dpConfigStore;
-import com.android.settings.development.Flags;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Dialog preference controller to set the Bluetooth A2DP config of codec
- */
-public class BluetoothCodecDialogPreferenceController extends
- AbstractBluetoothDialogPreferenceController {
-
- private static final String KEY = "bluetooth_audio_codec_settings";
- private static final String TAG = "BtCodecCtr";
-
- @Nullable private final Callback mCallback;
-
- public BluetoothCodecDialogPreferenceController(Context context, Lifecycle lifecycle,
- BluetoothA2dpConfigStore store,
- @Nullable Callback callback) {
- super(context, lifecycle, store);
- mCallback = callback;
- }
-
- @Override
- public boolean isAvailable() {
- return !Flags.a2dpOffloadCodecExtensibilitySettings();
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY;
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- ((BaseBluetoothDialogPreference) mPreference).setCallback(this);
- }
-
- @Override
- public List<Integer> getSelectableIndex() {
- List<Integer> index = new ArrayList<>();
- final BluetoothA2dp bluetoothA2dp = mBluetoothA2dp;
-
- index.add(getDefaultIndex());
- if (bluetoothA2dp == null) {
- return index;
- }
- final BluetoothDevice activeDevice = getA2dpActiveDevice();
- if (activeDevice == null) {
- Log.d(TAG, "Unable to get selectable index. No Active Bluetooth device");
- return index;
- }
- // Check HD audio is enabled, display the available list.
- if (bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
- == BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED) {
- List<BluetoothCodecConfig> configs = getSelectableConfigs(activeDevice);
- if (configs != null) {
- return getIndexFromConfig(configs);
- }
- }
- // If HD audio is disabled, SBC is the only one available codec.
- index.add(convertCfgToBtnIndex(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC));
- return index;
- }
-
- @Override
- protected void writeConfigurationValues(final int index) {
- int codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC; // default
- int codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
- switch (index) {
- case 0:
- final BluetoothDevice activeDevice = getA2dpActiveDevice();
- codecTypeValue = getHighestCodec(mBluetoothA2dp, activeDevice,
- getSelectableConfigs(activeDevice));
- codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
- break;
- case 1:
- codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC;
- codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
- break;
- case 2:
- codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC;
- codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
- break;
- case 3:
- codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX;
- codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
- break;
- case 4:
- codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD;
- codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
- break;
- case 5:
- codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC;
- codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
- break;
- case 6:
- codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3;
- codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
- break;
- case 7:
- codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS;
- codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
- break;
- default:
- break;
- }
- mBluetoothA2dpConfigStore.setCodecType(codecTypeValue);
- mBluetoothA2dpConfigStore.setCodecPriority(codecPriorityValue);
-
- // Once user changes codec, to reset configs with highest quality.
- final BluetoothCodecConfig config = getSelectableByCodecType(codecTypeValue);
- if (config == null) {
- Log.d(TAG, "Selectable config is null. Unable to reset");
- }
- mBluetoothA2dpConfigStore.setSampleRate(getHighestSampleRate(config));
- mBluetoothA2dpConfigStore.setBitsPerSample(getHighestBitsPerSample(config));
- mBluetoothA2dpConfigStore.setChannelMode(getHighestChannelMode(config));
- }
-
- @Override
- protected int getCurrentIndexByConfig(BluetoothCodecConfig config) {
- if (config == null) {
- Log.e(TAG, "Unable to get current config index. Config is null.");
- }
- return convertCfgToBtnIndex(config.getCodecType());
- }
-
- @Override
- public void onIndexUpdated(int index) {
- super.onIndexUpdated(index);
- mCallback.onBluetoothCodecChanged();
- }
-
- @Override
- public void onHDAudioEnabled(boolean enabled) {
- writeConfigurationValues(/* index= */ 0);
- }
-
- private List<Integer> getIndexFromConfig(List<BluetoothCodecConfig> configs) {
- List<Integer> indexArray = new ArrayList<>();
- for (BluetoothCodecConfig config : configs) {
- indexArray.add(convertCfgToBtnIndex(config.getCodecType()));
- }
- return indexArray;
- }
-
- @VisibleForTesting
- int convertCfgToBtnIndex(int config) {
- int index = getDefaultIndex();
- switch (config) {
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC:
- index = 1;
- break;
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC:
- index = 2;
- break;
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX:
- index = 3;
- break;
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD:
- index = 4;
- break;
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
- index = 5;
- break;
- case BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS:
- index = 7;
- break;
- default:
- Log.e(TAG, "Unsupported config:" + config);
- break;
- }
- return index;
- }
-}
diff --git a/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java b/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java
index 72da505..11ed93c 100644
--- a/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java
@@ -32,7 +32,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.development.BluetoothA2dpConfigStore;
-import com.android.settings.development.Flags;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -62,9 +61,7 @@
@Override
public boolean isAvailable() {
- boolean available = Flags.a2dpOffloadCodecExtensibilitySettings();
- Log.d(TAG, "isAvailable: " + available);
- return available;
+ return true;
}
@Override
@@ -80,10 +77,6 @@
@Override
public boolean onPreferenceChange(@Nullable Preference preference, @NonNull Object newValue) {
- if (!Flags.a2dpOffloadCodecExtensibilitySettings()) {
- return false;
- }
-
if (mListPreference == null) {
Log.e(TAG, "onPreferenceChange: List preference is null");
return false;
@@ -115,7 +108,7 @@
}
BluetoothCodecConfig codecConfig =
- mBluetoothA2dpConfigStore.createCodecConfigFromCodecType();
+ mBluetoothA2dpConfigStore.createCodecConfig();
Log.d(TAG, "onPreferenceChange: setCodecConfigPreference: " + codecConfig.toString());
bluetoothA2dp.setCodecConfigPreference(activeDevice, codecConfig);
if (mCallback != null) {
@@ -128,9 +121,6 @@
@Override
public void updateState(@Nullable Preference preference) {
super.updateState(preference);
- if (!Flags.a2dpOffloadCodecExtensibilitySettings()) {
- return;
- }
if (!isHDAudioEnabled()) {
Log.d(TAG, "updateState: HD Audio is disabled");
diff --git a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
index b5ee1d8..89f286c 100644
--- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
+++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
@@ -100,11 +100,17 @@
@VisibleForTesting
static final int MAX_PHONE_COUNT_SINGLE_SIM = 1;
- private final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener =
+ @VisibleForTesting
+ final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener =
new OnSubscriptionsChangedListener() {
@Override
public void onSubscriptionsChanged() {
+ SubscriptionInfo oldSubInfo = mSubscriptionInfo;
mSubscriptionInfo = getPhoneSubscriptionInfo(mSlotIndex);
+ if (getSubId(oldSubInfo) != getSubId(mSubscriptionInfo)) {
+ unregisterTelephonyCallback(oldSubInfo);
+ registerTelephonyCallback(mSubscriptionInfo);
+ }
updateSubscriptionStatus();
}
};
@@ -123,7 +129,6 @@
private final Context mContext;
private boolean mShowLatestAreaInfo;
- private boolean mIsRegisteredListener = false;
private final BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
@Override
@@ -137,7 +142,8 @@
};
@VisibleForTesting
- protected SimStatusDialogTelephonyCallback mTelephonyCallback;
+ protected final SimStatusDialogTelephonyCallback mTelephonyCallback =
+ new SimStatusDialogTelephonyCallback();
private CellBroadcastServiceConnection mCellBroadcastServiceConnection;
@@ -181,8 +187,6 @@
mContext = dialog.getContext();
mSlotIndex = slotId;
mSubscriptionInfo = getPhoneSubscriptionInfo(slotId);
-
- mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
mCarrierConfigManager = mContext.getSystemService(CarrierConfigManager.class);
mEuiccManager = mContext.getSystemService(EuiccManager.class);
mSubscriptionManager = mContext.getSystemService(SubscriptionManager.class);
@@ -201,11 +205,13 @@
public void initialize() {
if (mSubscriptionInfo == null) {
- return;
+ // Should not depend on default sub TelephonyManager, but lots of code already uses it
+ mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
+ } else {
+ mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
+ .createForSubscriptionId(mSubscriptionInfo.getSubscriptionId());
}
- mTelephonyManager =
- getTelephonyManager().createForSubscriptionId(mSubscriptionInfo.getSubscriptionId());
- mTelephonyCallback = new SimStatusDialogTelephonyCallback();
+
updateLatestAreaInfo();
updateSubscriptionStatus();
}
@@ -222,6 +228,10 @@
updateNetworkType();
updateRoamingStatus(serviceState);
updateIccidNumber();
+
+ if (mSubscriptionInfo == null) {
+ updateDataState(TelephonyManager.DATA_UNKNOWN);
+ }
}
/**
@@ -242,13 +252,9 @@
*/
@Override
public void onResume(@NonNull LifecycleOwner owner) {
- if (mSubscriptionInfo == null) {
- return;
- }
- mTelephonyManager = getTelephonyManager().createForSubscriptionId(
- mSubscriptionInfo.getSubscriptionId());
- getTelephonyManager()
- .registerTelephonyCallback(mContext.getMainExecutor(), mTelephonyCallback);
+ // get the latest sub info for it may be updated in onPause/onStop status.
+ mSubscriptionInfo = getPhoneSubscriptionInfo(mSlotIndex);
+ registerTelephonyCallback(mSubscriptionInfo);
mSubscriptionManager.addOnSubscriptionsChangedListener(
mContext.getMainExecutor(), mOnSubscriptionsChangedListener);
collectSimStatusDialogInfo(owner);
@@ -259,8 +265,6 @@
new IntentFilter(CellBroadcastIntents.ACTION_AREA_INFO_UPDATED),
Context.RECEIVER_EXPORTED/*UNAUDITED*/);
}
-
- mIsRegisteredListener = true;
}
/**
@@ -268,22 +272,9 @@
*/
@Override
public void onPause(@NonNull LifecycleOwner owner) {
- if (mSubscriptionInfo == null) {
- if (mIsRegisteredListener) {
- mSubscriptionManager.removeOnSubscriptionsChangedListener(
- mOnSubscriptionsChangedListener);
- getTelephonyManager().unregisterTelephonyCallback(mTelephonyCallback);
- if (mShowLatestAreaInfo) {
- mContext.unregisterReceiver(mAreaInfoReceiver);
- }
- mIsRegisteredListener = false;
- }
- return;
- }
-
- mSubscriptionManager.removeOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
- getTelephonyManager().unregisterTelephonyCallback(mTelephonyCallback);
-
+ mSubscriptionManager.removeOnSubscriptionsChangedListener(
+ mOnSubscriptionsChangedListener);
+ unregisterTelephonyCallback(mSubscriptionInfo);
if (mShowLatestAreaInfo) {
mContext.unregisterReceiver(mAreaInfoReceiver);
}
@@ -555,6 +546,34 @@
return SubscriptionManager.from(mContext).getActiveSubscriptionInfoForSimSlotIndex(slotId);
}
+ private void registerTelephonyCallback(SubscriptionInfo subInfo) {
+ if (subInfo == null) {
+ return;
+ }
+
+ // No need to have a member to hold mTelephonyManager, leaving it as lots of code
+ // depending on it
+ mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
+ .createForSubscriptionId(subInfo.getSubscriptionId());
+ mTelephonyManager.registerTelephonyCallback(
+ mContext.getMainExecutor(), mTelephonyCallback);
+ }
+
+ private void unregisterTelephonyCallback(SubscriptionInfo subInfo) {
+ if (subInfo == null) {
+ return;
+ }
+
+ mContext.getSystemService(TelephonyManager.class)
+ .createForSubscriptionId(subInfo.getSubscriptionId())
+ .unregisterTelephonyCallback(mTelephonyCallback);
+ }
+
+ private int getSubId(SubscriptionInfo subInfo) {
+ return subInfo == null ? SubscriptionManager.INVALID_SUBSCRIPTION_ID :
+ subInfo.getSubscriptionId();
+ }
+
@VisibleForTesting
class SimStatusDialogTelephonyCallback extends TelephonyCallback implements
TelephonyCallback.DataConnectionStateListener,
diff --git a/src/com/android/settings/vpn2/OWNERS b/src/com/android/settings/vpn2/OWNERS
index 4135645..919c56e 100644
--- a/src/com/android/settings/vpn2/OWNERS
+++ b/src/com/android/settings/vpn2/OWNERS
@@ -1,13 +1,7 @@
# People who can approve changes for submission.
-jchalard@google.com
-lorenzo@google.com
-maze@google.com
-reminv@google.com
+file:platform/packages/modules/Connectivity:main:/OWNERS_core_networking_xts
xiaom@google.com
hughchen@google.com
robertluo@google.com
timhypeng@google.com
vincentwei@google.com
-
-# Emergency approvers in case the above are not available
-satk@google.com
diff --git a/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java b/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java
index 9e489cf..ecb3123 100644
--- a/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java
+++ b/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java
@@ -37,6 +37,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.Locale;
+
@RunWith(AndroidJUnit4.class)
public class Enable16KbDeviceTest {
private static final long TIMEOUT = 2000;
@@ -92,7 +94,15 @@
// Verify that ext4 toggle is visible
verifyTextOnScreen(EXT4_TITLE);
- mDevice.wait(Until.findObject(By.text(EXT4_CONFIRMATION)), TIMEOUT).click();
+ UiObject2 confirmationObject =
+ mDevice.wait(Until.findObject(By.text(EXT4_CONFIRMATION)), TIMEOUT);
+ if (confirmationObject == null) {
+ // Workaround for (b/390535191). AOSP targets display the string in all caps.
+ confirmationObject = mDevice.wait(
+ Until.findObject(By.text(EXT4_CONFIRMATION.toUpperCase(Locale.ROOT))), TIMEOUT);
+ }
+ assertTrue(confirmationObject != null);
+ confirmationObject.click();
}
@Test
diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
index 7f33d14..3b70def 100644
--- a/tests/robotests/Android.bp
+++ b/tests/robotests/Android.bp
@@ -102,8 +102,6 @@
"SettingsLib-search",
],
- upstream: true,
-
strict_mode: false,
}
@@ -111,7 +109,7 @@
name: "Settings-robo-testutils",
srcs: ["testutils/**/*.java"],
libs: [
- "Robolectric_all-target_upstream",
+ "Robolectric_all-target",
"Settings-core",
"mockito-robolectric-prebuilt",
"truth",
diff --git a/tests/robotests/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceControllerTest.java
deleted file mode 100644
index 783c2ed..0000000
--- a/tests/robotests/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceControllerTest.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2017 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.development;
-
-import static com.android.settings.development.AbstractBluetoothA2dpPreferenceController
- .STREAMING_LABEL_ID;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.bluetooth.BluetoothA2dp;
-import android.bluetooth.BluetoothCodecConfig;
-import android.content.Context;
-
-import androidx.lifecycle.LifecycleOwner;
-import androidx.preference.ListPreference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class AbstractBluetoothA2dpPreferenceControllerTest {
-
- @Mock
- private BluetoothA2dp mBluetoothA2dp;
- @Mock
- private BluetoothCodecConfig mBluetoothCodecConfig;
- @Mock
- private ListPreference mPreference;
- @Mock
- private PreferenceScreen mScreen;
- @Mock
- private BluetoothA2dpConfigStore mBluetoothA2dpConfigStore;
-
- private LifecycleOwner mLifecycleOwner;
- private Lifecycle mLifecycle;
- private Context mContext;
- private AbstractBluetoothA2dpPreferenceController mController;
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
- mLifecycleOwner = () -> mLifecycle;
- mLifecycle = new Lifecycle(mLifecycleOwner);
- mController = spy(new AbstractBluetoothA2dpPreferenceControllerImpl(mContext, mLifecycle,
- mBluetoothA2dpConfigStore));
- mController.mBluetoothAdapter = null;
- doReturn(mBluetoothCodecConfig).when(mController).getCodecConfig(null);
- doNothing().when(mController).setCodecConfigPreference(any(), any());
- when(mBluetoothA2dpConfigStore.createCodecConfig()).thenReturn(mBluetoothCodecConfig);
- when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
- mController.displayPreference(mScreen);
- }
-
- @Test
- @Ignore
- public void onPreferenceChange_bluetoothConnected_shouldUpdateCodec() {
- mController.onBluetoothServiceConnected(mBluetoothA2dp);
-
- mController.onPreferenceChange(mPreference, "" /* new value */);
-
- verify(mController).setCodecConfigPreference(any(), any());
- }
-
- @Test
- public void onPreferenceChange_bluetoothNotConnected_shouldNotUpdateCodec() {
- mController.onBluetoothServiceDisconnected();
-
- mController.onPreferenceChange(mPreference, "" /* new value */);
-
- verify(mController, never()).setCodecConfigPreference(any(), any());
- }
-
- @Test
- @Ignore
- public void updateState_option2Set_shouldUpdateToOption2() {
- when(mBluetoothCodecConfig.getSampleRate()).thenReturn(
- BluetoothCodecConfig.SAMPLE_RATE_48000);
-
- doReturn(2).when(mController).getCurrentA2dpSettingIndex(any());
- mController.updateState(mPreference);
-
- verify(mPreference).setValue(mController.getListValues()[2]);
- verify(mPreference).setSummary(mContext.getString(STREAMING_LABEL_ID,
- mController.getListSummaries()[2]));
- }
-
- @Test
- public void onBluetoothServiceConnected_shouldUpdateState() {
- mController.onBluetoothServiceConnected(mBluetoothA2dp);
-
- verify(mController).updateState(mPreference);
- }
-
- private static class AbstractBluetoothA2dpPreferenceControllerImpl
- extends AbstractBluetoothA2dpPreferenceController {
-
- private AbstractBluetoothA2dpPreferenceControllerImpl(Context context,
- Lifecycle lifecycle, BluetoothA2dpConfigStore store) {
- super(context, lifecycle, store);
- }
-
- @Override
- public String getPreferenceKey() {
- return null;
- }
-
- @Override
- protected String[] getListValues() {
- return new String[]{"1", "2", "3"};
- }
-
- @Override
- protected String[] getListSummaries() {
- return new String[]{"foo", "bar", "foobar"};
- }
-
- @Override
- protected void writeConfigurationValues(Object newValue) {
- }
-
- @Override
- protected int getCurrentA2dpSettingIndex(BluetoothCodecConfig config) {
- return 0;
- }
-
- @Override
- protected int getDefaultIndex() {
- return 0;
- }
- }
-}
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceControllerTest.java
index 42b889c..9825c99 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceControllerTest.java
@@ -220,7 +220,7 @@
mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
- verify(mBluetoothA2dpConfigStore).setCodecType(mCodecConfigAAC.getCodecType());
+ verify(mBluetoothA2dpConfigStore).setCodecType(mCodecConfigAAC.getExtendedCodecType());
verify(mBluetoothA2dpConfigStore).setSampleRate(mCodecConfigAAC.getSampleRate());
verify(mBluetoothA2dpConfigStore).setBitsPerSample(mCodecConfigAAC.getBitsPerSample());
verify(mBluetoothA2dpConfigStore).setChannelMode(mCodecConfigAAC.getChannelMode());
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java
deleted file mode 100644
index de2b363..0000000
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (C) 2019 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.development.bluetooth;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.atLeastOnce;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.bluetooth.BluetoothA2dp;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothCodecConfig;
-import android.bluetooth.BluetoothCodecStatus;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothProfile;
-import android.content.Context;
-
-import androidx.lifecycle.LifecycleOwner;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.development.BluetoothA2dpConfigStore;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import java.util.Arrays;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class BluetoothCodecDialogPreferenceControllerTest {
-
- private static final String DEVICE_ADDRESS = "00:11:22:33:44:55";
-
- @Mock
- private BluetoothA2dp mBluetoothA2dp;
- @Mock
- private BluetoothAdapter mBluetoothAdapter;
- @Mock
- private PreferenceScreen mScreen;
- @Mock
- private AbstractBluetoothPreferenceController.Callback mCallback;
-
- private BluetoothCodecDialogPreferenceController mController;
- private BluetoothCodecDialogPreference mPreference;
- private BluetoothA2dpConfigStore mBluetoothA2dpConfigStore;
- private BluetoothCodecStatus mCodecStatus;
- private BluetoothCodecConfig mCodecConfigAAC;
- private BluetoothCodecConfig mCodecConfigSBC;
- private BluetoothCodecConfig mCodecConfigAPTX;
- private BluetoothCodecConfig mCodecConfigAPTXHD;
- private BluetoothCodecConfig mCodecConfigLDAC;
- private BluetoothCodecConfig mCodecConfigOPUS;
- private BluetoothDevice mActiveDevice;
- private Context mContext;
- private LifecycleOwner mLifecycleOwner;
- private Lifecycle mLifecycle;
-
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
- mLifecycleOwner = () -> mLifecycle;
- mLifecycle = new Lifecycle(mLifecycleOwner);
- mBluetoothA2dpConfigStore = spy(new BluetoothA2dpConfigStore());
- mActiveDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
- mController = new BluetoothCodecDialogPreferenceController(mContext, mLifecycle,
- mBluetoothA2dpConfigStore, mCallback);
- mController.mBluetoothAdapter = mBluetoothAdapter;
- mPreference = new BluetoothCodecDialogPreference(mContext);
- when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
- mController.displayPreference(mScreen);
- mCodecConfigSBC = new BluetoothCodecConfig.Builder()
- .setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC)
- .setCodecPriority(BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST)
- .setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_96000
- | BluetoothCodecConfig.SAMPLE_RATE_176400)
- .setBitsPerSample(BluetoothCodecConfig.BITS_PER_SAMPLE_32)
- .setChannelMode(BluetoothCodecConfig.CHANNEL_MODE_MONO
- | BluetoothCodecConfig.CHANNEL_MODE_STEREO)
- .build();
- mCodecConfigAAC = new BluetoothCodecConfig.Builder()
- .setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC)
- .setCodecPriority(BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST)
- .setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_48000
- | BluetoothCodecConfig.SAMPLE_RATE_88200)
- .setBitsPerSample(BluetoothCodecConfig.BITS_PER_SAMPLE_16
- | BluetoothCodecConfig.BITS_PER_SAMPLE_24)
- .setChannelMode(BluetoothCodecConfig.CHANNEL_MODE_STEREO)
- .build();
- mCodecConfigAPTX = new BluetoothCodecConfig.Builder()
- .setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX)
- .build();
- mCodecConfigAPTXHD = new BluetoothCodecConfig.Builder()
- .setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD)
- .build();
- mCodecConfigLDAC = new BluetoothCodecConfig.Builder()
- .setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC)
- .build();
- mCodecConfigOPUS = new BluetoothCodecConfig.Builder()
- .setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS)
- .build();
- when(mBluetoothAdapter.getActiveDevices(eq(BluetoothProfile.A2DP)))
- .thenReturn(Arrays.asList(mActiveDevice));
- }
-
- @Test
- public void writeConfigurationValues_selectDefault_setHighest() {
- BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigOPUS, mCodecConfigAAC,
- mCodecConfigSBC};
- mCodecStatus = new BluetoothCodecStatus.Builder()
- .setCodecConfig(mCodecConfigSBC)
- .setCodecsSelectableCapabilities(Arrays.asList(mCodecConfigs))
- .build();
- when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
- when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
- BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
- mController.onBluetoothServiceConnected(mBluetoothA2dp);
-
- mController.writeConfigurationValues(0);
- verify(mBluetoothA2dpConfigStore).setCodecType(
- BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS);
- }
-
- @Test
- public void writeConfigurationValues_checkCodec() {
- BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigOPUS, mCodecConfigAAC,
- mCodecConfigSBC, mCodecConfigAPTX, mCodecConfigAPTXHD, mCodecConfigLDAC};
- mCodecStatus = new BluetoothCodecStatus.Builder()
- .setCodecConfig(mCodecConfigSBC)
- .setCodecsSelectableCapabilities(Arrays.asList(mCodecConfigs))
- .build();
- when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
- mController.onBluetoothServiceConnected(mBluetoothA2dp);
-
- mController.writeConfigurationValues(1);
- verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecType(
- BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC);
-
- mController.writeConfigurationValues(2);
- verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC);
-
- mController.writeConfigurationValues(3);
- verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX);
-
- mController.writeConfigurationValues(4);
- verify(mBluetoothA2dpConfigStore).setCodecType(
- BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD);
-
- mController.writeConfigurationValues(5);
- verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC);
-
- mController.writeConfigurationValues(7);
- verify(mBluetoothA2dpConfigStore).setCodecType(
- BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS);
- }
-
- @Test
- public void writeConfigurationValues_resetHighestConfig() {
- BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX,
- mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigOPUS};
- mCodecStatus = new BluetoothCodecStatus.Builder()
- .setCodecConfig(mCodecConfigAAC)
- .setCodecsSelectableCapabilities(Arrays.asList(mCodecConfigs))
- .build();
- when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
- mController.onBluetoothServiceConnected(mBluetoothA2dp);
- mController.writeConfigurationValues(2);
-
- verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecPriority(
- BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST);
- verify(mBluetoothA2dpConfigStore, atLeastOnce()).setSampleRate(
- BluetoothCodecConfig.SAMPLE_RATE_88200);
- verify(mBluetoothA2dpConfigStore, atLeastOnce()).setBitsPerSample(
- BluetoothCodecConfig.BITS_PER_SAMPLE_24);
- verify(mBluetoothA2dpConfigStore, atLeastOnce()).setChannelMode(
- BluetoothCodecConfig.CHANNEL_MODE_STEREO);
- }
-
- @Test
- public void getCurrentIndexByConfig_verifyIndex() {
- assertThat(mController.getCurrentIndexByConfig(mCodecConfigAAC)).isEqualTo(
- mController.convertCfgToBtnIndex(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC));
- }
-
- @Test
- public void getCurrentIndexByConfig_verifyOpusIndex() {
- assertThat(mController.getCurrentIndexByConfig(mCodecConfigOPUS)).isEqualTo(
- mController.convertCfgToBtnIndex(
- BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS));
- }
-
-
- @Test
- public void onIndexUpdated_notifyPreference() {
- mController.onIndexUpdated(0);
-
- verify(mCallback).onBluetoothCodecChanged();
- }
-
- @Test
- public void onHDAudioEnabled_optionalCodecEnabled_setsCodecTypeAsOpus() {
- List<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigOPUS,
- mCodecConfigAAC, mCodecConfigSBC);
- mCodecStatus = new BluetoothCodecStatus.Builder()
- .setCodecConfig(mCodecConfigOPUS)
- .setCodecsSelectableCapabilities(mCodecConfigs)
- .build();
- when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
- when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
- BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
- mController.onBluetoothServiceConnected(mBluetoothA2dp);
-
- mController.onHDAudioEnabled(/* enabled= */ true);
-
- verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecType(
- eq(BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS));
- }
-
- @Test
- public void onHDAudioEnabled_optionalCodecEnabled_setsCodecTypeAsAAC() {
- List<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigOPUS,
- mCodecConfigAAC, mCodecConfigSBC);
- mCodecStatus = new BluetoothCodecStatus.Builder()
- .setCodecConfig(mCodecConfigAAC)
- .setCodecsSelectableCapabilities(mCodecConfigs)
- .build();
- when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
- when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
- BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
- mController.onBluetoothServiceConnected(mBluetoothA2dp);
-
- mController.onHDAudioEnabled(/* enabled= */ true);
-
- verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecType(
- eq(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC));
- }
- @Test
- public void onHDAudioEnabled_optionalCodecDisabled_setsCodecTypeAsSBC() {
- List<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigOPUS,
- mCodecConfigAAC, mCodecConfigSBC);
- mCodecStatus = new BluetoothCodecStatus.Builder()
- .setCodecConfig(mCodecConfigAAC)
- .setCodecsSelectableCapabilities(mCodecConfigs)
- .build();
- when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
- when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
- BluetoothA2dp.OPTIONAL_CODECS_PREF_DISABLED);
- mController.onBluetoothServiceConnected(mBluetoothA2dp);
-
- mController.onHDAudioEnabled(/* enabled= */ false);
-
- verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecType(
- eq(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC));
- }
-}
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceTest.java
deleted file mode 100644
index 4b8df16..0000000
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2019 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.development.bluetooth;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import com.android.settings.R;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class BluetoothCodecDialogPreferenceTest {
-
- private BluetoothCodecDialogPreference mPreference;
- private Context mContext;
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
- mPreference = new BluetoothCodecDialogPreference(mContext);
- }
-
- @Test
- public void getRadioButtonGroupId() {
- assertThat(mPreference.getRadioButtonGroupId())
- .isEqualTo(R.id.bluetooth_audio_codec_radio_group);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceControllerTest.java
index 4ac5dff..a99dc2b 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceControllerTest.java
@@ -18,7 +18,6 @@
import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.atLeastOnce;
@@ -35,14 +34,12 @@
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
-import android.platform.test.annotations.EnableFlags;
import androidx.lifecycle.LifecycleOwner;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.development.BluetoothA2dpConfigStore;
-import com.android.settings.development.Flags;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
@@ -73,6 +70,7 @@
private BluetoothCodecType mCodecTypeAAC;
private BluetoothCodecType mCodecTypeSBC;
private BluetoothCodecType mCodecTypeAPTX;
+ private BluetoothCodecType mCodecTypeAPTXHD;
private BluetoothCodecType mCodecTypeLDAC;
private BluetoothCodecType mCodecTypeOPUS;
private List<BluetoothCodecType> mCodecTypes;
@@ -114,6 +112,8 @@
BluetoothCodecType.createFromType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC);
mCodecTypeAPTX =
BluetoothCodecType.createFromType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX);
+ mCodecTypeAPTXHD =
+ BluetoothCodecType.createFromType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD);
mCodecTypeLDAC =
BluetoothCodecType.createFromType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC);
mCodecTypeOPUS =
@@ -125,6 +125,7 @@
mCodecTypeSBC,
mCodecTypeAAC,
mCodecTypeAPTX,
+ mCodecTypeAPTXHD,
mCodecTypeLDAC,
mCodecTypeOPUS));
@@ -213,6 +214,11 @@
verify(mBluetoothA2dpConfigStore).setCodecType(mCodecTypeAPTX);
assertTrue(
+ mController.writeConfigurationValues(String.valueOf(
+ mCodecTypeAPTXHD.getCodecId())));
+ verify(mBluetoothA2dpConfigStore).setCodecType(mCodecTypeAPTXHD);
+
+ assertTrue(
mController.writeConfigurationValues(String.valueOf(mCodecTypeLDAC.getCodecId())));
verify(mBluetoothA2dpConfigStore).setCodecType(mCodecTypeLDAC);
@@ -244,7 +250,6 @@
}
@Test
- @EnableFlags(Flags.FLAG_A2DP_OFFLOAD_CODEC_EXTENSIBILITY_SETTINGS)
public void onPreferenceChange_notifyPreference() {
assertFalse(
mController.onPreferenceChange(
@@ -271,7 +276,6 @@
}
@Test
- @EnableFlags(Flags.FLAG_A2DP_OFFLOAD_CODEC_EXTENSIBILITY_SETTINGS)
public void onPreferenceChange_listPreferenceIsNull() {
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(null);
assertFalse(
@@ -280,13 +284,11 @@
}
@Test
- @EnableFlags(Flags.FLAG_A2DP_OFFLOAD_CODEC_EXTENSIBILITY_SETTINGS)
public void onPreferenceChange_unknownCodecId() {
assertFalse(mController.onPreferenceChange(mPreference, String.valueOf(TEST_ENTRY_VALUE)));
}
@Test
- @EnableFlags(Flags.FLAG_A2DP_OFFLOAD_CODEC_EXTENSIBILITY_SETTINGS)
public void onPreferenceChange_codecSelection() {
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice))
@@ -327,6 +329,14 @@
mPreference, String.valueOf(mCodecTypeAPTX.getCodecId())));
mCodecStatus =
new BluetoothCodecStatus.Builder()
+ .setCodecConfig(mCodecConfigAPTXHD)
+ .setCodecsSelectableCapabilities(mCodecConfigs)
+ .build();
+ assertTrue(
+ mController.onPreferenceChange(
+ mPreference, String.valueOf(mCodecTypeAPTXHD.getCodecId())));
+ mCodecStatus =
+ new BluetoothCodecStatus.Builder()
.setCodecConfig(mCodecConfigOPUS)
.setCodecsSelectableCapabilities(mCodecConfigs)
.build();
@@ -336,7 +346,6 @@
}
@Test
- @EnableFlags(Flags.FLAG_A2DP_OFFLOAD_CODEC_EXTENSIBILITY_SETTINGS)
public void updateState_notifyPreference() {
assertFalse(
mController.onPreferenceChange(
@@ -437,7 +446,6 @@
}
@Test
- @EnableFlags(Flags.FLAG_A2DP_OFFLOAD_CODEC_EXTENSIBILITY_SETTINGS)
public void onBluetoothServiceConnected_verifyBluetoothA2dpConfigStore() {
mCodecStatus =
new BluetoothCodecStatus.Builder()
diff --git a/tests/screenshot/Android.bp b/tests/screenshot/Android.bp
index f79d00f..d3f4160 100644
--- a/tests/screenshot/Android.bp
+++ b/tests/screenshot/Android.bp
@@ -72,7 +72,6 @@
"truth",
],
- upstream: true,
instrumentation_for: "ScreenshotTestStub",
java_resource_dirs: ["config"],
}
diff --git a/tests/unit/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java b/tests/unit/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
index 3fa3808..d68ffa8 100644
--- a/tests/unit/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
+++ b/tests/unit/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
@@ -17,6 +17,7 @@
package com.android.settings.deviceinfo.simstatus;
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_DATA_NETWORK_TYPE_VALUE_ID;
+import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELLULAR_NETWORK_STATE;
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_VOICE_NETWORK_TYPE_VALUE_ID;
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_LABEL_ID;
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_VALUE_ID;
@@ -30,8 +31,10 @@
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.SERVICE_STATE_VALUE_ID;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -42,6 +45,7 @@
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager;
import android.telephony.UiccCardInfo;
import android.telephony.euicc.EuiccManager;
@@ -65,6 +69,7 @@
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.Executor;
@RunWith(AndroidJUnit4.class)
public class SimStatusDialogControllerTest {
@@ -74,6 +79,10 @@
@Mock
private TelephonyManager mTelephonyManager;
@Mock
+ private TelephonyManager mTelephonyManagerForSub1;
+ @Mock
+ private TelephonyManager mTelephonyManagerForSub2;
+ @Mock
private SubscriptionInfo mSubscriptionInfo;
@Mock
private ServiceState mServiceState;
@@ -94,6 +103,9 @@
private static final int MAX_PHONE_COUNT_DUAL_SIM = 2;
+ private static final int TEST_SUB_ID_1 = 1;
+ private static final int TEST_SUB_ID_2 = 2;
+
@Before
@UiThreadTest
public void setup() {
@@ -106,6 +118,7 @@
mSubscriptionManager = spy(mContext.getSystemService(SubscriptionManager.class));
doReturn(mSubscriptionInfo).when(mSubscriptionManager)
.getActiveSubscriptionInfoForSimSlotIndex(anyInt());
+ doReturn(TEST_SUB_ID_1).when(mSubscriptionInfo).getSubscriptionId();
when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
when(mContext.getSystemService(CarrierConfigManager.class)).thenReturn(
@@ -113,8 +126,10 @@
when(mContext.getSystemService(EuiccManager.class)).thenReturn(mEuiccManager);
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
- doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(
- anyInt());
+ doReturn(mTelephonyManagerForSub1).when(mTelephonyManager).createForSubscriptionId(
+ TEST_SUB_ID_1);
+ doReturn(mTelephonyManagerForSub2).when(mTelephonyManager).createForSubscriptionId(
+ TEST_SUB_ID_2);
doReturn(2).when(mTelephonyManager).getCardIdForDefaultEuicc();
doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mTelephonyManager).getDataNetworkType();
@@ -340,4 +355,45 @@
verify(mDialog).setSettingVisibility(IMS_REGISTRATION_STATE_LABEL_ID, false);
verify(mDialog).setSettingVisibility(IMS_REGISTRATION_STATE_VALUE_ID, false);
}
+
+ @Test
+ public void onSubscriptionsChanged_updateSubInfoToNewSub_testTelephonyCallbackUnregRereg() {
+ // sub id changed from 1 to 2
+ SubscriptionInfo subInfo2 = mock(SubscriptionInfo.class);
+ doReturn(TEST_SUB_ID_2).when(subInfo2).getSubscriptionId();
+ doReturn(subInfo2).when(mSubscriptionManager)
+ .getActiveSubscriptionInfoForSimSlotIndex(anyInt());
+ mController.mOnSubscriptionsChangedListener.onSubscriptionsChanged();
+ verify(mTelephonyManagerForSub2).registerTelephonyCallback(any(Executor.class),
+ any(TelephonyCallback.class));
+
+ // sub id changed from 2 to 1
+ SubscriptionInfo subInfo1 = mock(SubscriptionInfo.class);
+ doReturn(TEST_SUB_ID_1).when(subInfo1).getSubscriptionId();
+ doReturn(subInfo1).when(mSubscriptionManager)
+ .getActiveSubscriptionInfoForSimSlotIndex(anyInt());
+ mController.mOnSubscriptionsChangedListener.onSubscriptionsChanged();
+ verify(mTelephonyManagerForSub2).unregisterTelephonyCallback(
+ mController.mTelephonyCallback);
+ verify(mTelephonyManagerForSub1).registerTelephonyCallback(any(Executor.class),
+ any(TelephonyCallback.class));
+ }
+
+ @Test
+ public void onSubscriptionsChanged_updateSubInfoToNull_testTelephonyCallbackUnreg() {
+ doReturn(null).when(mSubscriptionManager).getActiveSubscriptionInfoForSimSlotIndex(
+ anyInt());
+ mController.mOnSubscriptionsChangedListener.onSubscriptionsChanged();
+ verify(mTelephonyManagerForSub1).unregisterTelephonyCallback(
+ mController.mTelephonyCallback);
+ }
+
+ @Test
+ public void onSubscriptionsChanged_updateSubInfoToNull_shouldUpdateDataStatusToUnknown() {
+ doReturn(null).when(mSubscriptionManager).getActiveSubscriptionInfoForSimSlotIndex(
+ anyInt());
+ mController.mOnSubscriptionsChangedListener.onSubscriptionsChanged();
+ final String unknownText = ResourcesUtils.getResourcesString(mContext, "radioInfo_unknown");
+ verify(mDialog).setText(CELLULAR_NETWORK_STATE, unknownText);
+ }
}