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