Merge "Bluetooth boot time start service" am: 336da06ac0 am: 37f7b55c73 am: 4772f86728

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1965082

Change-Id: Ia761d55d184209a340c3d3cef561342a764a7863
diff --git a/android/app/res/values/config.xml b/android/app/res/values/config.xml
index 35d2271..005d7bd 100644
--- a/android/app/res/values/config.xml
+++ b/android/app/res/values/config.xml
@@ -160,12 +160,6 @@
     <!-- Max number of connected audio devices supported by Bluetooth stack -->
     <integer name="config_bluetooth_max_connected_audio_devices">5</integer>
 
-    <bool name="config_supportBluetoothPersistedState">true</bool>
-
-    <!-- Boolean indicating if current platform need do one-time bluetooth address
-    re-validation -->
-    <bool name="config_bluetooth_address_validation">false</bool>
-
     <!-- Boolean indicating if current platform supports HFP inband ringing -->
     <bool name="config_bluetooth_hfp_inband_ringing_support">true</bool>
 </resources>
diff --git a/service/java/com/android/server/bluetooth/BluetoothManagerService.java b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
index 02d9d7d..1e87024 100644
--- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
@@ -564,19 +564,6 @@
         mSystemUiUid = systemUiUid;
     }
 
-    private boolean getBluetoothBooleanConfig(String name, boolean orElse) {
-        try {
-            Resources bluetoothRes = mContext.getPackageManager()
-                    .getResourcesForApplication(BLUETOOTH_PACKAGE_NAME);
-            orElse = bluetoothRes.getBoolean(bluetoothRes.getIdentifier(
-                    name, "bool", BLUETOOTH_PACKAGE_NAME));
-        } catch (PackageManager.NameNotFoundException e) {
-            Log.e(TAG, "Unable to retrieve Bluetooth configuration " + name);
-            e.printStackTrace();
-        }
-        return orElse;
-    }
-
     /**
      *  Returns true if airplane mode is currently on
      */
@@ -587,7 +574,7 @@
 
     private boolean supportBluetoothPersistedState() {
         // Set default support to true to copy config default.
-        return getBluetoothBooleanConfig("config_supportBluetoothPersistedState", true);
+        return BluetoothProperties.isSupportPersistedStateEnabled().orElse(true);
     }
 
     /**
@@ -660,7 +647,7 @@
         if (DBG) {
             Slog.d(TAG, "Loading stored name and address");
         }
-        if (getBluetoothBooleanConfig("config_bluetooth_address_validation", false)
+        if (BluetoothProperties.isAdapterAddressValidationEnabled().orElse(false)
                 && Settings.Secure.getIntForUser(mContentResolver,
                 Settings.Secure.BLUETOOTH_NAME, 0, mUserId)
                 == 0) {