summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jakub Pawlowski <jpawlowski@google.com> 2019-11-29 22:11:11 +0100
committer Jakub Pawlowski <jpawlowski@google.com> 2019-12-03 09:05:41 +0000
commit3f0ce98cfaa7e712d11af67c93d7d6825ffa5961 (patch)
treea79b86b3eb73cb797a44ed965a750587ebea43b8
parentee207f0241a3acc72e1484d7b8e8d6e0790f5236 (diff)
Do not call SystemConfig.getInstance() from Bluetooth (1/2)
Move call to SystemConfig.getInstance into BluetoothManagerService Bug: 145297991 Change-Id: I6edd91b831a240117757cb6683d8a373e861db99
-rw-r--r--services/core/java/com/android/server/BluetoothManagerService.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 798a4c663c51..a3188443591f 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -74,6 +74,7 @@ import com.android.server.pm.UserRestrictionsUtils;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.HashMap;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map;
@@ -695,6 +696,35 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
return mIsHearingAidProfileSupported;
}
+ @Override
+ /** @hide */
+ public java.util.List<String> getSystemConfigEnabledProfilesForPackage(String packageName) {
+ if (Binder.getCallingUid() != Process.BLUETOOTH_UID) {
+ Slog.w(TAG, "getSystemConfigEnabledProfilesForPackage(): not allowed for non-bluetooth");
+ return null;
+ }
+
+ SystemConfig systemConfig = SystemConfig.getInstance();
+ if (systemConfig == null) {
+ return null;
+ }
+
+ android.util.ArrayMap<String, Boolean> componentEnabledStates =
+ systemConfig.getComponentsEnabledStates(packageName);
+ if (componentEnabledStates == null) {
+ return null;
+ }
+
+ ArrayList enabledProfiles = new ArrayList<String>();
+ for (Map.Entry<String, Boolean> entry : componentEnabledStates.entrySet()) {
+ if (entry.getValue()) {
+ enabledProfiles.add(entry.getKey());
+ }
+ }
+
+ return enabledProfiles;
+ }
+
// Monitor change of BLE scan only mode settings.
private void registerForBleScanModeChange() {
ContentObserver contentObserver = new ContentObserver(null) {