diff --git a/AndroidManifest.xml b/AndroidManifest.xml index b730ba72efb..7c4be12d302 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1343,7 +1343,6 @@ diff --git a/res/drawable-hdpi/appwidget_settings_ind_on_c_holo.9.png b/res/drawable-hdpi/appwidget_settings_ind_on_c_holo.9.png index 04dd49899f5..4f05e36b332 100644 Binary files a/res/drawable-hdpi/appwidget_settings_ind_on_c_holo.9.png and b/res/drawable-hdpi/appwidget_settings_ind_on_c_holo.9.png differ diff --git a/res/drawable-hdpi/appwidget_settings_ind_on_l_holo.9.png b/res/drawable-hdpi/appwidget_settings_ind_on_l_holo.9.png index c3e15d2b9d2..c4849ff4ee2 100644 Binary files a/res/drawable-hdpi/appwidget_settings_ind_on_l_holo.9.png and b/res/drawable-hdpi/appwidget_settings_ind_on_l_holo.9.png differ diff --git a/res/drawable-hdpi/appwidget_settings_ind_on_r_holo.9.png b/res/drawable-hdpi/appwidget_settings_ind_on_r_holo.9.png index 673af628d89..e8975cd4c42 100644 Binary files a/res/drawable-hdpi/appwidget_settings_ind_on_r_holo.9.png and b/res/drawable-hdpi/appwidget_settings_ind_on_r_holo.9.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_bluetooth_off_holo.png b/res/drawable-hdpi/ic_appwidget_settings_bluetooth_off_holo.png index a45c3eaee51..396b0033792 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_bluetooth_off_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_bluetooth_off_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_bluetooth_on_holo.png b/res/drawable-hdpi/ic_appwidget_settings_bluetooth_on_holo.png index 102a50ee3ec..37b1b1075c5 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_bluetooth_on_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_bluetooth_on_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_brightness_auto_holo.png b/res/drawable-hdpi/ic_appwidget_settings_brightness_auto_holo.png index 9c826361bb8..5776a5f90bf 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_brightness_auto_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_brightness_auto_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_brightness_full_holo.png b/res/drawable-hdpi/ic_appwidget_settings_brightness_full_holo.png index 80a09800e6e..976844b1a68 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_brightness_full_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_brightness_full_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_brightness_half_holo.png b/res/drawable-hdpi/ic_appwidget_settings_brightness_half_holo.png index 3a5a043a739..3927f1be217 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_brightness_half_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_brightness_half_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_brightness_off_holo.png b/res/drawable-hdpi/ic_appwidget_settings_brightness_off_holo.png index 0f25e1f0dcf..649bb2a368f 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_brightness_off_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_brightness_off_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_location_off_holo.png b/res/drawable-hdpi/ic_appwidget_settings_location_off_holo.png index 831c87ab287..33dde9a6a7a 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_location_off_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_location_off_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_location_on_holo.png b/res/drawable-hdpi/ic_appwidget_settings_location_on_holo.png index 5ece2310d9b..cda8f565d79 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_location_on_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_location_on_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_location_saving_holo.png b/res/drawable-hdpi/ic_appwidget_settings_location_saving_holo.png new file mode 100644 index 00000000000..91ccc2dfcb6 Binary files /dev/null and b/res/drawable-hdpi/ic_appwidget_settings_location_saving_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_sync_off_holo.png b/res/drawable-hdpi/ic_appwidget_settings_sync_off_holo.png index 1c9079e394c..559a8c1e9de 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_sync_off_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_sync_off_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_sync_on_holo.png b/res/drawable-hdpi/ic_appwidget_settings_sync_on_holo.png index daddd54bd87..c77db7b8d07 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_sync_on_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_sync_on_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_wifi_off_holo.png b/res/drawable-hdpi/ic_appwidget_settings_wifi_off_holo.png index 0e0ccdabfa7..3bfb1a561b9 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_wifi_off_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_wifi_off_holo.png differ diff --git a/res/drawable-hdpi/ic_appwidget_settings_wifi_on_holo.png b/res/drawable-hdpi/ic_appwidget_settings_wifi_on_holo.png index e095cf9bf8d..dc0e6c1cc5c 100644 Binary files a/res/drawable-hdpi/ic_appwidget_settings_wifi_on_holo.png and b/res/drawable-hdpi/ic_appwidget_settings_wifi_on_holo.png differ diff --git a/res/drawable-mdpi/appwidget_settings_ind_on_c_holo.9.png b/res/drawable-mdpi/appwidget_settings_ind_on_c_holo.9.png index a02deec86c6..14c36d5e9e0 100644 Binary files a/res/drawable-mdpi/appwidget_settings_ind_on_c_holo.9.png and b/res/drawable-mdpi/appwidget_settings_ind_on_c_holo.9.png differ diff --git a/res/drawable-mdpi/appwidget_settings_ind_on_l_holo.9.png b/res/drawable-mdpi/appwidget_settings_ind_on_l_holo.9.png index 55a63868bed..a67d43fab92 100644 Binary files a/res/drawable-mdpi/appwidget_settings_ind_on_l_holo.9.png and b/res/drawable-mdpi/appwidget_settings_ind_on_l_holo.9.png differ diff --git a/res/drawable-mdpi/appwidget_settings_ind_on_r_holo.9.png b/res/drawable-mdpi/appwidget_settings_ind_on_r_holo.9.png index fa4c4f04a80..6a98bad1d63 100644 Binary files a/res/drawable-mdpi/appwidget_settings_ind_on_r_holo.9.png and b/res/drawable-mdpi/appwidget_settings_ind_on_r_holo.9.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_bluetooth_off_holo.png b/res/drawable-mdpi/ic_appwidget_settings_bluetooth_off_holo.png index 358306341eb..ea61621ccbe 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_bluetooth_off_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_bluetooth_off_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_bluetooth_on_holo.png b/res/drawable-mdpi/ic_appwidget_settings_bluetooth_on_holo.png index c01ffb28af5..e647c0384df 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_bluetooth_on_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_bluetooth_on_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_brightness_auto_holo.png b/res/drawable-mdpi/ic_appwidget_settings_brightness_auto_holo.png index 9cebeb38a5a..2fdd9d34634 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_brightness_auto_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_brightness_auto_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_brightness_full_holo.png b/res/drawable-mdpi/ic_appwidget_settings_brightness_full_holo.png index b0bbb265b96..92dbf0f6228 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_brightness_full_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_brightness_full_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_brightness_half_holo.png b/res/drawable-mdpi/ic_appwidget_settings_brightness_half_holo.png index fe043f50542..5ccec31c5b0 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_brightness_half_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_brightness_half_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_brightness_off_holo.png b/res/drawable-mdpi/ic_appwidget_settings_brightness_off_holo.png index c073ebebabd..72b62e7c251 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_brightness_off_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_brightness_off_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_location_off_holo.png b/res/drawable-mdpi/ic_appwidget_settings_location_off_holo.png index c5906111c08..04becf2074c 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_location_off_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_location_off_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_location_on_holo.png b/res/drawable-mdpi/ic_appwidget_settings_location_on_holo.png index dbdb9ebd727..a24c6eb6b70 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_location_on_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_location_on_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_location_saving_holo.png b/res/drawable-mdpi/ic_appwidget_settings_location_saving_holo.png new file mode 100644 index 00000000000..777a3f0f8d1 Binary files /dev/null and b/res/drawable-mdpi/ic_appwidget_settings_location_saving_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_sync_off_holo.png b/res/drawable-mdpi/ic_appwidget_settings_sync_off_holo.png index ddef24c4559..f2efb04163c 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_sync_off_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_sync_off_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_sync_on_holo.png b/res/drawable-mdpi/ic_appwidget_settings_sync_on_holo.png index f7ba24a4958..35f4558e549 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_sync_on_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_sync_on_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_wifi_off_holo.png b/res/drawable-mdpi/ic_appwidget_settings_wifi_off_holo.png index 6edec54ad1c..774b1496450 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_wifi_off_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_wifi_off_holo.png differ diff --git a/res/drawable-mdpi/ic_appwidget_settings_wifi_on_holo.png b/res/drawable-mdpi/ic_appwidget_settings_wifi_on_holo.png index 1fa295b9daa..a008f8aad72 100644 Binary files a/res/drawable-mdpi/ic_appwidget_settings_wifi_on_holo.png and b/res/drawable-mdpi/ic_appwidget_settings_wifi_on_holo.png differ diff --git a/res/drawable-nodpi/preview.png b/res/drawable-nodpi/preview.png index d06adc1988e..0ffb70079ba 100644 Binary files a/res/drawable-nodpi/preview.png and b/res/drawable-nodpi/preview.png differ diff --git a/res/drawable-xhdpi/appwidget_settings_ind_on_c_holo.9.png b/res/drawable-xhdpi/appwidget_settings_ind_on_c_holo.9.png index 8a62b72b99b..c764f4bb821 100644 Binary files a/res/drawable-xhdpi/appwidget_settings_ind_on_c_holo.9.png and b/res/drawable-xhdpi/appwidget_settings_ind_on_c_holo.9.png differ diff --git a/res/drawable-xhdpi/appwidget_settings_ind_on_l_holo.9.png b/res/drawable-xhdpi/appwidget_settings_ind_on_l_holo.9.png index 713d76db460..6bbc2aad95e 100644 Binary files a/res/drawable-xhdpi/appwidget_settings_ind_on_l_holo.9.png and b/res/drawable-xhdpi/appwidget_settings_ind_on_l_holo.9.png differ diff --git a/res/drawable-xhdpi/appwidget_settings_ind_on_r_holo.9.png b/res/drawable-xhdpi/appwidget_settings_ind_on_r_holo.9.png index ae0eda2b3a4..dc66839c223 100644 Binary files a/res/drawable-xhdpi/appwidget_settings_ind_on_r_holo.9.png and b/res/drawable-xhdpi/appwidget_settings_ind_on_r_holo.9.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_bluetooth_off_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_bluetooth_off_holo.png index bea478ec7e1..61d7aef2276 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_bluetooth_off_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_bluetooth_off_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_bluetooth_on_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_bluetooth_on_holo.png index 70aca2d34b6..380c4424161 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_bluetooth_on_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_bluetooth_on_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_brightness_auto_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_brightness_auto_holo.png index 709c25a9989..85287596f1b 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_brightness_auto_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_brightness_auto_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_brightness_full_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_brightness_full_holo.png index dd13c091807..b6b115c4918 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_brightness_full_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_brightness_full_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_brightness_half_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_brightness_half_holo.png index b6d238b348b..cec10f78625 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_brightness_half_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_brightness_half_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_brightness_off_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_brightness_off_holo.png index 54d40d69d0f..64117df299e 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_brightness_off_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_brightness_off_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_location_off_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_location_off_holo.png index dfaa6c30071..3f625988c8c 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_location_off_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_location_off_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_location_on_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_location_on_holo.png index bb00da6bf44..689222b2331 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_location_on_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_location_on_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_location_saving_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_location_saving_holo.png new file mode 100644 index 00000000000..235b3c3ebd9 Binary files /dev/null and b/res/drawable-xhdpi/ic_appwidget_settings_location_saving_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_sync_off_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_sync_off_holo.png index 11925bd7854..b8234cb391a 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_sync_off_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_sync_off_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_sync_on_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_sync_on_holo.png index 17b594659e0..9a7ea50970d 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_sync_on_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_sync_on_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_wifi_off_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_wifi_off_holo.png index 53b4566b464..ed30e3b5c54 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_wifi_off_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_wifi_off_holo.png differ diff --git a/res/drawable-xhdpi/ic_appwidget_settings_wifi_on_holo.png b/res/drawable-xhdpi/ic_appwidget_settings_wifi_on_holo.png index bdf9918c48a..9651f2b9c84 100644 Binary files a/res/drawable-xhdpi/ic_appwidget_settings_wifi_on_holo.png and b/res/drawable-xhdpi/ic_appwidget_settings_wifi_on_holo.png differ diff --git a/res/drawable-xxhdpi/appwidget_settings_ind_on_c_holo.9.png b/res/drawable-xxhdpi/appwidget_settings_ind_on_c_holo.9.png new file mode 100644 index 00000000000..a9114dcfb5a Binary files /dev/null and b/res/drawable-xxhdpi/appwidget_settings_ind_on_c_holo.9.png differ diff --git a/res/drawable-xxhdpi/appwidget_settings_ind_on_l_holo.9.png b/res/drawable-xxhdpi/appwidget_settings_ind_on_l_holo.9.png new file mode 100644 index 00000000000..c23c095aec6 Binary files /dev/null and b/res/drawable-xxhdpi/appwidget_settings_ind_on_l_holo.9.png differ diff --git a/res/drawable-xxhdpi/appwidget_settings_ind_on_r_holo.9.png b/res/drawable-xxhdpi/appwidget_settings_ind_on_r_holo.9.png new file mode 100644 index 00000000000..a86b32fe76f Binary files /dev/null and b/res/drawable-xxhdpi/appwidget_settings_ind_on_r_holo.9.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_bluetooth_off_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_bluetooth_off_holo.png new file mode 100644 index 00000000000..9facc9c0fa3 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_bluetooth_off_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_bluetooth_on_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_bluetooth_on_holo.png new file mode 100644 index 00000000000..de209529c4b Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_bluetooth_on_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_brightness_auto_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_brightness_auto_holo.png new file mode 100644 index 00000000000..73acdb281e5 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_brightness_auto_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_brightness_full_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_brightness_full_holo.png new file mode 100644 index 00000000000..f2289b8e833 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_brightness_full_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_brightness_half_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_brightness_half_holo.png new file mode 100644 index 00000000000..0965b13a5c1 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_brightness_half_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_brightness_off_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_brightness_off_holo.png new file mode 100644 index 00000000000..cb7c88a5c74 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_brightness_off_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_location_off_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_location_off_holo.png index d2fc839b137..9031164f0b9 100644 Binary files a/res/drawable-xxhdpi/ic_appwidget_settings_location_off_holo.png and b/res/drawable-xxhdpi/ic_appwidget_settings_location_off_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_location_on_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_location_on_holo.png index 893eb82a0e3..3024d54fc1d 100644 Binary files a/res/drawable-xxhdpi/ic_appwidget_settings_location_on_holo.png and b/res/drawable-xxhdpi/ic_appwidget_settings_location_on_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_location_saving_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_location_saving_holo.png new file mode 100644 index 00000000000..92af1499277 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_location_saving_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_sync_off_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_sync_off_holo.png new file mode 100644 index 00000000000..55120172119 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_sync_off_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_sync_on_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_sync_on_holo.png new file mode 100644 index 00000000000..88eb54bf2a7 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_sync_on_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_wifi_off_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_wifi_off_holo.png new file mode 100644 index 00000000000..4a20cf08605 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_wifi_off_holo.png differ diff --git a/res/drawable-xxhdpi/ic_appwidget_settings_wifi_on_holo.png b/res/drawable-xxhdpi/ic_appwidget_settings_wifi_on_holo.png new file mode 100644 index 00000000000..a8b477291b7 Binary files /dev/null and b/res/drawable-xxhdpi/ic_appwidget_settings_wifi_on_holo.png differ diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml index cd968b13e16..7275c73038b 100644 --- a/res/layout/wifi_dialog.xml +++ b/res/layout/wifi_dialog.xml @@ -196,6 +196,12 @@ style="@style/wifi_item_content" android:prompt="@string/proxy_settings_title" android:entries="@array/wifi_proxy_settings" /> + + false + + + true diff --git a/res/values/dimens.xml b/res/values/dimens.xml index bf697d63452..129448317c6 100755 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -50,7 +50,7 @@ 28dp - 260dip + 280dip 40dip 0dp diff --git a/res/values/strings.xml b/res/values/strings.xml index e6b88646aff..586373c48b0 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -436,6 +436,9 @@ The HTTP proxy is used by the browser but may not be used by the other apps. + + "PAC URL: " + Location: @@ -1223,37 +1226,22 @@ Remember settings - Wireless display - - To see devices, turn wireless display on. - - Wireless display is disabled because Wi\u2011Fi is off. - - Search for displays - - Searching\u2026 + Cast screen + + Enable wireless display - No nearby wireless displays were found. - - Paired displays - - Available devices + No nearby devices were found. Connecting Connected - - Available In use + + Unavailable Display settings - - Disconnect? - - This will end your connection with:<br><b>%1$s</b> - Wireless display options @@ -1263,13 +1251,6 @@ Name - - On - - Off - - Disabled - Certification @@ -1948,6 +1929,19 @@ Cancel + + Incorrect SIM PIN code you must now contact your carrier to unlock your device. + + + Incorrect SIM PIN code, you have %d remaining attempt before you must contact your carrier to unlock your device. + Incorrect SIM PIN code, you have %d remaining attempts. + + + SIM PIN operation failed! + Tablet status @@ -2426,11 +2420,11 @@ Location mode - Use GPS, Wi\u2011Fi and mobile networks to estimate location + Use GPS, Wi\u2011Fi, and mobile networks to determine location - Use Wi\u2011Fi and mobile networks to estimate location + Use Wi\u2011Fi and mobile networks to determine location - Use GPS to pinpoint your location + Use GPS to determine your location Retrieving… @@ -3478,6 +3472,9 @@ Printing %1$s + + Cancelling %1$s + Printer error %1$s @@ -4674,7 +4671,7 @@ This device is managed by:\n%s\n\nYour administrator is capable of monitoring your network activity, including emails, apps, and secure websites.\n\nFor more information, contact your administrator. - A third party is capable of monitoring your network\nactivity, including emails, apps, and secure websites.\n\nA trusted credential installed on your device is making this possible. + A third party is capable of monitoring your network activity, including emails, apps, and secure websites.\n\nA trusted credential installed on your device is making this possible. Check trusted credentials diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java index 7057f1a497c..23ec70ede83 100644 --- a/src/com/android/settings/CryptKeeper.java +++ b/src/com/android/settings/CryptKeeper.java @@ -43,6 +43,7 @@ import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; +import android.view.WindowManager; import android.view.View.OnClickListener; import android.view.View.OnKeyListener; import android.view.View.OnTouchListener; @@ -557,6 +558,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList // Notify the user in 120 seconds that we are waiting for him to enter the password. mHandler.removeMessages(MESSAGE_NOTIFY); mHandler.sendEmptyMessageDelayed(MESSAGE_NOTIFY, 120 * 1000); + + // Dismiss keyguard while this screen is showing. + getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); } /** diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java index 813923ddc8e..b0c944d2333 100644 --- a/src/com/android/settings/DisplaySettings.java +++ b/src/com/android/settings/DisplaySettings.java @@ -21,16 +21,10 @@ import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT; import android.app.ActivityManagerNative; import android.app.Dialog; import android.app.admin.DevicePolicyManager; -import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; import android.content.res.Configuration; import android.content.res.Resources; -import android.hardware.display.DisplayManager; -import android.hardware.display.WifiDisplay; -import android.hardware.display.WifiDisplayStatus; import android.os.Bundle; import android.os.RemoteException; import android.preference.CheckBoxPreference; @@ -40,7 +34,6 @@ import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceScreen; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; -import android.util.AttributeSet; import android.util.Log; import com.android.internal.view.RotationPolicy; @@ -60,12 +53,9 @@ public class DisplaySettings extends SettingsPreferenceFragment implements private static final String KEY_FONT_SIZE = "font_size"; private static final String KEY_NOTIFICATION_PULSE = "notification_pulse"; private static final String KEY_SCREEN_SAVER = "screensaver"; - private static final String KEY_WIFI_DISPLAY = "wifi_display"; private static final int DLG_GLOBAL_CHANGE_WARNING = 1; - private DisplayManager mDisplayManager; - private CheckBoxPreference mAccelerometer; private WarnedListPreference mFontSizePref; private CheckBoxPreference mNotificationPulse; @@ -75,9 +65,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements private ListPreference mScreenTimeoutPreference; private Preference mScreenSaverPreference; - private WifiDisplayStatus mWifiDisplayStatus; - private Preference mWifiDisplayPreference; - private final RotationPolicy.RotationPolicyListener mRotationPolicyListener = new RotationPolicy.RotationPolicyListener() { @Override @@ -135,16 +122,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found"); } } - - mDisplayManager = (DisplayManager)getActivity().getSystemService( - Context.DISPLAY_SERVICE); - mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus(); - mWifiDisplayPreference = (Preference)findPreference(KEY_WIFI_DISPLAY); - if (mWifiDisplayStatus.getFeatureState() - == WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) { - getPreferenceScreen().removePreference(mWifiDisplayPreference); - mWifiDisplayPreference = null; - } } private void updateTimeoutPreferenceDescription(long currentTimeout) { @@ -252,12 +229,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements RotationPolicy.registerRotationPolicyListener(getActivity(), mRotationPolicyListener); - if (mWifiDisplayPreference != null) { - getActivity().registerReceiver(mReceiver, new IntentFilter( - DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED)); - mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus(); - } - updateState(); } @@ -267,10 +238,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements RotationPolicy.unregisterRotationPolicyListener(getActivity(), mRotationPolicyListener); - - if (mWifiDisplayPreference != null) { - getActivity().unregisterReceiver(mReceiver); - } } @Override @@ -291,7 +258,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements updateAccelerometerRotationCheckbox(); readFontSizePreference(mFontSizePref); updateScreenSaverSummary(); - updateWifiDisplaySummary(); } private void updateScreenSaverSummary() { @@ -301,23 +267,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements } } - private void updateWifiDisplaySummary() { - if (mWifiDisplayPreference != null) { - switch (mWifiDisplayStatus.getFeatureState()) { - case WifiDisplayStatus.FEATURE_STATE_OFF: - mWifiDisplayPreference.setSummary(R.string.wifi_display_summary_off); - break; - case WifiDisplayStatus.FEATURE_STATE_ON: - mWifiDisplayPreference.setSummary(R.string.wifi_display_summary_on); - break; - case WifiDisplayStatus.FEATURE_STATE_DISABLED: - default: - mWifiDisplayPreference.setSummary(R.string.wifi_display_summary_disabled); - break; - } - } - } - private void updateAccelerometerRotationCheckbox() { if (getActivity() == null) return; @@ -347,6 +296,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements return super.onPreferenceTreeClick(preferenceScreen, preference); } + @Override public boolean onPreferenceChange(Preference preference, Object objValue) { final String key = preference.getKey(); if (KEY_SCREEN_TIMEOUT.equals(key)) { @@ -365,17 +315,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements return true; } - private final BroadcastReceiver mReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (intent.getAction().equals(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED)) { - mWifiDisplayStatus = (WifiDisplayStatus)intent.getParcelableExtra( - DisplayManager.EXTRA_WIFI_DISPLAY_STATUS); - updateWifiDisplaySummary(); - } - } - }; - @Override public boolean onPreferenceClick(Preference preference) { if (preference == mFontSizePref) { diff --git a/src/com/android/settings/IccLockSettings.java b/src/com/android/settings/IccLockSettings.java index ab125875d52..b988572b7b7 100644 --- a/src/com/android/settings/IccLockSettings.java +++ b/src/com/android/settings/IccLockSettings.java @@ -29,6 +29,7 @@ import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceScreen; +import android.util.Log; import android.widget.Toast; import com.android.internal.telephony.Phone; @@ -46,6 +47,8 @@ import com.android.internal.telephony.TelephonyIntents; */ public class IccLockSettings extends PreferenceActivity implements EditPinPreference.OnPinEnteredListener { + private static final String TAG = "IccLockSettings"; + private static final boolean DBG = true; private static final int OFF_MODE = 0; // State when enabling/disabling ICC lock @@ -101,10 +104,10 @@ public class IccLockSettings extends PreferenceActivity AsyncResult ar = (AsyncResult) msg.obj; switch (msg.what) { case MSG_ENABLE_ICC_PIN_COMPLETE: - iccLockChanged(ar.exception == null); + iccLockChanged(ar.exception == null, msg.arg1); break; case MSG_CHANGE_ICC_PIN_COMPLETE: - iccPinChanged(ar.exception == null); + iccPinChanged(ar.exception == null, msg.arg1); break; case MSG_SIM_STATE_CHANGED: updatePreferences(); @@ -352,21 +355,21 @@ public class IccLockSettings extends PreferenceActivity mPinToggle.setEnabled(false); } - private void iccLockChanged(boolean success) { + private void iccLockChanged(boolean success, int attemptsRemaining) { if (success) { mPinToggle.setChecked(mToState); } else { - Toast.makeText(this, mRes.getString(R.string.sim_lock_failed), Toast.LENGTH_SHORT) + Toast.makeText(this, getPinPasswordErrorMessage(attemptsRemaining), Toast.LENGTH_LONG) .show(); } mPinToggle.setEnabled(true); resetDialogState(); } - private void iccPinChanged(boolean success) { + private void iccPinChanged(boolean success, int attemptsRemaining) { if (!success) { - Toast.makeText(this, mRes.getString(R.string.sim_change_failed), - Toast.LENGTH_SHORT) + Toast.makeText(this, getPinPasswordErrorMessage(attemptsRemaining), + Toast.LENGTH_LONG) .show(); } else { Toast.makeText(this, mRes.getString(R.string.sim_change_succeeded), @@ -383,6 +386,23 @@ public class IccLockSettings extends PreferenceActivity mNewPin, callback); } + private String getPinPasswordErrorMessage(int attemptsRemaining) { + String displayMessage; + + if (attemptsRemaining == 0) { + displayMessage = mRes.getString(R.string.wrong_pin_code_pukked); + } else if (attemptsRemaining > 0) { + displayMessage = mRes + .getQuantityString(R.plurals.wrong_pin_code, attemptsRemaining, + attemptsRemaining); + } else { + displayMessage = mRes.getString(R.string.pin_failed); + } + if (DBG) Log.d(TAG, "getPinPasswordErrorMessage:" + + " attemptsRemaining=" + attemptsRemaining + " displayMessage=" + displayMessage); + return displayMessage; + } + private boolean reasonablePin(String pin) { if (pin == null || pin.length() < MIN_PIN_LENGTH || pin.length() > MAX_PIN_LENGTH) { return false; diff --git a/src/com/android/settings/KeyguardAppWidgetPickActivity.java b/src/com/android/settings/KeyguardAppWidgetPickActivity.java index f3db2caa653..7e801be0fc9 100644 --- a/src/com/android/settings/KeyguardAppWidgetPickActivity.java +++ b/src/com/android/settings/KeyguardAppWidgetPickActivity.java @@ -46,6 +46,7 @@ import android.view.IWindowManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.WindowManager; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.GridView; @@ -89,6 +90,8 @@ public class KeyguardAppWidgetPickActivity extends Activity @Override protected void onCreate(Bundle savedInstanceState) { + getWindow().addPrivateFlags( + WindowManager.LayoutParams.PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR); setContentView(R.layout.keyguard_appwidget_picker_layout); super.onCreate(savedInstanceState); diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index e0022649484..e4dcea1db7c 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -245,7 +245,8 @@ public class SecuritySettings extends RestrictedSettingsFragment // Enable or disable keyguard widget checkbox based on DPM state mEnableKeyguardWidgets = (CheckBoxPreference) root.findPreference(KEY_ENABLE_WIDGETS); if (mEnableKeyguardWidgets != null) { - if (ActivityManager.isLowRamDeviceStatic()) { + if (ActivityManager.isLowRamDeviceStatic() + || mLockPatternUtils.isLockScreenDisabled()) { // Widgets take a lot of RAM, so disable them on low-memory devices PreferenceGroup securityCategory = (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY); diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index e93fa186130..db7eb2b80ea 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -506,7 +506,6 @@ public class Settings extends PreferenceActivity // uiOptions for fragments also defined as activities in manifest. if (WifiSettings.class.getName().equals(fragmentName) || WifiP2pSettings.class.getName().equals(fragmentName) || - WifiDisplaySettings.class.getName().equals(fragmentName) || BluetoothSettings.class.getName().equals(fragmentName) || DreamSettings.class.getName().equals(fragmentName) || LocationSettings.class.getName().equals(fragmentName) || diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java index 6724cc129a6..65127b5773f 100644 --- a/src/com/android/settings/WirelessSettings.java +++ b/src/com/android/settings/WirelessSettings.java @@ -333,6 +333,16 @@ public class WirelessSettings extends RestrictedSettingsFragment removePreference(KEY_MOBILE_NETWORK_SETTINGS); removePreference(KEY_MANAGE_MOBILE_PLAN); } + // Remove Mobile Network Settings and Manage Mobile Plan + // if config_show_mobile_plan sets false. + boolean isMobilePlanEnabled = this.getResources().getBoolean( + R.bool.config_show_mobile_plan); + if (!isMobilePlanEnabled) { + Preference pref = findPreference(KEY_MANAGE_MOBILE_PLAN); + if (pref != null) { + removePreference(KEY_MANAGE_MOBILE_PLAN); + } + } protectByRestrictions(KEY_MOBILE_NETWORK_SETTINGS); protectByRestrictions(KEY_MANAGE_MOBILE_PLAN); diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java index a7f0f3057db..184f68092ab 100644 --- a/src/com/android/settings/accounts/ManageAccountsSettings.java +++ b/src/com/android/settings/accounts/ManageAccountsSettings.java @@ -55,11 +55,15 @@ import java.util.HashSet; /** Manages settings for Google Account. */ public class ManageAccountsSettings extends AccountPreferenceBase implements OnAccountsUpdateListener { - private static final String ACCOUNT_KEY = "account"; // to pass to auth settings public static final String KEY_ACCOUNT_TYPE = "account_type"; public static final String KEY_ACCOUNT_LABEL = "account_label"; + // Action name for the broadcast intent when the Google account preferences page is launching + // the location settings. + private static final String LAUNCHING_LOCATION_SETTINGS = + "com.android.settings.accounts.LAUNCHING_LOCATION_SETTINGS"; + private static final int MENU_SYNC_NOW_ID = Menu.FIRST; private static final int MENU_SYNC_CANCEL_ID = Menu.FIRST + 1; @@ -366,6 +370,13 @@ public class ManageAccountsSettings extends AccountPreferenceBase public boolean onPreferenceClick(Preference preference) { ((PreferenceActivity) getActivity()).startPreferencePanel( mClass, null, mTitleRes, null, null, 0); + // Hack: announce that the Google account preferences page is launching the location + // settings + if (mClass.equals(LocationSettings.class.getName())) { + Intent intent = new Intent(LAUNCHING_LOCATION_SETTINGS); + getActivity().sendBroadcast( + intent, android.Manifest.permission.WRITE_SECURE_SETTINGS); + } return true; } } diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java index 61d793a29a0..12637974bfc 100755 --- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java +++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java @@ -68,6 +68,9 @@ final class CachedBluetoothDevice implements Comparable { private int mMessagePermissionChoice; + private int mPhonebookRejectedTimes; + + private int mMessageRejectedTimes; private final Collection mCallbacks = new ArrayList(); @@ -79,9 +82,13 @@ final class CachedBluetoothDevice implements Comparable { // User has rejected the connection and let Settings app remember the decision 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; 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"; /** * When we connect to multiple profiles, we only want to display a single @@ -130,23 +137,6 @@ final class CachedBluetoothDevice implements Comparable { return; } mProfileConnectionState.put(profile, newProfileState); - if (newProfileState == BluetoothProfile.STATE_DISCONNECTED) { - // check whether we are disconnected with this device completely - boolean isDisconnected = true; - for (LocalBluetoothProfile pf: mProfileConnectionState.keySet()) { - if (mProfileConnectionState.get(pf) != BluetoothProfile.STATE_DISCONNECTED) { - isDisconnected = false; - break; - } - } - // if disconnected, restore permission choice. - // So ACCESS_REJECTED will take effect until we are disconnected with this device. - if (isDisconnected) { - fetchPhonebookPermissionChoice(); - fetchMessagePermissionChoice(); - } - } - if (newProfileState == BluetoothProfile.STATE_CONNECTED) { if (!mProfiles.contains(profile)) { mRemovedProfiles.remove(profile); @@ -159,7 +149,6 @@ final class CachedBluetoothDevice implements Comparable { } if (profile instanceof MapProfile) { profile.setPreferred(mDevice, true); - refresh(); } } else if (profile instanceof MapProfile && newProfileState == BluetoothProfile.STATE_DISCONNECTED) { @@ -168,7 +157,6 @@ final class CachedBluetoothDevice implements Comparable { mProfiles.remove(profile); } profile.setPreferred(mDevice, false); - refresh(); } else if (mLocalNapRoleConnected && profile instanceof PanProfile && ((PanProfile) profile).isLocalRoleNap(mDevice) && newProfileState == BluetoothProfile.STATE_DISCONNECTED) { @@ -375,8 +363,6 @@ final class CachedBluetoothDevice implements Comparable { for (LocalBluetoothProfile profile :getProfiles()) { mProfileConnectionState.put(profile, BluetoothProfile.STATE_DISCONNECTED); } - fetchPhonebookPermissionChoice(); - fetchMessagePermissionChoice(); } // TODO: do any of these need to run async on a background thread? @@ -386,6 +372,8 @@ final class CachedBluetoothDevice implements Comparable { updateProfiles(); fetchPhonebookPermissionChoice(); fetchMessagePermissionChoice(); + fetchPhonebookRejectTimes(); + fetchMessageRejectTimes(); mVisible = false; dispatchAttributesChanged(); @@ -499,7 +487,8 @@ final class CachedBluetoothDevice implements Comparable { ParcelUuid[] localUuids = mLocalAdapter.getUuids(); if (localUuids == null) return false; - mProfileManager.updateProfiles(uuids, localUuids, mProfiles, mRemovedProfiles, mLocalNapRoleConnected); + mProfileManager.updateProfiles(uuids, localUuids, mProfiles, mRemovedProfiles, + mLocalNapRoleConnected, mDevice); if (DEBUG) { Log.e(TAG, "updating profiles for " + mDevice.getAliasName()); @@ -552,6 +541,10 @@ final class CachedBluetoothDevice implements Comparable { mConnectAfterPairing = false; // cancel auto-connect setPhonebookPermissionChoice(ACCESS_UNKNOWN); setMessagePermissionChoice(ACCESS_UNKNOWN); + mPhonebookRejectedTimes = 0; + savePhonebookRejectTimes(); + mMessageRejectedTimes = 0; + saveMessageRejectTimes(); } refresh(); @@ -668,10 +661,16 @@ final class CachedBluetoothDevice implements Comparable { } void setPhonebookPermissionChoice(int permissionChoice) { - mPhonebookPermissionChoice = 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; + } + } - // if user reject it, don't save it to editor. - if (permissionChoice == ACCESS_REJECTED) return; + mPhonebookPermissionChoice = permissionChoice; SharedPreferences.Editor editor = mContext.getSharedPreferences(PHONEBOOK_PREFS_NAME, Context.MODE_PRIVATE).edit(); @@ -690,16 +689,39 @@ final class CachedBluetoothDevice implements Comparable { ACCESS_UNKNOWN); } + private void fetchPhonebookRejectTimes() { + SharedPreferences preference = mContext.getSharedPreferences(PHONEBOOK_REJECT_TIMES, + Context.MODE_PRIVATE); + mPhonebookRejectedTimes = preference.getInt(mDevice.getAddress(), 0); + } + + 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); + } + editor.commit(); + } int getMessagePermissionChoice() { return mMessagePermissionChoice; } void setMessagePermissionChoice(int permissionChoice) { - mMessagePermissionChoice = 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; + } + } - // if user reject it, don't save it to editor. - if (permissionChoice == ACCESS_REJECTED) return; + mMessagePermissionChoice = permissionChoice; SharedPreferences.Editor editor = mContext.getSharedPreferences(MESSAGE_PREFS_NAME, Context.MODE_PRIVATE).edit(); @@ -718,4 +740,21 @@ final class CachedBluetoothDevice implements Comparable { ACCESS_UNKNOWN); } + private void fetchMessageRejectTimes() { + SharedPreferences preference = mContext.getSharedPreferences(MESSAGE_REJECT_TIMES, + Context.MODE_PRIVATE); + mMessageRejectedTimes = preference.getInt(mDevice.getAddress(), 0); + } + + private void saveMessageRejectTimes() { + SharedPreferences.Editor editor = + mContext.getSharedPreferences(MESSAGE_REJECT_TIMES, Context.MODE_PRIVATE).edit(); + if (mMessageRejectedTimes == 0) { + editor.remove(mDevice.getAddress()); + } else { + editor.putInt(mDevice.getAddress(), mMessageRejectedTimes); + } + editor.commit(); + } + } diff --git a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java index 78d64414360..8fff964878d 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java @@ -321,7 +321,7 @@ final class LocalBluetoothProfileManager { synchronized void updateProfiles(ParcelUuid[] uuids, ParcelUuid[] localUuids, Collection profiles, Collection removedProfiles, - boolean isPanNapConnected) { + boolean isPanNapConnected, BluetoothDevice device) { // Copy previous profile list into removedProfiles removedProfiles.clear(); removedProfiles.addAll(profiles); @@ -367,6 +367,13 @@ final class LocalBluetoothProfileManager { profiles.add(mPanProfile); removedProfiles.remove(mPanProfile); } + + if ((mMapProfile != null) && + (mMapProfile.getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED)) { + profiles.add(mMapProfile); + removedProfiles.remove(mMapProfile); + mMapProfile.setPreferred(device, true); + } } } diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java b/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java index 4e5bd63f47c..ed5085a2a50 100644 --- a/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java +++ b/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java @@ -205,9 +205,7 @@ public class StorageVolumePreferenceCategory extends PreferenceCategory { addPreference(mMountTogglePreference); } - // Only allow formatting of primary physical storage - // TODO: enable for non-primary volumes once MTP is fixed - final boolean allowFormat = mVolume != null ? mVolume.isPrimary() : false; + final boolean allowFormat = mVolume != null; if (allowFormat) { mFormatPreference = new Preference(context); mFormatPreference.setTitle(R.string.sd_format); diff --git a/src/com/android/settings/fuelgauge/BatteryStatsHelper.java b/src/com/android/settings/fuelgauge/BatteryStatsHelper.java index 71c69a3328f..0191692a17e 100644 --- a/src/com/android/settings/fuelgauge/BatteryStatsHelper.java +++ b/src/com/android/settings/fuelgauge/BatteryStatsHelper.java @@ -490,6 +490,15 @@ public class BatteryStatsHelper { * mPowerProfile.getAveragePower(PowerProfile.POWER_WIFI_SCAN)) / 1000; power += p; if (DEBUG && p != 0) Log.i(TAG, String.format("wifi scanning power=%.2f", p)); + for (int bin = 0; bin < BatteryStats.Uid.NUM_WIFI_BATCHED_SCAN_BINS; bin++) { + long batchScanTimeMs = u.getWifiBatchedScanTime(bin, uSecTime, which) / 1000; + p = (batchScanTimeMs + * mPowerProfile.getAveragePower(PowerProfile.POWER_WIFI_BATCHED_SCAN, bin)); + power += p; + if (DEBUG && p != 0) { + Log.i(TAG, String.format("wifi batched scanning lvl %d = %.2f", bin, p)); + } + } // Process Sensor usage Map sensorStats = u.getSensorStats(); diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java index a2700cfc44e..3a948651d35 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java +++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java @@ -166,25 +166,6 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment mKeyboardSettingsCategory.addPreference(currentIme); } - synchronized (mInputMethodPreferenceList) { - mInputMethodPreferenceList.clear(); - final List imis = mInputMethodSettingValues.getInputMethodList(); - final int N = (imis == null ? 0 : imis.size()); - for (int i = 0; i < N; ++i) { - final InputMethodInfo imi = imis.get(i); - final InputMethodPreference pref = getInputMethodPreference(imi); - pref.setOnImePreferenceChangeListener(mOnImePreferenceChangedListener); - mInputMethodPreferenceList.add(pref); - } - - if (!mInputMethodPreferenceList.isEmpty()) { - Collections.sort(mInputMethodPreferenceList); - for (int i = 0; i < N; ++i) { - mKeyboardSettingsCategory.addPreference(mInputMethodPreferenceList.get(i)); - } - } - } - // Build hard keyboard and game controller preference categories. mIm = (InputManager)getActivity().getSystemService(Context.INPUT_SERVICE); updateInputDevices(); @@ -311,10 +292,6 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment // Refresh internal states in mInputMethodSettingValues to keep the latest // "InputMethodInfo"s and "InputMethodSubtype"s mInputMethodSettingValues.refreshAllInputMethodAndSubtypes(); - // TODO: Consolidate the logic to InputMethodSettingsWrapper - InputMethodAndSubtypeUtil.loadInputMethodSubtypeList( - this, getContentResolver(), - mInputMethodSettingValues.getInputMethodList(), null); updateInputMethodPreferenceViews(); } @@ -427,6 +404,28 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment private void updateInputMethodPreferenceViews() { synchronized (mInputMethodPreferenceList) { + // Clear existing "InputMethodPreference"s + for (final InputMethodPreference imp : mInputMethodPreferenceList) { + mKeyboardSettingsCategory.removePreference(imp); + } + mInputMethodPreferenceList.clear(); + final List imis = mInputMethodSettingValues.getInputMethodList(); + final int N = (imis == null ? 0 : imis.size()); + for (int i = 0; i < N; ++i) { + final InputMethodInfo imi = imis.get(i); + final InputMethodPreference pref = getInputMethodPreference(imi); + pref.setOnImePreferenceChangeListener(mOnImePreferenceChangedListener); + mInputMethodPreferenceList.add(pref); + } + + if (!mInputMethodPreferenceList.isEmpty()) { + Collections.sort(mInputMethodPreferenceList); + for (int i = 0; i < N; ++i) { + mKeyboardSettingsCategory.addPreference(mInputMethodPreferenceList.get(i)); + } + } + + // update views status for (Preference pref : mInputMethodPreferenceList) { if (pref instanceof InputMethodPreference) { ((InputMethodPreference) pref).updatePreferenceViews(); @@ -434,6 +433,13 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment } } updateCurrentImeName(); + // TODO: Consolidate the logic with InputMethodSettingsWrapper + // CAVEAT: The preference class here does not know about the default value - that is + // managed by the Input Method Manager Service, so in this case it could save the wrong + // value. Hence we must update the checkboxes here. + InputMethodAndSubtypeUtil.loadInputMethodSubtypeList( + this, getContentResolver(), + mInputMethodSettingValues.getInputMethodList(), null); } private void updateCurrentImeName() { diff --git a/src/com/android/settings/print/PrintJobSettingsFragment.java b/src/com/android/settings/print/PrintJobSettingsFragment.java index cfb4cb203f1..f420a82a2c8 100644 --- a/src/com/android/settings/print/PrintJobSettingsFragment.java +++ b/src/com/android/settings/print/PrintJobSettingsFragment.java @@ -19,7 +19,6 @@ package com.android.settings.print; import android.app.ActivityManager; import android.content.Context; import android.graphics.drawable.Drawable; -import android.net.Uri; import android.os.Bundle; import android.preference.Preference; import android.print.PrintJob; @@ -113,9 +112,11 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); - MenuItem cancel = menu.add(0, MENU_ITEM_ID_CANCEL, Menu.NONE, - getString(R.string.print_cancel)); - cancel.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + if (!mPrintJob.getInfo().isCancelling()) { + MenuItem cancel = menu.add(0, MENU_ITEM_ID_CANCEL, Menu.NONE, + getString(R.string.print_cancel)); + cancel.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + } if (mPrintJob.isFailed()) { MenuItem restart = menu.add(0, MENU_ITEM_ID_RESTART, Menu.NONE, @@ -169,8 +170,13 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment { switch (info.getState()) { case PrintJobInfo.STATE_QUEUED: case PrintJobInfo.STATE_STARTED: { - mPrintJobPreference.setTitle(getString( - R.string.print_printing_state_title_template, info.getLabel())); + if (!mPrintJob.getInfo().isCancelling()) { + mPrintJobPreference.setTitle(getString( + R.string.print_printing_state_title_template, info.getLabel())); + } else { + mPrintJobPreference.setTitle(getString( + R.string.print_cancelling_state_title_template, info.getLabel())); + } } break; case PrintJobInfo.STATE_FAILED: { @@ -179,8 +185,13 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment { } break; case PrintJobInfo.STATE_BLOCKED: { - mPrintJobPreference.setTitle(getString( - R.string.print_blocked_state_title_template, info.getLabel())); + if (!mPrintJob.getInfo().isCancelling()) { + mPrintJobPreference.setTitle(getString( + R.string.print_blocked_state_title_template, info.getLabel())); + } else { + mPrintJobPreference.setTitle(getString( + R.string.print_cancelling_state_title_template, info.getLabel())); + } } break; } diff --git a/src/com/android/settings/print/PrintSettingsFragment.java b/src/com/android/settings/print/PrintSettingsFragment.java index 391d5051cec..df38db4e5ab 100644 --- a/src/com/android/settings/print/PrintSettingsFragment.java +++ b/src/com/android/settings/print/PrintSettingsFragment.java @@ -376,9 +376,15 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements switch (printJob.getState()) { case PrintJobInfo.STATE_QUEUED: case PrintJobInfo.STATE_STARTED: { - preference.setTitle(getString( - R.string.print_printing_state_title_template, - printJob.getLabel())); + if (!printJob.isCancelling()) { + preference.setTitle(getString( + R.string.print_printing_state_title_template, + printJob.getLabel())); + } else { + preference.setTitle(getString( + R.string.print_cancelling_state_title_template, + printJob.getLabel())); + } } break; case PrintJobInfo.STATE_FAILED: { @@ -388,9 +394,15 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements } break; case PrintJobInfo.STATE_BLOCKED: { - preference.setTitle(getString( - R.string.print_blocked_state_title_template, - printJob.getLabel())); + if (!printJob.isCancelling()) { + preference.setTitle(getString( + R.string.print_blocked_state_title_template, + printJob.getLabel())); + } else { + preference.setTitle(getString( + R.string.print_cancelling_state_title_template, + printJob.getLabel())); + } } break; } diff --git a/src/com/android/settings/wfd/WifiDisplaySettings.java b/src/com/android/settings/wfd/WifiDisplaySettings.java index 6ec79f387e9..d04f6f2e31d 100755 --- a/src/com/android/settings/wfd/WifiDisplaySettings.java +++ b/src/com/android/settings/wfd/WifiDisplaySettings.java @@ -29,6 +29,8 @@ import android.database.ContentObserver; import android.hardware.display.DisplayManager; import android.hardware.display.WifiDisplay; import android.hardware.display.WifiDisplayStatus; +import android.media.MediaRouter; +import android.media.MediaRouter.RouteInfo; import android.net.Uri; import android.net.wifi.p2p.WifiP2pManager; import android.net.wifi.p2p.WifiP2pManager.ActionListener; @@ -63,31 +65,48 @@ import android.widget.ImageView; import android.widget.Switch; import android.widget.TextView; +import com.android.internal.app.MediaRouteDialogPresenter; import com.android.settings.ProgressCategory; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; /** * The Settings screen for WifiDisplay configuration and connection management. + * + * The wifi display routes are integrated together with other remote display routes + * from the media router. It may happen that wifi display isn't actually available + * on the system. In that case, the enable option will not be shown but other + * remote display routes will continue to be made available. */ public final class WifiDisplaySettings extends SettingsPreferenceFragment { private static final String TAG = "WifiDisplaySettings"; private static final boolean DEBUG = false; - private static final int MENU_ID_SCAN = Menu.FIRST; + private static final int MENU_ID_ENABLE_WIFI_DISPLAY = Menu.FIRST; + private static final int CHANGE_SETTINGS = 1 << 0; + private static final int CHANGE_ROUTES = 1 << 1; + private static final int CHANGE_WIFI_DISPLAY_STATUS = 1 << 2; + private static final int CHANGE_ALL = -1; + + private static final int ORDER_CERTIFICATION = 1; + private static final int ORDER_CONNECTED = 2; + private static final int ORDER_AVAILABLE = 3; + private static final int ORDER_UNAVAILABLE = 4; + + private final Handler mHandler; + + private MediaRouter mRouter; private DisplayManager mDisplayManager; + private boolean mStarted; + private int mPendingChanges; + private boolean mWifiDisplayOnSetting; private WifiDisplayStatus mWifiDisplayStatus; - private PreferenceGroup mPairedDevicesCategory; - private ProgressCategory mAvailableDevicesCategory; - private TextView mEmptyView; - private Switch mActionBarSwitch; - /* certification */ private boolean mWifiDisplayCertificationOn; private WifiP2pManager mWifiP2pManager; @@ -100,15 +119,18 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { private int mOperatingChannel; public WifiDisplaySettings() { + mHandler = new Handler(); } @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); - mDisplayManager = (DisplayManager)getActivity().getSystemService(Context.DISPLAY_SERVICE); - mWifiP2pManager = (WifiP2pManager)getActivity().getSystemService(Context.WIFI_P2P_SERVICE); - mWifiP2pChannel = mWifiP2pManager.initialize(getActivity(), Looper.getMainLooper(), null); + final Context context = getActivity(); + mRouter = (MediaRouter)context.getSystemService(Context.MEDIA_ROUTER_SERVICE); + mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); + mWifiP2pManager = (WifiP2pManager)context.getSystemService(Context.WIFI_P2P_SERVICE); + mWifiP2pChannel = mWifiP2pManager.initialize(context, Looper.getMainLooper(), null); addPreferencesFromResource(R.xml.wifi_display_settings); setHasOptionsMenu(true); @@ -118,42 +140,17 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - Activity activity = getActivity(); - mActionBarSwitch = new Switch(activity); - mActionBarSwitch.setOnCheckedChangeListener(mSwitchOnCheckedChangedListener); - - final int padding = activity.getResources().getDimensionPixelSize( - R.dimen.action_bar_switch_padding); - mActionBarSwitch.setPaddingRelative(0, 0, padding, 0); - activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, - ActionBar.DISPLAY_SHOW_CUSTOM); - activity.getActionBar().setCustomView(mActionBarSwitch, - new ActionBar.LayoutParams( - ActionBar.LayoutParams.WRAP_CONTENT, - ActionBar.LayoutParams.WRAP_CONTENT, - Gravity.CENTER_VERTICAL | Gravity.END)); - mEmptyView = (TextView) getView().findViewById(android.R.id.empty); + mEmptyView.setText(R.string.wifi_display_no_devices_found); getListView().setEmptyView(mEmptyView); - - update(); - - if (mWifiDisplayStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) { - activity.finish(); - } } @Override - public void onDestroyView() { - getActivity().getActionBar().setCustomView(null); - super.onDestroyView(); - } + public void onStart() { + super.onStart(); + mStarted = true; - @Override - public void onResume() { - super.onResume(); - - Context context = getActivity(); + final Context context = getActivity(); IntentFilter filter = new IntentFilter(); filter.addAction(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED); context.registerReceiver(mReceiver, filter); @@ -163,136 +160,156 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { getContentResolver().registerContentObserver(Settings.Global.getUriFor( Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON), false, mSettingsObserver); getContentResolver().registerContentObserver(Settings.Global.getUriFor( - Settings.Global.WIFI_DISPLAY_WPS_CONFIG), false, mSettingsObserver); + Settings.Global.WIFI_DISPLAY_WPS_CONFIG), false, mSettingsObserver); - mDisplayManager.scanWifiDisplays(); + mRouter.addCallback(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY, mRouterCallback, + MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN); - update(); + update(CHANGE_ALL); } @Override - public void onPause() { - super.onPause(); + public void onStop() { + super.onStop(); + mStarted = false; - Context context = getActivity(); + final Context context = getActivity(); context.unregisterReceiver(mReceiver); getContentResolver().unregisterContentObserver(mSettingsObserver); + + mRouter.removeCallback(mRouterCallback); + + unscheduleUpdate(); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - MenuItem item = menu.add(Menu.NONE, MENU_ID_SCAN, 0, - mWifiDisplayStatus.getScanState() == WifiDisplayStatus.SCAN_STATE_SCANNING ? - R.string.wifi_display_searching_for_devices : - R.string.wifi_display_search_for_devices); - item.setEnabled(mWifiDisplayStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON - && mWifiDisplayStatus.getScanState() == WifiDisplayStatus.SCAN_STATE_NOT_SCANNING); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + if (mWifiDisplayStatus != null && mWifiDisplayStatus.getFeatureState() + != WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) { + MenuItem item = menu.add(Menu.NONE, MENU_ID_ENABLE_WIFI_DISPLAY, 0, + R.string.wifi_display_enable_menu_item); + item.setCheckable(true); + item.setChecked(mWifiDisplayOnSetting); + } super.onCreateOptionsMenu(menu, inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case MENU_ID_SCAN: - if (mWifiDisplayStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON) { - mDisplayManager.scanWifiDisplays(); - } + case MENU_ID_ENABLE_WIFI_DISPLAY: + mWifiDisplayOnSetting = !item.isChecked(); + item.setChecked(mWifiDisplayOnSetting); + Settings.Global.putInt(getContentResolver(), + Settings.Global.WIFI_DISPLAY_ON, mWifiDisplayOnSetting ? 1 : 0); return true; } return super.onOptionsItemSelected(item); } - @Override - public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, - Preference preference) { - if (preference instanceof WifiDisplayPreference) { - WifiDisplayPreference p = (WifiDisplayPreference)preference; - WifiDisplay display = p.getDisplay(); - - if (display.equals(mWifiDisplayStatus.getActiveDisplay())) { - showDisconnectDialog(display); - } else if (display.canConnect()){ - mDisplayManager.connectWifiDisplay(display.getDeviceAddress()); + private void scheduleUpdate(int changes) { + if (mStarted) { + if (mPendingChanges == 0) { + mHandler.post(mUpdateRunnable); } + mPendingChanges |= changes; + } + } + + private void unscheduleUpdate() { + if (mPendingChanges != 0) { + mPendingChanges = 0; + mHandler.removeCallbacks(mUpdateRunnable); + } + } + + private void update(int changes) { + boolean invalidateOptions = false; + + // Update settings. + if ((changes & CHANGE_SETTINGS) != 0) { + mWifiDisplayOnSetting = Settings.Global.getInt(getContentResolver(), + Settings.Global.WIFI_DISPLAY_ON, 0) != 0; + mWifiDisplayCertificationOn = Settings.Global.getInt(getContentResolver(), + Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0; + mWpsConfig = Settings.Global.getInt(getContentResolver(), + Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID); + + // The wifi display enabled setting may have changed. + invalidateOptions = true; } - return super.onPreferenceTreeClick(preferenceScreen, preference); - } + // Update wifi display state. + if ((changes & CHANGE_WIFI_DISPLAY_STATUS) != 0) { + mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus(); - private void update() { - mWifiDisplayOnSetting = Settings.Global.getInt(getContentResolver(), - Settings.Global.WIFI_DISPLAY_ON, 0) != 0; - mWifiDisplayCertificationOn = Settings.Global.getInt(getContentResolver(), - Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0; - mWpsConfig = Settings.Global.getInt(getContentResolver(), - Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID); - mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus(); - - applyState(); - } - - private void applyState() { - final int featureState = mWifiDisplayStatus.getFeatureState(); - mActionBarSwitch.setEnabled(featureState != WifiDisplayStatus.FEATURE_STATE_DISABLED); - mActionBarSwitch.setChecked(mWifiDisplayOnSetting); + // The wifi display feature state may have changed. + invalidateOptions = true; + } + // Rebuild the routes. final PreferenceScreen preferenceScreen = getPreferenceScreen(); preferenceScreen.removeAll(); - if (featureState == WifiDisplayStatus.FEATURE_STATE_ON) { - final WifiDisplay[] displays = mWifiDisplayStatus.getDisplays(); + // Add all known remote display routes. + final int routeCount = mRouter.getRouteCount(); + for (int i = 0; i < routeCount; i++) { + MediaRouter.RouteInfo route = mRouter.getRouteAt(i); + if (route.matchesTypes(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY)) { + preferenceScreen.addPreference(createRoutePreference(route)); + } + } + // Additional features for wifi display routes. + if (mWifiDisplayStatus != null + && mWifiDisplayStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON) { + // Add all unpaired wifi displays. + for (WifiDisplay display : mWifiDisplayStatus.getDisplays()) { + if (!display.isRemembered() && display.isAvailable() + && !display.equals(mWifiDisplayStatus.getActiveDisplay())) { + preferenceScreen.addPreference(new UnpairedWifiDisplayPreference( + getActivity(), display)); + } + } + + // Add the certification menu if enabled in developer options. if (mWifiDisplayCertificationOn) { buildCertificationMenu(preferenceScreen); } - - if (mPairedDevicesCategory == null) { - mPairedDevicesCategory = new PreferenceCategory(getActivity()); - mPairedDevicesCategory.setTitle(R.string.wifi_display_paired_devices); - } else { - mPairedDevicesCategory.removeAll(); - } - preferenceScreen.addPreference(mPairedDevicesCategory); - - if (mAvailableDevicesCategory == null) { - mAvailableDevicesCategory = new ProgressCategory(getActivity(), null, - R.string.wifi_display_no_devices_found); - mAvailableDevicesCategory.setTitle(R.string.wifi_display_available_devices); - } else { - mAvailableDevicesCategory.removeAll(); - } - preferenceScreen.addPreference(mAvailableDevicesCategory); - - for (WifiDisplay d : displays) { - if (d.isRemembered()) { - mPairedDevicesCategory.addPreference(createWifiDisplayPreference(d)); - } else if (d.isAvailable()){ - mAvailableDevicesCategory.addPreference(createWifiDisplayPreference(d)); - } - } - if (mPairedDevicesCategory.getPreferenceCount() == 0) { - preferenceScreen.removePreference(mPairedDevicesCategory); - } - if (mWifiDisplayStatus.getScanState() == WifiDisplayStatus.SCAN_STATE_SCANNING) { - mAvailableDevicesCategory.setProgress(true); - } else { - mAvailableDevicesCategory.setProgress(false); - } - } else { - mEmptyView.setText(featureState == WifiDisplayStatus.FEATURE_STATE_OFF ? - R.string.wifi_display_settings_empty_list_wifi_display_off : - R.string.wifi_display_settings_empty_list_wifi_display_disabled); } - getActivity().invalidateOptionsMenu(); + // Invalidate menu options if needed. + if (invalidateOptions) { + getActivity().invalidateOptionsMenu(); + } + } + + private RoutePreference createRoutePreference(MediaRouter.RouteInfo route) { + WifiDisplay display = findWifiDisplay(route.getDeviceAddress()); + if (display != null) { + return new WifiDisplayRoutePreference(getActivity(), route, display); + } else { + return new RoutePreference(getActivity(), route); + } + } + + private WifiDisplay findWifiDisplay(String deviceAddress) { + if (mWifiDisplayStatus != null && deviceAddress != null) { + for (WifiDisplay display : mWifiDisplayStatus.getDisplays()) { + if (display.getDeviceAddress().equals(deviceAddress)) { + return display; + } + } + } + return null; } private void buildCertificationMenu(final PreferenceScreen preferenceScreen) { if (mCertCategory == null) { mCertCategory = new PreferenceCategory(getActivity()); mCertCategory.setTitle(R.string.wifi_display_certification_heading); + mCertCategory.setOrder(ORDER_CERTIFICATION); } else { mCertCategory.removeAll(); } @@ -526,53 +543,22 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { }); } - private Preference createWifiDisplayPreference(final WifiDisplay d) { - WifiDisplayPreference p = new WifiDisplayPreference(getActivity(), d); - if (d.equals(mWifiDisplayStatus.getActiveDisplay())) { - switch (mWifiDisplayStatus.getActiveDisplayState()) { - case WifiDisplayStatus.DISPLAY_STATE_CONNECTED: - p.setSummary(R.string.wifi_display_status_connected); - break; - case WifiDisplayStatus.DISPLAY_STATE_CONNECTING: - p.setSummary(R.string.wifi_display_status_connecting); - break; - } - } else if (d.isAvailable()) { - if (!d.canConnect()) { - p.setSummary(R.string.wifi_display_status_in_use); - p.setEnabled(false); - } else if (d.isRemembered()) { - p.setSummary(R.string.wifi_display_status_available); - } + private void toggleRoute(MediaRouter.RouteInfo route) { + if (route.isSelected()) { + MediaRouteDialogPresenter.showDialogFragment(getActivity(), + MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY, null); + } else { + route.select(); } - if (d.isRemembered()) { - p.setWidgetLayoutResource(R.layout.wifi_display_preference); - } - return p; } - private void showDisconnectDialog(final WifiDisplay display) { - DialogInterface.OnClickListener ok = new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (display.equals(mWifiDisplayStatus.getActiveDisplay())) { - mDisplayManager.disconnectWifiDisplay(); - } - } - }; - - AlertDialog dialog = new AlertDialog.Builder(getActivity()) - .setCancelable(true) - .setTitle(R.string.wifi_display_disconnect_title) - .setMessage(Html.fromHtml(getResources().getString( - R.string.wifi_display_disconnect_text, display.getFriendlyDisplayName()))) - .setPositiveButton(android.R.string.ok, ok) - .setNegativeButton(android.R.string.cancel, null) - .create(); - dialog.show(); + private void pairWifiDisplay(WifiDisplay display) { + if (display.canConnect()) { + mDisplayManager.connectWifiDisplay(display.getDeviceAddress()); + } } - private void showOptionsDialog(final WifiDisplay display) { + private void showWifiDisplayOptionsDialog(final WifiDisplay display) { View view = getActivity().getLayoutInflater().inflate(R.layout.wifi_display_options, null); final EditText nameEditText = (EditText)view.findViewById(R.id.name); nameEditText.setText(display.getFriendlyDisplayName()); @@ -604,22 +590,12 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { dialog.show(); } - private static boolean contains(WifiDisplay[] displays, String address) { - for (WifiDisplay d : displays) { - if (d.getDeviceAddress().equals(address)) { - return true; - } - } - return false; - } - - private final CompoundButton.OnCheckedChangeListener mSwitchOnCheckedChangedListener = - new CompoundButton.OnCheckedChangeListener() { + private final Runnable mUpdateRunnable = new Runnable() { @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - mWifiDisplayOnSetting = isChecked; - Settings.Global.putInt(getContentResolver(), - Settings.Global.WIFI_DISPLAY_ON, isChecked ? 1 : 0); + public void run() { + final int changes = mPendingChanges; + mPendingChanges = 0; + update(changes); } }; @@ -628,10 +604,7 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED)) { - WifiDisplayStatus status = (WifiDisplayStatus)intent.getParcelableExtra( - DisplayManager.EXTRA_WIFI_DISPLAY_STATUS); - mWifiDisplayStatus = status; - applyState(); + scheduleUpdate(CHANGE_WIFI_DISPLAY_STATUS); } } }; @@ -639,23 +612,87 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { private final ContentObserver mSettingsObserver = new ContentObserver(new Handler()) { @Override public void onChange(boolean selfChange, Uri uri) { - update(); + scheduleUpdate(CHANGE_SETTINGS); } }; - private final class WifiDisplayPreference extends Preference + private final MediaRouter.Callback mRouterCallback = new MediaRouter.SimpleCallback() { + @Override + public void onRouteAdded(MediaRouter router, RouteInfo info) { + scheduleUpdate(CHANGE_ROUTES); + } + + @Override + public void onRouteChanged(MediaRouter router, RouteInfo info) { + scheduleUpdate(CHANGE_ROUTES); + } + + @Override + public void onRouteRemoved(MediaRouter router, RouteInfo info) { + scheduleUpdate(CHANGE_ROUTES); + } + + @Override + public void onRouteSelected(MediaRouter router, int type, RouteInfo info) { + scheduleUpdate(CHANGE_ROUTES); + } + + @Override + public void onRouteUnselected(MediaRouter router, int type, RouteInfo info) { + scheduleUpdate(CHANGE_ROUTES); + } + }; + + private class RoutePreference extends Preference + implements Preference.OnPreferenceClickListener { + private final MediaRouter.RouteInfo mRoute; + + public RoutePreference(Context context, MediaRouter.RouteInfo route) { + super(context); + + mRoute = route; + setTitle(route.getName()); + setSummary(route.getDescription()); + setEnabled(route.isEnabled()); + if (route.isSelected()) { + setOrder(ORDER_CONNECTED); + if (route.isConnecting()) { + setSummary(R.string.wifi_display_status_connecting); + } else { + setSummary(R.string.wifi_display_status_connected); + } + } else { + if (isEnabled()) { + setOrder(ORDER_AVAILABLE); + } else { + setOrder(ORDER_UNAVAILABLE); + if (route.getStatusCode() == MediaRouter.RouteInfo.STATUS_IN_USE) { + setSummary(R.string.wifi_display_status_in_use); + } else { + setSummary(R.string.wifi_display_status_not_available); + } + } + } + setOnPreferenceClickListener(this); + } + + @Override + public boolean onPreferenceClick(Preference preference) { + toggleRoute(mRoute); + return true; + } + } + + private class WifiDisplayRoutePreference extends RoutePreference implements View.OnClickListener { private final WifiDisplay mDisplay; - public WifiDisplayPreference(Context context, WifiDisplay display) { - super(context); + public WifiDisplayRoutePreference(Context context, MediaRouter.RouteInfo route, + WifiDisplay display) { + super(context, route); mDisplay = display; - setTitle(display.getFriendlyDisplayName()); - } - - public WifiDisplay getDisplay() { - return mDisplay; + setWidgetLayoutResource(R.layout.wifi_display_preference); } @Override @@ -665,19 +702,46 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { ImageView deviceDetails = (ImageView) view.findViewById(R.id.deviceDetails); if (deviceDetails != null) { deviceDetails.setOnClickListener(this); - if (!isEnabled()) { TypedValue value = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.disabledAlpha, value, true); deviceDetails.setImageAlpha((int)(value.getFloat() * 255)); + deviceDetails.setEnabled(true); // always allow button to be pressed } } } @Override public void onClick(View v) { - showOptionsDialog(mDisplay); + showWifiDisplayOptionsDialog(mDisplay); + } + } + + private class UnpairedWifiDisplayPreference extends Preference + implements Preference.OnPreferenceClickListener { + private final WifiDisplay mDisplay; + + public UnpairedWifiDisplayPreference(Context context, WifiDisplay display) { + super(context); + + mDisplay = display; + setTitle(display.getFriendlyDisplayName()); + setSummary(com.android.internal.R.string.wireless_display_route_description); + setEnabled(display.canConnect()); + if (isEnabled()) { + setOrder(ORDER_AVAILABLE); + } else { + setOrder(ORDER_UNAVAILABLE); + setSummary(R.string.wifi_display_status_in_use); + } + setOnPreferenceClickListener(this); + } + + @Override + public boolean onPreferenceClick(Preference preference) { + pairWifiDisplay(mDisplay); + return true; } } } diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java index 85a0494c58a..a5d36582b7b 100644 --- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java +++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java @@ -509,27 +509,33 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider { * Subclass of StateTracker for location state. */ private static final class LocationStateTracker extends StateTracker { + private int mCurrentLocationMode = Settings.Secure.LOCATION_MODE_OFF; + public int getContainerId() { return R.id.btn_location; } public int getButtonId() { return R.id.img_location; } public int getIndicatorId() { return R.id.ind_location; } public int getButtonDescription() { return R.string.gadget_location; } public int getButtonImageId(boolean on) { - return on ? R.drawable.ic_appwidget_settings_location_on_holo - : R.drawable.ic_appwidget_settings_location_off_holo; + if (on) { + switch (mCurrentLocationMode) { + case Settings.Secure.LOCATION_MODE_HIGH_ACCURACY: + case Settings.Secure.LOCATION_MODE_SENSORS_ONLY: + return R.drawable.ic_appwidget_settings_location_on_holo; + default: + return R.drawable.ic_appwidget_settings_location_saving_holo; + } + } + + return R.drawable.ic_appwidget_settings_location_off_holo; } @Override public int getActualState(Context context) { ContentResolver resolver = context.getContentResolver(); - int currentLocationMode = Settings.Secure.getInt(resolver, + mCurrentLocationMode = Settings.Secure.getInt(resolver, Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF); - switch (currentLocationMode) { - case Settings.Secure.LOCATION_MODE_BATTERY_SAVING: - case Settings.Secure.LOCATION_MODE_OFF: - return STATE_DISABLED; - } - - return STATE_ENABLED; + return (mCurrentLocationMode == Settings.Secure.LOCATION_MODE_OFF) + ? STATE_DISABLED : STATE_ENABLED; } @Override @@ -566,7 +572,7 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider { break; } Settings.Secure.putInt(resolver, Settings.Secure.LOCATION_MODE, mode); - return desiredState; + return mode != Settings.Secure.LOCATION_MODE_OFF; } return getActualState(context) == STATE_ENABLED; diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index 90aef863788..55dc0337566 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -239,6 +239,13 @@ public class WifiConfigController implements TextWatcher, if (config.proxySettings == ProxySettings.STATIC) { mProxySettingsSpinner.setSelection(PROXY_STATIC); showAdvancedFields = true; + } else if (config.proxySettings == ProxySettings.PAC) { + mProxySettingsSpinner.setVisibility(View.GONE); + TextView textView = (TextView)mView.findViewById(R.id.proxy_pac_info); + textView.setVisibility(View.VISIBLE); + textView.setText(context.getString(R.string.proxy_url) + + config.linkProperties.getHttpProxy().getPacFileUrl()); + showAdvancedFields = true; } else { mProxySettingsSpinner.setSelection(PROXY_NONE); }