1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.phone.euicc;
17 
18 import android.annotation.Nullable;
19 import android.content.Intent;
20 import android.service.euicc.EuiccService;
21 import android.telephony.euicc.EuiccManager;
22 import android.util.Log;
23 
24 /**
25  * Trampoline activity to forward public eUICC intents to the active UI implementation.
26  *
27  * <p>Unlike {@link EuiccUiDispatcherActivity}, this activity does not require any permissions to
28  * start.
29  */
30 public class EuiccPublicActionUiDispatcherActivity extends EuiccUiDispatcherActivity {
31     private static final String TAG = "EuiccPublicActionUiDispatcherActivity";
32 
33     @Override
34     @Nullable
getEuiccUiIntent()35     protected Intent getEuiccUiIntent() {
36         String action = getIntent().getAction();
37 
38         Intent intent = new Intent();
39         // Propagate the extras from the original Intent.
40         intent.putExtras(getIntent());
41         switch (action) {
42             case EuiccManager.ACTION_START_EUICC_ACTIVATION:
43                 intent.setAction(EuiccService.ACTION_START_EUICC_ACTIVATION);
44                 break;
45             default:
46                 Log.w(TAG, "Unsupported action: " + action);
47                 return null;
48         }
49 
50         return intent;
51     }
52 }
53