Merge "Add isEuiccSupportedCountry system API to EuiccManager"
This commit is contained in:
@@ -10009,6 +10009,11 @@ package android.telephony.euicc {
|
|||||||
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDefaultDownloadableSubscriptionList(android.app.PendingIntent);
|
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDefaultDownloadableSubscriptionList(android.app.PendingIntent);
|
||||||
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDownloadableSubscriptionMetadata(android.telephony.euicc.DownloadableSubscription, android.app.PendingIntent);
|
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDownloadableSubscriptionMetadata(android.telephony.euicc.DownloadableSubscription, android.app.PendingIntent);
|
||||||
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public int getOtaStatus();
|
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public int getOtaStatus();
|
||||||
|
method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public java.util.List<java.lang.String> getSupportedCountries();
|
||||||
|
method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public java.util.List<java.lang.String> getUnsupportedCountries();
|
||||||
|
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public boolean isSupportedCountry(@NonNull String);
|
||||||
|
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void setSupportedCountries(@NonNull java.util.List<java.lang.String>);
|
||||||
|
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void setUnsupportedCountries(@NonNull java.util.List<java.lang.String>);
|
||||||
field public static final String ACTION_DELETE_SUBSCRIPTION_PRIVILEGED = "android.telephony.euicc.action.DELETE_SUBSCRIPTION_PRIVILEGED";
|
field public static final String ACTION_DELETE_SUBSCRIPTION_PRIVILEGED = "android.telephony.euicc.action.DELETE_SUBSCRIPTION_PRIVILEGED";
|
||||||
field @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public static final String ACTION_OTA_STATUS_CHANGED = "android.telephony.euicc.action.OTA_STATUS_CHANGED";
|
field @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public static final String ACTION_OTA_STATUS_CHANGED = "android.telephony.euicc.action.OTA_STATUS_CHANGED";
|
||||||
field public static final String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.telephony.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION";
|
field public static final String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.telephony.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION";
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ import com.android.internal.telephony.euicc.IEuiccController;
|
|||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EuiccManager is the application interface to eUICCs, or eSIMs/embedded SIMs.
|
* EuiccManager is the application interface to eUICCs, or eSIMs/embedded SIMs.
|
||||||
@@ -938,6 +941,138 @@ public class EuiccManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the supported countries for eUICC.
|
||||||
|
*
|
||||||
|
* <p>Requires that the calling app has the
|
||||||
|
* {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission.
|
||||||
|
*
|
||||||
|
* <p>The supported country list will be replaced by {@code supportedCountries}. For how we
|
||||||
|
* determine whether a country is supported please check {@link #isSupportedCountry}.
|
||||||
|
*
|
||||||
|
* @param supportedCountries is a list of strings contains country ISO codes in uppercase.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
@RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
|
||||||
|
public void setSupportedCountries(@NonNull List<String> supportedCountries) {
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
getIEuiccController().setSupportedCountries(
|
||||||
|
true /* isSupported */,
|
||||||
|
supportedCountries.stream()
|
||||||
|
.map(String::toUpperCase).collect(Collectors.toList()));
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the unsupported countries for eUICC.
|
||||||
|
*
|
||||||
|
* <p>Requires that the calling app has the
|
||||||
|
* {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission.
|
||||||
|
*
|
||||||
|
* <p>The unsupported country list will be replaced by {@code unsupportedCountries}. For how we
|
||||||
|
* determine whether a country is supported please check {@link #isSupportedCountry}.
|
||||||
|
*
|
||||||
|
* @param unsupportedCountries is a list of strings contains country ISO codes in uppercase.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
@RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
|
||||||
|
public void setUnsupportedCountries(@NonNull List<String> unsupportedCountries) {
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
getIEuiccController().setSupportedCountries(
|
||||||
|
false /* isSupported */,
|
||||||
|
unsupportedCountries.stream()
|
||||||
|
.map(String::toUpperCase).collect(Collectors.toList()));
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the supported countries for eUICC.
|
||||||
|
*
|
||||||
|
* <p>Requires that the calling app has the
|
||||||
|
* {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission.
|
||||||
|
*
|
||||||
|
* @return list of strings contains country ISO codes in uppercase.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
@RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
|
||||||
|
@NonNull
|
||||||
|
public List<String> getSupportedCountries() {
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return getIEuiccController().getSupportedCountries(true /* isSupported */);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the unsupported countries for eUICC.
|
||||||
|
*
|
||||||
|
* <p>Requires that the calling app has the
|
||||||
|
* {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission.
|
||||||
|
*
|
||||||
|
* @return list of strings contains country ISO codes in uppercase.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
@RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
|
||||||
|
@NonNull
|
||||||
|
public List<String> getUnsupportedCountries() {
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return getIEuiccController().getSupportedCountries(false /* isSupported */);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the given country supports eUICC.
|
||||||
|
*
|
||||||
|
* <p>Supported country list has a higher prority than unsupported country list. If the
|
||||||
|
* supported country list is not empty, {@code countryIso} will be considered as supported when
|
||||||
|
* it exists in the supported country list. Otherwise {@code countryIso} is not supported. If
|
||||||
|
* the supported country list is empty, {@code countryIso} will be considered as supported if it
|
||||||
|
* does not exist in the unsupported country list. Otherwise {@code countryIso} is not
|
||||||
|
* supported. If both supported and unsupported country lists are empty, then all countries are
|
||||||
|
* consider be supported. For how to set supported and unsupported country list, please check
|
||||||
|
* {@link #setSupportedCountries} and {@link #setUnsupportedCountries}.
|
||||||
|
*
|
||||||
|
* @param countryIso should be the ISO-3166 country code is provided in uppercase 2 character
|
||||||
|
* format.
|
||||||
|
* @return whether the given country supports eUICC or not.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
@RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
|
||||||
|
public boolean isSupportedCountry(@NonNull String countryIso) {
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return getIEuiccController().isSupportedCountry(countryIso.toUpperCase());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the cardId if its uninitialized, and returns whether we should continue the
|
* Refreshes the cardId if its uninitialized, and returns whether we should continue the
|
||||||
* operation.
|
* operation.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.telephony.euicc.DownloadableSubscription;
|
import android.telephony.euicc.DownloadableSubscription;
|
||||||
import android.telephony.euicc.EuiccInfo;
|
import android.telephony.euicc.EuiccInfo;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
interface IEuiccController {
|
interface IEuiccController {
|
||||||
@@ -47,4 +48,7 @@ interface IEuiccController {
|
|||||||
oneway void eraseSubscriptionsWithOptions(
|
oneway void eraseSubscriptionsWithOptions(
|
||||||
int cardId, int options, in PendingIntent callbackIntent);
|
int cardId, int options, in PendingIntent callbackIntent);
|
||||||
oneway void retainSubscriptionsForFactoryReset(int cardId, in PendingIntent callbackIntent);
|
oneway void retainSubscriptionsForFactoryReset(int cardId, in PendingIntent callbackIntent);
|
||||||
|
void setSupportedCountries(boolean isSupported, in List<String> countriesList);
|
||||||
|
List<String> getSupportedCountries(boolean isSupported);
|
||||||
|
boolean isSupportedCountry(String countryIso);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user