Clean up DefaultSubscriptionController.getSummary

Which is always overridden by subclass after Change
I7d29b58ca5476ae0bb6fe2e04fecb96164cb1ada

This is a no op.

Bug: 277301125
Test: Manually with Mobile Settings
Test: Unit test
Change-Id: Ifa5928e1026b18c33f2bdd51fdcba267249dcee5
This commit is contained in:
Chaohui Wang
2023-05-06 14:39:40 +08:00
parent 23d3eda967
commit ab8a130674
4 changed files with 0 additions and 142 deletions

View File

@@ -19,11 +19,7 @@ package com.android.settings.network.telephony;
import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
import android.content.ComponentName;
import android.content.Context;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.SubscriptionManager;
import android.view.View;
@@ -57,15 +53,10 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
protected ListPreference mPreference;
protected SubscriptionManager mManager;
protected TelecomManager mTelecomManager;
protected MobileNetworkRepository mMobileNetworkRepository;
protected LifecycleOwner mLifecycleOwner;
private DefaultSubscriptionReceiver mDataSubscriptionChangedReceiver;
private static final String EMERGENCY_ACCOUNT_HANDLE_ID = "E";
private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT =
new ComponentName("com.android.phone",
"com.android.services.telephony.TelephonyConnectionService");
private boolean mIsRtlMode;
List<SubscriptionInfoEntity> mSubInfoEntityList = new ArrayList<>();
@@ -84,10 +75,6 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
}
}
/** @return SubscriptionInfo for the default subscription for the service, or null if there
* isn't one. */
protected abstract SubscriptionInfoEntity getDefaultSubscriptionInfo();
/** @return the id of the default subscription for the service, or
* SubscriptionManager.INVALID_SUBSCRIPTION_ID if there isn't one. */
protected abstract int getDefaultSubscriptionId();
@@ -138,26 +125,6 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
}
}
@Override
public CharSequence getSummary() {
final PhoneAccountHandle handle = getDefaultCallingAccountHandle();
if ((handle != null) && (!isCallingAccountBindToSubscription(handle))) {
// display VoIP account in summary when configured through settings within dialer
return getLabelFromCallingAccount(handle);
}
final SubscriptionInfoEntity info = getDefaultSubscriptionInfo();
if (info != null) {
// display subscription based account
return info.uniqueName;
} else {
if (isAskEverytimeSupported()) {
return mContext.getString(R.string.calls_and_sms_ask_every_time);
} else {
return "";
}
}
}
@VisibleForTesting
void updateEntries() {
if (mPreference == null) {
@@ -218,76 +185,6 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
}
}
/**
* Get default calling account
*
* @return current calling account {@link PhoneAccountHandle}
*/
public PhoneAccountHandle getDefaultCallingAccountHandle() {
final PhoneAccountHandle currentSelectPhoneAccount =
getTelecomManager().getUserSelectedOutgoingPhoneAccount();
if (currentSelectPhoneAccount == null) {
return null;
}
final List<PhoneAccountHandle> accountHandles =
getTelecomManager().getCallCapablePhoneAccounts(false);
final PhoneAccountHandle emergencyAccountHandle = new PhoneAccountHandle(
PSTN_CONNECTION_SERVICE_COMPONENT, EMERGENCY_ACCOUNT_HANDLE_ID);
if (currentSelectPhoneAccount.equals(emergencyAccountHandle)) {
return null;
}
for (PhoneAccountHandle handle : accountHandles) {
if (currentSelectPhoneAccount.equals(handle)) {
return currentSelectPhoneAccount;
}
}
return null;
}
@VisibleForTesting
TelecomManager getTelecomManager() {
if (mTelecomManager == null) {
mTelecomManager = mContext.getSystemService(TelecomManager.class);
}
return mTelecomManager;
}
@VisibleForTesting
PhoneAccount getPhoneAccount(PhoneAccountHandle handle) {
return getTelecomManager().getPhoneAccount(handle);
}
/**
* Check if calling account bind to subscription
*
* @param handle {@link PhoneAccountHandle} for specific calling account
*/
public boolean isCallingAccountBindToSubscription(PhoneAccountHandle handle) {
final PhoneAccount account = getPhoneAccount(handle);
if (account == null) {
return false;
}
return account.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION);
}
/**
* Get label from calling account
*
* @param handle to get label from {@link PhoneAccountHandle}
* @return label of calling account
*/
public CharSequence getLabelFromCallingAccount(PhoneAccountHandle handle) {
CharSequence label = null;
final PhoneAccount account = getPhoneAccount(handle);
if (account != null) {
label = account.getLabel();
}
if (label != null) {
label = mContext.getPackageManager().getUserBadgedLabel(label, handle.getUserHandle());
}
return (label != null) ? label : "";
}
@VisibleForTesting
protected List<SubscriptionInfoEntity> getSubscriptionInfoList() {
return mSubInfoEntityList;