1 /* 2 * Copyright (C) 2023 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 17 package android.telecom.cts.apps; 18 19 import android.content.ComponentName; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 import android.telecom.PhoneAccount; 23 import android.telecom.PhoneAccountHandle; 24 25 /** 26 * Each enum in TelecomTestApp represents an application in the cts/tests/tests/telecom-apps 27 * directory. 28 */ 29 public enum TelecomTestApp implements Parcelable { 30 TransactionalVoipAppMain, 31 TransactionalVoipAppClone, 32 ConnectionServiceVoipAppMain, 33 ConnectionServiceVoipAppClone, 34 ManagedConnectionServiceApp; 35 36 /** 37 * General TestApp info 38 */ 39 public static final String DEFAULT_ID = "1"; 40 public static final String CUSTOM_ID = "2"; 41 42 /** 43 * ManagedConnectionServiceApp 44 */ 45 public static final String MANAGED_APP_ID = "ManagedApp_1"; 46 public static final String MANAGED_PACKAGE_NAME = "android.telecom.cts.apps.managedapp"; 47 public static final String MANAGED_CONNECTION_SERVICE_NAME = 48 MANAGED_PACKAGE_NAME + ".ManagedConnectionService"; 49 public static final ComponentName MANAGED_APP_CN = new ComponentName( 50 MANAGED_PACKAGE_NAME, MANAGED_CONNECTION_SERVICE_NAME 51 ); 52 public static final String CONTROL_INTERFACE_ACTION = MANAGED_PACKAGE_NAME + ".BIND"; 53 public static final String MANAGED_ADDRESS = "tel:555-TEST-sim2"; 54 public static final String MANAGED_APP_LABEL = "test label"; 55 56 57 /** 58 * ConnectionServiceVoipApp* 59 */ 60 public static final String SELF_MANAGED_CS_MAIN_PACKAGE_NAME = 61 "android.telecom.cts.apps.connectionservicevoipappmain"; 62 public static final String SELF_MANAGED_CS_CLONE_PACKAGE_NAME = 63 "android.telecom.cts.apps.connectionservicevoipappclone"; 64 65 public static final String SELF_MANAGED_CS_MAIN_SERVICE = 66 SELF_MANAGED_CS_MAIN_PACKAGE_NAME + ".VoipConnectionServiceMain"; 67 public static final String SELF_CLONE_CS_MAIN_SERVICE = 68 SELF_MANAGED_CS_CLONE_PACKAGE_NAME + ".VoipConnectionServiceClone"; 69 70 71 72 public static final String VOIP_CS_CONTROL_INTERFACE_ACTION = 73 "android.telecom.cts.apps.connectionservicevoipapp.BIND"; 74 75 public static final PhoneAccountHandle SELF_MANAGED_CS_MAIN_HANDLE = new PhoneAccountHandle( 76 new ComponentName(SELF_MANAGED_CS_MAIN_PACKAGE_NAME, 77 SELF_MANAGED_CS_MAIN_SERVICE), DEFAULT_ID); 78 79 public static final PhoneAccountHandle SELF_MANAGED_CS_MAIN_CUSTOM_HANDLE = 80 new PhoneAccountHandle( 81 new ComponentName(SELF_MANAGED_CS_MAIN_PACKAGE_NAME, 82 SELF_MANAGED_CS_MAIN_SERVICE), CUSTOM_ID); 83 84 public static final PhoneAccountHandle SELF_MANAGED_CS_MAIN_TRANSACTIONAL_HANDLE = 85 new PhoneAccountHandle( 86 new ComponentName(SELF_MANAGED_CS_MAIN_PACKAGE_NAME, 87 SELF_MANAGED_CS_MAIN_PACKAGE_NAME), CUSTOM_ID); 88 89 public static final PhoneAccountHandle SELF_MANAGED_CS_CLONE_HANDLE = 90 new PhoneAccountHandle( 91 new ComponentName(SELF_MANAGED_CS_CLONE_PACKAGE_NAME, 92 SELF_CLONE_CS_MAIN_SERVICE), DEFAULT_ID); 93 94 public static final PhoneAccount SELF_MANAGED_CS_MAIN_ACCOUNT = 95 PhoneAccount.builder(SELF_MANAGED_CS_MAIN_HANDLE, 96 "SelfManaged_Main D-Label") 97 .setCapabilities( 98 PhoneAccount.CAPABILITY_SELF_MANAGED 99 ).build(); 100 101 public static final PhoneAccount SELF_MANAGED_CS_MAIN_ACCOUNT_CUSTOM = 102 PhoneAccount.builder(SELF_MANAGED_CS_MAIN_CUSTOM_HANDLE, 103 "SelfManaged_Main C-Label") 104 .setCapabilities( 105 PhoneAccount.CAPABILITY_SELF_MANAGED 106 ).build(); 107 108 public static final PhoneAccount SELF_MANAGED_CS_MAIN_ACCOUNT_TRANSACTIONAL = 109 PhoneAccount.builder(SELF_MANAGED_CS_MAIN_TRANSACTIONAL_HANDLE, 110 "SelfManaged_Main Transactional-Label") 111 .setCapabilities( 112 PhoneAccount.CAPABILITY_SELF_MANAGED 113 | PhoneAccount.CAPABILITY_SUPPORTS_TRANSACTIONAL_OPERATIONS 114 ).build(); 115 116 public static final PhoneAccount SELF_MANAGED_CS_CLONE_ACCOUNT = 117 PhoneAccount.builder(SELF_MANAGED_CS_CLONE_HANDLE, 118 "SelfManaged_Clone D-Label") 119 .setCapabilities( 120 PhoneAccount.CAPABILITY_SELF_MANAGED 121 ).build(); 122 123 /** 124 * TransactionalVoipApp* 125 */ 126 public static final String TRANSACTIONAL_PACKAGE_NAME = 127 "android.telecom.cts.apps.transactionalvoipappmain"; 128 public static final String TRANSACTIONAL_CLONE_PACKAGE_NAME = 129 "android.telecom.cts.apps.transactionalvoipappclone"; 130 public static final String T_CONTROL_INTERFACE_ACTION = 131 "android.telecom.cts.apps.transactionalvoipapp.BIND"; 132 133 134 public static final PhoneAccountHandle TRANSACTIONAL_APP_DEFAULT_HANDLE = 135 new PhoneAccountHandle( 136 new ComponentName(TRANSACTIONAL_PACKAGE_NAME, TRANSACTIONAL_PACKAGE_NAME), 137 DEFAULT_ID); 138 139 public static final PhoneAccountHandle TRANSACTIONAL_APP_SUPPLEMENTARY_HANDLE = 140 new PhoneAccountHandle( 141 new ComponentName(TRANSACTIONAL_PACKAGE_NAME, TRANSACTIONAL_PACKAGE_NAME), 142 CUSTOM_ID); 143 144 public static final PhoneAccountHandle TRANSACTIONAL_APP_CLONE_DEFAULT_HANDLE = 145 new PhoneAccountHandle( 146 new ComponentName(TRANSACTIONAL_CLONE_PACKAGE_NAME, 147 TRANSACTIONAL_CLONE_PACKAGE_NAME), 148 CUSTOM_ID); 149 150 public static final PhoneAccount TRANSACTIONAL_MAIN_DEFAULT_ACCOUNT = 151 PhoneAccount.builder(TRANSACTIONAL_APP_DEFAULT_HANDLE, "T-Label MAIN") 152 .setCapabilities( 153 PhoneAccount.CAPABILITY_SUPPORTS_TRANSACTIONAL_OPERATIONS 154 | PhoneAccount.CAPABILITY_SUPPORTS_VIDEO_CALLING 155 | PhoneAccount.CAPABILITY_VIDEO_CALLING 156 ).build(); 157 158 public static final PhoneAccount TRANSACTIONAL_MAIN_SUPPLEMENTARY_ACCOUNT = 159 PhoneAccount.builder(TRANSACTIONAL_APP_SUPPLEMENTARY_HANDLE, "T-Label MAIN supp.") 160 .setCapabilities( 161 PhoneAccount.CAPABILITY_SUPPORTS_TRANSACTIONAL_OPERATIONS 162 | PhoneAccount.CAPABILITY_SUPPORTS_VIDEO_CALLING 163 | PhoneAccount.CAPABILITY_VIDEO_CALLING 164 | PhoneAccount.CAPABILITY_SELF_MANAGED 165 ).build(); 166 167 public static final PhoneAccount TRANSACTIONAL_CLONE_ACCOUNT = 168 PhoneAccount.builder(TRANSACTIONAL_APP_CLONE_DEFAULT_HANDLE, "T-Label CLONE") 169 .setCapabilities( 170 PhoneAccount.CAPABILITY_SUPPORTS_TRANSACTIONAL_OPERATIONS 171 | PhoneAccount.CAPABILITY_SUPPORTS_VIDEO_CALLING 172 | PhoneAccount.CAPABILITY_VIDEO_CALLING 173 ).build(); 174 175 @Override describeContents()176 public int describeContents() { 177 return 0; 178 } 179 180 @Override writeToParcel(Parcel dest, int flags)181 public void writeToParcel(Parcel dest, int flags) { 182 dest.writeInt(toInteger()); 183 } 184 185 public static final Creator<TelecomTestApp> CREATOR = new Creator<>() { 186 @Override 187 public TelecomTestApp createFromParcel(Parcel in) { 188 return TelecomTestApp.fromInteger(in.readInt()); 189 } 190 191 @Override 192 public TelecomTestApp[] newArray(int size) { 193 return new TelecomTestApp[size]; 194 } 195 }; 196 toInteger()197 public int toInteger() { 198 return this.ordinal(); 199 } 200 fromInteger(int value)201 public static TelecomTestApp fromInteger(int value) { 202 return values()[value]; 203 } 204 } 205