Merge "Introduce ANSWER_PHONE_CALLS permission"
This commit is contained in:
committed by
Android (Google) Code Review
commit
247a3c0132
@@ -16,6 +16,7 @@ package android {
|
||||
field public static final java.lang.String ACCOUNT_MANAGER = "android.permission.ACCOUNT_MANAGER";
|
||||
field public static final java.lang.String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL";
|
||||
field public static final java.lang.String ALLOCATE_AGGRESSIVE = "android.permission.ALLOCATE_AGGRESSIVE";
|
||||
field public static final java.lang.String ANSWER_PHONE_CALLS = "android.permission.ANSWER_PHONE_CALLS";
|
||||
field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS";
|
||||
field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE";
|
||||
field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET";
|
||||
@@ -4143,6 +4144,7 @@ package android.app {
|
||||
field public static final int MODE_ERRORED = 2; // 0x2
|
||||
field public static final int MODE_IGNORED = 1; // 0x1
|
||||
field public static final java.lang.String OPSTR_ADD_VOICEMAIL = "android:add_voicemail";
|
||||
field public static final java.lang.String OPSTR_ANSWER_PHONE_CALLS = "android:answer_phone_calls";
|
||||
field public static final java.lang.String OPSTR_BODY_SENSORS = "android:body_sensors";
|
||||
field public static final java.lang.String OPSTR_CALL_PHONE = "android:call_phone";
|
||||
field public static final java.lang.String OPSTR_CAMERA = "android:camera";
|
||||
@@ -38721,6 +38723,8 @@ package android.telecom {
|
||||
}
|
||||
|
||||
public class TelecomManager {
|
||||
method public void acceptRingingCall();
|
||||
method public void acceptRingingCall(int);
|
||||
method public void addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
|
||||
method public void cancelMissedCallsNotification();
|
||||
method public android.content.Intent createManageBlockedNumbersIntent();
|
||||
|
||||
@@ -25,6 +25,7 @@ package android {
|
||||
field public static final java.lang.String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL";
|
||||
field public static final java.lang.String ALLOCATE_AGGRESSIVE = "android.permission.ALLOCATE_AGGRESSIVE";
|
||||
field public static final java.lang.String ALLOW_ANY_CODEC_FOR_PLAYBACK = "android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK";
|
||||
field public static final java.lang.String ANSWER_PHONE_CALLS = "android.permission.ANSWER_PHONE_CALLS";
|
||||
field public static final java.lang.String BACKUP = "android.permission.BACKUP";
|
||||
field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS";
|
||||
field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE";
|
||||
@@ -4286,6 +4287,7 @@ package android.app {
|
||||
field public static final int MODE_IGNORED = 1; // 0x1
|
||||
field public static final java.lang.String OPSTR_ACTIVATE_VPN = "android:activate_vpn";
|
||||
field public static final java.lang.String OPSTR_ADD_VOICEMAIL = "android:add_voicemail";
|
||||
field public static final java.lang.String OPSTR_ANSWER_PHONE_CALLS = "android:answer_phone_calls";
|
||||
field public static final java.lang.String OPSTR_BODY_SENSORS = "android:body_sensors";
|
||||
field public static final java.lang.String OPSTR_CALL_PHONE = "android:call_phone";
|
||||
field public static final java.lang.String OPSTR_CAMERA = "android:camera";
|
||||
|
||||
@@ -16,6 +16,7 @@ package android {
|
||||
field public static final java.lang.String ACCOUNT_MANAGER = "android.permission.ACCOUNT_MANAGER";
|
||||
field public static final java.lang.String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL";
|
||||
field public static final java.lang.String ALLOCATE_AGGRESSIVE = "android.permission.ALLOCATE_AGGRESSIVE";
|
||||
field public static final java.lang.String ANSWER_PHONE_CALLS = "android.permission.ANSWER_PHONE_CALLS";
|
||||
field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS";
|
||||
field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE";
|
||||
field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET";
|
||||
@@ -4153,6 +4154,7 @@ package android.app {
|
||||
field public static final int MODE_ERRORED = 2; // 0x2
|
||||
field public static final int MODE_IGNORED = 1; // 0x1
|
||||
field public static final java.lang.String OPSTR_ADD_VOICEMAIL = "android:add_voicemail";
|
||||
field public static final java.lang.String OPSTR_ANSWER_PHONE_CALLS = "android:answer_phone_calls";
|
||||
field public static final java.lang.String OPSTR_BODY_SENSORS = "android:body_sensors";
|
||||
field public static final java.lang.String OPSTR_CALL_PHONE = "android:call_phone";
|
||||
field public static final java.lang.String OPSTR_CAMERA = "android:camera";
|
||||
@@ -38905,6 +38907,8 @@ package android.telecom {
|
||||
}
|
||||
|
||||
public class TelecomManager {
|
||||
method public void acceptRingingCall();
|
||||
method public void acceptRingingCall(int);
|
||||
method public void addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
|
||||
method public void cancelMissedCallsNotification();
|
||||
method public android.content.Intent createManageBlockedNumbersIntent();
|
||||
|
||||
@@ -249,8 +249,10 @@ public class AppOpsManager {
|
||||
public static final int OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE = 67;
|
||||
/** @hide Instant app start foreground service. */
|
||||
public static final int OP_INSTANT_APP_START_FOREGROUND = 68;
|
||||
/** @hide Answer incoming phone calls */
|
||||
public static final int OP_ANSWER_PHONE_CALLS = 69;
|
||||
/** @hide */
|
||||
public static final int _NUM_OP = 69;
|
||||
public static final int _NUM_OP = 70;
|
||||
|
||||
/** Access to coarse location information. */
|
||||
public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
|
||||
@@ -356,6 +358,9 @@ public class AppOpsManager {
|
||||
/** @hide */
|
||||
public static final String OPSTR_INSTANT_APP_START_FOREGROUND
|
||||
= "android:instant_app_start_foreground";
|
||||
/** Answer incoming phone calls */
|
||||
public static final String OPSTR_ANSWER_PHONE_CALLS
|
||||
= "android:answer_phone_calls";
|
||||
|
||||
private static final int[] RUNTIME_AND_APPOP_PERMISSIONS_OPS = {
|
||||
// RUNTIME PERMISSIONS
|
||||
@@ -388,6 +393,7 @@ public class AppOpsManager {
|
||||
OP_ADD_VOICEMAIL,
|
||||
OP_USE_SIP,
|
||||
OP_PROCESS_OUTGOING_CALLS,
|
||||
OP_ANSWER_PHONE_CALLS,
|
||||
// Microphone
|
||||
OP_RECORD_AUDIO,
|
||||
// Camera
|
||||
@@ -480,6 +486,7 @@ public class AppOpsManager {
|
||||
OP_REQUEST_INSTALL_PACKAGES,
|
||||
OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE,
|
||||
OP_INSTANT_APP_START_FOREGROUND,
|
||||
OP_ANSWER_PHONE_CALLS
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -556,6 +563,7 @@ public class AppOpsManager {
|
||||
null, // OP_REQUEST_INSTALL_PACKAGES
|
||||
null,
|
||||
OPSTR_INSTANT_APP_START_FOREGROUND,
|
||||
OPSTR_ANSWER_PHONE_CALLS,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -632,6 +640,7 @@ public class AppOpsManager {
|
||||
"REQUEST_INSTALL_PACKAGES",
|
||||
"OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE",
|
||||
"INSTANT_APP_START_FOREGROUND",
|
||||
"ANSWER_PHONE_CALLS",
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -708,6 +717,7 @@ public class AppOpsManager {
|
||||
Manifest.permission.REQUEST_INSTALL_PACKAGES,
|
||||
null, // no permission for entering picture-in-picture on hide
|
||||
Manifest.permission.INSTANT_APP_FOREGROUND_SERVICE,
|
||||
Manifest.permission.ANSWER_PHONE_CALLS,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -785,6 +795,7 @@ public class AppOpsManager {
|
||||
null, // REQUEST_INSTALL_PACKAGES
|
||||
null, // ENTER_PICTURE_IN_PICTURE_ON_HIDE
|
||||
null, // INSTANT_APP_START_FOREGROUND
|
||||
null, // ANSWER_PHONE_CALLS
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -861,6 +872,7 @@ public class AppOpsManager {
|
||||
false, // REQUEST_INSTALL_PACKAGES
|
||||
false, // ENTER_PICTURE_IN_PICTURE_ON_HIDE
|
||||
false, // INSTANT_APP_START_FOREGROUND
|
||||
false, // ANSWER_PHONE_CALLS
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -936,6 +948,7 @@ public class AppOpsManager {
|
||||
AppOpsManager.MODE_DEFAULT, // OP_REQUEST_INSTALL_PACKAGES
|
||||
AppOpsManager.MODE_ALLOWED, // OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE
|
||||
AppOpsManager.MODE_DEFAULT, // OP_INSTANT_APP_START_FOREGROUND
|
||||
AppOpsManager.MODE_ALLOWED, // ANSWER_PHONE_CALLS
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1015,6 +1028,7 @@ public class AppOpsManager {
|
||||
false, // OP_REQUEST_INSTALL_PACKAGES
|
||||
false, // OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE
|
||||
false,
|
||||
false, // ANSWER_PHONE_CALLS
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -897,6 +897,17 @@
|
||||
android:description="@string/permdesc_processOutgoingCalls"
|
||||
android:protectionLevel="dangerous" />
|
||||
|
||||
|
||||
<!-- Allows the app to answer an incoming phone call.
|
||||
<p>Protection level: dangerous
|
||||
-->
|
||||
<permission android:name="android.permission.ANSWER_PHONE_CALLS"
|
||||
android:permissionGroup="android.permission-group.PHONE"
|
||||
android:label="@string/permlab_answerPhoneCalls"
|
||||
android:description="@string/permdesc_answerPhoneCalls"
|
||||
android:protectionLevel="dangerous" />
|
||||
|
||||
|
||||
<!-- ====================================================================== -->
|
||||
<!-- Permissions for accessing the device microphone -->
|
||||
<!-- ====================================================================== -->
|
||||
|
||||
@@ -727,6 +727,11 @@
|
||||
number being dialed during an outgoing call with the option to redirect
|
||||
the call to a different number or abort the call altogether.</string>
|
||||
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permlab_answerPhoneCalls">answer phone calls</string>
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permdesc_answerPhoneCalls">Allows the app to answer an incoming phone call.</string>
|
||||
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permlab_receiveSms">receive text messages (SMS)</string>
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
|
||||
@@ -582,7 +582,8 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
Manifest.permission.RECEIVE_MMS,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_PHONE_NUMBER);
|
||||
Manifest.permission.READ_PHONE_NUMBER,
|
||||
Manifest.permission.ANSWER_PHONE_CALLS);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1130,18 +1130,22 @@ public class TelecomManager {
|
||||
|
||||
/**
|
||||
* If there is a ringing incoming call, this method accepts the call on behalf of the user.
|
||||
* TODO: L-release - need to convert all invocation of ITelecmmService#answerRingingCall to use
|
||||
* this method (clockwork & gearhead).
|
||||
*
|
||||
* If the incoming call is a video call, the call will be answered with the same video state as
|
||||
* the incoming call requests. This means, for example, that an incoming call requesting
|
||||
* {@link VideoProfile#STATE_BIDIRECTIONAL} will be answered, accepting that state.
|
||||
* @hide
|
||||
*
|
||||
* Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} or
|
||||
* {@link android.Manifest.permission#ANSWER_PHONE_CALLS}
|
||||
*/
|
||||
@SystemApi
|
||||
//TODO: L-release - need to convert all invocation of ITelecmmService#answerRingingCall to use
|
||||
// this method (clockwork & gearhead).
|
||||
@RequiresPermission(anyOf =
|
||||
{Manifest.permission.ANSWER_PHONE_CALLS, Manifest.permission.MODIFY_PHONE_STATE})
|
||||
public void acceptRingingCall() {
|
||||
try {
|
||||
if (isServiceConnected()) {
|
||||
getTelecomService().acceptRingingCall();
|
||||
getTelecomService().acceptRingingCall(mContext.getPackageName());
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error calling ITelecomService#acceptRingingCall", e);
|
||||
@@ -1152,14 +1156,18 @@ public class TelecomManager {
|
||||
* If there is a ringing incoming call, this method accepts the call on behalf of the user,
|
||||
* with the specified video state.
|
||||
*
|
||||
* Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} or
|
||||
* {@link android.Manifest.permission#ANSWER_PHONE_CALLS}
|
||||
*
|
||||
* @param videoState The desired video state to answer the call with.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(anyOf =
|
||||
{Manifest.permission.ANSWER_PHONE_CALLS, Manifest.permission.MODIFY_PHONE_STATE})
|
||||
public void acceptRingingCall(int videoState) {
|
||||
try {
|
||||
if (isServiceConnected()) {
|
||||
getTelecomService().acceptRingingCallWithVideoState(videoState);
|
||||
getTelecomService().acceptRingingCallWithVideoState(
|
||||
mContext.getPackageName(), videoState);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error calling ITelecomService#acceptRingingCallWithVideoState", e);
|
||||
|
||||
@@ -182,12 +182,12 @@ interface ITelecomService {
|
||||
/**
|
||||
* @see TelecomServiceImpl#acceptRingingCall
|
||||
*/
|
||||
void acceptRingingCall();
|
||||
void acceptRingingCall(String callingPackage);
|
||||
|
||||
/**
|
||||
* @see TelecomServiceImpl#acceptRingingCallWithVideoState(int)
|
||||
*/
|
||||
void acceptRingingCallWithVideoState(int videoState);
|
||||
void acceptRingingCallWithVideoState(String callingPackage, int videoState);
|
||||
|
||||
/**
|
||||
* @see TelecomServiceImpl#cancelMissedCallsNotification
|
||||
|
||||
Reference in New Issue
Block a user