Merge "Add the extra "Ask every time" if supported only" am: 7b9edcde47 am: b09f09b02d am: 0e5fdb184d

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1455946

Change-Id: I282af7cad68106b706d6b6fa477d720797b74ad1
This commit is contained in:
Amit Mahajan
2020-10-16 07:48:10 +00:00
committed by Automerger Merge Worker
2 changed files with 24 additions and 4 deletions

View File

@@ -83,6 +83,10 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
/** Called to change the default subscription for the service. */
protected abstract void setDefaultSubscription(int subscriptionId);
protected boolean isAskEverytimeSupported() {
return true;
}
@Override
public int getAvailabilityStatus(int subId) {
final List<SubscriptionInfo> subs = SubscriptionUtil.getActiveSubscriptions(mManager);
@@ -123,7 +127,11 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
// display subscription based account
return info.getDisplayName();
} else {
return mContext.getString(R.string.calls_and_sms_ask_every_time);
if (isAskEverytimeSupported()) {
return mContext.getString(R.string.calls_and_sms_ask_every_time);
} else {
return "";
}
}
}
@@ -163,9 +171,12 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
subIsAvailable = true;
}
}
// Add the extra "Ask every time" value at the end.
displayNames.add(mContext.getString(R.string.calls_and_sms_ask_every_time));
subscriptionIds.add(Integer.toString(SubscriptionManager.INVALID_SUBSCRIPTION_ID));
if (isAskEverytimeSupported()) {
// Add the extra "Ask every time" value at the end.
displayNames.add(mContext.getString(R.string.calls_and_sms_ask_every_time));
subscriptionIds.add(Integer.toString(SubscriptionManager.INVALID_SUBSCRIPTION_ID));
}
mPreference.setEntries(displayNames.toArray(new CharSequence[0]));
mPreference.setEntryValues(subscriptionIds.toArray(new CharSequence[0]));

View File

@@ -23,8 +23,12 @@ import android.telephony.SubscriptionManager;
public class SmsDefaultSubscriptionController extends DefaultSubscriptionController {
private final boolean mIsAskEverytimeSupported;
public SmsDefaultSubscriptionController(Context context, String preferenceKey) {
super(context, preferenceKey);
mIsAskEverytimeSupported = mContext.getResources()
.getBoolean(com.android.internal.R.bool.config_sms_ask_every_time_support);
}
@Override
@@ -42,6 +46,11 @@ public class SmsDefaultSubscriptionController extends DefaultSubscriptionControl
mManager.setDefaultSmsSubId(subscriptionId);
}
@Override
protected boolean isAskEverytimeSupported() {
return mIsAskEverytimeSupported;
}
@Override
public PhoneAccountHandle getDefaultCallingAccountHandle() {
// Not supporting calling account override by VoIP