Merge "[TelephonyMainline] Make getMergedSubscriberIdsFromGroup as System API and rename it"

This commit is contained in:
Zoey Chen
2020-09-01 01:58:18 +00:00
committed by Gerrit Code Review
7 changed files with 16 additions and 12 deletions

View File

@@ -9026,6 +9026,7 @@ package android.telephony {
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping();
method public int getMaxNumberOfSimultaneouslyActiveSims();
method public static long getMaxNumberVerificationTimeoutMillis();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String[] getMergedImsisFromGroup();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
method public int getSimApplicationState();

View File

@@ -8924,6 +8924,7 @@ package android.telephony {
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping();
method public int getMaxNumberOfSimultaneouslyActiveSims();
method public static long getMaxNumberVerificationTimeoutMillis();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String[] getMergedImsisFromGroup();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
method public int getSimApplicationState();

View File

@@ -46,7 +46,7 @@ public class DataUsageUtils {
}
final String[] mergedSubscriberIds = telephonyManager.createForSubscriptionId(subId)
.getMergedSubscriberIdsFromGroup();
.getMergedImsisFromGroup();
if (ArrayUtils.isEmpty(mergedSubscriberIds)) {
Log.i(TAG, "mergedSubscriberIds is null.");

View File

@@ -87,7 +87,7 @@ public class DataUsageUtilsTest {
public void getMobileTemplate_groupUuidNull_returnMobileAll() {
when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID)).thenReturn(mInfo1);
when(mInfo1.getGroupUuid()).thenReturn(null);
when(mTelephonyManager.getMergedSubscriberIdsFromGroup())
when(mTelephonyManager.getMergedImsisFromGroup())
.thenReturn(new String[] {SUBSCRIBER_ID});
final NetworkTemplate networkTemplate = DataUsageUtils.getMobileTemplate(mContext, SUB_ID);
@@ -99,7 +99,7 @@ public class DataUsageUtilsTest {
public void getMobileTemplate_groupUuidExist_returnMobileMerged() {
when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID)).thenReturn(mInfo1);
when(mInfo1.getGroupUuid()).thenReturn(mParcelUuid);
when(mTelephonyManager.getMergedSubscriberIdsFromGroup())
when(mTelephonyManager.getMergedImsisFromGroup())
.thenReturn(new String[] {SUBSCRIBER_ID, SUBSCRIBER_ID_2});
final NetworkTemplate networkTemplate = DataUsageUtils.getMobileTemplate(mContext, SUB_ID);

View File

@@ -1825,7 +1825,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
String[] mergedSubscriberId = ArrayUtils.defeatNullable(
tm.createForSubscriptionId(subId).getMergedSubscriberIdsFromGroup());
tm.createForSubscriptionId(subId).getMergedImsisFromGroup());
mergedSubscriberIdsList.add(mergedSubscriberId);
}

View File

@@ -4266,7 +4266,7 @@ public class TelephonyManager {
* The returned set of subscriber IDs will include the subscriber ID corresponding to this
* TelephonyManager's subId.
*
* This is deprecated and {@link #getMergedSubscriberIdsFromGroup()} should be used for data
* This is deprecated and {@link #getMergedImsisFromGroup()} should be used for data
* usage merging purpose.
* TODO: remove this API.
*
@@ -4287,25 +4287,27 @@ public class TelephonyManager {
}
/**
* Return the set of subscriber IDs that should be considered "merged together" for data usage
* purposes. Unlike {@link #getMergedSubscriberIds()} this API merge subscriberIds based on
* subscription grouping: subscriberId of those in the same group will all be returned.
* Return the set of IMSIs that should be considered "merged together" for data usage
* purposes. Unlike {@link #getMergedSubscriberIds()} this API merge IMSIs based on
* subscription grouping: IMSI of those in the same group will all be returned.
* Return the current IMSI if there is no subscription group.
*
* <p>Requires the calling app to have READ_PRIVILEGED_PHONE_STATE permission.
*
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public @Nullable String[] getMergedSubscriberIdsFromGroup() {
public @NonNull String[] getMergedImsisFromGroup() {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.getMergedSubscriberIdsFromGroup(getSubId(), getOpPackageName());
return telephony.getMergedImsisFromGroup(getSubId(), getOpPackageName());
}
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
return null;
return new String[0];
}
/**

View File

@@ -1155,7 +1155,7 @@ interface ITelephony {
/**
* @hide
*/
String[] getMergedSubscriberIdsFromGroup(int subId, String callingPackage);
String[] getMergedImsisFromGroup(int subId, String callingPackage);
/**
* Override the operator branding for the current ICCID.