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 if (action == null) { 38 Log.w(TAG, "No action is specified in the intent"); 39 return null; 40 } 41 42 Intent intent = new Intent(); 43 // Propagate the extras from the original Intent. 44 intent.putExtras(getIntent()); 45 switch (action) { 46 case EuiccManager.ACTION_START_EUICC_ACTIVATION: 47 intent.setAction(EuiccService.ACTION_START_EUICC_ACTIVATION); 48 break; 49 default: 50 Log.w(TAG, "Unsupported action: " + action); 51 return null; 52 } 53 54 return intent; 55 } 56 } 57