Merge "Revise strings as per string UX review" am: 110d7ff721
Change-Id: I523fe708d2ff6cacafec362c05e227ae5dda07c8
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
<string name="allow">Allow</string>
|
||||
<!-- Strings for Dialog deny button -->
|
||||
<string name="deny">Deny</string>
|
||||
<!-- Used in confirmation dialogs as the action that the user will tap to turn on the feature. [CHAR LIMIT=40]-->
|
||||
<string name="confirmation_turn_on">Turn on</string>
|
||||
|
||||
<!-- Device Info screen. Used for a status item's value when the proper value is not known -->
|
||||
<string name="device_info_default">Unknown</string>
|
||||
@@ -6993,19 +6995,33 @@
|
||||
<string name="enhanced_4g_lte_mode_summary">Use LTE services to improve voice and other communications (recommended)</string>
|
||||
<!-- Enhaced 4G LTE Mode summary for 4g calling. [CHAR LIMIT=100] -->
|
||||
<string name="enhanced_4g_lte_mode_summary_4g_calling">Use 4G services to improve voice and other communications (recommended)</string>
|
||||
<!-- Title of a preference determining whether or not the user has enabled contact discovery,
|
||||
which is a service that uses the phone numbers in your contacts to determine if your
|
||||
<!-- Title of a preference determining whether or not the user has allowed the device to share
|
||||
their contacts' phone numbers with their carrier in order to implement contact discovery,
|
||||
which is a service that exchanges contacts with the carrier to determine if your
|
||||
contacts support advanced calling features, such as video calling. [CHAR LIMIT=50]-->
|
||||
<string name="contact_discovery_opt_in_title">Contact discovery</string>
|
||||
<!-- Summary of a preference determining whether or not the user has enabled contact discovery.
|
||||
[CHAR LIMIT=110] -->
|
||||
<string name="contact_discovery_opt_in_summary">Allows your carrier to discover which calling features your contacts support.</string>
|
||||
<!-- Title of the dialog shown when the user tries to enable Contact Discovery.
|
||||
<string name="contact_discovery_opt_in_title">Send contacts to carrier</string>
|
||||
<!-- Summary of a preference determining whether or not the user has enabled contact discovery,
|
||||
which is a service that exchanges contacts with the carrier to determine if your contacts
|
||||
support enhanced features, such as video calling and RCS messaging. [CHAR LIMIT=110] -->
|
||||
<string name="contact_discovery_opt_in_summary">Send your contacts\u2019 phone numbers to provide enhanced features</string>
|
||||
<!-- Title of the dialog shown when the user tries to enable Contact Discovery, which is a
|
||||
service that exchanges contacts with the carrier to determine if your contacts support
|
||||
enhanced features, such as video calling and RCS messaging. [CHAR LIMIT=50] -->
|
||||
<string name="contact_discovery_opt_in_dialog_title">Send contacts to <xliff:g id="carrier" example="T-mobile">%1$s</xliff:g>?</string>
|
||||
<!-- Title of the dialog shown when the carrier name is not known and the user tries to enable
|
||||
Contact Discovery, which is a service that exchanges contacts with the carrier to determine
|
||||
if your contacts support enhanced features, such as video calling and RCS messaging.
|
||||
[CHAR LIMIT=50] -->
|
||||
<string name="contact_discovery_opt_in_dialog_title">Enable contact discovery?</string>
|
||||
<!-- Text displayed in the dialog shown when the user tries to enable Contact Discovery.
|
||||
[CHAR LIMIT=NONE]-->
|
||||
<string name="contact_discovery_opt_in_dialog_message">All of the phone numbers in your contacts will be periodically sent to your carrier in order to discover which calling features are supported.</string>
|
||||
<string name="contact_discovery_opt_in_dialog_title_no_carrier_defined">Send contacts to your carrier?</string>
|
||||
<!-- The text displayed in the dialog shown when the user tries to enable Contact Discovery,
|
||||
which is a service that exchanges contacts with the carrier to determine if your contacts
|
||||
support enhanced features, such as video calling and RCS messaging. [CHAR LIMIT=NONE]-->
|
||||
<string name="contact_discovery_opt_in_dialog_message">Your contacts\u2019 phone numbers will be periodically sent to <xliff:g id="carrier" example="T-mobile">%1$s</xliff:g>.<xliff:g id="empty_line" example=" ">\n\n</xliff:g>This info identifies whether your contacts can use certain features, like video calls or some messaging features.</string>
|
||||
<!-- The text displayed in the dialog shown when the mobile carrier's name is not known and the
|
||||
user tries to enable Contact Discovery, which is a service that exchanges contacts with
|
||||
the carrier to determine if your contacts support enhanced features, such as video calling
|
||||
and RCS messaging. [CHAR LIMIT=NONE]-->
|
||||
<string name="contact_discovery_opt_in_dialog_message_no_carrier_defined">Your contacts\u2019 phone numbers will be periodically sent to your carrier.<xliff:g id="empty_line" example=" ">\n\n</xliff:g>This info identifies whether your contacts can use certain features, like video calls or some messaging features.</string>
|
||||
<!-- Preferred network type title. [CHAR LIMIT=50] -->
|
||||
<string name="preferred_network_type_title">Preferred network type</string>
|
||||
<!-- Preferred network type summary. [CHAR LIMIT=100] -->
|
||||
|
@@ -23,6 +23,7 @@ import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.ims.ImsManager;
|
||||
import android.telephony.ims.ImsRcsManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@@ -39,9 +40,11 @@ public class ContactDiscoveryDialogFragment extends InstrumentedDialogFragment
|
||||
implements DialogInterface.OnClickListener {
|
||||
|
||||
private static final String SUB_ID_KEY = "sub_id_key";
|
||||
private static final String CARRIER_NAME_KEY = "carrier_name_key";
|
||||
private static final String DIALOG_TAG = "discovery_dialog:";
|
||||
|
||||
private int mSubId;
|
||||
private CharSequence mCarrierName;
|
||||
private ImsManager mImsManager;
|
||||
|
||||
/**
|
||||
@@ -50,10 +53,11 @@ public class ContactDiscoveryDialogFragment extends InstrumentedDialogFragment
|
||||
* @param subId The subscription ID to associate with this Dialog.
|
||||
* @return a new instance of ContactDiscoveryDialogFragment.
|
||||
*/
|
||||
public static ContactDiscoveryDialogFragment newInstance(int subId) {
|
||||
public static ContactDiscoveryDialogFragment newInstance(int subId, CharSequence carrierName) {
|
||||
final ContactDiscoveryDialogFragment dialogFragment = new ContactDiscoveryDialogFragment();
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(SUB_ID_KEY, subId);
|
||||
args.putCharSequence(CARRIER_NAME_KEY, carrierName);
|
||||
dialogFragment.setArguments(args);
|
||||
|
||||
return dialogFragment;
|
||||
@@ -64,18 +68,30 @@ public class ContactDiscoveryDialogFragment extends InstrumentedDialogFragment
|
||||
super.onAttach(context);
|
||||
final Bundle args = getArguments();
|
||||
mSubId = args.getInt(SUB_ID_KEY);
|
||||
mCarrierName = args.getCharSequence(CARRIER_NAME_KEY);
|
||||
mImsManager = getImsManager(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
final int title = R.string.contact_discovery_opt_in_dialog_title;
|
||||
int message = R.string.contact_discovery_opt_in_dialog_message;
|
||||
builder.setMessage(getResources().getString(message))
|
||||
CharSequence title;
|
||||
CharSequence message;
|
||||
if (!TextUtils.isEmpty(mCarrierName)) {
|
||||
title = getContext().getString(
|
||||
R.string.contact_discovery_opt_in_dialog_title, mCarrierName);
|
||||
message = getContext().getString(
|
||||
R.string.contact_discovery_opt_in_dialog_message, mCarrierName);
|
||||
} else {
|
||||
title = getContext().getString(
|
||||
R.string.contact_discovery_opt_in_dialog_title_no_carrier_defined);
|
||||
message = getContext().getString(
|
||||
R.string.contact_discovery_opt_in_dialog_message_no_carrier_defined);
|
||||
}
|
||||
builder.setMessage(message)
|
||||
.setTitle(title)
|
||||
.setIconAttribute(android.R.attr.alertDialogIcon)
|
||||
.setPositiveButton(android.R.string.ok, this)
|
||||
.setPositiveButton(R.string.confirmation_turn_on, this)
|
||||
.setNegativeButton(android.R.string.cancel, this);
|
||||
return builder.create();
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import android.net.Uri;
|
||||
import android.os.PersistableBundle;
|
||||
import android.provider.Telephony;
|
||||
import android.telephony.CarrierConfigManager;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.ims.ImsManager;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -34,6 +35,8 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.network.SubscriptionUtil;
|
||||
|
||||
|
||||
/**
|
||||
* Controller for the "Contact Discovery" option present in MobileNetworkSettings.
|
||||
@@ -130,7 +133,19 @@ public class ContactDiscoveryPreferenceController extends TelephonyTogglePrefere
|
||||
|
||||
private void showContentDiscoveryDialog() {
|
||||
ContactDiscoveryDialogFragment dialog = ContactDiscoveryDialogFragment.newInstance(
|
||||
mSubId);
|
||||
mSubId, getCarrierDisplayName(preference.getContext()));
|
||||
dialog.show(mFragmentManager, ContactDiscoveryDialogFragment.getFragmentTag(mSubId));
|
||||
}
|
||||
|
||||
private CharSequence getCarrierDisplayName(Context context) {
|
||||
CharSequence result = "";
|
||||
|
||||
for (SubscriptionInfo info : SubscriptionUtil.getAvailableSubscriptions(context)) {
|
||||
if (mSubId == info.getSubscriptionId()) {
|
||||
result = info.getDisplayName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@@ -205,22 +205,32 @@ public class MobileNetworkActivity extends SettingsBaseActivity {
|
||||
final Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
final int subId = intent.getIntExtra(Settings.EXTRA_SUB_ID, SUB_ID_NULL);
|
||||
if (subId != SUB_ID_NULL) {
|
||||
for (SubscriptionInfo subscription :
|
||||
SubscriptionUtil.getAvailableSubscriptions(this)) {
|
||||
if (subscription.getSubscriptionId() == subId) {
|
||||
return subscription;
|
||||
}
|
||||
}
|
||||
}
|
||||
SubscriptionInfo info = getSubscriptionInfo(subId);
|
||||
if (info != null) return info;
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(mSubscriptionInfos)) {
|
||||
return null;
|
||||
}
|
||||
return mSubscriptionInfos.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subscription associated with a given subscription ID or null if none can be
|
||||
* found.
|
||||
*/
|
||||
SubscriptionInfo getSubscriptionInfo(int subId) {
|
||||
if (subId == SUB_ID_NULL) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (SubscriptionInfo subscription : SubscriptionUtil.getAvailableSubscriptions(this)) {
|
||||
if (subscription.getSubscriptionId() == subId) {
|
||||
return subscription;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current subId to display.
|
||||
*/
|
||||
@@ -340,6 +350,11 @@ public class MobileNetworkActivity extends SettingsBaseActivity {
|
||||
}
|
||||
|
||||
private void maybeShowContactDiscoveryDialog(int subId) {
|
||||
SubscriptionInfo info = getSubscriptionInfo(subId);
|
||||
CharSequence carrierName = "";
|
||||
if (info != null) {
|
||||
carrierName = info.getDisplayName();
|
||||
}
|
||||
// If this activity was launched using ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN, show the
|
||||
// associated dialog only if the opt-in has not been granted yet.
|
||||
boolean showOptInDialog = doesIntentContainOptInAction(getIntent())
|
||||
@@ -350,7 +365,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity {
|
||||
ContactDiscoveryDialogFragment fragment = getContactDiscoveryFragment(subId);
|
||||
if (showOptInDialog) {
|
||||
if (fragment == null) {
|
||||
fragment = ContactDiscoveryDialogFragment.newInstance(subId);
|
||||
fragment = ContactDiscoveryDialogFragment.newInstance(subId, carrierName);
|
||||
}
|
||||
// Only try to show the dialog if it has not already been added, otherwise we may
|
||||
// accidentally add it multiple times, causing multiple dialogs.
|
||||
|
@@ -48,6 +48,7 @@ import org.robolectric.shadows.ShadowAlertDialog;
|
||||
@Config(shadows = ShadowAlertDialog.class)
|
||||
public class ContactDiscoveryDialogFragmentTest {
|
||||
private static final int TEST_SUB_ID = 2;
|
||||
private static final String TEST_CARRIER = "TestMobile";
|
||||
|
||||
@Mock private ImsManager mImsManager;
|
||||
@Mock private ImsRcsManager mImsRcsManager;
|
||||
@@ -60,7 +61,8 @@ public class ContactDiscoveryDialogFragmentTest {
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mActivity = Robolectric.buildActivity(FragmentActivity.class).setup().get();
|
||||
mDialogFragmentUT = spy(ContactDiscoveryDialogFragment.newInstance(TEST_SUB_ID));
|
||||
mDialogFragmentUT = spy(ContactDiscoveryDialogFragment.newInstance(TEST_SUB_ID,
|
||||
TEST_CARRIER));
|
||||
doReturn(mImsManager).when(mDialogFragmentUT).getImsManager(any());
|
||||
doReturn(mImsRcsManager).when(mImsManager).getImsRcsManager(TEST_SUB_ID);
|
||||
doReturn(mRcsUceAdapter).when(mImsRcsManager).getUceAdapter();
|
||||
|
@@ -48,6 +48,7 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.network.SubscriptionUtil;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -59,6 +60,8 @@ import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class ContactDiscoveryPreferenceControllerTest {
|
||||
|
||||
@@ -99,6 +102,8 @@ public class ContactDiscoveryPreferenceControllerTest {
|
||||
|
||||
mPreferenceControllerUT = new ContactDiscoveryPreferenceController(mContext,
|
||||
"ContactDiscovery");
|
||||
// Ensure subscriptionInfo check doesn't fail.
|
||||
SubscriptionUtil.setAvailableSubscriptionsForTesting(Collections.emptyList());
|
||||
mPreferenceControllerUT.init(mFragmentManager, TEST_SUB_ID, mLifecycle);
|
||||
mSwitchPreferenceUT = spy(new SwitchPreference(mContext));
|
||||
mSwitchPreferenceUT.setKey(mPreferenceControllerUT.getPreferenceKey());
|
||||
|
Reference in New Issue
Block a user