Add permission to protect data when sending broadcast

This CL before, DevicePickerFragment didn't check the
whether 3rd-party app have Bluetooth permission before
sending broadcast. It's will cause the 3rd-party app can
get Bluetooth device information without request permission.

This CL will send broadcast with Bluetooth permission that
make sure the receiver who have Bluetooth permission can get
this Bluetooth device infomation.

Bug: 161716630
Test: verify on test apk to confirm that not showing mac address.
Change-Id: I6662dc38b3491e5ee467058dd74863ecac27cdd7
This commit is contained in:
Hugh Chen
2020-09-11 14:19:35 +08:00
parent 3a64d5898b
commit 75dea8ea80

View File

@@ -18,6 +18,7 @@ package com.android.settings.bluetooth;
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
import android.Manifest;
import android.app.settings.SettingsEnums;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -192,6 +193,6 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
if (mLaunchPackage != null && mLaunchClass != null) {
intent.setClassName(mLaunchPackage, mLaunchClass);
}
getActivity().sendBroadcast(intent);
getActivity().sendBroadcast(intent, Manifest.permission.BLUETOOTH_ADMIN);
}
}