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 privileged eUICC intents from the system to the active UI 26 * implementation. 27 * 28 * <p>Unlike {@link EuiccUiDispatcherActivity}, this activity requires a locked-down permission to 29 * start. 30 */ 31 public class EuiccPrivilegedActionUiDispatcherActivity extends EuiccUiDispatcherActivity { 32 private static final String TAG = "EuiccPrivUiDispatcher"; 33 34 @Override 35 @Nullable getEuiccUiIntent()36 protected Intent getEuiccUiIntent() { 37 String action = getIntent().getAction(); 38 if (action == null) { 39 Log.w(TAG, "No action is specified in the intent"); 40 return null; 41 } 42 43 Intent intent = new Intent(); 44 // Propagate the extras from the original Intent. 45 intent.putExtras(getIntent()); 46 switch (action) { 47 case EuiccManager.ACTION_TOGGLE_SUBSCRIPTION_PRIVILEGED: 48 intent.setAction(EuiccService.ACTION_TOGGLE_SUBSCRIPTION_PRIVILEGED); 49 break; 50 case EuiccManager.ACTION_DELETE_SUBSCRIPTION_PRIVILEGED: 51 intent.setAction(EuiccService.ACTION_DELETE_SUBSCRIPTION_PRIVILEGED); 52 break; 53 case EuiccManager.ACTION_RENAME_SUBSCRIPTION_PRIVILEGED: 54 intent.setAction(EuiccService.ACTION_RENAME_SUBSCRIPTION_PRIVILEGED); 55 break; 56 default: 57 Log.w(TAG, "Unsupported action: " + action); 58 return null; 59 } 60 61 return intent; 62 } 63 } 64