Merge "Add Telecom command for setting connectionservice filter" am: 25f4dca660 am: 05e03e8c0c
am: 4d4dc1165a
Change-Id: Id7e2c0c4f6c18b074ba40d31dbb43ec2dfc269fc
This commit is contained in:
@@ -2896,6 +2896,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 {
|
package android.telephony.mbms {
|
||||||
|
|
||||||
public static class DownloadRequest.Builder {
|
public static class DownloadRequest.Builder {
|
||||||
|
|||||||
@@ -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_SET_SIM_COUNT = "set-sim-count";
|
||||||
private static final String COMMAND_GET_SIM_CONFIG = "get-sim-config";
|
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_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 ComponentName mComponent;
|
||||||
private String mAccountId;
|
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-enabled <COMPONENT> <ID> <USER_SN>\n"
|
||||||
+ "usage: telecom set-phone-account-disabled <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 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"
|
+ "<USER_SN>\n"
|
||||||
+ "usage: telecom set-test-call-redirection-app <PACKAGE>\n"
|
+ "usage: telecom set-test-call-redirection-app <PACKAGE>\n"
|
||||||
+ "usage: telecom set-test-call-screening-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 set-sim-count <COUNT>\n"
|
||||||
+ "usage: telecom get-sim-config\n"
|
+ "usage: telecom get-sim-config\n"
|
||||||
+ "usage: telecom get-max-phones\n"
|
+ "usage: telecom get-max-phones\n"
|
||||||
|
+ "usage: telecom set-emer-phone-account-filter <PACKAGE>\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "telecom set-phone-account-enabled: Enables the given phone account, if it has"
|
+ "telecom set-phone-account-enabled: Enables the given phone account, if it has"
|
||||||
+ " already been registered with Telecom.\n"
|
+ " 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"
|
+ "telecom get-default-dialer: Displays the current default dialer.\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "telecom get-system-dialer: Displays the current system dialer.\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"
|
+ "\n"
|
||||||
+ "telecom wait-on-handlers: Wait until all handlers finish their work.\n"
|
+ "telecom wait-on-handlers: Wait until all handlers finish their work.\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
@@ -131,6 +139,10 @@ public final class Telecom extends BaseCommand {
|
|||||||
+ " or \"\" for single SIM\n"
|
+ " or \"\" for single SIM\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "telecom get-max-phones: Get the max supported phones from the modem.\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:
|
case COMMAND_GET_MAX_PHONES:
|
||||||
runGetMaxPhones();
|
runGetMaxPhones();
|
||||||
break;
|
break;
|
||||||
|
case COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER:
|
||||||
|
runSetEmergencyPhoneAccountPackageFilter();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Log.w(this, "onRun: unknown command: %s", command);
|
Log.w(this, "onRun: unknown command: %s", command);
|
||||||
throw new IllegalArgumentException ("unknown command '" + command + "'");
|
throw new IllegalArgumentException ("unknown command '" + command + "'");
|
||||||
@@ -245,19 +260,31 @@ public final class Telecom extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void runRegisterSimPhoneAccount() throws RemoteException {
|
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 PhoneAccountHandle handle = getPhoneAccountHandleFromArgs();
|
||||||
final String label = nextArgRequired();
|
final String label = nextArgRequired();
|
||||||
final String address = 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(
|
PhoneAccount account = PhoneAccount.builder(
|
||||||
handle, label)
|
handle, label)
|
||||||
.setAddress(Uri.parse(address))
|
.setAddress(Uri.parse(address))
|
||||||
.setSubscriptionAddress(Uri.parse(address))
|
.setSubscriptionAddress(Uri.parse(address))
|
||||||
.setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER |
|
.setCapabilities(capabilities)
|
||||||
PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)
|
.setShortDescription(label)
|
||||||
.setShortDescription(label)
|
.addSupportedUriScheme(PhoneAccount.SCHEME_TEL)
|
||||||
.addSupportedUriScheme(PhoneAccount.SCHEME_TEL)
|
.addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL)
|
||||||
.addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL)
|
.build();
|
||||||
.build();
|
|
||||||
mTelecomService.registerPhoneAccount(account);
|
mTelecomService.registerPhoneAccount(account);
|
||||||
System.out.println("Success - " + handle + " registered.");
|
System.out.println("Success - " + handle + " registered.");
|
||||||
}
|
}
|
||||||
@@ -309,9 +336,11 @@ public final class Telecom extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void runSetSystemDialer() throws RemoteException {
|
private void runSetSystemDialer() throws RemoteException {
|
||||||
final String packageName = nextArg();
|
final String flatComponentName = nextArg();
|
||||||
mTelecomService.setSystemDialerPackage(packageName.equals("default") ? null : packageName);
|
final ComponentName componentName = (flatComponentName.equals("default")
|
||||||
System.out.println("Success - " + packageName + " set as override system dialer.");
|
? null : parseComponentName(flatComponentName));
|
||||||
|
mTelecomService.setSystemDialer(componentName);
|
||||||
|
System.out.println("Success - " + componentName + " set as override system dialer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runGetDefaultDialer() throws RemoteException {
|
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 {
|
private PhoneAccountHandle getPhoneAccountHandleFromArgs() throws RemoteException {
|
||||||
if (TextUtils.isEmpty(mArgs.peekNextArg())) {
|
if (TextUtils.isEmpty(mArgs.peekNextArg())) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -2059,12 +2059,13 @@ public class TelecomManager {
|
|||||||
/**
|
/**
|
||||||
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
|
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
|
||||||
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
|
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
|
||||||
|
* @param callingPackageProxy The original package that called this before it was trampolined.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void handleCallIntent(Intent intent) {
|
public void handleCallIntent(Intent intent, String callingPackageProxy) {
|
||||||
try {
|
try {
|
||||||
if (isServiceConnected()) {
|
if (isServiceConnected()) {
|
||||||
getTelecomService().handleCallIntent(intent);
|
getTelecomService().handleCallIntent(intent, callingPackageProxy);
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "RemoteException handleCallIntent: " + e);
|
Log.e(TAG, "RemoteException handleCallIntent: " + e);
|
||||||
|
|||||||
@@ -281,6 +281,11 @@ interface ITelecomService {
|
|||||||
*/
|
*/
|
||||||
void acceptHandover(in Uri srcAddr, int videoState, in PhoneAccountHandle destAcct);
|
void acceptHandover(in Uri srcAddr, int videoState, in PhoneAccountHandle destAcct);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TelecomServiceImpl#setTestEmergencyPhoneAccountPackageNameFilter
|
||||||
|
*/
|
||||||
|
void setTestEmergencyPhoneAccountPackageNameFilter(String packageName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see TelecomServiceImpl#isInEmergencyCall
|
* @see TelecomServiceImpl#isInEmergencyCall
|
||||||
*/
|
*/
|
||||||
@@ -289,7 +294,7 @@ interface ITelecomService {
|
|||||||
/**
|
/**
|
||||||
* @see TelecomServiceImpl#handleCallIntent
|
* @see TelecomServiceImpl#handleCallIntent
|
||||||
*/
|
*/
|
||||||
void handleCallIntent(in Intent intent);
|
void handleCallIntent(in Intent intent, in String callingPackageProxy);
|
||||||
|
|
||||||
void setTestDefaultCallRedirectionApp(String packageName);
|
void setTestDefaultCallRedirectionApp(String packageName);
|
||||||
|
|
||||||
@@ -302,9 +307,9 @@ interface ITelecomService {
|
|||||||
void setTestAutoModeApp(String packageName);
|
void setTestAutoModeApp(String packageName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see TelecomServiceImpl#setSystemDialerPackage
|
* @see TelecomServiceImpl#setSystemDialer
|
||||||
*/
|
*/
|
||||||
void setSystemDialerPackage(in String packageName);
|
void setSystemDialer(in ComponentName testComponentName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see TelecomServiceImpl#setTestDefaultDialer
|
* @see TelecomServiceImpl#setTestDefaultDialer
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package android.telephony.emergency;
|
|||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.TestApi;
|
||||||
import android.hardware.radio.V1_4.EmergencyNumberSource;
|
import android.hardware.radio.V1_4.EmergencyNumberSource;
|
||||||
import android.hardware.radio.V1_4.EmergencyServiceCategory;
|
import android.hardware.radio.V1_4.EmergencyServiceCategory;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
@@ -184,6 +185,7 @@ public final class EmergencyNumber implements Parcelable, Comparable<EmergencyNu
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@TestApi
|
||||||
public static final int EMERGENCY_NUMBER_SOURCE_TEST = 1 << 5;
|
public static final int EMERGENCY_NUMBER_SOURCE_TEST = 1 << 5;
|
||||||
/** Bit-field which indicates the number is from the modem config. */
|
/** Bit-field which indicates the number is from the modem config. */
|
||||||
public static final int EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG =
|
public static final int EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG =
|
||||||
|
|||||||
Reference in New Issue
Block a user