Merge "Add Telecom command for setting connectionservice filter"

am: 25f4dca660

Change-Id: I00ba7ce3b64f4680eaf8798c52d98318160b45f0
This commit is contained in:
Brad Ebinger
2019-10-01 10:51:45 -07:00
committed by android-build-merger
5 changed files with 74 additions and 17 deletions

View File

@@ -2895,6 +2895,14 @@ package android.telephony {
}
package android.telephony.emergency {
public final class EmergencyNumber implements java.lang.Comparable<android.telephony.emergency.EmergencyNumber> android.os.Parcelable {
field public static final int EMERGENCY_NUMBER_SOURCE_TEST = 32; // 0x20
}
}
package android.telephony.mbms {
public static class DownloadRequest.Builder {

View File

@@ -78,6 +78,8 @@ public final class Telecom extends BaseCommand {
private static final String COMMAND_SET_SIM_COUNT = "set-sim-count";
private static final String COMMAND_GET_SIM_CONFIG = "get-sim-config";
private static final String COMMAND_GET_MAX_PHONES = "get-max-phones";
private static final String COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER =
"set-test-emergency-phone-account-package-filter";
private ComponentName mComponent;
private String mAccountId;
@@ -91,7 +93,10 @@ public final class Telecom extends BaseCommand {
+ "usage: telecom set-phone-account-enabled <COMPONENT> <ID> <USER_SN>\n"
+ "usage: telecom set-phone-account-disabled <COMPONENT> <ID> <USER_SN>\n"
+ "usage: telecom register-phone-account <COMPONENT> <ID> <USER_SN> <LABEL>\n"
+ "usage: telecom set-user-selected-outgoing-phone-account <COMPONENT> <ID> "
+ "usage: telecom register-sim-phone-account [-e] <COMPONENT> <ID> <USER_SN>"
+ " <LABEL>: registers a PhoneAccount with CAPABILITY_SIM_SUBSCRIPTION"
+ " and optionally CAPABILITY_PLACE_EMERGENCY_CALLS if \"-e\" is provided\n"
+ "usage: telecom set-user-selected-outgoing-phone-account [-e] <COMPONENT> <ID> "
+ "<USER_SN>\n"
+ "usage: telecom set-test-call-redirection-app <PACKAGE>\n"
+ "usage: telecom set-test-call-screening-app <PACKAGE>\n"
@@ -108,6 +113,7 @@ public final class Telecom extends BaseCommand {
+ "usage: telecom set-sim-count <COUNT>\n"
+ "usage: telecom get-sim-config\n"
+ "usage: telecom get-max-phones\n"
+ "usage: telecom set-emer-phone-account-filter <PACKAGE>\n"
+ "\n"
+ "telecom set-phone-account-enabled: Enables the given phone account, if it has"
+ " already been registered with Telecom.\n"
@@ -121,6 +127,8 @@ public final class Telecom extends BaseCommand {
+ "telecom get-default-dialer: Displays the current default dialer.\n"
+ "\n"
+ "telecom get-system-dialer: Displays the current system dialer.\n"
+ "telecom set-system-dialer: Set the override system dialer to the given"
+ " component. To remove the override, send \"default\"\n"
+ "\n"
+ "telecom wait-on-handlers: Wait until all handlers finish their work.\n"
+ "\n"
@@ -131,6 +139,10 @@ public final class Telecom extends BaseCommand {
+ " or \"\" for single SIM\n"
+ "\n"
+ "telecom get-max-phones: Get the max supported phones from the modem.\n"
+ "telecom set-test-emergency-phone-account-package-filter <PACKAGE>: sets a"
+ " package name that will be used for test emergency calls. To clear,"
+ " send an empty package name. Real emergency calls will still be placed"
+ " over Telephony.\n"
);
}
@@ -219,6 +231,9 @@ public final class Telecom extends BaseCommand {
case COMMAND_GET_MAX_PHONES:
runGetMaxPhones();
break;
case COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER:
runSetEmergencyPhoneAccountPackageFilter();
break;
default:
Log.w(this, "onRun: unknown command: %s", command);
throw new IllegalArgumentException ("unknown command '" + command + "'");
@@ -245,19 +260,31 @@ public final class Telecom extends BaseCommand {
}
private void runRegisterSimPhoneAccount() throws RemoteException {
boolean isEmergencyAccount = false;
String opt;
while ((opt = nextOption()) != null) {
switch (opt) {
case "-e": {
isEmergencyAccount = true;
break;
}
}
}
final PhoneAccountHandle handle = getPhoneAccountHandleFromArgs();
final String label = nextArgRequired();
final String address = nextArgRequired();
int capabilities = PhoneAccount.CAPABILITY_CALL_PROVIDER
| PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION
| (isEmergencyAccount ? PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS : 0);
PhoneAccount account = PhoneAccount.builder(
handle, label)
.setAddress(Uri.parse(address))
.setSubscriptionAddress(Uri.parse(address))
.setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER |
PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)
.setShortDescription(label)
.addSupportedUriScheme(PhoneAccount.SCHEME_TEL)
.addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL)
.build();
.setAddress(Uri.parse(address))
.setSubscriptionAddress(Uri.parse(address))
.setCapabilities(capabilities)
.setShortDescription(label)
.addSupportedUriScheme(PhoneAccount.SCHEME_TEL)
.addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL)
.build();
mTelecomService.registerPhoneAccount(account);
System.out.println("Success - " + handle + " registered.");
}
@@ -309,9 +336,11 @@ public final class Telecom extends BaseCommand {
}
private void runSetSystemDialer() throws RemoteException {
final String packageName = nextArg();
mTelecomService.setSystemDialerPackage(packageName.equals("default") ? null : packageName);
System.out.println("Success - " + packageName + " set as override system dialer.");
final String flatComponentName = nextArg();
final ComponentName componentName = (flatComponentName.equals("default")
? null : parseComponentName(flatComponentName));
mTelecomService.setSystemDialer(componentName);
System.out.println("Success - " + componentName + " set as override system dialer.");
}
private void runGetDefaultDialer() throws RemoteException {
@@ -355,6 +384,18 @@ public final class Telecom extends BaseCommand {
}
}
private void runSetEmergencyPhoneAccountPackageFilter() throws RemoteException {
String packageName = mArgs.getNextArg();
if (TextUtils.isEmpty(packageName)) {
mTelecomService.setTestEmergencyPhoneAccountPackageNameFilter(null);
System.out.println("Success - filter cleared");
} else {
mTelecomService.setTestEmergencyPhoneAccountPackageNameFilter(packageName);
System.out.println("Success = filter set to " + packageName);
}
}
private PhoneAccountHandle getPhoneAccountHandleFromArgs() throws RemoteException {
if (TextUtils.isEmpty(mArgs.peekNextArg())) {
return null;

View File

@@ -2059,12 +2059,13 @@ public class TelecomManager {
/**
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
* @param callingPackageProxy The original package that called this before it was trampolined.
* @hide
*/
public void handleCallIntent(Intent intent) {
public void handleCallIntent(Intent intent, String callingPackageProxy) {
try {
if (isServiceConnected()) {
getTelecomService().handleCallIntent(intent);
getTelecomService().handleCallIntent(intent, callingPackageProxy);
}
} catch (RemoteException e) {
Log.e(TAG, "RemoteException handleCallIntent: " + e);

View File

@@ -281,6 +281,11 @@ interface ITelecomService {
*/
void acceptHandover(in Uri srcAddr, int videoState, in PhoneAccountHandle destAcct);
/**
* @see TelecomServiceImpl#setTestEmergencyPhoneAccountPackageNameFilter
*/
void setTestEmergencyPhoneAccountPackageNameFilter(String packageName);
/**
* @see TelecomServiceImpl#isInEmergencyCall
*/
@@ -289,7 +294,7 @@ interface ITelecomService {
/**
* @see TelecomServiceImpl#handleCallIntent
*/
void handleCallIntent(in Intent intent);
void handleCallIntent(in Intent intent, in String callingPackageProxy);
void setTestDefaultCallRedirectionApp(String packageName);
@@ -302,9 +307,9 @@ interface ITelecomService {
void setTestAutoModeApp(String packageName);
/**
* @see TelecomServiceImpl#setSystemDialerPackage
* @see TelecomServiceImpl#setSystemDialer
*/
void setSystemDialerPackage(in String packageName);
void setSystemDialer(in ComponentName testComponentName);
/**
* @see TelecomServiceImpl#setTestDefaultDialer

View File

@@ -18,6 +18,7 @@ package android.telephony.emergency;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.hardware.radio.V1_4.EmergencyNumberSource;
import android.hardware.radio.V1_4.EmergencyServiceCategory;
import android.os.Parcel;
@@ -184,6 +185,7 @@ public final class EmergencyNumber implements Parcelable, Comparable<EmergencyNu
*
* @hide
*/
@TestApi
public static final int EMERGENCY_NUMBER_SOURCE_TEST = 1 << 5;
/** Bit-field which indicates the number is from the modem config. */
public static final int EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG =