Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91480647 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Protect TelecomManager#getPhoneAccount with necessary permissions."...

Merge "Protect TelecomManager#getPhoneAccount with necessary permissions." into sc-dev am: d62464f4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15053492

Change-Id: I1416946b0ca62ab9ced528e5c8f4bacacaac34f6
parents 7b1b070a d62464f4
Loading
Loading
Loading
Loading
+14 −1
Original line number Original line Diff line number Diff line
@@ -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);
            }
            }
+1 −1
Original line number Original line Diff line number Diff line
@@ -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