Fixed CTS EuiccManagerTest on HSUM devices
When EuiccManagerTest runs on HSUM devices, the
EuiccUiDispatcherActivity is running as secondary user and on
a different process than phone process. Fixed by storing the
test component in the phone process. This also fixed a security issue
that any malware can use the shell command to override the Euicc
UI component and mess up the eSIM download procedure.
Fix: 353346528
Test: atest EuiccManagerTest on HSUM device
Flag: EXEMPT bug fix
Change-Id: Ib59cb02949bbbd29bc14e426fbd444d4855f2ef9
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 7342580..92ed609 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -442,6 +442,9 @@
private PackageManager mPackageManager;
private final int mVendorApiLevel;
+ @Nullable
+ private ComponentName mTestEuiccUiComponent;
+
/** User Activity */
private final AtomicBoolean mNotifyUserActivity;
private static final int USER_ACTIVITY_NOTIFICATION_DELAY = 200;
@@ -14439,4 +14442,31 @@
Binder.restoreCallingIdentity(identity);
}
}
+
+ /**
+ * This API can be used by only CTS to override the Euicc UI component.
+ *
+ * @param componentName ui component to be launched for testing. {@code null} to reset.
+ *
+ * @hide
+ */
+ @Override
+ public void setTestEuiccUiComponent(@Nullable ComponentName componentName) {
+ enforceModifyPermission();
+ log("setTestEuiccUiComponent: " + componentName);
+ mTestEuiccUiComponent = componentName;
+ }
+
+ /**
+ * This API can be used by only CTS to retrieve the Euicc UI component.
+ *
+ * @return Euicc UI component. {@code null} if not available.
+ * @hide
+ */
+ @Override
+ @Nullable
+ public ComponentName getTestEuiccUiComponent() {
+ enforceReadPrivilegedPermission("getTestEuiccUiComponent");
+ return mTestEuiccUiComponent;
+ }
}