Merge "Modify the preferredSimDialogFragment" into main

This commit is contained in:
SongFerng Wang
2024-08-26 07:20:30 +00:00
committed by Android (Google) Code Review
3 changed files with 16 additions and 11 deletions

View File

@@ -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>

View File

@@ -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);
}

View File

@@ -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) {