API plumbing to support carrier app downloading.
-Include UiccAccessRules in a DownloadableSubscription, so the LPA can
tell the platform which apps are permitted to manage a particular
embedded subscription.
-Include the calling package in the API, so the platform can match the
package against the UiccAccessRule package list.
Bug: 33075886
Test: TreeHugger
Change-Id: Ifc7d3eca07d5ebea0e09398dfc1e253f1a273813
diff --git a/telephony/java/android/telephony/euicc/DownloadableSubscription.java b/telephony/java/android/telephony/euicc/DownloadableSubscription.java
index e880978..b12864c 100644
--- a/telephony/java/android/telephony/euicc/DownloadableSubscription.java
+++ b/telephony/java/android/telephony/euicc/DownloadableSubscription.java
@@ -18,6 +18,7 @@
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.UiccAccessRule;
import com.android.internal.util.Preconditions;
@@ -57,6 +58,8 @@
private String carrierName;
// see isConsentGranted and setConsentGranted
private boolean consentGranted;
+ // see getAccessRules and setAccessRules
+ private UiccAccessRule[] accessRules;
/** @hide */
private DownloadableSubscription(String encodedActivationCode) {
@@ -67,6 +70,7 @@
encodedActivationCode = in.readString();
carrierName = in.readString();
consentGranted = in.readInt() == 1;
+ accessRules = in.createTypedArray(UiccAccessRule.CREATOR);
}
/**
@@ -103,7 +107,7 @@
*/
@Nullable
public String getCarrierName() {
- return this.carrierName;
+ return carrierName;
}
@@ -112,7 +116,7 @@
* @hide
*/
public void setConsentGranted() {
- this.consentGranted = true;
+ consentGranted = true;
}
/**
@@ -125,7 +129,31 @@
* TODO(b/35851809): Make this a SystemApi.
*/
public boolean isConsentGranted() {
- return this.consentGranted;
+ return consentGranted;
+ }
+
+ /**
+ * Returns the {@link UiccAccessRule}s dictating access to this subscription.
+ *
+ * <p>Only present for downloadable subscriptions that were queried from a server (as opposed to
+ * those created with {@link #forActivationCode}). May be populated with
+ * {@link EuiccManager#getDownloadableSubscriptionMetadata}.
+ * @hide
+ *
+ * TODO(b/35851809): Make this a SystemApi.
+ */
+ public UiccAccessRule[] getAccessRules() {
+ return accessRules;
+ }
+
+ /**
+ * Set the {@link UiccAccessRule}s dictating access to this subscription.
+ * @hide
+ *
+ * TODO(b/35851809): Make this a SystemApi.
+ */
+ public void setAccessRules(UiccAccessRule[] accessRules) {
+ this.accessRules = accessRules;
}
/**
@@ -144,6 +172,7 @@
dest.writeString(encodedActivationCode);
dest.writeString(carrierName);
dest.writeInt(consentGranted ? 1 : 0);
+ dest.writeTypedArray(accessRules, flags);
}
@Override
diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java
index 73cf162..10492c0 100644
--- a/telephony/java/android/telephony/euicc/EuiccManager.java
+++ b/telephony/java/android/telephony/euicc/EuiccManager.java
@@ -178,7 +178,8 @@
return;
}
try {
- mController.downloadSubscription(subscription, switchAfterDownload, callbackIntent);
+ mController.downloadSubscription(subscription, switchAfterDownload,
+ mContext.getOpPackageName(), callbackIntent);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl
index b2092bb..de198c1 100644
--- a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl
+++ b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl
@@ -25,5 +25,5 @@
in PendingIntent callbackIntent);
String getEid();
oneway void downloadSubscription(in DownloadableSubscription subscription,
- boolean switchAfterDownload, in PendingIntent callbackIntent);
+ boolean switchAfterDownload, String callingPackage, in PendingIntent callbackIntent);
}
\ No newline at end of file