Merge "BluetoothManagerService: enforce BLUETOOTH_PRIVILEGED for onFactoryReset" into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d53798ab4b
@@ -95,6 +95,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
|
|
||||||
private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN;
|
private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN;
|
||||||
private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH;
|
private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH;
|
||||||
|
private static final String BLUETOOTH_PRIVILEGED =
|
||||||
|
android.Manifest.permission.BLUETOOTH_PRIVILEGED;
|
||||||
|
|
||||||
private static final String SECURE_SETTINGS_BLUETOOTH_ADDR_VALID = "bluetooth_addr_valid";
|
private static final String SECURE_SETTINGS_BLUETOOTH_ADDR_VALID = "bluetooth_addr_valid";
|
||||||
private static final String SECURE_SETTINGS_BLUETOOTH_ADDRESS = "bluetooth_address";
|
private static final String SECURE_SETTINGS_BLUETOOTH_ADDRESS = "bluetooth_address";
|
||||||
@@ -279,6 +281,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public boolean onFactoryReset() {
|
public boolean onFactoryReset() {
|
||||||
|
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED,
|
||||||
|
"Need BLUETOOTH_PRIVILEGED permission");
|
||||||
|
|
||||||
// Wait for stable state if bluetooth is temporary state.
|
// Wait for stable state if bluetooth is temporary state.
|
||||||
int state = getState();
|
int state = getState();
|
||||||
if (state == BluetoothAdapter.STATE_BLE_TURNING_ON
|
if (state == BluetoothAdapter.STATE_BLE_TURNING_ON
|
||||||
|
|||||||
Reference in New Issue
Block a user