Merge "Add public APIs for carrier apps"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d264bad..9b029ab 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -469,6 +469,21 @@
</intent-filter>
</activity>
+ <!--
+ Handler for EuiccManager's public action intents. These are public and do not require
+ any special permissions to start, although the calling package name should be
+ whitelisted by the underlying eUICC service implementation (i.e. the LPA).
+ -->
+ <activity android:name=".euicc.EuiccPublicActionUiDispatcherActivity"
+ android:theme="@android:style/Theme.NoDisplay">
+ <!-- Max out priority to ensure nobody else will handle these intents. -->
+ <intent-filter android:priority="1000">
+ <action android:name=
+ "android.telephony.euicc.action.START_EUICC_ACTIVATION" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
<activity android:name="EmergencyCallbackModeExitDialog"
android:excludeFromRecents="true"
android:label="@string/ecm_exit_dialog"
diff --git a/src/com/android/phone/euicc/EuiccPublicActionUiDispatcherActivity.java b/src/com/android/phone/euicc/EuiccPublicActionUiDispatcherActivity.java
new file mode 100644
index 0000000..64a40b9
--- /dev/null
+++ b/src/com/android/phone/euicc/EuiccPublicActionUiDispatcherActivity.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.phone.euicc;
+
+import android.annotation.Nullable;
+import android.content.Intent;
+import android.service.euicc.EuiccService;
+import android.telephony.euicc.EuiccManager;
+import android.util.Log;
+
+/**
+ * Trampoline activity to forward public eUICC intents to the active UI implementation.
+ *
+ * <p>Unlike {@link EuiccUiDispatcherActivity}, this activity does not require any permissions to
+ * start.
+ */
+public class EuiccPublicActionUiDispatcherActivity extends EuiccUiDispatcherActivity {
+ private static final String TAG = "EuiccPublicActionUiDispatcherActivity";
+
+ @Override
+ @Nullable
+ protected Intent getEuiccUiIntent() {
+ String action = getIntent().getAction();
+
+ Intent intent = new Intent();
+ // Propagate the extras from the original Intent.
+ intent.putExtras(getIntent());
+ switch (action) {
+ case EuiccManager.ACTION_START_EUICC_ACTIVATION:
+ intent.setAction(EuiccService.ACTION_START_EUICC_ACTIVATION);
+ break;
+ default:
+ Log.w(TAG, "Unsupported action: " + action);
+ return null;
+ }
+
+ return intent;
+ }
+}