Add the extra "Ask every time" if supported only

Test: manual

Change-Id: Ie4bb150db41f1e654ea427a605050afbb57114cf
Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
This commit is contained in:
Taesu Lee
2020-09-28 17:23:58 +09:00
parent c5a500bf07
commit 50ef14540d
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]));