diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0fcb0d68502..ac63cbff4f6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3071,10 +3071,9 @@
Use %1$s
-
- Update preferred SIM?
+
- %1$s is the only SIM in your device. Do you want to use this SIM for mobile data, calls, and SMS messages?
+ %1$s is now your primary SIM
Improve mobile data coverage?
@@ -7531,7 +7530,7 @@
Select a SIM for SMS
Switching data SIM, this may take up to a minute\u2026
-
+
Use %1$s for mobile data?
If you switch to %1$s, %2$s will no longer be used for mobile data.
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 8321588fd12..493a27b6f26 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -79,7 +79,7 @@ public class Settings extends SettingsActivity {
public static class WifiDetailsSettingsActivity extends SettingsActivity {
@Override
protected void createUiFromIntent(@Nullable Bundle savedState, Intent intent) {
- Bundle bundle = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
+ Bundle bundle = intent.getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
if (TextUtils.isEmpty(bundle.getString(WifiUtils.KEY_CHOSEN_WIFIENTRY_KEY))) {
Log.e(getLocalClassName(), "The key of WifiEntry is empty!");
finishAndRemoveTask();
diff --git a/src/com/android/settings/development/bluetooth/AbstractBluetoothListPreferenceController.java b/src/com/android/settings/development/bluetooth/AbstractBluetoothListPreferenceController.java
index 9436e06bee5..362a5cdde99 100644
--- a/src/com/android/settings/development/bluetooth/AbstractBluetoothListPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/AbstractBluetoothListPreferenceController.java
@@ -43,7 +43,6 @@ public abstract class AbstractBluetoothListPreferenceController
implements Preference.OnPreferenceChangeListener {
private static final String TAG = "AbstrBtListPrefCtrl";
- private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
protected static final int DEFAULT_VALUE_INT = 1000;
@@ -74,9 +73,7 @@ public abstract class AbstractBluetoothListPreferenceController
@Override
public boolean onPreferenceChange(@Nullable Preference preference, @NonNull Object newValue) {
- if (DEBUG) {
- Log.d(TAG, "onPreferenceChange: newValue=" + (String) newValue);
- }
+ Log.d(TAG, "onPreferenceChange: newValue=" + (String) newValue);
if (mListPreference == null) {
Log.e(TAG, "onPreferenceChange: List preference is null");
return false;
@@ -99,9 +96,7 @@ public abstract class AbstractBluetoothListPreferenceController
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
- if (DEBUG) {
- Log.d(TAG, "onDeveloperOptionsSwitchDisabled");
- }
+ Log.d(TAG, "onDeveloperOptionsSwitchDisabled");
if (mListPreference == null) {
Log.e(TAG, "onDeveloperOptionsSwitchDisabled: List preference is null");
return;
@@ -230,14 +225,12 @@ public abstract class AbstractBluetoothListPreferenceController
}
private void setupDefaultListPreference() {
- if (DEBUG) {
- Log.d(
- TAG,
- "setupDefaultListPreference: mDefaultEntry="
- + mDefaultEntry
- + ", mDefaultValue="
- + mDefaultValue);
- }
+ Log.d(
+ TAG,
+ "setupDefaultListPreference: mDefaultEntry="
+ + mDefaultEntry
+ + ", mDefaultValue="
+ + mDefaultValue);
if (mListPreference == null) {
Log.e(TAG, "setupListPreference: List preference is null");
return;
diff --git a/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java b/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java
index 863cd2795c4..9808807b077 100644
--- a/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java
@@ -43,7 +43,6 @@ public class BluetoothCodecListPreferenceController
private static final String KEY = "bluetooth_audio_codec_settings_list";
private static final String TAG = "BtExtCodecCtr";
- private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
@Nullable private final Callback mCallback;
@@ -59,9 +58,7 @@ public class BluetoothCodecListPreferenceController
@Override
public boolean isAvailable() {
boolean available = Flags.a2dpOffloadCodecExtensibilitySettings();
- if (DEBUG) {
- Log.d(TAG, "isAvailable: " + available);
- }
+ Log.d(TAG, "isAvailable: " + available);
return available;
}
@@ -82,9 +79,7 @@ public class BluetoothCodecListPreferenceController
return false;
}
- if (DEBUG) {
- Log.d(TAG, "onPreferenceChange: newValue=" + (String) newValue);
- }
+ Log.d(TAG, "onPreferenceChange: newValue=" + (String) newValue);
final BluetoothA2dp bluetoothA2dp = mBluetoothA2dp;
if (bluetoothA2dp == null) {
Log.e(TAG, "onPreferenceChange: bluetoothA2dp is null");
@@ -110,9 +105,7 @@ public class BluetoothCodecListPreferenceController
return false;
}
- if (DEBUG) {
- Log.d(TAG, "onPreferenceChange: setCodecConfigPreference: " + codecConfig.toString());
- }
+ Log.d(TAG, "onPreferenceChange: setCodecConfigPreference: " + codecConfig.toString());
bluetoothA2dp.setCodecConfigPreference(activeDevice, codecConfig);
if (mCallback != null) {
mCallback.onBluetoothCodecChanged();
@@ -161,14 +154,12 @@ public class BluetoothCodecListPreferenceController
&& currentCodecConfig.getExtendedCodecType().equals(codecType)) {
selectedCodecId = codecIds.get(codecIds.size() - 1);
selectedLabel = labels.get(labels.size() - 1);
- if (DEBUG) {
- Log.d(
- TAG,
- "updateState: Current config: "
- + selectedLabel
- + ", id: "
- + selectedCodecId);
- }
+ Log.d(
+ TAG,
+ "updateState: Current config: "
+ + selectedLabel
+ + ", id: "
+ + selectedCodecId);
}
}
@@ -178,9 +169,7 @@ public class BluetoothCodecListPreferenceController
@Override
public void onHDAudioEnabled(boolean enabled) {
- if (DEBUG) {
- Log.d(TAG, "onHDAudioEnabled: enabled=" + enabled);
- }
+ Log.d(TAG, "onHDAudioEnabled: enabled=" + enabled);
if (mListPreference == null) {
Log.e(TAG, "onHDAudioEnabled: List preference is null");
return;
@@ -216,9 +205,7 @@ public class BluetoothCodecListPreferenceController
return;
}
- if (DEBUG) {
- Log.d(TAG, "writeConfigurationValues: Selected codec: " + selectedCodecType.toString());
- }
+ Log.d(TAG, "writeConfigurationValues: Selected codec: " + selectedCodecType.toString());
final BluetoothCodecStatus codecStatus = getBluetoothCodecStatus();
if (codecStatus == null) {
Log.e(TAG, "writeConfigurationValues: Bluetooth Codec Status is null");
diff --git a/src/com/android/settings/network/telephony/EuiccPreferenceController.java b/src/com/android/settings/network/telephony/EuiccPreferenceController.java
deleted file mode 100644
index 50523792e6a..00000000000
--- a/src/com/android/settings/network/telephony/EuiccPreferenceController.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2018 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.network.telephony;
-
-import android.content.Context;
-import android.content.Intent;
-import android.telephony.TelephonyManager;
-import android.telephony.euicc.EuiccManager;
-import android.text.TextUtils;
-
-import androidx.preference.Preference;
-
-import com.android.settings.Utils;
-
-/**
- * Preference controller for "Euicc preference"
- */
-public class EuiccPreferenceController extends TelephonyBasePreferenceController {
-
- private TelephonyManager mTelephonyManager;
-
- public EuiccPreferenceController(Context context, String key) {
- super(context, key);
- mTelephonyManager = context.getSystemService(TelephonyManager.class);
- }
-
- @Override
- public int getAvailabilityStatus(int subId) {
- return MobileNetworkUtils.showEuiccSettings(mContext)
- ? AVAILABLE
- : CONDITIONALLY_UNAVAILABLE;
- }
-
- @Override
- public CharSequence getSummary() {
- return mTelephonyManager.getSimOperatorName();
- }
-
- public void init(int subId) {
- mSubId = subId;
- mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
- .createForSubscriptionId(mSubId);
- }
-
- @Override
- public boolean handlePreferenceTreeClick(Preference preference) {
- if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
- Intent intent = new Intent(EuiccManager.ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS)
- .setPackage(Utils.PHONE_PACKAGE_NAME);
- mContext.startActivity(intent);
- return true;
- }
-
- return false;
- }
-}
diff --git a/src/com/android/settings/sim/PreferredSimDialogFragment.java b/src/com/android/settings/sim/PreferredSimDialogFragment.java
index bb694406a28..96c0eb61a75 100644
--- a/src/com/android/settings/sim/PreferredSimDialogFragment.java
+++ b/src/com/android/settings/sim/PreferredSimDialogFragment.java
@@ -37,8 +37,8 @@ import com.android.settings.R;
import com.android.settings.network.SubscriptionUtil;
/**
- * Presents a dialog asking the user if they want to update all services to use a given "preferred"
- * SIM. Typically this would be used in a case where a device goes from having multiple SIMs down to
+ * After androidV, presents a dialog asking the user if they want to update the mobile data.
+ * Typically this would be used in a case where a device goes from having multiple SIMs down to
* only one.
*/
public class PreferredSimDialogFragment extends SimDialogFragment implements
@@ -48,7 +48,7 @@ public class PreferredSimDialogFragment extends SimDialogFragment implements
public static PreferredSimDialogFragment newInstance() {
final PreferredSimDialogFragment fragment = new PreferredSimDialogFragment();
final Bundle args = initArguments(SimDialogActivity.PREFERRED_PICK,
- R.string.sim_preferred_title);
+ R.string.select_specific_sim_for_data_title);
fragment.setArguments(args);
return fragment;
}
@@ -57,7 +57,6 @@ public class PreferredSimDialogFragment extends SimDialogFragment implements
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final AlertDialog dialog = new AlertDialog.Builder(getContext())
- .setTitle(getTitleResId())
.setPositiveButton(R.string.yes, this)
.setNegativeButton(R.string.no, null)
.create();
@@ -104,10 +103,18 @@ public class PreferredSimDialogFragment extends SimDialogFragment implements
dismiss();
return;
}
+ Log.d(TAG, "SubscriptionInfo: " + info);
+ final CharSequence simName =
+ SubscriptionUtil.getUniqueSubscriptionDisplayName(info, getContext());
+ final String title =
+ getContext().getString(
+ getTitleResId(),
+ simName);
final String message =
getContext().getString(
R.string.sim_preferred_message,
- SubscriptionUtil.getUniqueSubscriptionDisplayName(info, getContext()));
+ simName);
+ dialog.setTitle(title);
dialog.setMessage(message);
}
diff --git a/src/com/android/settings/sim/SimDialogActivity.java b/src/com/android/settings/sim/SimDialogActivity.java
index 2e19641af12..5512117f733 100644
--- a/src/com/android/settings/sim/SimDialogActivity.java
+++ b/src/com/android/settings/sim/SimDialogActivity.java
@@ -122,6 +122,7 @@ public class SimDialogActivity extends FragmentActivity {
private void showOrUpdateDialog() {
final int dialogType = getIntent().getIntExtra(DIALOG_TYPE_KEY, INVALID_PICK);
+ Log.d(TAG, "dialogType:" + dialogType);
if (dialogType == PICK_DISMISS) {
finishAndRemoveTask();
@@ -379,8 +380,6 @@ public class SimDialogActivity extends FragmentActivity {
private void setPreferredSim(final int subId) {
setDefaultDataSubId(subId);
- setDefaultSmsSubId(subId);
- setDefaultCallsSubId(subId);
}
private PhoneAccountHandle subscriptionIdToPhoneAccountHandle(final int subId) {
diff --git a/tests/unit/src/com/android/settings/network/telephony/EuiccPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/EuiccPreferenceControllerTest.java
deleted file mode 100644
index ccc12e369d9..00000000000
--- a/tests/unit/src/com/android/settings/network/telephony/EuiccPreferenceControllerTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2020 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.network.telephony;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.content.Intent;
-import android.telephony.TelephonyManager;
-import android.telephony.euicc.EuiccManager;
-
-import androidx.preference.Preference;
-import androidx.test.core.app.ApplicationProvider;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-@RunWith(AndroidJUnit4.class)
-public class EuiccPreferenceControllerTest {
- private static final int SUB_ID = 2;
-
- @Mock private TelephonyManager mTelephonyManager;
-
- private EuiccPreferenceController mController;
- private Preference mPreference;
- private Context mContext;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
-
- mContext = spy(ApplicationProvider.getApplicationContext());
- when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
- when(mTelephonyManager.createForSubscriptionId(SUB_ID)).thenReturn(mTelephonyManager);
-
- mPreference = new Preference(mContext);
- mController = new EuiccPreferenceController(mContext, "euicc");
- mController.init(SUB_ID);
- mPreference.setKey(mController.getPreferenceKey());
- }
-
- @Test
- public void handlePreferenceTreeClick_startActivity() {
- ArgumentCaptor captor = ArgumentCaptor.forClass(Intent.class);
- doNothing().when(mContext).startActivity(captor.capture());
-
- mController.handlePreferenceTreeClick(mPreference);
-
- assertThat(captor.getValue().getAction()).isEqualTo(
- EuiccManager.ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS);
- }
-}