Allows auto dismissing of bluetooth activation dialogs
Create a new overlay boolean that allows products (like Android@Home
ones that have no or minimal display) to not bring up the bluetooth
activation confirmation dialog.
Change-Id: Ib76a26d440ede34cc8a41ffc8b680ca2b20b38ca
Signed-off-by: Mike J. Chen <mjchen@google.com>
diff --git a/res/values/bools.xml b/res/values/bools.xml
index 278859b..2d05fbf 100644
--- a/res/values/bools.xml
+++ b/res/values/bools.xml
@@ -25,4 +25,8 @@
<!-- Display additional System Update menu if true -->
<bool name="config_additional_system_update_setting_enable">false</bool>
+
+ <!-- Whether the bluetooth activation confirmation dialogs should be auto dismissed.
+ Can be overridden for specific product builds. -->
+ <bool name="auto_confirm_bluetooth_activation_dialog">false</bool>
</resources>
diff --git a/src/com/android/settings/bluetooth/RequestPermissionActivity.java b/src/com/android/settings/bluetooth/RequestPermissionActivity.java
index 07a7316..529312d 100644
--- a/src/com/android/settings/bluetooth/RequestPermissionActivity.java
+++ b/src/com/android/settings/bluetooth/RequestPermissionActivity.java
@@ -173,6 +173,11 @@
mDialog = builder.create();
mDialog.show();
+
+ if (getResources().getBoolean(R.bool.auto_confirm_bluetooth_activation_dialog) == true) {
+ // dismiss dialog immediately if settings say so
+ onClick(null, DialogInterface.BUTTON_POSITIVE);
+ }
}
@Override
diff --git a/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java b/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java
index 9b5946b..5c4b828 100644
--- a/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java
+++ b/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java
@@ -62,6 +62,12 @@
}
createDialog();
+
+ if (getResources().getBoolean(R.bool.auto_confirm_bluetooth_activation_dialog) == true) {
+ // dismiss dialog immediately if settings say so
+ onClick(null, BUTTON_POSITIVE);
+ dismiss();
+ }
}
void createDialog() {