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

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

Change-Id: Ic294da712bb5b23bc86c0183aeacc82ee57ad7cf
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 849a3c0..b9517d5 100644
--- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
@@ -568,19 +568,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
      */
@@ -591,7 +578,7 @@
 
     private boolean supportBluetoothPersistedState() {
         // Set default support to true to copy config default.
-        return getBluetoothBooleanConfig("config_supportBluetoothPersistedState", true);
+        return BluetoothProperties.isSupportPersistedStateEnabled().orElse(true);
     }
 
     /**
@@ -664,7 +651,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,
                 SECURE_SETTINGS_BLUETOOTH_ADDR_VALID, 0, mUserId)
                 == 0) {