OSDN Git Service

Merge "Alignment updates for Wi-Fi Settings dialog." into lmp-dev
authorPauloftheWest <paulofthewest@google.com>
Tue, 16 Sep 2014 02:13:29 +0000 (02:13 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Tue, 16 Sep 2014 02:13:29 +0000 (02:13 +0000)
72 files changed:
AndroidManifest.xml
res/drawable-hdpi/ic_settings_wireless.png
res/drawable-hdpi/ic_wifi_lock_signal_0_teal.png [new file with mode: 0644]
res/drawable-hdpi/ic_wifi_lock_signal_1_teal.png [new file with mode: 0644]
res/drawable-hdpi/ic_wifi_lock_signal_2_teal.png [new file with mode: 0644]
res/drawable-hdpi/ic_wifi_lock_signal_3_teal.png [new file with mode: 0644]
res/drawable-hdpi/ic_wifi_lock_signal_4_teal.png [new file with mode: 0644]
res/drawable-hdpi/ic_wifi_signal_0_teal.png [new file with mode: 0644]
res/drawable-hdpi/ic_wifi_signal_1_teal.png [new file with mode: 0644]
res/drawable-hdpi/ic_wifi_signal_2_teal.png [new file with mode: 0644]
res/drawable-hdpi/ic_wifi_signal_3_teal.png [new file with mode: 0644]
res/drawable-hdpi/ic_wifi_signal_4_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_settings_wireless.png
res/drawable-mdpi/ic_wifi_lock_signal_0_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_wifi_lock_signal_1_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_wifi_lock_signal_2_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_wifi_lock_signal_3_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_wifi_lock_signal_4_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_wifi_signal_0_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_wifi_signal_1_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_wifi_signal_2_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_wifi_signal_3_teal.png [new file with mode: 0644]
res/drawable-mdpi/ic_wifi_signal_4_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_settings_wireless.png
res/drawable-xhdpi/ic_wifi_lock_signal_0_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_wifi_lock_signal_1_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_wifi_lock_signal_2_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_wifi_lock_signal_3_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_wifi_lock_signal_4_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_wifi_signal_0_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_wifi_signal_1_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_wifi_signal_2_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_wifi_signal_3_teal.png [new file with mode: 0644]
res/drawable-xhdpi/ic_wifi_signal_4_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_settings_wireless.png
res/drawable-xxhdpi/ic_wifi_lock_signal_0_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_wifi_lock_signal_1_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_wifi_lock_signal_2_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_wifi_lock_signal_3_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_wifi_lock_signal_4_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_wifi_signal_0_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_wifi_signal_1_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_wifi_signal_2_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_wifi_signal_3_teal.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_wifi_signal_4_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_settings_wireless.png
res/drawable-xxxhdpi/ic_wifi_lock_signal_0_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_wifi_lock_signal_1_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_wifi_lock_signal_2_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_wifi_lock_signal_3_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_wifi_lock_signal_4_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_wifi_signal_0_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_wifi_signal_1_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_wifi_signal_2_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_wifi_signal_3_teal.png [new file with mode: 0644]
res/drawable-xxxhdpi/ic_wifi_signal_4_teal.png [new file with mode: 0644]
res/drawable/wifi_signal_lock_teal.xml [new file with mode: 0644]
res/drawable/wifi_signal_open_teal.xml [new file with mode: 0644]
res/drawable/wifi_signal_teal.xml [new file with mode: 0644]
res/layout/bluetooth_pin_confirm.xml
res/layout/bluetooth_pin_entry.xml
res/layout/wifi_assistant_card.xml
res/values/strings.xml
res/values/themes.xml
res/xml/wifi_advanced_settings.xml
src/com/android/settings/bluetooth/BluetoothPairingDialog.java
src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
src/com/android/settings/bluetooth/CachedBluetoothDevice.java
src/com/android/settings/bluetooth/DeviceProfilesSettings.java
src/com/android/settings/fuelgauge/BatteryHistoryChart.java
src/com/android/settings/wifi/WifiSettings.java

index 0fb6228..a2d80b9 100644 (file)
 
         <activity android:name=".wifi.WifiSetupActivity"
                 android:taskAffinity="com.android.wizard"
-                android:theme="@style/SetupWizardWifiTheme"
+                android:theme="@style/SetupWizardDisableAppStartingTheme"
                 android:label="@string/wifi_setup_wizard_title"
                 android:icon="@drawable/empty_icon"
                 android:clearTaskOnLaunch="true">
index 28409db..5c82e8b 100644 (file)
Binary files a/res/drawable-hdpi/ic_settings_wireless.png and b/res/drawable-hdpi/ic_settings_wireless.png differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_0_teal.png b/res/drawable-hdpi/ic_wifi_lock_signal_0_teal.png
new file mode 100644 (file)
index 0000000..d0c9b30
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_lock_signal_0_teal.png differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_1_teal.png b/res/drawable-hdpi/ic_wifi_lock_signal_1_teal.png
new file mode 100644 (file)
index 0000000..0bef891
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_lock_signal_1_teal.png differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_2_teal.png b/res/drawable-hdpi/ic_wifi_lock_signal_2_teal.png
new file mode 100644 (file)
index 0000000..9252d90
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_lock_signal_2_teal.png differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_3_teal.png b/res/drawable-hdpi/ic_wifi_lock_signal_3_teal.png
new file mode 100644 (file)
index 0000000..a758ad4
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_lock_signal_3_teal.png differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_4_teal.png b/res/drawable-hdpi/ic_wifi_lock_signal_4_teal.png
new file mode 100644 (file)
index 0000000..8378399
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_lock_signal_4_teal.png differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_0_teal.png b/res/drawable-hdpi/ic_wifi_signal_0_teal.png
new file mode 100644 (file)
index 0000000..3030279
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_signal_0_teal.png differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_1_teal.png b/res/drawable-hdpi/ic_wifi_signal_1_teal.png
new file mode 100644 (file)
index 0000000..3340d95
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_signal_1_teal.png differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_2_teal.png b/res/drawable-hdpi/ic_wifi_signal_2_teal.png
new file mode 100644 (file)
index 0000000..180f7b1
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_signal_2_teal.png differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_3_teal.png b/res/drawable-hdpi/ic_wifi_signal_3_teal.png
new file mode 100644 (file)
index 0000000..af27fb0
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_signal_3_teal.png differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_4_teal.png b/res/drawable-hdpi/ic_wifi_signal_4_teal.png
new file mode 100644 (file)
index 0000000..5c82e8b
Binary files /dev/null and b/res/drawable-hdpi/ic_wifi_signal_4_teal.png differ
index 59ed4d4..6b81932 100644 (file)
Binary files a/res/drawable-mdpi/ic_settings_wireless.png and b/res/drawable-mdpi/ic_settings_wireless.png differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_0_teal.png b/res/drawable-mdpi/ic_wifi_lock_signal_0_teal.png
new file mode 100644 (file)
index 0000000..d746c1e
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_lock_signal_0_teal.png differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_1_teal.png b/res/drawable-mdpi/ic_wifi_lock_signal_1_teal.png
new file mode 100644 (file)
index 0000000..01f6f87
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_lock_signal_1_teal.png differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_2_teal.png b/res/drawable-mdpi/ic_wifi_lock_signal_2_teal.png
new file mode 100644 (file)
index 0000000..230b1a3
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_lock_signal_2_teal.png differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_3_teal.png b/res/drawable-mdpi/ic_wifi_lock_signal_3_teal.png
new file mode 100644 (file)
index 0000000..20fe9a5
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_lock_signal_3_teal.png differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_4_teal.png b/res/drawable-mdpi/ic_wifi_lock_signal_4_teal.png
new file mode 100644 (file)
index 0000000..938a203
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_lock_signal_4_teal.png differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_0_teal.png b/res/drawable-mdpi/ic_wifi_signal_0_teal.png
new file mode 100644 (file)
index 0000000..9dcdf91
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_signal_0_teal.png differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_1_teal.png b/res/drawable-mdpi/ic_wifi_signal_1_teal.png
new file mode 100644 (file)
index 0000000..b58d5f4
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_signal_1_teal.png differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_2_teal.png b/res/drawable-mdpi/ic_wifi_signal_2_teal.png
new file mode 100644 (file)
index 0000000..5cbb5a3
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_signal_2_teal.png differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_3_teal.png b/res/drawable-mdpi/ic_wifi_signal_3_teal.png
new file mode 100644 (file)
index 0000000..cec46b0
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_signal_3_teal.png differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_4_teal.png b/res/drawable-mdpi/ic_wifi_signal_4_teal.png
new file mode 100644 (file)
index 0000000..6b81932
Binary files /dev/null and b/res/drawable-mdpi/ic_wifi_signal_4_teal.png differ
index d7a6955..ad6a98e 100644 (file)
Binary files a/res/drawable-xhdpi/ic_settings_wireless.png and b/res/drawable-xhdpi/ic_settings_wireless.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_0_teal.png b/res/drawable-xhdpi/ic_wifi_lock_signal_0_teal.png
new file mode 100644 (file)
index 0000000..8d99e31
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_lock_signal_0_teal.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_1_teal.png b/res/drawable-xhdpi/ic_wifi_lock_signal_1_teal.png
new file mode 100644 (file)
index 0000000..da282b6
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_lock_signal_1_teal.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_2_teal.png b/res/drawable-xhdpi/ic_wifi_lock_signal_2_teal.png
new file mode 100644 (file)
index 0000000..b6a378f
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_lock_signal_2_teal.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_3_teal.png b/res/drawable-xhdpi/ic_wifi_lock_signal_3_teal.png
new file mode 100644 (file)
index 0000000..7227b08
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_lock_signal_3_teal.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_4_teal.png b/res/drawable-xhdpi/ic_wifi_lock_signal_4_teal.png
new file mode 100644 (file)
index 0000000..92257c3
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_lock_signal_4_teal.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_0_teal.png b/res/drawable-xhdpi/ic_wifi_signal_0_teal.png
new file mode 100644 (file)
index 0000000..08aba96
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_signal_0_teal.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_1_teal.png b/res/drawable-xhdpi/ic_wifi_signal_1_teal.png
new file mode 100644 (file)
index 0000000..8d282c9
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_signal_1_teal.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_2_teal.png b/res/drawable-xhdpi/ic_wifi_signal_2_teal.png
new file mode 100644 (file)
index 0000000..6caedf9
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_signal_2_teal.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_3_teal.png b/res/drawable-xhdpi/ic_wifi_signal_3_teal.png
new file mode 100644 (file)
index 0000000..799c9e3
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_signal_3_teal.png differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_4_teal.png b/res/drawable-xhdpi/ic_wifi_signal_4_teal.png
new file mode 100644 (file)
index 0000000..ad6a98e
Binary files /dev/null and b/res/drawable-xhdpi/ic_wifi_signal_4_teal.png differ
index 4125f9f..3058e98 100644 (file)
Binary files a/res/drawable-xxhdpi/ic_settings_wireless.png and b/res/drawable-xxhdpi/ic_settings_wireless.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_0_teal.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_0_teal.png
new file mode 100644 (file)
index 0000000..544c041
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_lock_signal_0_teal.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_1_teal.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_1_teal.png
new file mode 100644 (file)
index 0000000..ac0cb62
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_lock_signal_1_teal.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_2_teal.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_2_teal.png
new file mode 100644 (file)
index 0000000..beb6e12
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_lock_signal_2_teal.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_3_teal.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_3_teal.png
new file mode 100644 (file)
index 0000000..3eaaf39
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_lock_signal_3_teal.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_4_teal.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_4_teal.png
new file mode 100644 (file)
index 0000000..8b6bfb1
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_lock_signal_4_teal.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_0_teal.png b/res/drawable-xxhdpi/ic_wifi_signal_0_teal.png
new file mode 100644 (file)
index 0000000..f28f0ad
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_signal_0_teal.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_1_teal.png b/res/drawable-xxhdpi/ic_wifi_signal_1_teal.png
new file mode 100644 (file)
index 0000000..1728dc7
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_signal_1_teal.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_2_teal.png b/res/drawable-xxhdpi/ic_wifi_signal_2_teal.png
new file mode 100644 (file)
index 0000000..e7e4788
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_signal_2_teal.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_3_teal.png b/res/drawable-xxhdpi/ic_wifi_signal_3_teal.png
new file mode 100644 (file)
index 0000000..c2967ed
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_signal_3_teal.png differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_4_teal.png b/res/drawable-xxhdpi/ic_wifi_signal_4_teal.png
new file mode 100644 (file)
index 0000000..3058e98
Binary files /dev/null and b/res/drawable-xxhdpi/ic_wifi_signal_4_teal.png differ
index ed05fb3..bcc4233 100644 (file)
Binary files a/res/drawable-xxxhdpi/ic_settings_wireless.png and b/res/drawable-xxxhdpi/ic_settings_wireless.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_0_teal.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_0_teal.png
new file mode 100644 (file)
index 0000000..74c9c31
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_lock_signal_0_teal.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_1_teal.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_1_teal.png
new file mode 100644 (file)
index 0000000..dab15c4
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_lock_signal_1_teal.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_2_teal.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_2_teal.png
new file mode 100644 (file)
index 0000000..66a7736
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_lock_signal_2_teal.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_3_teal.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_3_teal.png
new file mode 100644 (file)
index 0000000..d23cf22
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_lock_signal_3_teal.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_4_teal.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_4_teal.png
new file mode 100644 (file)
index 0000000..83e4988
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_lock_signal_4_teal.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_0_teal.png b/res/drawable-xxxhdpi/ic_wifi_signal_0_teal.png
new file mode 100644 (file)
index 0000000..3dc5cbe
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_signal_0_teal.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_1_teal.png b/res/drawable-xxxhdpi/ic_wifi_signal_1_teal.png
new file mode 100644 (file)
index 0000000..d80ac48
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_signal_1_teal.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_2_teal.png b/res/drawable-xxxhdpi/ic_wifi_signal_2_teal.png
new file mode 100644 (file)
index 0000000..4fdd825
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_signal_2_teal.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_3_teal.png b/res/drawable-xxxhdpi/ic_wifi_signal_3_teal.png
new file mode 100644 (file)
index 0000000..e1cbcb8
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_signal_3_teal.png differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_4_teal.png b/res/drawable-xxxhdpi/ic_wifi_signal_4_teal.png
new file mode 100644 (file)
index 0000000..bcc4233
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_wifi_signal_4_teal.png differ
diff --git a/res/drawable/wifi_signal_lock_teal.xml b/res/drawable/wifi_signal_lock_teal.xml
new file mode 100644 (file)
index 0000000..2e79274
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<level-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:maxLevel="0" android:drawable="@drawable/ic_wifi_lock_signal_1_teal" />
+    <item android:maxLevel="1" android:drawable="@drawable/ic_wifi_lock_signal_2_teal" />
+    <item android:maxLevel="2" android:drawable="@drawable/ic_wifi_lock_signal_3_teal" />
+    <item android:maxLevel="3" android:drawable="@drawable/ic_wifi_lock_signal_4_teal" />
+</level-list>
+
diff --git a/res/drawable/wifi_signal_open_teal.xml b/res/drawable/wifi_signal_open_teal.xml
new file mode 100644 (file)
index 0000000..eb4ba8a
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<level-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:maxLevel="0" android:drawable="@drawable/ic_wifi_signal_1_teal" />
+    <item android:maxLevel="1" android:drawable="@drawable/ic_wifi_signal_2_teal" />
+    <item android:maxLevel="2" android:drawable="@drawable/ic_wifi_signal_3_teal" />
+    <item android:maxLevel="3" android:drawable="@drawable/ic_wifi_signal_4_teal" />
+</level-list>
+
diff --git a/res/drawable/wifi_signal_teal.xml b/res/drawable/wifi_signal_teal.xml
new file mode 100644 (file)
index 0000000..637336f
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+    <item settings:state_encrypted="true" android:drawable="@drawable/wifi_signal_lock_teal" />
+    <item settings:state_encrypted="false" android:drawable="@drawable/wifi_signal_open_teal" />
+</selector>
index 2e2cd7f..241bedc 100644 (file)
             android:textColor="@*android:color/secondary_text_material_light"
             android:visibility="gone" />
 
+        <TextView
+            android:id="@+id/phonebook_sharing_message"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/bluetooth_dialog_padding"
+            android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
+            android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
+            android:gravity="center_vertical"
+            android:text="@string/bluetooth_pairing_will_share_phonebook"
+            android:textSize="12sp" />
+
     </LinearLayout>
 
 </ScrollView>
index caca4fb..7161342 100644 (file)
             android:gravity="center_vertical"
             android:textAppearance="?android:attr/textAppearanceMedium" />
 
+        <TextView
+            android:id="@+id/phonebook_sharing_message"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/bluetooth_dialog_padding"
+            android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
+            android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
+            android:gravity="center_vertical"
+            android:text="@string/bluetooth_pairing_will_share_phonebook"
+            android:textSize="12sp" />
+
     </LinearLayout>
 
 </ScrollView>
index 28756a0..b7ab7b9 100644 (file)
@@ -57,7 +57,6 @@
         android:layout_marginLeft="@dimen/wifi_assistant_padding_start_end"
         android:layout_marginRight="@dimen/wifi_assistant_padding_start_end"
         android:gravity="start"
-        android:text="@string/wifi_assistant_title_message"
         android:textAppearance="?android:attr/textAppearanceMedium" />
 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
index e054423..df9afb4 100644 (file)
     <!-- Button text for declining an incoming pairing request. [CHAR LIMIT=20] -->
     <string name="bluetooth_pairing_decline">Cancel</string>
 
+    <!-- Message in pairing dialogs.  [CHAR LIMIT=NONE] -->
+    <string name="bluetooth_pairing_will_share_phonebook">Pairing grants access to your contacts and call history when connected.</string>
+
     <!-- Title for BT error dialogs. -->
     <string name="bluetooth_error_title"></string>
     <!-- Message for the error dialog when BT pairing fails generically. -->
     <!-- Wifi Assistant title.  [CHAR LIMIT=40] -->
     <string name="wifi_assistant_title">Wi\u2011Fi Assistant</string>
     <!-- Wifi Assistant title message.  First piece of text on the Wifi Assistant setup wizard.  [CHAR LIMIT=200] -->
-    <string name="wifi_assistant_title_message">Google Wi\u2011Fi Assistant automatically connects you to the best available Wi\u2011Fi</string>
-    <!-- Wifi Assistant explanation message.  Explains what wifi assistant does to the android phone.  [CHAR LIMIT=200] -->
-    <string name="wifi_assistant_explanation_message">Google Wi\u2011Fi Assistant detects the networks available to you and connects your device to the one with the best speed and reliability.</string>
-    <!-- Wifi Assistant vpn message.  Explains to the user that Google may use/provide a secure VPN connecte to Google's servers.  [CHAR LIMIT=100] -->
-    <string name="wifi_assistant_vpn_message">To help protect your data, Google Wi\u2011Fi Assistant may provide a secure VPN connection through Google servers.</string>
-    <!-- Wifi Assistant No, thanks string.  Text to say no to wifi assistant. [CHAR LIMIT=20] -->
-    <string name="wifi_assistant_activity_no_thanks">No, thanks</string>
-    <!-- Wifi Assistant Yes string.  Text to say yes to wifi assistant. [CHAR LIMIT=20] -->
-    <string name="wifi_assistant_activity_yes">YES, I\'M IN</string>
-    <!-- Wifi Assistant Dialog title.  [CHAR LIMIT=30] -->
-    <string name="wifi_assistant_dialog_title">Connection Request</string>
-    <!-- Wifi Assistant Dialog message.  Explains what monitor may occur with wifi-assistant [CHAR LIMIT=100] -->
-    <string name="wifi_assistant_dialog_message">Wi\u2011Fi Assistant" wants to set up a VPN connection that allows it to monitor network traffic.  Only accept if you trust the source.</string>
-    <!-- Wifi Assistant Dialog message. Notice of the icon that will appear when wifi assistant is on.  [CHAR LIMIT=100] -->
-    <string name="wifi_assistant_dialog_notice">appears at the top of your screen when VPN is active.</string>
-    <!-- Wifi Assistant dialog accept.  [CHAR LIMIT=20] -->
-    <string name="wifi_assistant_accept">ACCEPT</string>
-    <!-- Wifi Assistant dialog deny.  [CHAR LIMIT=20] -->
-    <string name="wifi_assistant_deny">DENY</string>
-    <!-- Wifi Assistant Network Monitoring titile.  [CHAR LIMIT=40] -->
-    <string name="wifi_assistant_network_title">Network monitoring</string>
-    <!-- Wifi Assistant permission accepted message.  [CHAR LIMIT=140] -->
-    <string name="wifi_assistant_permission_accepted">You gave “Google Wi\u2011Fi Assistant” permission to set up a VPN connection. That means this app can monitor network traffic.</string>
+    <string name="wifi_assistant_title_message"><xliff:g id="wifi_assistant">%1$s</xliff:g> automatically connects you to the best available Wi\u2011Fi</string>
     <!-- Wifi Assistant open app button text.  [CHAR LIMIT=40] -->
     <string name="wifi_assistant_open_app">OPEN APP</string>
 
     <string name="wifi_automatically_manage_title">Automatically manage Wi\u2011Fi</string>
     <!-- Checkbox summary for option to Automatically manage Wi\u2011Fi  [CHAR LIMIT=100] -->
     <string name="wifi_automatically_manage_summary">Let <xliff:g id="wifi_assistant">%1$s</xliff:g> manage your Wi\u2011Fi connection</string>
-    <!-- Checkbox title for option for Wi\u2011Fi Assistant  [CHAR LIMIT=40] -->
-    <string name="wifi_assistant_setting_title">Wi\u2011Fi assistant</string>
-    <!-- Checkbox summary for option for Wi\u2011Fi Assistant  [CHAR LIMIT=40] -->
-    <string name="wifi_assistant_setting_summary">Google Wi\u2011Fi Assistant</string>
     <!-- Preference title for option to install certificates -->
     <string name="wifi_install_credentials">Install certificates</string>
     <string name="wifi_scan_notify_text_location_on">To improve location accuracy and for other purposes, Google and other apps may scan for nearby networks, even when Wi-Fi is off. If you don\'t want this to happen, go to Advanced &gt; Scanning always available.</string>
index aa46341..e9d4297 100644 (file)
     <attr name="wifi_signal_color" format="reference" />
     <attr name="wifi_signal" format="reference" />
 
+    <style name="SetupWizardDisableAppStartingTheme">
+        <!-- Theme to disable the app starting window. The actual theme of the activity needs to
+             be then set in code via setTheme or onApplyThemeResource. -->
+        <item name="android:windowBackground">@null</item>
+    </style>
+
     <style name="SetupWizardWifiTheme" parent="android:Theme.Material.NoActionBar">
         <item name="android:alertDialogTheme">@style/Theme.WifiDialog</item>
         <item name="android:colorAccent">@color/setup_wizard_color_accent_dark</item>
@@ -35,7 +41,7 @@
         <item name="ic_wps">@drawable/ic_wps_dark</item>
         <item name="setup_divider_color">@color/setup_divider_color_dark</item>
         <item name="wifi_signal_color">@color/setup_wizard_wifi_color_dark</item>
-        <item name="wifi_signal">@drawable/wifi_signal_colored</item>
+        <item name="wifi_signal">@drawable/wifi_signal_teal</item>
         <item name="preferenceBackgroundColor">@color/setup_wizard_preference_background_color_dark</item>
     </style>
 
@@ -52,7 +58,7 @@
         <item name="ic_wps">@drawable/ic_wps_light</item>
         <item name="setup_divider_color">@color/setup_divider_color_light</item>
         <item name="wifi_signal_color">@color/setup_wizard_wifi_color_light</item>
-        <item name="wifi_signal">@drawable/wifi_signal_colored</item>
+        <item name="wifi_signal">@drawable/wifi_signal_teal</item>
         <item name="preferenceBackgroundColor">@color/setup_wizard_preference_background_color_light</item>
     </style>
 
@@ -91,7 +97,7 @@
         <item name="ic_menu_add">@drawable/ic_menu_add_dark</item>
         <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_holo_dark</item>
         <item name="ic_wps">@drawable/ic_wps_dark</item>
-        <item name="wifi_signal">@drawable/wifi_signal_light</item>
+        <item name="wifi_signal">@drawable/wifi_signal_teal</item>
 
         <!-- Redefine the ActionBar style for contentInsetStart -->
         <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
index f83a106..5b81d25 100644 (file)
@@ -33,7 +33,6 @@
     <SwitchPreference
             android:key="wifi_assistant"
             android:title="@string/wifi_automatically_manage_title"
-            android:summary="@string/wifi_assistant_setting_summary"
             android:persistent="false" />
 
     <ListPreference
index 02eed99..6d0e690 100755 (executable)
@@ -55,6 +55,9 @@ public final class BluetoothPairingDialog extends AlertActivity implements
 
     private static final int BLUETOOTH_PIN_MAX_LENGTH = 16;
     private static final int BLUETOOTH_PASSKEY_MAX_LENGTH = 6;
+
+    private LocalBluetoothManager mBluetoothManager;
+    private CachedBluetoothDeviceManager mCachedDeviceManager;
     private BluetoothDevice mDevice;
     private int mType;
     private String mPairingKey;
@@ -98,13 +101,13 @@ public final class BluetoothPairingDialog extends AlertActivity implements
             return;
         }
 
-        LocalBluetoothManager manager = LocalBluetoothManager.getInstance(this);
-        if (manager == null) {
+        mBluetoothManager = LocalBluetoothManager.getInstance(this);
+        if (mBluetoothManager == null) {
             Log.e(TAG, "Error: BluetoothAdapter not supported by system");
             finish();
             return;
         }
-        CachedBluetoothDeviceManager deviceManager = manager.getCachedDeviceManager();
+        mCachedDeviceManager = mBluetoothManager.getCachedDeviceManager();
 
         mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
         mType = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.ERROR);
@@ -112,7 +115,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         switch (mType) {
             case BluetoothDevice.PAIRING_VARIANT_PIN:
             case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
-                createUserEntryDialog(deviceManager);
+                createUserEntryDialog();
                 break;
 
             case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION:
@@ -123,12 +126,12 @@ public final class BluetoothPairingDialog extends AlertActivity implements
                     return;
                 }
                 mPairingKey = String.format(Locale.US, "%06d", passkey);
-                createConfirmationDialog(deviceManager);
+                createConfirmationDialog();
                 break;
 
             case BluetoothDevice.PAIRING_VARIANT_CONSENT:
             case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT:
-                createConsentDialog(deviceManager);
+                createConsentDialog();
                 break;
 
             case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY:
@@ -144,7 +147,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
                 } else {
                     mPairingKey = String.format("%04d", pairingKey);
                 }
-                createDisplayPasskeyOrPinDialog(deviceManager);
+                createDisplayPasskeyOrPinDialog();
                 break;
 
             default:
@@ -159,10 +162,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
     }
 
-    private void createUserEntryDialog(CachedBluetoothDeviceManager deviceManager) {
+    private void createUserEntryDialog() {
         final AlertController.AlertParams p = mAlertParams;
         p.mTitle = getString(R.string.bluetooth_pairing_request);
-        p.mView = createPinEntryView(deviceManager.getName(mDevice));
+        p.mView = createPinEntryView();
         p.mPositiveButtonText = getString(android.R.string.ok);
         p.mPositiveButtonListener = this;
         p.mNegativeButtonText = getString(android.R.string.cancel);
@@ -173,7 +176,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         mOkButton.setEnabled(false);
     }
 
-    private View createPinEntryView(String deviceName) {
+    private View createPinEntryView() {
         View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_entry, null);
         TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption);
         TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
@@ -208,7 +211,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         }
 
         messageViewCaption.setText(messageId1);
-        messageViewContent.setText(deviceName);
+        messageViewContent.setText(mCachedDeviceManager.getName(mDevice));
         messageView2.setText(messageId2);
         mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
         mPairingView.setFilters(new InputFilter[] {
@@ -217,10 +220,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         return view;
     }
 
-    private View createView(CachedBluetoothDeviceManager deviceManager) {
+    private View createView() {
         View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null);
         // Escape device name to avoid HTML injection.
-        String name = Html.escapeHtml(deviceManager.getName(mDevice));
+        String name = Html.escapeHtml(mCachedDeviceManager.getName(mDevice));
         TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption);
         TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
         TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption);
@@ -262,10 +265,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         return view;
     }
 
-    private void createConfirmationDialog(CachedBluetoothDeviceManager deviceManager) {
+    private void createConfirmationDialog() {
         final AlertController.AlertParams p = mAlertParams;
         p.mTitle = getString(R.string.bluetooth_pairing_request);
-        p.mView = createView(deviceManager);
+        p.mView = createView();
         p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept);
         p.mPositiveButtonListener = this;
         p.mNegativeButtonText = getString(R.string.bluetooth_pairing_decline);
@@ -273,10 +276,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         setupAlert();
     }
 
-    private void createConsentDialog(CachedBluetoothDeviceManager deviceManager) {
+    private void createConsentDialog() {
         final AlertController.AlertParams p = mAlertParams;
         p.mTitle = getString(R.string.bluetooth_pairing_request);
-        p.mView = createView(deviceManager);
+        p.mView = createView();
         p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept);
         p.mPositiveButtonListener = this;
         p.mNegativeButtonText = getString(R.string.bluetooth_pairing_decline);
@@ -284,11 +287,10 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         setupAlert();
     }
 
-    private void createDisplayPasskeyOrPinDialog(
-            CachedBluetoothDeviceManager deviceManager) {
+    private void createDisplayPasskeyOrPinDialog() {
         final AlertController.AlertParams p = mAlertParams;
         p.mTitle = getString(R.string.bluetooth_pairing_request);
-        p.mView = createView(deviceManager);
+        p.mView = createView();
         p.mNegativeButtonText = getString(android.R.string.cancel);
         p.mNegativeButtonListener = this;
         setupAlert();
@@ -315,7 +317,20 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         }
     }
 
+    private void allowPhonebookAccess() {
+        CachedBluetoothDevice cachedDevice = mCachedDeviceManager.findDevice(mDevice);
+        if (cachedDevice == null) {
+            cachedDevice = mCachedDeviceManager.addDevice(
+                    mBluetoothManager.getBluetoothAdapter(),
+                    mBluetoothManager.getProfileManager(),
+                    mDevice);
+        }
+        cachedDevice.setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_ALLOWED);
+    }
+
     private void onPair(String value) {
+        allowPhonebookAccess();
+
         switch (mType) {
             case BluetoothDevice.PAIRING_VARIANT_PIN:
                 byte[] pinBytes = BluetoothDevice.convertPinToBytes(value);
index 5426f52..f43d176 100755 (executable)
@@ -26,11 +26,8 @@ import android.os.Bundle;
 import android.preference.Preference;
 import android.util.Log;
 import android.view.View;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
 import android.widget.TextView;
 import android.widget.Button;
-import android.widget.CompoundButton.OnCheckedChangeListener;
 
 import com.android.internal.app.AlertActivity;
 import com.android.internal.app.AlertController;
@@ -62,7 +59,7 @@ public class BluetoothPermissionActivity extends AlertActivity implements
             String action = intent.getAction();
             if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL)) {
                 int requestType = intent.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
-                                               BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS);
+                        BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS);
                 if (requestType != mRequestType) return;
                 BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                 if (mDevice.equals(device)) dismissDialog();
@@ -186,40 +183,43 @@ public class BluetoothPermissionActivity extends AlertActivity implements
 
     private void onPositive() {
         if (DEBUG) Log.d(TAG, "onPositive");
-        savePermissionChoice(mRequestType, CachedBluetoothDevice.ACCESS_ALLOWED);
-        // TODO(edjee): Now that we always save the user's choice,
-        // we can get rid of BluetoothDevice#EXTRA_ALWAYS_ALLOWED.
-        sendIntentToReceiver(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY, true,
-                             BluetoothDevice.EXTRA_ALWAYS_ALLOWED, true);
+        sendReplyIntentToReceiver(true, true);
         finish();
     }
 
     private void onNegative() {
         if (DEBUG) Log.d(TAG, "onNegative");
-        savePermissionChoice(mRequestType, CachedBluetoothDevice.ACCESS_REJECTED);
-        sendIntentToReceiver(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY, false,
-                             null, false // dummy value, no effect since last param is null
-                             );
-        finish();
+
+        boolean always = true;
+        if (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
+            LocalBluetoothManager bluetoothManager = LocalBluetoothManager.getInstance(this);
+            CachedBluetoothDeviceManager cachedDeviceManager =
+                    bluetoothManager.getCachedDeviceManager();
+            CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(mDevice);
+            if (cachedDevice == null) {
+                cachedDevice = cachedDeviceManager.addDevice(bluetoothManager.getBluetoothAdapter(),
+                                                             bluetoothManager.getProfileManager(),
+                                                             mDevice);
+            }
+            always = cachedDevice.checkAndIncreaseMessageRejectionCount();
+        }
+
+        sendReplyIntentToReceiver(false, always);
     }
 
-    private void sendIntentToReceiver(final String intentName, final boolean allowed,
-                                      final String extraName, final boolean extraValue) {
-        Intent intent = new Intent(intentName);
+    private void sendReplyIntentToReceiver(final boolean allowed, final boolean always) {
+        Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY);
 
         if (mReturnPackage != null && mReturnClass != null) {
             intent.setClassName(mReturnPackage, mReturnClass);
         }
-        if(DEBUG) Log.i(TAG, "sendIntentToReceiver() Request type: " + mRequestType +
+        if (DEBUG) Log.i(TAG, "sendReplyIntentToReceiver() Request type: " + mRequestType +
                 " mReturnPackage" + mReturnPackage + " mReturnClass" + mReturnClass);
 
         intent.putExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT,
-                        allowed ? BluetoothDevice.CONNECTION_ACCESS_YES :
-                                  BluetoothDevice.CONNECTION_ACCESS_NO);
-
-        if (extraName != null) {
-            intent.putExtra(extraName, extraValue);
-        }
+                        allowed ? BluetoothDevice.CONNECTION_ACCESS_YES
+                                : BluetoothDevice.CONNECTION_ACCESS_NO);
+        intent.putExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, always);
         intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
         intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
         sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN);
@@ -251,23 +251,4 @@ public class BluetoothPermissionActivity extends AlertActivity implements
     public boolean onPreferenceChange(Preference preference, Object newValue) {
         return true;
     }
-
-    private void savePermissionChoice(int permissionType, int permissionChoice) {
-        LocalBluetoothManager bluetoothManager = LocalBluetoothManager.getInstance(this);
-        CachedBluetoothDeviceManager cachedDeviceManager =
-            bluetoothManager.getCachedDeviceManager();
-        CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(mDevice);
-        if (DEBUG) Log.d(TAG, "savePermissionChoice permissionType: " + permissionType);
-        if (cachedDevice == null ) {
-            cachedDevice = cachedDeviceManager.addDevice(bluetoothManager.getBluetoothAdapter(),
-                                                         bluetoothManager.getProfileManager(),
-                                                         mDevice);
-        }
-        if(permissionType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS){
-            cachedDevice.setPhonebookPermissionChoice(permissionChoice);
-        }else if (permissionType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS){
-            cachedDevice.setMessagePermissionChoice(permissionChoice);
-        }
-    }
-
 }
index 1ede05b..bcd4d77 100644 (file)
@@ -66,20 +66,30 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
             if (DEBUG) Log.d(TAG, "onReceive request type: " + mRequestType + " return "
                     + mReturnPackage + "," + mReturnClass);
 
-            // Check if user had made decisions on accepting or rejecting the phonebook access
-            // request. If there is, reply the request and return, no need to start permission
-            // activity dialog or notification.
+            // Even if the user has already made the choice, Bluetooth still may not know that if
+            // the user preference data have not been migrated from Settings app's shared
+            // preferences to Bluetooth app's. In that case, Bluetooth app broadcasts an
+            // ACTION_CONNECTION_ACCESS_REQUEST intent to ask to Settings app.
+            //
+            // If that happens, 'checkUserChoice()' here will do migration because it finds or
+            // creates a 'CachedBluetoothDevice' object for the device.
+            //
+            // After migration is done, 'checkUserChoice()' replies to the request by sending an
+            // ACTION_CONNECTION_ACCESS_REPLY intent. And we don't need to start permission activity
+            // dialog or notification.
             if (checkUserChoice()) {
                 return;
             }
 
             Intent connectionAccessIntent = new Intent(action);
             connectionAccessIntent.setClass(context, BluetoothPermissionActivity.class);
-            // We use the FLAG_ACTIVITY_MULTIPLE_TASK since we can have multiple concurrent access requests
-            connectionAccessIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
-            connectionAccessIntent.setType(Integer.toString(mRequestType)); /* This is needed to create two pending
-                                                                               intents to the same activity.
-                                                                               The value is not used in the activity. */
+            // We use the FLAG_ACTIVITY_MULTIPLE_TASK since we can have multiple concurrent access
+            // requests.
+            connectionAccessIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                    | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
+            // This is needed to create two pending intents to the same activity. The value is not
+            // used in the activity.
+            connectionAccessIntent.setType(Integer.toString(mRequestType));
             connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                                             mRequestType);
             connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
@@ -92,8 +102,9 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
             PowerManager powerManager =
                 (PowerManager) context.getSystemService(Context.POWER_SERVICE);
 
-            if (powerManager.isScreenOn() &&
-                LocalBluetoothPreferences.shouldShowDialogInForeground(context, deviceAddress) ) {
+            if (powerManager.isScreenOn()
+                    && LocalBluetoothPreferences.shouldShowDialogInForeground(
+                            context, deviceAddress)) {
                 context.startActivity(connectionAccessIntent);
             } else {
                 // Put up a notification that leads to the dialog
@@ -110,15 +121,18 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
                 switch (mRequestType) {
                     case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS:
                         title = context.getString(R.string.bluetooth_phonebook_request);
-                        message = context.getString(R.string.bluetooth_pb_acceptance_dialog_text, deviceName, deviceName);
+                        message = context.getString(R.string.bluetooth_pb_acceptance_dialog_text,
+                                deviceName, deviceName);
                         break;
                     case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS:
                         title = context.getString(R.string.bluetooth_map_request);
-                        message = context.getString(R.string.bluetooth_map_acceptance_dialog_text, deviceName, deviceName);
+                        message = context.getString(R.string.bluetooth_map_acceptance_dialog_text,
+                                deviceName, deviceName);
                         break;
                     default:
                         title = context.getString(R.string.bluetooth_connection_permission_request);
-                        message = context.getString(R.string.bluetooth_connection_dialog_text, deviceName, deviceName);
+                        message = context.getString(R.string.bluetooth_connection_dialog_text,
+                                deviceName, deviceName);
                         break;
                 }
                 Notification notification = new Notification.Builder(context)
@@ -137,12 +151,13 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
                                 com.android.internal.R.color.system_notification_accent_color))
                         .build();
 
-                notification.flags |= Notification.FLAG_NO_CLEAR; /* cannot be set with the builder */
+                notification.flags |= Notification.FLAG_NO_CLEAR; // Cannot be set with the builder.
 
                 NotificationManager notificationManager =
                     (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
 
-                notificationManager.notify(getNotificationTag(mRequestType),NOTIFICATION_ID, notification);
+                notificationManager.notify(getNotificationTag(mRequestType), NOTIFICATION_ID,
+                        notification);
             }
         } else if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL)) {
             // Remove the notification
@@ -174,7 +189,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
         // ignore if it is something else than phonebook/message settings it wants us to remember
         if (mRequestType != BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS
                 && mRequestType != BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
-            if (DEBUG) Log.d(TAG, "Unknown RequestType: " + mRequestType);
+            if (DEBUG) Log.d(TAG, "checkUserChoice(): Unknown RequestType " + mRequestType);
             return processed;
         }
 
@@ -182,71 +197,56 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
         CachedBluetoothDeviceManager cachedDeviceManager =
             bluetoothManager.getCachedDeviceManager();
         CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(mDevice);
-
         if (cachedDevice == null) {
             cachedDevice = cachedDeviceManager.addDevice(bluetoothManager.getBluetoothAdapter(),
                 bluetoothManager.getProfileManager(), mDevice);
         }
 
-        if(mRequestType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS) {
+        String intentName = BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY;
 
+        if (mRequestType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS) {
             int phonebookPermission = cachedDevice.getPhonebookPermissionChoice();
 
             if (phonebookPermission == CachedBluetoothDevice.ACCESS_UNKNOWN) {
-                return processed;
-            }
-
-            String intentName = BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY;
-            if (phonebookPermission == CachedBluetoothDevice.ACCESS_ALLOWED) {
-                sendIntentToReceiver(intentName, true, BluetoothDevice.EXTRA_ALWAYS_ALLOWED, true);
+                // Leave 'processed' as false.
+            } else if (phonebookPermission == CachedBluetoothDevice.ACCESS_ALLOWED) {
+                sendReplyIntentToReceiver(true);
                 processed = true;
             } else if (phonebookPermission == CachedBluetoothDevice.ACCESS_REJECTED) {
-                sendIntentToReceiver(intentName, false,
-                                     null, false ); // dummy value, no effect since previous param is null
+                sendReplyIntentToReceiver(false);
                 processed = true;
             } else {
                 Log.e(TAG, "Bad phonebookPermission: " + phonebookPermission);
             }
-
-        } else if(mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
-
+        } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
             int messagePermission = cachedDevice.getMessagePermissionChoice();
 
             if (messagePermission == CachedBluetoothDevice.ACCESS_UNKNOWN) {
-                return processed;
-            }
-
-            String intentName = BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY;
-            if (messagePermission == CachedBluetoothDevice.ACCESS_ALLOWED) {
-                sendIntentToReceiver(intentName, true, BluetoothDevice.EXTRA_ALWAYS_ALLOWED, true);
+                // Leave 'processed' as false.
+            } else if (messagePermission == CachedBluetoothDevice.ACCESS_ALLOWED) {
+                sendReplyIntentToReceiver(true);
                 processed = true;
             } else if (messagePermission == CachedBluetoothDevice.ACCESS_REJECTED) {
-                sendIntentToReceiver(intentName, false,
-                                     null, false); // dummy value, no effect since previous param is null
+                sendReplyIntentToReceiver(false);
                 processed = true;
             } else {
                 Log.e(TAG, "Bad messagePermission: " + messagePermission);
             }
         }
-        if(DEBUG) Log.d(TAG,"checkUserChoice(): returning " + processed);
+        if (DEBUG) Log.d(TAG,"checkUserChoice(): returning " + processed);
         return processed;
     }
 
-    private void sendIntentToReceiver(final String intentName, final boolean allowed,
-                                      final String extraName, final boolean extraValue) {
-        Intent intent = new Intent(intentName);
+    private void sendReplyIntentToReceiver(final boolean allowed) {
+        Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY);
 
         if (mReturnPackage != null && mReturnClass != null) {
             intent.setClassName(mReturnPackage, mReturnClass);
         }
 
         intent.putExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT,
-                        allowed ? BluetoothDevice.CONNECTION_ACCESS_YES :
-                        BluetoothDevice.CONNECTION_ACCESS_NO);
-
-        if (extraName != null) {
-            intent.putExtra(extraName, extraValue);
-        }
+                        allowed ? BluetoothDevice.CONNECTION_ACCESS_YES
+                                : BluetoothDevice.CONNECTION_ACCESS_NO);
         intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
         intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
         mContext.sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN);
index 3b64ade..6d2222e 100755 (executable)
@@ -68,9 +68,7 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
 
     private int mMessagePermissionChoice;
 
-    private int mPhonebookRejectedTimes;
-
-    private int mMessageRejectedTimes;
+    private int mMessageRejectionCount;
 
     private final Collection<Callback> mCallbacks = new ArrayList<Callback>();
 
@@ -82,13 +80,10 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
     // User has rejected the connection and let Settings app remember the decision
     public final static int ACCESS_REJECTED = 2;
 
-    // how many times did User reject the connection to make the rejected persist.
-    final static int PERSIST_REJECTED_TIMES_LIMIT = 2;
+    // How many times user should reject the connection to make the choice persist.
+    private final static int MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST = 2;
 
-    private final static String PHONEBOOK_PREFS_NAME = "bluetooth_phonebook_permission";
-    private final static String MESSAGE_PREFS_NAME = "bluetooth_message_permission";
-    private final static String PHONEBOOK_REJECT_TIMES = "bluetooth_phonebook_reject";
-    private final static String MESSAGE_REJECT_TIMES = "bluetooth_message_reject";
+    private final static String MESSAGE_REJECTION_COUNT_PREFS_NAME = "bluetooth_message_reject";
 
     /**
      * When we connect to multiple profiles, we only want to display a single
@@ -370,10 +365,9 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
         fetchName();
         fetchBtClass();
         updateProfiles();
-        fetchPhonebookPermissionChoice();
-        fetchMessagePermissionChoice();
-        fetchPhonebookRejectTimes();
-        fetchMessageRejectTimes();
+        migratePhonebookPermissionChoice();
+        migrateMessagePermissionChoice();
+        fetchMessageRejectionCount();
 
         mVisible = false;
         dispatchAttributesChanged();
@@ -541,10 +535,8 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
             mConnectAfterPairing = false;  // cancel auto-connect
             setPhonebookPermissionChoice(ACCESS_UNKNOWN);
             setMessagePermissionChoice(ACCESS_UNKNOWN);
-            mPhonebookRejectedTimes = 0;
-            savePhonebookRejectTimes();
-            mMessageRejectedTimes = 0;
-            saveMessageRejectTimes();
+            mMessageRejectionCount = 0;
+            saveMessageRejectionCount();
         }
 
         refresh();
@@ -657,104 +649,116 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
     }
 
     int getPhonebookPermissionChoice() {
-        return mPhonebookPermissionChoice;
+        int permission = mDevice.getPhonebookAccessPermission();
+        if (permission == BluetoothDevice.ACCESS_ALLOWED) {
+            return ACCESS_ALLOWED;
+        } else if (permission == BluetoothDevice.ACCESS_REJECTED) {
+            return ACCESS_REJECTED;
+        }
+        return ACCESS_UNKNOWN;
     }
 
     void setPhonebookPermissionChoice(int permissionChoice) {
-        // if user reject it, only save it when reject exceed limit.
-        if (permissionChoice == ACCESS_REJECTED) {
-            mPhonebookRejectedTimes++;
-            savePhonebookRejectTimes();
-            if (mPhonebookRejectedTimes < PERSIST_REJECTED_TIMES_LIMIT) {
-                return;
-            }
-        }
-
-        mPhonebookPermissionChoice = permissionChoice;
-
-        SharedPreferences.Editor editor =
-            mContext.getSharedPreferences(PHONEBOOK_PREFS_NAME, Context.MODE_PRIVATE).edit();
-        if (permissionChoice == ACCESS_UNKNOWN) {
-            editor.remove(mDevice.getAddress());
-        } else {
-            editor.putInt(mDevice.getAddress(), permissionChoice);
+        int permission = BluetoothDevice.ACCESS_UNKNOWN;
+        if (permissionChoice == ACCESS_ALLOWED) {
+            permission = BluetoothDevice.ACCESS_ALLOWED;
+        } else if (permissionChoice == ACCESS_REJECTED) {
+            permission = BluetoothDevice.ACCESS_REJECTED;
         }
-        editor.commit();
-    }
-
-    private void fetchPhonebookPermissionChoice() {
-        SharedPreferences preference = mContext.getSharedPreferences(PHONEBOOK_PREFS_NAME,
-                                                                     Context.MODE_PRIVATE);
-        mPhonebookPermissionChoice = preference.getInt(mDevice.getAddress(),
-                                                       ACCESS_UNKNOWN);
+        mDevice.setPhonebookAccessPermission(permission);
     }
 
-    private void fetchPhonebookRejectTimes() {
-        SharedPreferences preference = mContext.getSharedPreferences(PHONEBOOK_REJECT_TIMES,
-                                                                     Context.MODE_PRIVATE);
-        mPhonebookRejectedTimes = preference.getInt(mDevice.getAddress(), 0);
-    }
+    // Migrates data from old data store (in Settings app's shared preferences) to new (in Bluetooth
+    // app's shared preferences).
+    private void migratePhonebookPermissionChoice() {
+        SharedPreferences preferences = mContext.getSharedPreferences(
+                "bluetooth_phonebook_permission", Context.MODE_PRIVATE);
+        if (!preferences.contains(mDevice.getAddress())) {
+            return;
+        }
 
-    private void savePhonebookRejectTimes() {
-        SharedPreferences.Editor editor =
-            mContext.getSharedPreferences(PHONEBOOK_REJECT_TIMES,
-                                          Context.MODE_PRIVATE).edit();
-        if (mPhonebookRejectedTimes == 0) {
-            editor.remove(mDevice.getAddress());
-        } else {
-            editor.putInt(mDevice.getAddress(), mPhonebookRejectedTimes);
+        if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_UNKNOWN) {
+            int oldPermission = preferences.getInt(mDevice.getAddress(), ACCESS_UNKNOWN);
+            if (oldPermission == ACCESS_ALLOWED) {
+                mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
+            } else if (oldPermission == ACCESS_REJECTED) {
+                mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
+            }
         }
+
+        SharedPreferences.Editor editor = preferences.edit();
+        editor.remove(mDevice.getAddress());
         editor.commit();
     }
 
     int getMessagePermissionChoice() {
-        return mMessagePermissionChoice;
+        int permission = mDevice.getMessageAccessPermission();
+        if (permission == BluetoothDevice.ACCESS_ALLOWED) {
+            return ACCESS_ALLOWED;
+        } else if (permission == BluetoothDevice.ACCESS_REJECTED) {
+            return ACCESS_REJECTED;
+        }
+        return ACCESS_UNKNOWN;
     }
 
     void setMessagePermissionChoice(int permissionChoice) {
-        // if user reject it, only save it when reject exceed limit.
-        if (permissionChoice == ACCESS_REJECTED) {
-            mMessageRejectedTimes++;
-            saveMessageRejectTimes();
-            if (mMessageRejectedTimes < PERSIST_REJECTED_TIMES_LIMIT) {
-                return;
-            }
+        int permission = BluetoothDevice.ACCESS_UNKNOWN;
+        if (permissionChoice == ACCESS_ALLOWED) {
+            permission = BluetoothDevice.ACCESS_ALLOWED;
+        } else if (permissionChoice == ACCESS_REJECTED) {
+            permission = BluetoothDevice.ACCESS_REJECTED;
         }
+        mDevice.setMessageAccessPermission(permission);
+    }
 
-        mMessagePermissionChoice = permissionChoice;
+    // Migrates data from old data store (in Settings app's shared preferences) to new (in Bluetooth
+    // app's shared preferences).
+    private void migrateMessagePermissionChoice() {
+        SharedPreferences preferences = mContext.getSharedPreferences(
+                "bluetooth_message_permission", Context.MODE_PRIVATE);
+        if (!preferences.contains(mDevice.getAddress())) {
+            return;
+        }
 
-        SharedPreferences.Editor editor =
-            mContext.getSharedPreferences(MESSAGE_PREFS_NAME, Context.MODE_PRIVATE).edit();
-        if (permissionChoice == ACCESS_UNKNOWN) {
-            editor.remove(mDevice.getAddress());
-        } else {
-            editor.putInt(mDevice.getAddress(), permissionChoice);
+        if (mDevice.getMessageAccessPermission() == BluetoothDevice.ACCESS_UNKNOWN) {
+            int oldPermission = preferences.getInt(mDevice.getAddress(), ACCESS_UNKNOWN);
+            if (oldPermission == ACCESS_ALLOWED) {
+                mDevice.setMessageAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
+            } else if (oldPermission == ACCESS_REJECTED) {
+                mDevice.setMessageAccessPermission(BluetoothDevice.ACCESS_REJECTED);
+            }
         }
+
+        SharedPreferences.Editor editor = preferences.edit();
+        editor.remove(mDevice.getAddress());
         editor.commit();
     }
 
-    private void fetchMessagePermissionChoice() {
-        SharedPreferences preference = mContext.getSharedPreferences(MESSAGE_PREFS_NAME,
-                                                                     Context.MODE_PRIVATE);
-        mMessagePermissionChoice = preference.getInt(mDevice.getAddress(),
-                                                       ACCESS_UNKNOWN);
+    /**
+     * @return Whether this rejection should persist.
+     */
+    boolean checkAndIncreaseMessageRejectionCount() {
+        if (mMessageRejectionCount < MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST) {
+            mMessageRejectionCount++;
+            saveMessageRejectionCount();
+        }
+        return mMessageRejectionCount >= MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST;
     }
 
-    private void fetchMessageRejectTimes() {
-        SharedPreferences preference = mContext.getSharedPreferences(MESSAGE_REJECT_TIMES,
-                                                                     Context.MODE_PRIVATE);
-        mMessageRejectedTimes = preference.getInt(mDevice.getAddress(), 0);
+    private void fetchMessageRejectionCount() {
+        SharedPreferences preference = mContext.getSharedPreferences(
+                MESSAGE_REJECTION_COUNT_PREFS_NAME, Context.MODE_PRIVATE);
+        mMessageRejectionCount = preference.getInt(mDevice.getAddress(), 0);
     }
 
-    private void saveMessageRejectTimes() {
-        SharedPreferences.Editor editor =
-            mContext.getSharedPreferences(MESSAGE_REJECT_TIMES, Context.MODE_PRIVATE).edit();
-        if (mMessageRejectedTimes == 0) {
+    private void saveMessageRejectionCount() {
+        SharedPreferences.Editor editor = mContext.getSharedPreferences(
+                MESSAGE_REJECTION_COUNT_PREFS_NAME, Context.MODE_PRIVATE).edit();
+        if (mMessageRejectionCount == 0) {
             editor.remove(mDevice.getAddress());
         } else {
-            editor.putInt(mDevice.getAddress(), mMessageRejectedTimes);
+            editor.putInt(mDevice.getAddress(), mMessageRejectionCount);
         }
         editor.commit();
     }
-
 }
index 5c2beba..c94c2cf 100755 (executable)
@@ -151,7 +151,6 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
         if (pbapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN) {
             final PbapServerProfile psp = mManager.getProfileManager().getPbapProfile();
             CheckBoxPreference pbapPref = createProfilePreference(psp);
-            pbapPref.setChecked(pbapPermission == CachedBluetoothDevice.ACCESS_ALLOWED);
             mProfileContainer.addPreference(pbapPref);
         }
 
@@ -191,11 +190,6 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
             pref.setIcon(getResources().getDrawable(iconResource));
         }
 
-        /**
-         * Gray out profile while connecting and disconnecting
-         */
-        pref.setEnabled(!mCachedDevice.isBusy());
-
         refreshProfilePreference(pref, profile);
 
         return pref;
@@ -310,11 +304,16 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
             LocalBluetoothProfile profile) {
         BluetoothDevice device = mCachedDevice.getDevice();
 
-        /*
-         * Gray out checkbox while connecting and disconnecting
-         */
+        // Gray out checkbox while connecting and disconnecting.
         profilePref.setEnabled(!mCachedDevice.isBusy());
-        profilePref.setChecked(profile.isPreferred(device));
+
+        if (profile instanceof PbapServerProfile) {
+            // Handle PBAP specially.
+            profilePref.setChecked(mCachedDevice.getPhonebookPermissionChoice()
+                    == CachedBluetoothDevice.ACCESS_ALLOWED);
+        } else {
+            profilePref.setChecked(profile.isPreferred(device));
+        }
     }
 
     private LocalBluetoothProfile getProfileOf(Preference pref) {
index c16708d..fbd0ea3 100644 (file)
@@ -565,10 +565,22 @@ public class BatteryHistoryChart extends View {
                 }
                 if (rec.cmd == HistoryItem.CMD_CURRENT_TIME
                         || rec.cmd == HistoryItem.CMD_RESET) {
+                    // If there is a ridiculously large jump in time, then we won't be
+                    // able to create a good chart with that data, so just ignore the
+                    // times we got before and pretend like our data extends back from
+                    // the time we have now.
+                    // Also, if we are getting a time change and we are less than 5 minutes
+                    // since the start of the history real time, then also use this new
+                    // time to compute the base time, since whatever time we had before is
+                    // pretty much just noise.
+                    if (rec.currentTime > (lastWallTime+(180*24*60*60*1000L))
+                            || rec.time < (mHistStart+(5*60*1000L))) {
+                        mStartWallTime = 0;
+                    }
                     lastWallTime = rec.currentTime;
                     lastRealtime = rec.time;
                     if (mStartWallTime == 0) {
-                        mStartWallTime = lastWallTime;
+                        mStartWallTime = lastWallTime - (lastRealtime-mHistStart);
                     }
                 }
                 if (rec.isDeltaData()) {
@@ -774,7 +786,7 @@ public class BatteryHistoryChart extends View {
         final long walltimeStart = mStartWallTime;
         final long walltimeChange = mEndWallTime > walltimeStart
                 ? (mEndWallTime-walltimeStart) : 1;
-        long curWalltime = 0;
+        long curWalltime = mStartWallTime;
         long lastRealtime = 0;
 
         final int batLow = mBatLow;
@@ -791,17 +803,12 @@ public class BatteryHistoryChart extends View {
         boolean lastWifiRunning = false, lastWifiSupplRunning = false, lastCpuRunning = false;
         int lastWifiSupplState = BatteryStats.WIFI_SUPPL_STATE_INVALID;
         final int N = mNumHist;
-        if (mStats.startIteratingHistoryLocked()) {
+        if (mEndDataWallTime > mStartWallTime && mStats.startIteratingHistoryLocked()) {
             final HistoryItem rec = new HistoryItem();
             while (mStats.getNextHistoryLocked(rec) && i < N) {
-                if (rec.cmd == HistoryItem.CMD_CURRENT_TIME || rec.cmd == HistoryItem.CMD_RESET) {
-                    curWalltime = rec.currentTime;
-                    lastRealtime = rec.time;
-                } else if (curWalltime != 0) {
+                if (rec.isDeltaData()) {
                     curWalltime += rec.time-lastRealtime;
                     lastRealtime = rec.time;
-                }
-                if (curWalltime != 0 && rec.isDeltaData()) {
                     x = mLevelLeft + (int)(((curWalltime-walltimeStart)*levelWidth)/walltimeChange);
                     if (x < 0) {
                         x = 0;
@@ -950,21 +957,36 @@ public class BatteryHistoryChart extends View {
                         }
                     }
 
-                } else if (rec.cmd != HistoryItem.CMD_OVERFLOW
-                        && rec.cmd != HistoryItem.CMD_CURRENT_TIME) {
-                    if (curLevelPath != null) {
-                        finishPaths(x+1, h, levelh, startX, lastY, curLevelPath, lastX,
-                                lastCharging, lastScreenOn, lastGpsOn, lastWifiRunning,
-                                lastCpuRunning, lastLinePath);
-                        lastX = lastY = -1;
-                        curLevelPath = null;
-                        lastLinePath = null;
-                        lastCharging = lastScreenOn = lastGpsOn = lastCpuRunning = false;
+                } else {
+                    long lastWalltime = curWalltime;
+                    if (rec.cmd == HistoryItem.CMD_CURRENT_TIME
+                            || rec.cmd == HistoryItem.CMD_RESET) {
+                        if (rec.currentTime >= mStartWallTime) {
+                            curWalltime = rec.currentTime;
+                        } else {
+                            curWalltime = mStartWallTime + (rec.time-mHistStart);
+                        }
+                        lastRealtime = rec.time;
+                    }
+
+                    if (rec.cmd != HistoryItem.CMD_OVERFLOW
+                            && (rec.cmd != HistoryItem.CMD_CURRENT_TIME
+                                    || Math.abs(lastWalltime-curWalltime) > (60*60*1000))) {
+                        if (curLevelPath != null) {
+                            finishPaths(x+1, h, levelh, startX, lastY, curLevelPath, lastX,
+                                    lastCharging, lastScreenOn, lastGpsOn, lastWifiRunning,
+                                    lastCpuRunning, lastLinePath);
+                            lastX = lastY = -1;
+                            curLevelPath = null;
+                            lastLinePath = null;
+                            lastCharging = lastScreenOn = lastGpsOn = lastCpuRunning = false;
+                        }
                     }
                 }
                 
                 i++;
             }
+            mStats.finishIteratingHistoryLocked();
         }
 
         if (lastY < 0 || lastX < 0) {
index 6d4237c..258c220 100644 (file)
@@ -735,6 +735,10 @@ public class WifiSettings extends RestrictedSettingsFragment
                     .inflate(R.layout.wifi_assistant_card, getListView(), false);
             Button setup = (Button) mWifiAssistantCard.findViewById(R.id.setup);
             Button noThanks = (Button) mWifiAssistantCard.findViewById(R.id.no_thanks_button);
+            TextView assistantText =
+                (TextView) mWifiAssistantCard.findViewById(R.id.wifi_assistant_text);
+            assistantText.setText(getResources().getString(
+                    R.string.wifi_assistant_title_message, mWifiAssistantApp.mScorerName));
 
             if (setup != null && noThanks != null) {
                 setup.setOnClickListener(new OnClickListener() {