Merge "Update to modern Bluetooth permissions." into sc-dev

This commit is contained in:
Jeff Sharkey
2021-06-24 14:44:28 +00:00
committed by Android (Google) Code Review
6 changed files with 12 additions and 13 deletions

View File

@@ -17,8 +17,7 @@
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" /> <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" /> <uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
@@ -2226,7 +2225,7 @@
<activity android:name=".bluetooth.RequestPermissionActivity" <activity android:name=".bluetooth.RequestPermissionActivity"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:permission="android.permission.BLUETOOTH" android:permission="android.permission.BLUETOOTH_CONNECT"
android:exported="true" android:exported="true"
android:theme="@style/Theme.BluetoothPermission"> android:theme="@style/Theme.BluetoothPermission">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
@@ -2269,7 +2268,7 @@
<activity android:name=".bluetooth.RequestPermissionHelperActivity" <activity android:name=".bluetooth.RequestPermissionHelperActivity"
android:label="@string/bluetooth_pairing_request" android:label="@string/bluetooth_pairing_request"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:permission="android.permission.BLUETOOTH" android:permission="android.permission.BLUETOOTH_CONNECT"
android:theme="@*android:style/Theme.DeviceDefault.Dialog.Alert.DayNight"> android:theme="@*android:style/Theme.DeviceDefault.Dialog.Alert.DayNight">
</activity> </activity>
@@ -2284,7 +2283,7 @@
<receiver android:name=".bluetooth.BluetoothPermissionRequest" <receiver android:name=".bluetooth.BluetoothPermissionRequest"
android:exported="true" android:exported="true"
android:permission="android.permission.BLUETOOTH_ADMIN"> android:permission="android.permission.BLUETOOTH_CONNECT">
<intent-filter> <intent-filter>
<action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_REQUEST" /> <action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_REQUEST" />
<action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_CANCEL" /> <action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_CANCEL" />
@@ -2294,7 +2293,7 @@
<activity android:name=".bluetooth.BluetoothPermissionActivity" <activity android:name=".bluetooth.BluetoothPermissionActivity"
android:label="@string/bluetooth_connection_permission_request" android:label="@string/bluetooth_connection_permission_request"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:permission="android.permission.BLUETOOTH_ADMIN" android:permission="android.permission.BLUETOOTH_CONNECT"
android:exported="true" android:exported="true"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert"> android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
@@ -3549,7 +3548,7 @@
<activity android:name="Settings$BluetoothDeviceDetailActivity" <activity android:name="Settings$BluetoothDeviceDetailActivity"
android:label="@string/device_details_title" android:label="@string/device_details_title"
android:exported="true" android:exported="true"
android:permission="android.permission.BLUETOOTH_ADMIN"> android:permission="android.permission.BLUETOOTH_CONNECT">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS" /> <action android:name="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@@ -3754,7 +3753,7 @@
<receiver <receiver
android:name=".media.BluetoothPairingReceiver" android:name=".media.BluetoothPairingReceiver"
android:exported="true" android:exported="true"
android:permission="android.permission.BLUETOOTH_ADMIN"> android:permission="android.permission.BLUETOOTH_CONNECT">
<intent-filter> <intent-filter>
<action android:name="com.android.settings.action.LAUNCH_BLUETOOTH_PAIRING"/> <action android:name="com.android.settings.action.LAUNCH_BLUETOOTH_PAIRING"/>
</intent-filter>/> </intent-filter>/>

View File

@@ -221,7 +221,7 @@ public class BluetoothPermissionActivity extends AlertActivity implements
intent.putExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, always); intent.putExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, always);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType); intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN); sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_CONNECT);
} }
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {

View File

@@ -293,6 +293,6 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
: BluetoothDevice.CONNECTION_ACCESS_NO); : BluetoothDevice.CONNECTION_ACCESS_NO);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType); intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
mContext.sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN); mContext.sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_CONNECT);
} }
} }

View File

@@ -212,6 +212,6 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
} }
} }
mContext.sendBroadcast(intent, Manifest.permission.BLUETOOTH_ADMIN); mContext.sendBroadcast(intent, Manifest.permission.BLUETOOTH_CONNECT);
} }
} }

View File

@@ -53,6 +53,6 @@ public class BluetoothPermissionActivityTest {
mActivity.sendReplyIntentToReceiver(true, true); mActivity.sendReplyIntentToReceiver(true, true);
verify(mContext).sendBroadcast(intentCaptor.capture(), verify(mContext).sendBroadcast(intentCaptor.capture(),
eq("android.permission.BLUETOOTH_ADMIN")); eq("android.permission.BLUETOOTH_CONNECT"));
} }
} }

View File

@@ -82,7 +82,7 @@ public class DevicePickerFragmentTest {
mFragment.onDeviceBondStateChanged(cachedDevice, BluetoothDevice.BOND_BONDED); mFragment.onDeviceBondStateChanged(cachedDevice, BluetoothDevice.BOND_BONDED);
verify(mContext).sendBroadcast(intentCaptor.capture(), verify(mContext).sendBroadcast(intentCaptor.capture(),
eq("android.permission.BLUETOOTH_ADMIN")); eq("android.permission.BLUETOOTH_CONNECT"));
assertThat(intentCaptor.getValue().getComponent().getPackageName()) assertThat(intentCaptor.getValue().getComponent().getPackageName())
.isEqualTo(mFragment.mLaunchPackage); .isEqualTo(mFragment.mLaunchPackage);
} }