Snap for 12278291 from d0ea9bc2bc
to 24Q4-release
Change-Id: I2531b231cde9c457527fd04b891bff0a772873e9
This commit is contained in:
@@ -3071,10 +3071,9 @@
|
||||
<string name="sim_change_data_ok">
|
||||
Use <xliff:g id="carrier" example="Verizon">%1$s</xliff:g>
|
||||
</string>
|
||||
<!-- Title for the dialog asking to user to change the preferred SIM [CHAR LIMIT=30] -->
|
||||
<string name="sim_preferred_title">Update preferred SIM?</string>
|
||||
|
||||
<!-- Message for the dialog asking to user to change the preferred SIM [CHAR LIMIT=NONE] -->
|
||||
<string name="sim_preferred_message"><xliff:g id="new_sim">%1$s</xliff:g> is the only SIM in your device. Do you want to use this SIM for mobile data, calls, and SMS messages?</string>
|
||||
<string name="sim_preferred_message"><xliff:g id="new_sim">%1$s</xliff:g> is now your primary SIM</string>
|
||||
|
||||
<!-- Title for the dialog asking user to enable auto data switch upon enabling multi-SIM [CHAR LIMIT=30] -->
|
||||
<string name="enable_auto_data_switch_dialog_title">Improve mobile data coverage?</string>
|
||||
@@ -7531,7 +7530,7 @@
|
||||
<string name="select_sim_for_sms">Select a SIM for SMS</string>
|
||||
<!-- Message for switching data SIM; switching takes a while -->
|
||||
<string name="data_switch_started">Switching data SIM, this may take up to a minute\u2026</string>
|
||||
<!-- Title for selecting specific sim for data in settings. [CHAR LIMIT=40] -->
|
||||
<!-- Title for selecting specific sim/preferred sim for data in settings. [CHAR LIMIT=40] -->
|
||||
<string name="select_specific_sim_for_data_title">Use <xliff:g id="new_sim" example="carrierA">%1$s</xliff:g> for mobile data?</string>
|
||||
<!-- Message for selecting specific sim for data in settings. [CHAR LIMIT=NONE] -->
|
||||
<string name="select_specific_sim_for_data_msg">If you switch to <xliff:g id="new_sim" example="carrierA">%1$s</xliff:g>, <xliff:g id="old_sim" example="carrierB">%2$s</xliff:g> will no longer be used for mobile data.</string>
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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");
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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<Intent> captor = ArgumentCaptor.forClass(Intent.class);
|
||||
doNothing().when(mContext).startActivity(captor.capture());
|
||||
|
||||
mController.handlePreferenceTreeClick(mPreference);
|
||||
|
||||
assertThat(captor.getValue().getAction()).isEqualTo(
|
||||
EuiccManager.ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user