Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02b70189 authored by Jack Yu's avatar Jack Yu
Browse files

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: I3fa872036dc7061e5a38f9d73b9eb57b99e59737
parent 5b3ec801
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -19426,4 +19426,48 @@ public class TelephonyManager {
                return "UNKNOWN(" + state + ")";
        }
    }
    /**
     * 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
     */
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public void setTestEuiccUiComponent(@Nullable ComponentName componentName) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony == null) {
                Rlog.e(TAG, "setTestEuiccUiComponent(): ITelephony instance is NULL");
                throw new IllegalStateException("Telephony service not available.");
            }
            telephony.setTestEuiccUiComponent(componentName);
        } catch (RemoteException ex) {
            Rlog.e(TAG, "setTestEuiccUiComponent() RemoteException : " + ex);
            throw ex.rethrowAsRuntimeException();
        }
    }
    /**
     * This API can be used by only CTS to retrieve the Euicc UI component.
     *
     * @return The Euicc UI component for testing. {@code null} if not available.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    @Nullable
    public ComponentName getTestEuiccUiComponent() {
        try {
            ITelephony telephony = getITelephony();
            if (telephony == null) {
                Rlog.e(TAG, "getTestEuiccUiComponent(): ITelephony instance is NULL");
                throw new IllegalStateException("Telephony service not available.");
            }
            return telephony.getTestEuiccUiComponent();
        } catch (RemoteException ex) {
            Rlog.e(TAG, "getTestEuiccUiComponent() RemoteException : " + ex);
            throw ex.rethrowAsRuntimeException();
        }
    }
}
+16 −0
Original line number Diff line number Diff line
@@ -3409,4 +3409,20 @@ interface ITelephony {
     * @hide
     */
    boolean setSatelliteSubscriberIdListChangedIntentComponent(in String name);

    /**
     * This API can be used by only CTS to override the Euicc UI component.
     *
     * @param componentName ui component to be launched for testing
     * @hide
     */
    void setTestEuiccUiComponent(in ComponentName componentName);

    /**
     * This API can be used by only CTS to retrieve the Euicc UI component.
     *
     * @return The Euicc UI component for testing.
     * @hide
     */
    ComponentName getTestEuiccUiComponent();
}