resolve merge conflicts of 903d641 to nyc-mr2-dev-plus-aosp
Test: Treehugger Change-Id: Ie994c37011f6f4255ca681e4f0c0a99fa5c337fd
This commit is contained in:
@@ -40,6 +40,7 @@ import android.content.pm.UserInfo;
|
|||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@@ -183,7 +184,12 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
final boolean bluetoothDisallowed =
|
final boolean bluetoothDisallowed =
|
||||||
newRestrictions.getBoolean(UserManager.DISALLOW_BLUETOOTH);
|
newRestrictions.getBoolean(UserManager.DISALLOW_BLUETOOTH);
|
||||||
if ((mEnable || mEnableExternal) && bluetoothDisallowed) {
|
if ((mEnable || mEnableExternal) && bluetoothDisallowed) {
|
||||||
disable(true);
|
try {
|
||||||
|
disable("android.os.UserManagerInternal", true);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
// Shouldn't happen: startConsentUiIfNeeded not called
|
||||||
|
// when from system.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -669,7 +675,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean enable() {
|
public boolean enable(String packageName) throws RemoteException {
|
||||||
if (isBluetoothDisallowed()) {
|
if (isBluetoothDisallowed()) {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Slog.d(TAG,"enable(): not enabling - bluetooth disallowed");
|
Slog.d(TAG,"enable(): not enabling - bluetooth disallowed");
|
||||||
@@ -677,14 +683,25 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Binder.getCallingUid() != Process.SYSTEM_UID) &&
|
final int callingUid = Binder.getCallingUid();
|
||||||
(!checkIfCallerIsForegroundUser())) {
|
final boolean callerSystem = UserHandle.getAppId(callingUid) == Process.SYSTEM_UID;
|
||||||
Slog.w(TAG,"enable(): not allowed for non-active and non system user");
|
|
||||||
return false;
|
if (!callerSystem) {
|
||||||
|
if (!checkIfCallerIsForegroundUser()) {
|
||||||
|
Slog.w(TAG, "enable(): not allowed for non-active and non system user");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
|
||||||
|
"Need BLUETOOTH ADMIN permission");
|
||||||
|
|
||||||
|
if (!isEnabled() && mPermissionReviewRequired
|
||||||
|
&& startConsentUiIfNeeded(packageName, callingUid,
|
||||||
|
BluetoothAdapter.ACTION_REQUEST_ENABLE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
|
|
||||||
"Need BLUETOOTH ADMIN permission");
|
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Slog.d(TAG,"enable(): mBluetooth =" + mBluetooth +
|
Slog.d(TAG,"enable(): mBluetooth =" + mBluetooth +
|
||||||
" mBinding = " + mBinding + " mState = " + mState);
|
" mBinding = " + mBinding + " mState = " + mState);
|
||||||
|
|||||||
Reference in New Issue
Block a user