From 75dea8ea802c946b50aaa52a4bb9efeafe41c5ed Mon Sep 17 00:00:00 2001 From: Hugh Chen Date: Fri, 11 Sep 2020 14:19:35 +0800 Subject: [PATCH] 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 --- src/com/android/settings/bluetooth/DevicePickerFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/bluetooth/DevicePickerFragment.java b/src/com/android/settings/bluetooth/DevicePickerFragment.java index 02625bbad2b..ab8eea5db68 100644 --- a/src/com/android/settings/bluetooth/DevicePickerFragment.java +++ b/src/com/android/settings/bluetooth/DevicePickerFragment.java @@ -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); } }