Merge "Protect TelecomManager#getPhoneAccount with necessary permissions." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d62464f4fe
@@ -1018,6 +1018,16 @@ public class TelecomManager {
|
|||||||
// this magic number is a bug ID
|
// this magic number is a bug ID
|
||||||
public static final long ENABLE_GET_CALL_STATE_PERMISSION_PROTECTION = 157233955L;
|
public static final long ENABLE_GET_CALL_STATE_PERMISSION_PROTECTION = 157233955L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable READ_PHONE_NUMBERS or READ_PRIVILEGED_PHONE_STATE protections on
|
||||||
|
* {@link TelecomManager#getPhoneAccount(PhoneAccountHandle)}.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@ChangeId
|
||||||
|
@EnabledSince(targetSdkVersion = Build.VERSION_CODES.S)
|
||||||
|
// bug ID
|
||||||
|
public static final long ENABLE_GET_PHONE_ACCOUNT_PERMISSION_PROTECTION = 183407956L;
|
||||||
|
|
||||||
private static final String TAG = "TelecomManager";
|
private static final String TAG = "TelecomManager";
|
||||||
|
|
||||||
|
|
||||||
@@ -1351,6 +1361,9 @@ public class TelecomManager {
|
|||||||
* Return the {@link PhoneAccount} for a specified {@link PhoneAccountHandle}. Object includes
|
* Return the {@link PhoneAccount} for a specified {@link PhoneAccountHandle}. Object includes
|
||||||
* resources which can be used in a user interface.
|
* resources which can be used in a user interface.
|
||||||
*
|
*
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_NUMBERS} for applications targeting API
|
||||||
|
* level 31+.
|
||||||
* @param account The {@link PhoneAccountHandle}.
|
* @param account The {@link PhoneAccountHandle}.
|
||||||
* @return The {@link PhoneAccount} object.
|
* @return The {@link PhoneAccount} object.
|
||||||
*/
|
*/
|
||||||
@@ -1358,7 +1371,7 @@ public class TelecomManager {
|
|||||||
ITelecomService service = getTelecomService();
|
ITelecomService service = getTelecomService();
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
try {
|
try {
|
||||||
return service.getPhoneAccount(account);
|
return service.getPhoneAccount(account, mContext.getPackageName());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Error calling ITelecomService#getPhoneAccount", e);
|
Log.e(TAG, "Error calling ITelecomService#getPhoneAccount", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ interface ITelecomService {
|
|||||||
/**
|
/**
|
||||||
* @see TelecomManager#getPhoneAccount
|
* @see TelecomManager#getPhoneAccount
|
||||||
*/
|
*/
|
||||||
PhoneAccount getPhoneAccount(in PhoneAccountHandle account);
|
PhoneAccount getPhoneAccount(in PhoneAccountHandle account, String callingPackage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see TelecomManager#getAllPhoneAccountsCount
|
* @see TelecomManager#getAllPhoneAccountsCount
|
||||||
|
|||||||
Reference in New Issue
Block a user