Propagate intent extras in dispatcher activity
Forward any intent extras set in the EuiccUiDispatcherActivity.
Test: atest tests/src/com/android/phone/euicc/EuiccUiDispatcherActivityTest.java
Bug: 74211978
Change-Id: I9f3398521315f32897dc7d770014f79d5f5daabf
diff --git a/src/com/android/phone/euicc/EuiccUiDispatcherActivity.java b/src/com/android/phone/euicc/EuiccUiDispatcherActivity.java
index 19ef9f7..8297c18 100644
--- a/src/com/android/phone/euicc/EuiccUiDispatcherActivity.java
+++ b/src/com/android/phone/euicc/EuiccUiDispatcherActivity.java
@@ -89,15 +89,13 @@
String action = getIntent().getAction();
Intent intent = new Intent();
+ intent.putExtras(getIntent());
switch (action) {
case EuiccManager.ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS:
intent.setAction(EuiccService.ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS);
break;
case EuiccManager.ACTION_PROVISION_EMBEDDED_SUBSCRIPTION:
intent.setAction(EuiccService.ACTION_PROVISION_EMBEDDED_SUBSCRIPTION);
- intent.putExtra(
- EuiccManager.EXTRA_FORCE_PROVISION,
- getIntent().getBooleanExtra(EuiccManager.EXTRA_FORCE_PROVISION, false));
break;
default:
Log.w(TAG, "Unsupported action: " + action);
diff --git a/tests/src/com/android/phone/euicc/EuiccUiDispatcherActivityTest.java b/tests/src/com/android/phone/euicc/EuiccUiDispatcherActivityTest.java
index 901ad9e..5ecebc3 100644
--- a/tests/src/com/android/phone/euicc/EuiccUiDispatcherActivityTest.java
+++ b/tests/src/com/android/phone/euicc/EuiccUiDispatcherActivityTest.java
@@ -15,6 +15,7 @@
*/
package com.android.phone.euicc;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.when;
@@ -94,6 +95,15 @@
assertNotNull(mActivity.resolveEuiccUiIntent());
}
+ @Test
+ public void testExtrasPropagated() {
+ mIntent.putExtra("foo", "bar");
+
+ Intent euiccUiIntent = mActivity.resolveEuiccUiIntent();
+ assertNotNull(euiccUiIntent);
+ assertEquals("bar", euiccUiIntent.getStringExtra("foo"));
+ }
+
class TestEuiccUiDispatcherActivity extends EuiccUiDispatcherActivity {
public TestEuiccUiDispatcherActivity() {
attachBaseContext(mMockContext);