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:
@@ -83,6 +83,10 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
|||||||
/** Called to change the default subscription for the service. */
|
/** Called to change the default subscription for the service. */
|
||||||
protected abstract void setDefaultSubscription(int subscriptionId);
|
protected abstract void setDefaultSubscription(int subscriptionId);
|
||||||
|
|
||||||
|
protected boolean isAskEverytimeSupported() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus(int subId) {
|
public int getAvailabilityStatus(int subId) {
|
||||||
final List<SubscriptionInfo> subs = SubscriptionUtil.getActiveSubscriptions(mManager);
|
final List<SubscriptionInfo> subs = SubscriptionUtil.getActiveSubscriptions(mManager);
|
||||||
@@ -123,7 +127,11 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
|||||||
// display subscription based account
|
// display subscription based account
|
||||||
return info.getDisplayName();
|
return info.getDisplayName();
|
||||||
} else {
|
} 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;
|
subIsAvailable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add the extra "Ask every time" value at the end.
|
|
||||||
displayNames.add(mContext.getString(R.string.calls_and_sms_ask_every_time));
|
if (isAskEverytimeSupported()) {
|
||||||
subscriptionIds.add(Integer.toString(SubscriptionManager.INVALID_SUBSCRIPTION_ID));
|
// 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.setEntries(displayNames.toArray(new CharSequence[0]));
|
||||||
mPreference.setEntryValues(subscriptionIds.toArray(new CharSequence[0]));
|
mPreference.setEntryValues(subscriptionIds.toArray(new CharSequence[0]));
|
||||||
|
@@ -23,8 +23,12 @@ import android.telephony.SubscriptionManager;
|
|||||||
|
|
||||||
public class SmsDefaultSubscriptionController extends DefaultSubscriptionController {
|
public class SmsDefaultSubscriptionController extends DefaultSubscriptionController {
|
||||||
|
|
||||||
|
private final boolean mIsAskEverytimeSupported;
|
||||||
|
|
||||||
public SmsDefaultSubscriptionController(Context context, String preferenceKey) {
|
public SmsDefaultSubscriptionController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
|
mIsAskEverytimeSupported = mContext.getResources()
|
||||||
|
.getBoolean(com.android.internal.R.bool.config_sms_ask_every_time_support);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -42,6 +46,11 @@ public class SmsDefaultSubscriptionController extends DefaultSubscriptionControl
|
|||||||
mManager.setDefaultSmsSubId(subscriptionId);
|
mManager.setDefaultSmsSubId(subscriptionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isAskEverytimeSupported() {
|
||||||
|
return mIsAskEverytimeSupported;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PhoneAccountHandle getDefaultCallingAccountHandle() {
|
public PhoneAccountHandle getDefaultCallingAccountHandle() {
|
||||||
// Not supporting calling account override by VoIP
|
// Not supporting calling account override by VoIP
|
||||||
|
Reference in New Issue
Block a user