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

Commit 7a5870bd authored by Zach Johnson's avatar Zach Johnson
Browse files

Simplify local mac address permission checking

Simple find and replace.

Bug: 145171640
Test: compile
Change-Id: I0a05cac0d1d7734f31fc702e2c89914150a2b703
parent f1369687
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -272,6 +272,12 @@ public final class Utils {
                "Need BLUETOOTH PRIVILEGED permission");
    }

    public static void enforceLocalMacAddressPermission(Context context) {
        context.enforceCallingOrSelfPermission(
                android.Manifest.permission.LOCAL_MAC_ADDRESS,
                "Need LOCAL_MAC_ADDRESS permission");
    }

    public static boolean checkCaller() {
        int callingUser = UserHandle.getCallingUserId();
        int callingUid = Binder.getCallingUid();
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.bluetooth.btservice;
import static com.android.bluetooth.Utils.enforceBluetoothPermission;
import static com.android.bluetooth.Utils.enforceBluetoothAdminPermission;
import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission;
import static com.android.bluetooth.Utils.enforceLocalMacAddressPermission;

import android.app.ActivityManager;
import android.app.AlarmManager;
@@ -2077,7 +2078,7 @@ public class AdapterService extends Service {

    String getAddress() {
        enforceBluetoothPermission(this);
        enforceCallingOrSelfPermission(LOCAL_MAC_ADDRESS_PERM, "Need LOCAL_MAC_ADDRESS permission");
        enforceLocalMacAddressPermission(this);

        String addrString = null;
        byte[] address = mAdapterProperties.getAddress();