Merge "Remove PM query for silent provisioning BroadcastReceiver." into nyc-dev
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index ee9d2f8..3b3dafe 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -179,6 +179,10 @@
             android:entries="@array/usb_configuration_titles"
             android:entryValues="@array/usb_configuration_values" />
 
+        <SwitchPreference
+            android:key="bluetooth_disable_absolute_volume"
+            android:title="@string/bluetooth_disable_absolute_volume"
+            android:summary="@string/bluetooth_disable_absolute_volume_summary"/>
     </PreferenceCategory>
 
     <PreferenceCategory android:key="debug_input_category"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 37e234f..af38ad0 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -181,6 +181,11 @@
     private static final String ENABLE_FREEFORM_SUPPORT_KEY = "enable_freeform_support";
     private static final String COLOR_TEMPERATURE_KEY = "color_temperature";
 
+    private static final String BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY =
+                                    "bluetooth_disable_absolute_volume";
+    private static final String BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY =
+                                    "persist.bluetooth.disableabsvol";
+
     private static final String INACTIVE_APPS_KEY = "inactive_apps";
 
     private static final String OPENGL_TRACES_KEY = "enable_opengl_traces";
@@ -246,6 +251,7 @@
     private SwitchPreference mWifiAggressiveHandover;
     private SwitchPreference mLegacyDhcpClient;
     private SwitchPreference mMobileDataAlwaysOn;
+    private SwitchPreference mBluetoothDisableAbsVolume;
 
     private SwitchPreference mWifiAllowScansWithTraffic;
     private SwitchPreference mStrictMode;
@@ -412,6 +418,7 @@
         mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
         mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
         mWebViewProvider = addListPreference(WEBVIEW_PROVIDER_KEY);
+        mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);
 
         mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
         mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
@@ -709,6 +716,7 @@
         if (mColorTemperaturePreference != null) {
             updateColorTemperature();
         }
+        updateBluetoothDisableAbsVolumeOptions();
     }
 
     private void resetDangerousOptions() {
@@ -1397,6 +1405,16 @@
                 mLegacyDhcpClient.isChecked() ? 1 : 0);
     }
 
+    private void updateBluetoothDisableAbsVolumeOptions() {
+        updateSwitchPreference(mBluetoothDisableAbsVolume,
+                SystemProperties.getBoolean(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY, false));
+    }
+
+    private void writeBluetoothDisableAbsVolumeOptions() {
+        SystemProperties.set(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY,
+                mBluetoothDisableAbsVolume.isChecked() ? "true" : "false");
+    }
+
     private void updateMobileDataAlwaysOnOptions() {
         updateSwitchPreference(mMobileDataAlwaysOn, Settings.Global.getInt(
                 getActivity().getContentResolver(),
@@ -1884,6 +1902,8 @@
             startInactiveAppsFragment();
         } else if (BACKGROUND_CHECK_KEY.equals(preference.getKey())) {
             startBackgroundCheckFragment();
+        } else if (preference == mBluetoothDisableAbsVolume) {
+            writeBluetoothDisableAbsVolumeOptions();
         } else {
             return super.onPreferenceTreeClick(preference);
         }
diff --git a/src/com/android/settings/fingerprint/FingerprintUiHelper.java b/src/com/android/settings/fingerprint/FingerprintUiHelper.java
index df09c49..6e7f8ec 100644
--- a/src/com/android/settings/fingerprint/FingerprintUiHelper.java
+++ b/src/com/android/settings/fingerprint/FingerprintUiHelper.java
@@ -49,7 +49,7 @@
     }
 
     public void startListening() {
-        if (mFingerprintManager != null
+        if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()
                 && mFingerprintManager.getEnrolledFingerprints(mUserId).size() > 0) {
             mCancellationSignal = new CancellationSignal();
             mFingerprintManager.setActiveUser(mUserId);