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

Commit 1d8ea036 authored by Zhihai Xu's avatar Zhihai Xu Committed by Android Git Automerger
Browse files

am ec7a8b6f: am e1a867f6: Merge " BluetoothManagerService call should allow...

am ec7a8b6f: am e1a867f6: Merge " BluetoothManagerService call should allow SYSTEM_UID" into jb-mr1.1-dev

* commit 'ec7a8b6f':
  BluetoothManagerService call should allow SYSTEM_UID
parents e6dc0139 ec7a8b6f
Loading
Loading
Loading
Loading
+17 −17
Original line number Original line Diff line number Diff line
@@ -297,8 +297,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
    }
    }


    public boolean isEnabled() {
    public boolean isEnabled() {
        if (!checkIfCallerIsForegroundUser()) {
        if ((Binder.getCallingUid() != Process.SYSTEM_UID) &&
            Log.w(TAG,"isEnabled(): not allowed for non-active user");
            (!checkIfCallerIsForegroundUser())) {
            Log.w(TAG,"isEnabled(): not allowed for non-active and non system user");
            return false;
            return false;
        }
        }


@@ -325,11 +326,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH ADMIN permission");
                                                "Need BLUETOOTH ADMIN permission");


        if (!checkIfCallerIsForegroundUser()) {
            Log.w(TAG,"enableNoAutoConnect(): not allowed for non-active user");
            return false;
        }

        if (DBG) {
        if (DBG) {
            Log.d(TAG,"enableNoAutoConnect():  mBluetooth =" + mBluetooth +
            Log.d(TAG,"enableNoAutoConnect():  mBluetooth =" + mBluetooth +
                    " mBinding = " + mBinding);
                    " mBinding = " + mBinding);
@@ -345,8 +341,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub {


    }
    }
    public boolean enable() {
    public boolean enable() {
        if (!checkIfCallerIsForegroundUser()) {
        if ((Binder.getCallingUid() != Process.SYSTEM_UID) &&
            Log.w(TAG,"enable(): not allowed for non-active user");
            (!checkIfCallerIsForegroundUser())) {
            Log.w(TAG,"enable(): not allowed for non-active and non system user");
            return false;
            return false;
        }
        }


@@ -357,8 +354,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH ADMIN permissicacheNameAndAddresson");
                                                "Need BLUETOOTH ADMIN permissicacheNameAndAddresson");


        if (!checkIfCallerIsForegroundUser()) {
        if ((Binder.getCallingUid() != Process.SYSTEM_UID) &&
            Log.w(TAG,"disable(): not allowed for non-active user");
            (!checkIfCallerIsForegroundUser())) {
            Log.w(TAG,"disable(): not allowed for non-active and non system user");
            return false;
            return false;
        }
        }


@@ -456,9 +454,10 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH ADMIN permission");
                                                "Need BLUETOOTH ADMIN permission");


        if (!checkIfCallerIsForegroundUser()) {
        if ((Binder.getCallingUid() != Process.SYSTEM_UID) &&
            Log.w(TAG,"getAddress(): not allowed for non-active user");
            (!checkIfCallerIsForegroundUser())) {
            return mAddress;
            Log.w(TAG,"getAddress(): not allowed for non-active and non system user");
            return null;
        }
        }


        synchronized(mConnection) {
        synchronized(mConnection) {
@@ -480,9 +479,10 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH ADMIN permission");
                                                "Need BLUETOOTH ADMIN permission");


        if (!checkIfCallerIsForegroundUser()) {
        if ((Binder.getCallingUid() != Process.SYSTEM_UID) &&
            Log.w(TAG,"getName(): not allowed for non-active user");
            (!checkIfCallerIsForegroundUser())) {
            return mName;
            Log.w(TAG,"getName(): not allowed for non-active and non system user");
            return null;
        }
        }


        synchronized(mConnection) {
        synchronized(mConnection) {