Merge "Settings user restriction changes: wireless & networks changes."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b40cfb2..7810466 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -97,7 +97,7 @@
</activity>
<activity android:name="CreateShortcut" android:label="@string/settings_shortcut"
- android:theme="@style/Theme.CreateShortCut">
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
@@ -169,6 +169,7 @@
</activity>
<activity android:name=".wifi.WifiSetupActivity"
+ android:taskAffinity="com.android.wizard"
android:theme="@style/SetupWizardWifiTheme"
android:label="@string/wifi_setup_wizard_title"
android:icon="@drawable/empty_icon"
@@ -181,7 +182,7 @@
</activity>
<activity android:name=".wifi.WifiSettingsForSetupWizardXL"
- android:theme="@android:style/Theme.Quantum.Light.NoActionBar"
+ android:theme="@android:style/Theme.Material.Light.NoActionBar"
android:screenOrientation="behind"
android:clearTaskOnLaunch="true"
android:windowSoftInputMode="adjustResize"
@@ -205,7 +206,7 @@
</activity>
<activity android:name=".wifi.WifiInfo"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"
android:taskAffinity="com.android.settings"
android:parentActivityName="Settings$WifiSettingsActivity">
<intent-filter>
@@ -216,7 +217,7 @@
</activity>
<activity android:name=".wifi.WifiConfigInfo"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"
android:taskAffinity="com.android.settings"
android:parentActivityName="Settings$WifiSettingsActivity">
<intent-filter>
@@ -227,7 +228,7 @@
</activity>
<activity android:name=".wifi.WifiAPITest"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge">
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
@@ -236,7 +237,7 @@
</activity>
<activity android:name=".wifi.WifiStatusTest"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge">
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
@@ -297,7 +298,7 @@
</activity-alias>
<activity android:name=".bluetooth.DevicePickerActivity"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"
android:label="@string/device_picker"
android:clearTaskOnLaunch="true">
<intent-filter>
@@ -385,7 +386,7 @@
<activity android:name="DateTimeSettingsSetupWizard"
android:label="@string/date_and_time"
- android:theme="@android:style/Theme.Quantum.Light.NoActionBar"
+ android:theme="@android:style/Theme.Material.Light.NoActionBar"
android:screenOrientation="behind">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -500,7 +501,7 @@
<activity android:name=".inputmethod.UserDictionaryAddWordActivity"
android:label="@string/user_dict_settings_title"
- android:theme="@android:style/Theme.Quantum.Light.Dialog.NoActionBar"
+ android:theme="@android:style/Theme.Material.Light.Dialog.NoActionBar"
android:windowSoftInputMode="stateVisible"
android:noHistory="true"
android:excludeFromRecents="true">
@@ -523,35 +524,6 @@
android:resource="@id/language_settings" />
</activity-alias>
- <activity android:name="Settings$SoundSettingsActivity"
- android:label="@string/sound_settings"
- android:taskAffinity=""
- android:excludeFromRecents="true">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <action android:name="com.android.settings.SOUND_SETTINGS" />
- <action android:name="android.settings.SOUND_SETTINGS" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.VOICE_LAUNCH" />
- <category android:name="com.android.settings.SHORTCUT" />
- </intent-filter>
- <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.SoundSettings" />
- <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
- android:resource="@id/sound_settings" />
- </activity>
-
- <!-- Keep compatibility with old shortcuts. -->
- <activity-alias android:name="SoundSettings"
- android:label="@string/sound_settings"
- android:exported="true"
- android:targetActivity="Settings$SoundSettingsActivity">
- <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.SoundSettings" />
- <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
- android:resource="@id/sound_settings" />
- </activity-alias>
-
<activity android:name="Settings$ZenModeSettingsActivity"
android:label="@string/zen_mode_settings_title"
android:exported="true"
@@ -599,7 +571,7 @@
</activity-alias>
<activity android:name="Settings$DeviceInfoSettingsActivity"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"
android:label="@string/device_info_settings"
android:taskAffinity="com.android.settings"
android:parentActivityName="Settings">
@@ -617,7 +589,7 @@
<activity android:name="SettingsLicenseActivity"
android:label="@string/settings_license_activity_title"
- android:theme="@android:style/Theme.Quantum.Light.Panel"
+ android:theme="@android:style/Theme.Material.Light.Panel"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.settings.LICENSE" />
@@ -627,7 +599,7 @@
<activity android:name="SettingsSafetyLegalActivity"
android:label="@string/settings_safetylegal_activity_title"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
<intent-filter>
<action android:name="android.settings.SAFETY" />
<category android:name="android.intent.category.DEFAULT" />
@@ -763,7 +735,8 @@
</activity>
<activity android:name="Settings$NotificationStationActivity"
- android:label="@string/sound_category_notification_title"
+ android:theme="@android:style/Theme.DeviceDefault"
+ android:label="@string/notification_log_title"
android:taskAffinity=""
android:excludeFromRecents="true">
<intent-filter>
@@ -891,7 +864,7 @@
</activity>
<activity android:name="SetFullBackupPassword"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"
android:exported="false">
</activity>
@@ -935,7 +908,7 @@
<activity android:name="DeviceAdminAdd"
android:label="@string/device_admin_add_title"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"
android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.app.action.ADD_DEVICE_ADMIN" />
@@ -945,7 +918,7 @@
<activity android:name="IccLockSettings"
android:label="@string/sim_lock_settings"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"
android:process="com.android.phone">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -1062,7 +1035,7 @@
<!-- Runs in the phone process since it needs access to the Phone object -->
<activity android:name=".deviceinfo.Status"
android:label="@string/device_status_activity_title"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"
android:process="com.android.phone">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -1089,7 +1062,7 @@
</activity>
<activity android:name=".deviceinfo.MiscFilesHandler"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"/>
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"/>
<activity android:name="ApnEditor"
android:label="@string/apn_edit">
@@ -1190,7 +1163,7 @@
</activity-alias>
<activity android:name=".AppPicker" android:label="@string/select_application"
- android:theme="@android:style/Theme.Quantum.Light.Dialog" />
+ android:theme="@android:style/Theme.Material.Light.Dialog" />
<activity android:name="Settings$UsbSettingsActivity"
android:label="@string/storage_title_usb"
@@ -1224,7 +1197,7 @@
<activity android:name=".bluetooth.BluetoothPairingDialog"
android:label="@string/bluetooth_pairing_request"
android:excludeFromRecents="true"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
<intent-filter>
<action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
<category android:name="android.intent.category.DEFAULT" />
@@ -1257,7 +1230,7 @@
android:label="@string/bluetooth_permission_request"
android:excludeFromRecents="true"
android:permission="android.permission.BLUETOOTH"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
<intent-filter>
<action android:name="android.bluetooth.adapter.action.REQUEST_DISCOVERABLE" />
<action android:name="android.bluetooth.adapter.action.REQUEST_ENABLE" />
@@ -1278,7 +1251,7 @@
android:label="@string/bluetooth_pairing_request"
android:excludeFromRecents="true"
android:permission="android.permission.BLUETOOTH"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
</activity>
<receiver android:name=".bluetooth.BluetoothPairingRequest">
@@ -1301,7 +1274,7 @@
android:label="@string/bluetooth_connection_permission_request"
android:excludeFromRecents="true"
android:permission="android.permission.BLUETOOTH_ADMIN"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
<intent-filter>
<action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_REQUEST" />
<action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_CANCEL" />
@@ -1311,7 +1284,7 @@
<activity android:name="ActivityPicker"
android:label="@string/activity_picker_label"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert"
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert"
android:finishOnCloseSystemDialogs="true">
<intent-filter>
<action android:name="android.intent.action.PICK_ACTIVITY" />
@@ -1423,7 +1396,7 @@
<!-- Standard picker for widgets -->
<activity android:name="AppWidgetPickActivity"
android:label="@string/widget_picker_title"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert"
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert"
android:finishOnCloseSystemDialogs="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_PICK" />
@@ -1432,7 +1405,7 @@
</activity>
<activity android:name="AllowBindAppWidgetActivity"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert"
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert"
android:finishOnCloseSystemDialogs="true"
android:excludeFromRecents="true">
<intent-filter>
@@ -1444,7 +1417,7 @@
<!-- Special picker for keyguard widgets -->
<activity android:name="KeyguardAppWidgetPickActivity"
android:label="@string/widget_picker_title"
- android:theme="@android:style/Theme.Quantum.Wallpaper.NoTitleBar"
+ android:theme="@android:style/Theme.Material.Wallpaper.NoTitleBar"
android:permission="android.permission.BIND_KEYGUARD_APPWIDGET"
android:finishOnCloseSystemDialogs="true">
<intent-filter>
@@ -1533,15 +1506,16 @@
<activity android:name="com.android.settings.accounts.ChooseAccountActivity"
android:label="@string/header_add_an_account"
android:configChanges="orientation|keyboardHidden|screenSize"
- android:theme="@android:style/Theme.Quantum.Light.DialogWhenLarge"/>
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"/>
<activity android:name=".CryptKeeper"
android:immersive="true"
android:launchMode="singleTop"
android:excludeFromRecents="true"
- android:theme="@android:style/Theme.Quantum.Light.NoActionBar"
+ android:theme="@android:style/Theme.Material.Light.NoActionBar"
android:configChanges="keyboard|keyboardHidden|uiMode"
- android:windowSoftInputMode="adjustResize">
+ android:windowSoftInputMode="adjustResize"
+ android:screenOrientation="nosensor">
<intent-filter android:priority="10">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
@@ -1638,7 +1612,7 @@
<activity android:name=".nfc.PaymentDefaultDialog"
android:label="@string/nfc_payment_set_default_label"
android:excludeFromRecents="true"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
<intent-filter>
<action android:name="android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT" />
<category android:name="android.intent.category.DEFAULT" />
@@ -1648,7 +1622,7 @@
<activity android:name=".SmsDefaultDialog"
android:label="@string/sms_application_title"
android:excludeFromRecents="true"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
<intent-filter>
<action android:name="android.provider.Telephony.ACTION_CHANGE_DEFAULT" />
<category android:name="android.intent.category.DEFAULT" />
@@ -1658,7 +1632,7 @@
<activity android:name=".ActiveNetworkScorerDialog"
android:label="@string/network_scorer_application"
android:excludeFromRecents="true"
- android:theme="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
<intent-filter>
<action android:name="android.net.scoring.CHANGE_ACTIVE" />
<category android:name="android.intent.category.DEFAULT" />
@@ -1712,6 +1686,36 @@
android:resource="@id/notification_settings" />
</activity>
+ <!-- Keep compatibility with old shortcuts. -->
+ <activity-alias android:name="Settings$SoundSettingsActivity"
+ android:label="@string/notification_settings"
+ android:taskAffinity=""
+ android:excludeFromRecents="true"
+ android:targetActivity="Settings$NotificationSettingsActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <action android:name="com.android.settings.SOUND_SETTINGS" />
+ <action android:name="android.settings.SOUND_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.VOICE_LAUNCH" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.notification.NotificationSettings" />
+ <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
+ android:resource="@id/notification_settings" />
+ </activity-alias>
+
+ <!-- Keep compatibility with old shortcuts. -->
+ <activity-alias android:name="SoundSettings"
+ android:label="@string/notification_settings"
+ android:exported="true"
+ android:targetActivity="Settings$NotificationSettingsActivity">
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.notification.NotificationSettings" />
+ <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
+ android:resource="@id/notification_settings" />
+ </activity-alias>
+
<activity android:name="Settings$NotificationDisplaySettingsActivity"
android:label="@string/notification_display_settings"
android:exported="true"
@@ -1728,18 +1732,18 @@
android:resource="@id/notification_settings" />
</activity>
- <activity android:name="Settings$TouchSoundSettingsActivity"
- android:label="@string/touch_sound_settings"
+ <activity android:name="Settings$OtherSoundSettingsActivity"
+ android:label="@string/other_sound_settings"
android:exported="true"
android:taskAffinity=""
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
- <action android:name="android.settings.ACTION_TOUCH_SOUND_SETTINGS" />
+ <action android:name="android.settings.ACTION_OTHER_SOUND_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.notification.TouchSoundSettings" />
+ android:value="com.android.settings.notification.OtherSoundSettings" />
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
android:resource="@id/notification_settings" />
</activity>
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_0_dark.png b/res/drawable-hdpi/ic_wifi_lock_signal_0_dark.png
new file mode 100644
index 0000000..57f2839
--- /dev/null
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_0_light.png b/res/drawable-hdpi/ic_wifi_lock_signal_0_light.png
new file mode 100644
index 0000000..0bc4109
--- /dev/null
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_0_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_1_dark.png b/res/drawable-hdpi/ic_wifi_lock_signal_1_dark.png
index 2ec38ae..d153336 100644
--- a/res/drawable-hdpi/ic_wifi_lock_signal_1_dark.png
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_1_light.png b/res/drawable-hdpi/ic_wifi_lock_signal_1_light.png
index 8b0009b..72ae32f 100644
--- a/res/drawable-hdpi/ic_wifi_lock_signal_1_light.png
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_1_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_2_dark.png b/res/drawable-hdpi/ic_wifi_lock_signal_2_dark.png
index a3383a8..7ffbc84 100644
--- a/res/drawable-hdpi/ic_wifi_lock_signal_2_dark.png
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_2_light.png b/res/drawable-hdpi/ic_wifi_lock_signal_2_light.png
index b79d3e5..2259d3d 100644
--- a/res/drawable-hdpi/ic_wifi_lock_signal_2_light.png
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_2_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_3_dark.png b/res/drawable-hdpi/ic_wifi_lock_signal_3_dark.png
index e2cb17e..73ab082 100644
--- a/res/drawable-hdpi/ic_wifi_lock_signal_3_dark.png
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_3_light.png b/res/drawable-hdpi/ic_wifi_lock_signal_3_light.png
index 053c7af..356f2fa 100644
--- a/res/drawable-hdpi/ic_wifi_lock_signal_3_light.png
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_3_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_4_dark.png b/res/drawable-hdpi/ic_wifi_lock_signal_4_dark.png
index 65b02dd..3b47049 100644
--- a/res/drawable-hdpi/ic_wifi_lock_signal_4_dark.png
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_lock_signal_4_light.png b/res/drawable-hdpi/ic_wifi_lock_signal_4_light.png
index 0516bd4..4f69b27 100644
--- a/res/drawable-hdpi/ic_wifi_lock_signal_4_light.png
+++ b/res/drawable-hdpi/ic_wifi_lock_signal_4_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_0_dark.png b/res/drawable-hdpi/ic_wifi_signal_0_dark.png
new file mode 100644
index 0000000..20519fd
--- /dev/null
+++ b/res/drawable-hdpi/ic_wifi_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_0_light.png b/res/drawable-hdpi/ic_wifi_signal_0_light.png
new file mode 100644
index 0000000..99c4932
--- /dev/null
+++ b/res/drawable-hdpi/ic_wifi_signal_0_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_1_dark.png b/res/drawable-hdpi/ic_wifi_signal_1_dark.png
index f3f0208..8b055b0 100644
--- a/res/drawable-hdpi/ic_wifi_signal_1_dark.png
+++ b/res/drawable-hdpi/ic_wifi_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_1_light.png b/res/drawable-hdpi/ic_wifi_signal_1_light.png
index d9968b9..217b7ff 100644
--- a/res/drawable-hdpi/ic_wifi_signal_1_light.png
+++ b/res/drawable-hdpi/ic_wifi_signal_1_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_2_dark.png b/res/drawable-hdpi/ic_wifi_signal_2_dark.png
index 9541c38..9514eae 100644
--- a/res/drawable-hdpi/ic_wifi_signal_2_dark.png
+++ b/res/drawable-hdpi/ic_wifi_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_2_light.png b/res/drawable-hdpi/ic_wifi_signal_2_light.png
index d3065de..a992720 100644
--- a/res/drawable-hdpi/ic_wifi_signal_2_light.png
+++ b/res/drawable-hdpi/ic_wifi_signal_2_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_3_dark.png b/res/drawable-hdpi/ic_wifi_signal_3_dark.png
index be1ba37..b8a4fe7 100644
--- a/res/drawable-hdpi/ic_wifi_signal_3_dark.png
+++ b/res/drawable-hdpi/ic_wifi_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_3_light.png b/res/drawable-hdpi/ic_wifi_signal_3_light.png
index 4a6407f..8789d64 100644
--- a/res/drawable-hdpi/ic_wifi_signal_3_light.png
+++ b/res/drawable-hdpi/ic_wifi_signal_3_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_4_dark.png b/res/drawable-hdpi/ic_wifi_signal_4_dark.png
index 3fed8e6..ec697c8 100644
--- a/res/drawable-hdpi/ic_wifi_signal_4_dark.png
+++ b/res/drawable-hdpi/ic_wifi_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_wifi_signal_4_light.png b/res/drawable-hdpi/ic_wifi_signal_4_light.png
index e52acd6..a8dcaaf 100644
--- a/res/drawable-hdpi/ic_wifi_signal_4_light.png
+++ b/res/drawable-hdpi/ic_wifi_signal_4_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_more.png b/res/drawable-mdpi/ic_settings_more.png
index 048e3ed..8619833 100644
--- a/res/drawable-mdpi/ic_settings_more.png
+++ b/res/drawable-mdpi/ic_settings_more.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_0_dark.png b/res/drawable-mdpi/ic_wifi_lock_signal_0_dark.png
new file mode 100644
index 0000000..1dcb7ac
--- /dev/null
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_0_light.png b/res/drawable-mdpi/ic_wifi_lock_signal_0_light.png
new file mode 100644
index 0000000..df55614
--- /dev/null
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_0_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_1_dark.png b/res/drawable-mdpi/ic_wifi_lock_signal_1_dark.png
index d6868aa..03738de 100644
--- a/res/drawable-mdpi/ic_wifi_lock_signal_1_dark.png
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_1_light.png b/res/drawable-mdpi/ic_wifi_lock_signal_1_light.png
index eb41a10..f18211a 100644
--- a/res/drawable-mdpi/ic_wifi_lock_signal_1_light.png
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_1_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_2_dark.png b/res/drawable-mdpi/ic_wifi_lock_signal_2_dark.png
index ada9739..b37d529 100644
--- a/res/drawable-mdpi/ic_wifi_lock_signal_2_dark.png
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_2_light.png b/res/drawable-mdpi/ic_wifi_lock_signal_2_light.png
index ff041c4..ee212bc 100644
--- a/res/drawable-mdpi/ic_wifi_lock_signal_2_light.png
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_2_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_3_dark.png b/res/drawable-mdpi/ic_wifi_lock_signal_3_dark.png
index 0a294ff..d456111 100644
--- a/res/drawable-mdpi/ic_wifi_lock_signal_3_dark.png
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_3_light.png b/res/drawable-mdpi/ic_wifi_lock_signal_3_light.png
index 98cf1ff..8ab15d9 100644
--- a/res/drawable-mdpi/ic_wifi_lock_signal_3_light.png
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_3_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_4_dark.png b/res/drawable-mdpi/ic_wifi_lock_signal_4_dark.png
index ccda2c7..435f768 100644
--- a/res/drawable-mdpi/ic_wifi_lock_signal_4_dark.png
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_lock_signal_4_light.png b/res/drawable-mdpi/ic_wifi_lock_signal_4_light.png
index 83af4de..60a9833 100644
--- a/res/drawable-mdpi/ic_wifi_lock_signal_4_light.png
+++ b/res/drawable-mdpi/ic_wifi_lock_signal_4_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_0_dark.png b/res/drawable-mdpi/ic_wifi_signal_0_dark.png
new file mode 100644
index 0000000..2162d2d
--- /dev/null
+++ b/res/drawable-mdpi/ic_wifi_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_0_light.png b/res/drawable-mdpi/ic_wifi_signal_0_light.png
new file mode 100644
index 0000000..c9f97e9
--- /dev/null
+++ b/res/drawable-mdpi/ic_wifi_signal_0_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_1_dark.png b/res/drawable-mdpi/ic_wifi_signal_1_dark.png
index 6715c5d..5e186b3 100644
--- a/res/drawable-mdpi/ic_wifi_signal_1_dark.png
+++ b/res/drawable-mdpi/ic_wifi_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_1_light.png b/res/drawable-mdpi/ic_wifi_signal_1_light.png
index eec60c0..1f80018 100644
--- a/res/drawable-mdpi/ic_wifi_signal_1_light.png
+++ b/res/drawable-mdpi/ic_wifi_signal_1_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_2_dark.png b/res/drawable-mdpi/ic_wifi_signal_2_dark.png
index e31d19f..eb0b290 100644
--- a/res/drawable-mdpi/ic_wifi_signal_2_dark.png
+++ b/res/drawable-mdpi/ic_wifi_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_2_light.png b/res/drawable-mdpi/ic_wifi_signal_2_light.png
index 7caa144..2b1ed62 100644
--- a/res/drawable-mdpi/ic_wifi_signal_2_light.png
+++ b/res/drawable-mdpi/ic_wifi_signal_2_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_3_dark.png b/res/drawable-mdpi/ic_wifi_signal_3_dark.png
index bd6a1e8..47afa46 100644
--- a/res/drawable-mdpi/ic_wifi_signal_3_dark.png
+++ b/res/drawable-mdpi/ic_wifi_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_3_light.png b/res/drawable-mdpi/ic_wifi_signal_3_light.png
index 7be2515..ecbe438 100644
--- a/res/drawable-mdpi/ic_wifi_signal_3_light.png
+++ b/res/drawable-mdpi/ic_wifi_signal_3_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_4_dark.png b/res/drawable-mdpi/ic_wifi_signal_4_dark.png
index af125c2..df5cbf5 100644
--- a/res/drawable-mdpi/ic_wifi_signal_4_dark.png
+++ b/res/drawable-mdpi/ic_wifi_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_wifi_signal_4_light.png b/res/drawable-mdpi/ic_wifi_signal_4_light.png
index 658761a..4832197 100644
--- a/res/drawable-mdpi/ic_wifi_signal_4_light.png
+++ b/res/drawable-mdpi/ic_wifi_signal_4_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_more.png b/res/drawable-xhdpi/ic_settings_more.png
index d1b5c37..717b7ec 100644
--- a/res/drawable-xhdpi/ic_settings_more.png
+++ b/res/drawable-xhdpi/ic_settings_more.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_0_dark.png b/res/drawable-xhdpi/ic_wifi_lock_signal_0_dark.png
new file mode 100644
index 0000000..1e29c6a
--- /dev/null
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_0_light.png b/res/drawable-xhdpi/ic_wifi_lock_signal_0_light.png
new file mode 100644
index 0000000..b4bf667
--- /dev/null
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_0_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_1_dark.png b/res/drawable-xhdpi/ic_wifi_lock_signal_1_dark.png
index c2be32f..c9dde7b 100644
--- a/res/drawable-xhdpi/ic_wifi_lock_signal_1_dark.png
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_1_light.png b/res/drawable-xhdpi/ic_wifi_lock_signal_1_light.png
index 57c8fb2..0328b63 100644
--- a/res/drawable-xhdpi/ic_wifi_lock_signal_1_light.png
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_1_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_2_dark.png b/res/drawable-xhdpi/ic_wifi_lock_signal_2_dark.png
index 9e65730..4e8f631 100644
--- a/res/drawable-xhdpi/ic_wifi_lock_signal_2_dark.png
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_2_light.png b/res/drawable-xhdpi/ic_wifi_lock_signal_2_light.png
index db783f8..5a64d46 100644
--- a/res/drawable-xhdpi/ic_wifi_lock_signal_2_light.png
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_2_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_3_dark.png b/res/drawable-xhdpi/ic_wifi_lock_signal_3_dark.png
index 5a12175..c50c727 100644
--- a/res/drawable-xhdpi/ic_wifi_lock_signal_3_dark.png
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_3_light.png b/res/drawable-xhdpi/ic_wifi_lock_signal_3_light.png
index 8b7df74..5ce95e5 100644
--- a/res/drawable-xhdpi/ic_wifi_lock_signal_3_light.png
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_3_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_4_dark.png b/res/drawable-xhdpi/ic_wifi_lock_signal_4_dark.png
index 4d2942c..7b3b9e5 100644
--- a/res/drawable-xhdpi/ic_wifi_lock_signal_4_dark.png
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_lock_signal_4_light.png b/res/drawable-xhdpi/ic_wifi_lock_signal_4_light.png
index bf26501..91bbbc2 100644
--- a/res/drawable-xhdpi/ic_wifi_lock_signal_4_light.png
+++ b/res/drawable-xhdpi/ic_wifi_lock_signal_4_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_0_dark.png b/res/drawable-xhdpi/ic_wifi_signal_0_dark.png
new file mode 100644
index 0000000..cee9e2b
--- /dev/null
+++ b/res/drawable-xhdpi/ic_wifi_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_0_light.png b/res/drawable-xhdpi/ic_wifi_signal_0_light.png
new file mode 100644
index 0000000..c7cd1ee
--- /dev/null
+++ b/res/drawable-xhdpi/ic_wifi_signal_0_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_1_dark.png b/res/drawable-xhdpi/ic_wifi_signal_1_dark.png
index bf1634c..142db5b 100644
--- a/res/drawable-xhdpi/ic_wifi_signal_1_dark.png
+++ b/res/drawable-xhdpi/ic_wifi_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_1_light.png b/res/drawable-xhdpi/ic_wifi_signal_1_light.png
index 0f58f3d..a3c1ce4 100644
--- a/res/drawable-xhdpi/ic_wifi_signal_1_light.png
+++ b/res/drawable-xhdpi/ic_wifi_signal_1_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_2_dark.png b/res/drawable-xhdpi/ic_wifi_signal_2_dark.png
index 5345ff3..0c41ae0 100644
--- a/res/drawable-xhdpi/ic_wifi_signal_2_dark.png
+++ b/res/drawable-xhdpi/ic_wifi_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_2_light.png b/res/drawable-xhdpi/ic_wifi_signal_2_light.png
index c5bcc7e..0c0a3d0 100644
--- a/res/drawable-xhdpi/ic_wifi_signal_2_light.png
+++ b/res/drawable-xhdpi/ic_wifi_signal_2_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_3_dark.png b/res/drawable-xhdpi/ic_wifi_signal_3_dark.png
index 8cc3a6e..6f0d944 100644
--- a/res/drawable-xhdpi/ic_wifi_signal_3_dark.png
+++ b/res/drawable-xhdpi/ic_wifi_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_3_light.png b/res/drawable-xhdpi/ic_wifi_signal_3_light.png
index 1cdacc5..0ac41ce 100644
--- a/res/drawable-xhdpi/ic_wifi_signal_3_light.png
+++ b/res/drawable-xhdpi/ic_wifi_signal_3_light.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_4_dark.png b/res/drawable-xhdpi/ic_wifi_signal_4_dark.png
index c9aa4e5..418d53c 100644
--- a/res/drawable-xhdpi/ic_wifi_signal_4_dark.png
+++ b/res/drawable-xhdpi/ic_wifi_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_wifi_signal_4_light.png b/res/drawable-xhdpi/ic_wifi_signal_4_light.png
index 3cf1c8d..58cf07a 100644
--- a/res/drawable-xhdpi/ic_wifi_signal_4_light.png
+++ b/res/drawable-xhdpi/ic_wifi_signal_4_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_settings_more.png b/res/drawable-xxhdpi/ic_settings_more.png
index 610e340..507a279 100644
--- a/res/drawable-xxhdpi/ic_settings_more.png
+++ b/res/drawable-xxhdpi/ic_settings_more.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_0_dark.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_0_dark.png
new file mode 100644
index 0000000..5cb27ab
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_0_light.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_0_light.png
new file mode 100644
index 0000000..22e7f0f
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_0_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_1_dark.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_1_dark.png
index 20739fa..d862a5e 100644
--- a/res/drawable-xxhdpi/ic_wifi_lock_signal_1_dark.png
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_1_light.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_1_light.png
index c13edff..526bd28 100644
--- a/res/drawable-xxhdpi/ic_wifi_lock_signal_1_light.png
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_1_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_2_dark.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_2_dark.png
index 9cd652a..1f5e563 100644
--- a/res/drawable-xxhdpi/ic_wifi_lock_signal_2_dark.png
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_2_light.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_2_light.png
index cb7f0c2..97a01f7 100644
--- a/res/drawable-xxhdpi/ic_wifi_lock_signal_2_light.png
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_2_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_3_dark.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_3_dark.png
index 99097df..e02938b 100644
--- a/res/drawable-xxhdpi/ic_wifi_lock_signal_3_dark.png
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_3_light.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_3_light.png
index a0961f4..7c34d42 100644
--- a/res/drawable-xxhdpi/ic_wifi_lock_signal_3_light.png
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_3_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_4_dark.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_4_dark.png
index 6c00a9c..b312c97 100644
--- a/res/drawable-xxhdpi/ic_wifi_lock_signal_4_dark.png
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_lock_signal_4_light.png b/res/drawable-xxhdpi/ic_wifi_lock_signal_4_light.png
index 74e1a40..60e39ff 100644
--- a/res/drawable-xxhdpi/ic_wifi_lock_signal_4_light.png
+++ b/res/drawable-xxhdpi/ic_wifi_lock_signal_4_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_0_dark.png b/res/drawable-xxhdpi/ic_wifi_signal_0_dark.png
new file mode 100644
index 0000000..0fd7006
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_wifi_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_0_light.png b/res/drawable-xxhdpi/ic_wifi_signal_0_light.png
new file mode 100644
index 0000000..678d3c4
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_wifi_signal_0_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_1_dark.png b/res/drawable-xxhdpi/ic_wifi_signal_1_dark.png
index b50fda5..45adfbe 100644
--- a/res/drawable-xxhdpi/ic_wifi_signal_1_dark.png
+++ b/res/drawable-xxhdpi/ic_wifi_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_1_light.png b/res/drawable-xxhdpi/ic_wifi_signal_1_light.png
index f6fad9d..698cee0 100644
--- a/res/drawable-xxhdpi/ic_wifi_signal_1_light.png
+++ b/res/drawable-xxhdpi/ic_wifi_signal_1_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_2_dark.png b/res/drawable-xxhdpi/ic_wifi_signal_2_dark.png
index f906023..711c1f7 100644
--- a/res/drawable-xxhdpi/ic_wifi_signal_2_dark.png
+++ b/res/drawable-xxhdpi/ic_wifi_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_2_light.png b/res/drawable-xxhdpi/ic_wifi_signal_2_light.png
index 7f5859b..9ae3c7c 100644
--- a/res/drawable-xxhdpi/ic_wifi_signal_2_light.png
+++ b/res/drawable-xxhdpi/ic_wifi_signal_2_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_3_dark.png b/res/drawable-xxhdpi/ic_wifi_signal_3_dark.png
index ef40952..b8aef2d 100644
--- a/res/drawable-xxhdpi/ic_wifi_signal_3_dark.png
+++ b/res/drawable-xxhdpi/ic_wifi_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_3_light.png b/res/drawable-xxhdpi/ic_wifi_signal_3_light.png
index e3151b3..6b8ef69 100644
--- a/res/drawable-xxhdpi/ic_wifi_signal_3_light.png
+++ b/res/drawable-xxhdpi/ic_wifi_signal_3_light.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_4_dark.png b/res/drawable-xxhdpi/ic_wifi_signal_4_dark.png
index 13f9425..6166fdc 100644
--- a/res/drawable-xxhdpi/ic_wifi_signal_4_dark.png
+++ b/res/drawable-xxhdpi/ic_wifi_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_wifi_signal_4_light.png b/res/drawable-xxhdpi/ic_wifi_signal_4_light.png
index 96e25e5..b9d0cf2 100644
--- a/res/drawable-xxhdpi/ic_wifi_signal_4_light.png
+++ b/res/drawable-xxhdpi/ic_wifi_signal_4_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_settings_more.png b/res/drawable-xxxhdpi/ic_settings_more.png
index def6b0e..b2083ba 100644
--- a/res/drawable-xxxhdpi/ic_settings_more.png
+++ b/res/drawable-xxxhdpi/ic_settings_more.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_0_dark.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_0_dark.png
new file mode 100644
index 0000000..e1e0a11
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_0_light.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_0_light.png
new file mode 100644
index 0000000..b9ab604
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_0_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_1_dark.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_1_dark.png
new file mode 100644
index 0000000..dfc176f
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_1_light.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_1_light.png
new file mode 100644
index 0000000..f31dedf
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_1_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_2_dark.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_2_dark.png
new file mode 100644
index 0000000..0386e0d
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_2_light.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_2_light.png
new file mode 100644
index 0000000..8176741
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_2_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_3_dark.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_3_dark.png
new file mode 100644
index 0000000..7a9349f
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_3_light.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_3_light.png
new file mode 100644
index 0000000..0c4741e
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_3_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_4_dark.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_4_dark.png
new file mode 100644
index 0000000..aa2eb6d
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_lock_signal_4_light.png b/res/drawable-xxxhdpi/ic_wifi_lock_signal_4_light.png
new file mode 100644
index 0000000..68b0cb5
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_lock_signal_4_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_0_dark.png b/res/drawable-xxxhdpi/ic_wifi_signal_0_dark.png
new file mode 100644
index 0000000..a42a6eb
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_0_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_0_light.png b/res/drawable-xxxhdpi/ic_wifi_signal_0_light.png
new file mode 100644
index 0000000..2e67439
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_0_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_1_dark.png b/res/drawable-xxxhdpi/ic_wifi_signal_1_dark.png
new file mode 100644
index 0000000..d8ba287
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_1_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_1_light.png b/res/drawable-xxxhdpi/ic_wifi_signal_1_light.png
new file mode 100644
index 0000000..1b2b597
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_1_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_2_dark.png b/res/drawable-xxxhdpi/ic_wifi_signal_2_dark.png
new file mode 100644
index 0000000..e700338
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_2_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_2_light.png b/res/drawable-xxxhdpi/ic_wifi_signal_2_light.png
new file mode 100644
index 0000000..8474c53
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_2_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_3_dark.png b/res/drawable-xxxhdpi/ic_wifi_signal_3_dark.png
new file mode 100644
index 0000000..8d3c446
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_3_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_3_light.png b/res/drawable-xxxhdpi/ic_wifi_signal_3_light.png
new file mode 100644
index 0000000..eb41081
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_3_light.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_4_dark.png b/res/drawable-xxxhdpi/ic_wifi_signal_4_dark.png
new file mode 100644
index 0000000..c11b797
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_4_dark.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_wifi_signal_4_light.png b/res/drawable-xxxhdpi/ic_wifi_signal_4_light.png
new file mode 100644
index 0000000..62796af
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_wifi_signal_4_light.png
Binary files differ
diff --git a/res/drawable/data_usage_bar.xml b/res/drawable/data_usage_bar.xml
index 96f1cae..2e69710 100644
--- a/res/drawable/data_usage_bar.xml
+++ b/res/drawable/data_usage_bar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
+<!-- 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.
@@ -16,22 +16,19 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
- <shape>
- <solid android:color="#ff28262c" />
- </shape>
+ <nine-patch android:src="@*android:drawable/progress_mtrl_alpha"
+ android:tint="@color/material_empty_color_light" />
</item>
<item android:id="@android:id/secondaryProgress">
- <clip>
- <shape>
- <solid android:color="#c050ade5" />
- </shape>
- </clip>
+ <scale android:scaleWidth="100%">
+ <nine-patch android:src="@*android:drawable/progress_mtrl_alpha"
+ android:tint="?android:attr/colorControlActivated" />
+ </scale>
</item>
<item android:id="@android:id/progress">
- <clip>
- <shape>
- <solid android:color="#c050ade5" />
- </shape>
- </clip>
+ <scale android:scaleWidth="100%">
+ <nine-patch android:src="@*android:drawable/progress_primary_mtrl_alpha"
+ android:tint="?android:attr/colorControlActivated" />
+ </scale>
</item>
</layer-list>
diff --git a/res/drawable/switch_inner.xml b/res/drawable/switch_inner.xml
index 2822915..c6d39ef 100644
--- a/res/drawable/switch_inner.xml
+++ b/res/drawable/switch_inner.xml
@@ -16,21 +16,21 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:state_checked="true">
- <bitmap android:src="@*android:drawable/btn_switch_to_off_qntm_000"
+ <bitmap android:src="@*android:drawable/btn_switch_to_off_mtrl_000"
android:tint="?android:attr/colorControlNormal"
android:alpha="?android:attr/disabledAlpha" />
</item>
<item android:state_enabled="false">
- <bitmap android:src="@*android:drawable/btn_switch_to_on_qntm_000"
+ <bitmap android:src="@*android:drawable/btn_switch_to_on_mtrl_000"
android:tint="?android:attr/colorControlNormal"
android:alpha="?android:attr/disabledAlpha" />
</item>
<item android:state_checked="true">
- <bitmap android:src="@*android:drawable/btn_switch_to_off_qntm_000"
+ <bitmap android:src="@*android:drawable/btn_switch_to_off_mtrl_000"
android:tint="@color/switch_accent_color" />
</item>
<item>
- <bitmap android:src="@*android:drawable/btn_switch_to_on_qntm_000"
+ <bitmap android:src="@*android:drawable/btn_switch_to_on_mtrl_000"
android:tint="?android:attr/colorControlNormal" />
</item>
</selector>
diff --git a/res/drawable/switch_track.xml b/res/drawable/switch_track.xml
index 466cc2c..2655da0 100644
--- a/res/drawable/switch_track.xml
+++ b/res/drawable/switch_track.xml
@@ -16,11 +16,11 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
- <nine-patch android:src="@*android:drawable/switch_track_qntm_alpha"
+ <nine-patch android:src="@*android:drawable/switch_track_mtrl_alpha"
android:tint="@color/switch_accent_color" />
</item>
<item>
- <nine-patch android:src="@*android:drawable/switch_track_qntm_alpha"
+ <nine-patch android:src="@*android:drawable/switch_track_mtrl_alpha"
android:tint="?android:attr/colorControlNormal" />
</item>
</selector>
diff --git a/res/drawable/switchbar_background.xml b/res/drawable/switchbar_background.xml
new file mode 100644
index 0000000..d329b6b
--- /dev/null
+++ b/res/drawable/switchbar_background.xml
@@ -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.
+-->
+
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:tint="?android:attr/colorControlHighlight">
+ <item>
+ <color android:color="@color/switchbar_background_color" />
+ </item>
+</ripple>
+
diff --git a/res/layout/account_type_preference.xml b/res/layout/account_type_preference.xml
new file mode 100644
index 0000000..f7ba859
--- /dev/null
+++ b/res/layout/account_type_preference.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/accountTypeIcon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:contentDescription="@null" />
diff --git a/res/layout/trust_agent_settings.xml b/res/layout/advanced_security_settings.xml
similarity index 100%
rename from res/layout/trust_agent_settings.xml
rename to res/layout/advanced_security_settings.xml
diff --git a/res/layout/app_percentage_item.xml b/res/layout/app_percentage_item.xml
index 03226ca..08042a9 100644
--- a/res/layout/app_percentage_item.xml
+++ b/res/layout/app_percentage_item.xml
@@ -45,16 +45,16 @@
<TextView
android:id="@android:id/text1"
- android:layout_marginStart="8dip"
+ android:layout_marginStart="6dip"
android:layout_marginTop="2dip"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ProgressBar
android:id="@android:id/progress"
- android:layout_height="12dip"
+ android:layout_height="8dip"
android:layout_columnSpan="2"
android:layout_gravity="fill_horizontal|top"
- android:layout_marginTop="4dip"
+ android:layout_marginTop="8dip"
android:max="100"
android:progressDrawable="@drawable/data_usage_bar"
style="?android:attr/progressBarStyleHorizontal" />
@@ -64,7 +64,7 @@
android:layout_width="0dip"
android:layout_gravity="fill_horizontal|top"
android:layout_columnSpan="2"
- android:layout_marginTop="4dip"
+ android:layout_marginTop="6dip"
android:visibility="gone"
android:maxLines="2"
android:textAppearance="?android:attr/textAppearanceSmall" />
diff --git a/res/layout/battery_history_chart.xml b/res/layout/battery_history_chart.xml
new file mode 100644
index 0000000..0d3e185
--- /dev/null
+++ b/res/layout/battery_history_chart.xml
@@ -0,0 +1,35 @@
+<?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.
+-->
+
+<com.android.settings.fuelgauge.BatteryHistoryChart
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res/com.android.settings"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:id="@+android:id/battery_history_chart"
+ android:paddingEnd="?android:attr/scrollbarSize"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="#ff000000"
+ app:headerAppearance="?android:attr/textAppearanceMedium"
+ android:shadowRadius="4"
+ android:shadowColor="?android:attr/colorBackground"
+ android:shadowDx="2"
+ android:shadowDy="2"
+ app:barPrimaryColor="?android:attr/colorControlActivated"
+ app:barPredictionColor="@color/material_empty_color_light"
+ app:chartMinHeight="@dimen/battery_history_chart_height">
+</com.android.settings.fuelgauge.BatteryHistoryChart>
diff --git a/res/layout/captioning_preview.xml b/res/layout/captioning_preview.xml
index 0963ee9..b90c3a5 100644
--- a/res/layout/captioning_preview.xml
+++ b/res/layout/captioning_preview.xml
@@ -21,6 +21,7 @@
android:orientation="vertical" >
<FrameLayout
+ android:id="@+id/preview_viewport"
android:layout_width="match_parent"
android:layout_height="@dimen/captioning_preview_height" >
diff --git a/res/layout/dashboard.xml b/res/layout/dashboard.xml
index c6c7292..7917c96 100644
--- a/res/layout/dashboard.xml
+++ b/res/layout/dashboard.xml
@@ -18,8 +18,9 @@
android:id="@+id/dashboard"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingStart="@*android:dimen/preference_fragment_padding_side"
- android:paddingEnd="@*android:dimen/preference_fragment_padding_side"
+ android:paddingStart="@dimen/dashboard_padding_start"
+ android:paddingEnd="@dimen/dashboard_padding_end"
+ android:paddingBottom="@dimen/dashboard_padding_bottom"
android:scrollbarStyle="outsideOverlay"
android:background="@color/dashboard_background_color">
@@ -27,7 +28,6 @@
android:id="@+id/dashboard_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingBottom="12dp"
android:layout_gravity="center_horizontal"
android:orientation="vertical"
/>
diff --git a/res/layout/dashboard_category.xml b/res/layout/dashboard_category.xml
index 1099dda..6e90fa9 100644
--- a/res/layout/dashboard_category.xml
+++ b/res/layout/dashboard_category.xml
@@ -23,10 +23,11 @@
<TextView android:id="@+id/category_title"
android:layout_width="match_parent"
android:layout_height="@dimen/dashboard_category_title_height"
+ android:paddingStart="@dimen/dashboard_category_title_padding_start"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center_vertical"
- android:textAppearance="@style/TextAppearance.Small"
+ android:textAppearance="@style/TextAppearance.CategoryTitle"
android:textAlignment="viewStart"
/>
diff --git a/res/layout/dashboard_tile.xml b/res/layout/dashboard_tile.xml
index 2a811b2..a0049be 100644
--- a/res/layout/dashboard_tile.xml
+++ b/res/layout/dashboard_tile.xml
@@ -19,15 +19,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
- android:minHeight="72dp" >
+ android:minHeight="@dimen/dashboard_tile_minimum_height">
<ImageView
android:id="@+id/icon"
- android:layout_width="40dp"
- android:layout_height="40dp"
+ android:layout_width="@dimen/dashboard_tile_image_size"
+ android:layout_height="@dimen/dashboard_tile_image_size"
android:scaleType="centerInside"
- android:layout_marginStart="12dp"
- android:layout_marginEnd="16dp"
+ android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
+ android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end"
/>
<RelativeLayout
@@ -39,7 +39,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
- android:textAppearance="@style/TextAppearance.Medium"
+ android:textAppearance="@style/TextAppearance.TileTitle"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
diff --git a/res/layout/notification_app.xml b/res/layout/notification_app.xml
index 8f5f8e6..6818a45 100644
--- a/res/layout/notification_app.xml
+++ b/res/layout/notification_app.xml
@@ -53,8 +53,8 @@
android:ellipsize="end"
android:singleLine="true"
android:textAlignment="viewStart"
- android:textColor="#888"
- android:textAppearance="?android:attr/textAppearanceMedium" />
+ android:textColor="?android:attr/textColorSecondary"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
<View
diff --git a/res/layout/notification_log_row.xml b/res/layout/notification_log_row.xml
index 702e6b8..57f5a79 100644
--- a/res/layout/notification_log_row.xml
+++ b/res/layout/notification_log_row.xml
@@ -51,6 +51,7 @@
android:layout_toEndOf="@android:id/icon"
android:ellipsize="end"
android:singleLine="true"
+ android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:textAlignment="viewStart"
@@ -66,6 +67,7 @@
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
+ android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewEnd"
/>
@@ -79,6 +81,7 @@
android:layout_marginStart="30dp"
android:ellipsize="end"
android:singleLine="true"
+ android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart"
/>
@@ -109,6 +112,7 @@
android:layout_gravity="left|center_vertical"
android:ellipsize="end"
android:singleLine="true"
+ android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart"
/>
diff --git a/res/layout/preference_batteryhistory.xml b/res/layout/preference_batteryhistory.xml
index a09c6a8..766ec51 100644
--- a/res/layout/preference_batteryhistory.xml
+++ b/res/layout/preference_batteryhistory.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- 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.
@@ -14,19 +14,18 @@
limitations under the License.
-->
-<com.android.settings.fuelgauge.BatteryHistoryChart
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res/com.android.settings"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="@dimen/battery_history_chart_height"
- android:gravity="center_vertical"
- android:id="@+android:id/battery_history_chart"
- android:paddingEnd="?android:attr/scrollbarSize"
- android:textAppearance="?android:attr/textAppearanceSmall"
- app:headerAppearance="?android:attr/textAppearanceMedium"
- android:shadowRadius="4"
- android:shadowColor="?android:attr/colorBackground"
- android:shadowDx="2"
- android:shadowDy="2">
-</com.android.settings.fuelgauge.BatteryHistoryChart>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:minHeight="@dimen/battery_history_chart_height"
+ android:paddingEnd="?android:attr/scrollbarSize">
+ <include layout="@layout/battery_history_chart" />
+ <TextView android:id="@+id/labelsHeader"
+ android:layout_width="match_parent" android:layout_height="48dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="14sp"
+ android:textColor="?android:attr/colorControlActivated"
+ android:gravity="left|center_vertical"
+ android:text="@string/power_usage_list_summary" />
+</LinearLayout>
diff --git a/res/layout/search_panel.xml b/res/layout/search_panel.xml
index 8837bc9..1242c73 100644
--- a/res/layout/search_panel.xml
+++ b/res/layout/search_panel.xml
@@ -18,8 +18,8 @@
android:id="@+id/dashboard"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingStart="@*android:dimen/preference_fragment_padding_side"
- android:paddingEnd="@*android:dimen/preference_fragment_padding_side"
+ android:paddingStart="@dimen/search_results_padding_start"
+ android:paddingEnd="@dimen/search_results_padding_end"
android:background="@color/dashboard_background_color">
<LinearLayout android:layout_width="match_parent"
@@ -35,10 +35,11 @@
<TextView android:layout_width="wrap_content"
android:layout_height="@dimen/dashboard_category_title_height"
+ android:paddingStart="@dimen/search_title_padding_start"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center_vertical"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textAppearance="@style/TextAppearance.RecentsTitle"
android:textAlignment="viewStart"
android:text="@string/search_recents_queries_label"
/>
@@ -59,10 +60,11 @@
<TextView android:layout_width="wrap_content"
android:layout_height="@dimen/dashboard_category_title_height"
+ android:paddingStart="@dimen/search_title_padding_start"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center_vertical"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textAppearance="@style/TextAppearance.ResultTitle"
android:textAlignment="viewStart"
android:text="@string/search_results_label"
/>
diff --git a/res/layout/search_result_item.xml b/res/layout/search_result_item.xml
index 30d6fc0..b659387 100644
--- a/res/layout/search_result_item.xml
+++ b/res/layout/search_result_item.xml
@@ -19,7 +19,6 @@
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
- android:paddingStart="@*android:dimen/preference_item_padding_side"
android:paddingEnd="?android:attr/scrollbarSize">
<LinearLayout
@@ -31,12 +30,11 @@
<ImageView
android:id="@+id/icon"
- android:layout_width="48dp"
- android:layout_height="48dp"
- android:layout_gravity="center"
- android:minWidth="48dp"
+ android:layout_width="@dimen/search_result_item_image_size"
+ android:layout_height="@dimen/search_result_item_image_size"
android:scaleType="centerInside"
- android:layout_marginEnd="@*android:dimen/preference_item_padding_inner"
+ android:layout_marginStart="@dimen/search_result_item_image_margin_start"
+ android:layout_marginEnd="@dimen/search_result_item_image_margin_end"
/>
</LinearLayout>
@@ -44,10 +42,7 @@
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingEnd="@*android:dimen/preference_item_padding_inner"
- android:paddingTop="6dip"
- android:paddingBottom="6dip">
+ android:layout_weight="1">
<TextView android:id="@+id/title"
android:layout_width="wrap_content"
@@ -57,15 +52,6 @@
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
- <TextView android:id="@+id/summary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/title"
- android:layout_alignStart="@id/title"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary"
- android:maxLines="10" />
-
</RelativeLayout>
</LinearLayout>
diff --git a/res/layout/search_suggestion_item.xml b/res/layout/search_suggestion_item.xml
index 49df3ca..b92a7f0 100644
--- a/res/layout/search_suggestion_item.xml
+++ b/res/layout/search_suggestion_item.xml
@@ -18,15 +18,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
- android:gravity="center_vertical"
- android:paddingStart="@*android:dimen/preference_item_padding_side"
- android:paddingEnd="?android:attr/scrollbarSize">
+ android:gravity="center_vertical">
<TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingStart="@*android:dimen/preference_item_padding_inner"
- android:paddingEnd="@*android:dimen/preference_item_padding_inner"
+ android:paddingStart="@dimen/search_title_padding_start"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee"
diff --git a/res/layout/settings_main.xml b/res/layout/settings_main.xml
index 740932d..ddbf2af 100644
--- a/res/layout/settings_main.xml
+++ b/res/layout/settings_main.xml
@@ -31,8 +31,8 @@
<com.android.settings.widget.SwitchBar android:id="@+id/switch_bar"
android:layout_height="?android:attr/actionBarSize"
android:layout_width="match_parent"
- android:background="@color/switch_bar_background_color"
- android:theme="@android:style/Theme.Quantum" />
+ android:background="@drawable/switchbar_background"
+ android:theme="@android:style/Theme.Material" />
<FrameLayout
android:id="@+id/prefs"
diff --git a/res/layout/setup_preference.xml b/res/layout/setup_preference.xml
index d0cbc02..dc6130d 100644
--- a/res/layout/setup_preference.xml
+++ b/res/layout/setup_preference.xml
@@ -18,7 +18,7 @@
-->
<view
xmlns:android="http://schemas.android.com/apk/res/android"
- class="com.android.settings.wifi.WifiSettings$ProportionalOuterFrame"
+ class="com.android.settings.widget.ProportionalOuterFrame"
android:layout_height="match_parent"
android:layout_width="match_parent">
diff --git a/res/menu/options_menu.xml b/res/menu/options_menu.xml
index 1f35c5d..f73ce90 100644
--- a/res/menu/options_menu.xml
+++ b/res/menu/options_menu.xml
@@ -18,7 +18,7 @@
<item
android:id="@+id/search"
android:title="@string/search_menu"
- android:icon="@*android:drawable/ic_search_api_quantum"
+ android:icon="@*android:drawable/ic_search_api_material"
android:showAsAction="collapseActionView|ifRoom"
android:actionViewClass="android.widget.SearchView" />
</menu>
\ No newline at end of file
diff --git a/res/menu/print_service_settings.xml b/res/menu/print_service_settings.xml
index a9a4aed..f8a7372 100644
--- a/res/menu/print_service_settings.xml
+++ b/res/menu/print_service_settings.xml
@@ -18,9 +18,8 @@
<item
android:id="@+id/print_menu_item_search"
android:title="@string/print_menu_item_search"
- android:icon="@*android:drawable/ic_menu_search_holo_dark"
android:actionViewClass="android.widget.SearchView"
- android:showAsAction="ifRoom|collapseActionView"
+ android:showAsAction="never|collapseActionView"
android:imeOptions="actionSearch">
</item>
<item
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 288d4e3..63550d7 100755
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -24,4 +24,8 @@
<integer name="keyguard_appwidget_picker_cols">2</integer>
<dimen name="captioning_preview_height">100dp</dimen>
+
+ <!-- Dashboard tile minimum height -->
+ <dimen name="dashboard_tile_minimum_height">64dp</dimen>
+
</resources>
diff --git a/res/values-sw600dp-land/config.xml b/res/values-sw600dp-land/config.xml
index eb1a7c3..543dfee 100644
--- a/res/values-sw600dp-land/config.xml
+++ b/res/values-sw600dp-land/config.xml
@@ -17,6 +17,6 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Dashboard number of columns -->
- <integer name="dashboard_num_columns">3</integer>
+ <integer name="dashboard_num_columns">2</integer>
</resources>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 0cef851..fe42d69 100755
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -39,10 +39,26 @@
<dimen name="keyguard_appwidget_picker_margin_right">2dip</dimen>
<integer name="keyguard_appwidget_picker_cols">2</integer>
- <!-- Dashboard padding between each tiles within the layout -->
- <dimen name="dashboard_cell_gap">8dp</dimen>
+ <!-- ActionBar contentInsetStart -->
+ <dimen name="actionbar_contentInsetStart">24dp</dimen>
+
+ <!-- Dashboard category title padding start -->
+ <dimen name="dashboard_category_title_padding_start">24dp</dimen>
+
+ <!-- Dashboard tile image padding start / end -->
+ <dimen name="dashboard_tile_image_margin_start">24dp</dimen>
+ <dimen name="dashboard_tile_image_margin_end">32dp</dimen>
<!-- SwitchBar padding start -->
- <dimen name="switchbar_padding_start">80dp</dimen>
+ <dimen name="switchbar_padding_start">24dp</dimen>
+ <!-- SwitchBar padding end -->
+ <dimen name="switchbar_padding_end">24dp</dimen>
+
+ <!-- Search title (recent / results) padding start -->
+ <dimen name="search_title_padding_start">24dp</dimen>
+
+ <!-- Result item image margin start / end -->
+ <dimen name="search_result_item_image_margin_start">24dp</dimen>
+ <dimen name="search_result_item_image_margin_end">32dp</dimen>
</resources>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 8b8777c..b95a479 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -473,20 +473,6 @@
<item>Proxy Auto-Config</item>
</string-array>
- <!-- Sound settings for emergency tone. -->
- <string-array name="emergency_tone_entries">
- <item>Off</item>
- <item>Alert</item>
- <item>Vibrate</item>
- </string-array>
-
- <!-- Do not translate. -->
- <string-array name="emergency_tone_values">
- <item>0</item>
- <item>1</item>
- <item>2</item>
- </string-array>
-
<!-- Locales in this list are displayed with the corresponding
name from special_locale_names instead of using the name
from Locale.getDisplayName(). -->
@@ -752,6 +738,7 @@
<!-- Titles for captioning character edge type preference. [CHAR LIMIT=35] -->
<string-array name="captioning_edge_type_selector_titles">
+ <item>Default</item>
<item>None</item>
<item>Outline</item>
<item>Drop shadow</item>
@@ -761,6 +748,7 @@
<!-- Values for captioning character edge type preference. -->
<integer-array name="captioning_edge_type_selector_values" translatable="false" >
+ <item>-1</item>
<item>0</item>
<item>1</item>
<item>2</item>
@@ -770,6 +758,7 @@
<!-- Titles for captioning color preference. -->
<string-array name="captioning_color_selector_titles" translatable="false" >
+ <item>@string/color_unspecified</item>
<item>@string/color_white</item>
<item>@string/color_black</item>
<item>@string/color_red</item>
@@ -782,6 +771,7 @@
<!-- Values for captioning color preference. -->
<integer-array name="captioning_color_selector_values" translatable="false" >
+ <item>0x00000100</item>
<item>0xFFFFFFFF</item>
<item>0xFF000000</item>
<item>0xFFFF0000</item>
@@ -866,6 +856,7 @@
<!-- Titles for captioning text style preset preference. [CHAR LIMIT=35] -->
<string-array name="captioning_preset_selector_titles" >
+ <item>Use app defaults</item>
<item>White on black</item>
<item>Black on white</item>
<item>Yellow on black</item>
@@ -875,6 +866,7 @@
<!-- Values for captioning text style preset preference. -->
<integer-array name="captioning_preset_selector_values" translatable="false" >
+ <item>4</item>
<item>0</item>
<item>1</item>
<item>2</item>
@@ -1048,7 +1040,6 @@
<string-array name="track_frame_time_entries">
<item>Off</item>
<item>On screen as bars</item>
- <item>On screen as lines</item>
<item>In adb shell dumpsys gfxinfo</item>
</string-array>
@@ -1056,7 +1047,6 @@
<string-array name="track_frame_time_values" translatable="false" >
<item>false</item>
<item>visual_bars</item>
- <item>visual_lines</item>
<item>true</item>
</string-array>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 3ad0375..c1cb5ae 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -43,6 +43,12 @@
<attr name="android:shadowRadius" />
<!-- Text color, typeface, size, and style of header. -->
<attr name="headerAppearance" format="reference" />
+ <!-- Primary color of chart. -->
+ <attr name="barPrimaryColor" format="color|reference" />
+ <!-- Color of predicted future use part of chart. -->
+ <attr name="barPredictionColor" format="color|reference" />
+ <!-- Minimum height of the chart itself. -->
+ <attr name="chartMinHeight" format="dimension|reference" />
</declare-styleable>
<declare-styleable name="PercentageBarChart">
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 8a2c1f5..30516a1 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -42,23 +42,34 @@
<color name="circle_avatar_frame_shadow_color">#80000000</color>
<color name="circle_avatar_frame_pressed_color">#ffffffff</color>
- <color name="lock_pattern_background">#8000</color>
+ <color name="lock_pattern_background">#00000000</color>
+ <color name="lock_pattern_view_regular_color">#ff37474f</color>
+ <color name="lock_pattern_view_success_color">#ff009688</color>
+ <color name="lock_pattern_view_error_color">#fff4511e</color>
- <color name="quantum_blue_grey_50">#ffeceff1</color>
- <color name="quantum_blue_grey_100">#ffcfd8dc</color>
- <color name="quantum_blue_grey_300">#ff90a4ae</color>
- <color name="quantum_blue_grey_500">#ff607d8b</color>
- <color name="quantum_blue_grey_700">#ff455a64</color>
+ <color name="material_blue_grey_50">#ffeceff1</color>
+ <color name="material_blue_grey_100">#ffcfd8dc</color>
+ <color name="material_blue_grey_300">#ff90a4ae</color>
+ <color name="material_blue_grey_500">#ff607d8b</color>
+ <color name="material_blue_grey_700">#ff455a64</color>
- <color name="quantum_orange_100">#ffffe0b2</color>
- <color name="quantum_orange_300">#ffffb74d</color>
- <color name="quantum_orange_500">#ffff9800</color>
- <color name="quantum_orange_700">#fff57c00</color>
- <color name="quantum_orange_A200">#ffffab40</color>
- <color name="quantum_orange_A400">#ffff9100</color>
+ <color name="material_orange_100">#ffffe0b2</color>
+ <color name="material_orange_300">#ffffb74d</color>
+ <color name="material_orange_500">#ffff9800</color>
+ <color name="material_orange_700">#fff57c00</color>
+ <color name="material_orange_A200">#ffffab40</color>
+ <color name="material_orange_A400">#ffff9100</color>
- <color name="actionbar_background_color">#ff263238</color>
+ <color name="material_accent_color_light">#FF009688</color>
+ <color name="material_accent_color_dark">#FF80CBC4</color>
+ <color name="material_empty_color_light">#FFCED7DB</color>
+
+ <!-- Palette colors referenced by top-level themes and manually copied into base theme. -->
+ <color name="theme_primary">#ff263238</color>
+ <color name="theme_primary_dark">@color/theme_primary</color>
+ <color name="theme_accent">@color/material_accent_color_light</color>
+
<color name="dashboard_background_color">#ffe1e1e0</color>
- <color name="switch_bar_background_color">#ff384248</color>
+ <color name="switchbar_background_color">#ff384248</color>
<color name="switch_accent_color">#ff7fcac3</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 460fb44..b656182 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -87,15 +87,53 @@
<dimen name="notification_app_settings_divider_height">48dp</dimen>
<dimen name="zen_mode_dropdown_width">160dp</dimen>
+ <!-- Default text size for caption preview samples. Uses dp rather than sp because captions are not scaled. -->
+ <dimen name="caption_preview_text_size">48dp</dimen>
+
+ <!-- ActionBar contentInsetStart -->
+ <dimen name="actionbar_contentInsetStart">16dp</dimen>
+
<!-- Dashboard padding between each tiles within the layout -->
- <dimen name="dashboard_cell_gap">4dp</dimen>
+ <dimen name="dashboard_cell_gap">1dp</dimen>
+
+ <!-- Dashboard padding in its container -->
+ <dimen name="dashboard_padding_start">1dp</dimen>
+ <dimen name="dashboard_padding_end">1dp</dimen>
+ <dimen name="dashboard_padding_bottom">1dp</dimen>
<!-- Dashboard category title layout height -->
<dimen name="dashboard_category_title_height">48dp</dimen>
+ <!-- Dashboard category title padding start -->
+ <dimen name="dashboard_category_title_padding_start">16dp</dimen>
+
+ <!-- Dashboard tile minimum height -->
+ <dimen name="dashboard_tile_minimum_height">72dp</dimen>
+
+ <!-- Dashboard image tile size -->
+ <dimen name="dashboard_tile_image_size">24dp</dimen>
+
+ <!-- Dashboard tile image margin start / end -->
+ <dimen name="dashboard_tile_image_margin_start">16dp</dimen>
+ <dimen name="dashboard_tile_image_margin_end">32dp</dimen>
+
<!-- SwitchBar padding start -->
- <dimen name="switchbar_padding_start">72dp</dimen>
- <!-- SwitchBar padding emd -->
- <dimen name="switchbar_padding_end">@*android:dimen/preference_fragment_padding_side</dimen>
+ <dimen name="switchbar_padding_start">16dp</dimen>
+ <!-- SwitchBar padding end. Should be n x @*android:dimen/preference_fragment_padding_side -->
+ <dimen name="switchbar_padding_end">16dp</dimen>
+
+ <!-- Search Results padding in its container -->
+ <dimen name="search_results_padding_start">1dp</dimen>
+ <dimen name="search_results_padding_end">1dp</dimen>
+
+ <!-- Search title (recent / results) padding start -->
+ <dimen name="search_title_padding_start">16dp</dimen>
+
+ <!-- Result item image size -->
+ <dimen name="search_result_item_image_size">24dp</dimen>
+
+ <!-- Result item image margin start / end -->
+ <dimen name="search_result_item_image_margin_start">16dp</dimen>
+ <dimen name="search_result_item_image_margin_end">32dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 355b1d9..f8dc7b5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -610,7 +610,7 @@
<!-- Wireless controls settings screen, setting check box label -->
<string name="airplane_mode">Airplane mode</string>
<!-- Main Settings screen settings title for things like airplane mode, tethering, NFC, VPN. This will take you to another screen with those settings. -->
- <string name="radio_controls_title">More\u2026</string>
+ <string name="radio_controls_title">NFC & more</string>
<!-- Wireless Settings screen title for things like Wi-Fi, bluetooth, airplane mode. -->
<string name="wireless_networks_settings_title">Wireless & networks</string>
<!-- Main Settings screen settings summary text for the "Wireless controls" setting -->
@@ -718,6 +718,8 @@
<string name="profile_info_settings_title">Profile info</string>
<!-- Main Settings screen setting option title for the item to take you to the location screen -->
<string name="location_settings_title">Location</string>
+ <!-- Main Settings screen setting option title for the item to take you to the accounts screen [CHAR LIMIT=22] -->
+ <string name="account_settings_title">Accounts</string>
<!-- Main Settings screen setting option title for the item to take you to the security screen -->
<string name="security_settings_title">Security</string>
<!-- Main Settings screen setting option summary text for the item tot ake you to the security and location screen -->
@@ -1804,6 +1806,10 @@
<!-- Account settings header. [CHAR LIMIT=30] -->
<string name="account_settings">Accounts</string>
+ <!-- Header for items under the personal user [CHAR LIMIT=30] -->
+ <string name="category_personal">Personal</string>
+ <!-- Header for items under the work user [CHAR LIMIT=30] -->
+ <string name="category_work">Work</string>
<!-- Main Settings screen, setting option name to go into search settings -->
<string name="search_settings">Search</string>
@@ -1827,9 +1833,9 @@
<string name="brightness">Brightness level</string>
<!-- Sound & display settings screen, setting option summary to change brightness level -->
<string name="brightness_summary">Adjust the brightness of the screen</string>
- <!-- Sound & display settings screen, setting option name to enable adaptive brightness -->
+ <!-- Sound & display settings screen, setting option name to enable adaptive brightness [CHAR LIMIT=30] -->
<string name="auto_brightness_title">Adaptive brightness</string>
- <!-- Sound & display settings screen, setting option summary to enable adaptive brightness -->
+ <!-- Sound & display settings screen, setting option summary to enable adaptive brightness [CHAR LIMIT=100] -->
<string name="auto_brightness_summary">Optimize brightness level for available light</string>
<!-- Sound & display settings screen, setting option name to change screen timeout -->
<string name="screen_timeout">Sleep</string>
@@ -3140,7 +3146,7 @@
<!-- [CHAR LIMIT=NONE] Setting checkbox title for Whether to include bug report item in power menu. -->
<string name="bugreport_in_power">Bug report shortcut</string>
<!-- [CHAR LIMIT=NONE] Setting checkbox summary for Whether to include bug report item in power -->
- <string name="bugreport_in_power_summary">Show a button in Quick Settings for taking a bug report</string>
+ <string name="bugreport_in_power_summary">Show a button in the power menu for taking a bug report</string>
<!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source -->
<string name="keep_screen_on">Stay awake</string>
<!-- setting Checkbox summary whether to keep the screen on when plugged in -->
@@ -3379,7 +3385,9 @@
<!-- Label for the default device locale. [CHAR LIMIT=35] -->
<string name="locale_default">Default</string>
- <!-- Label for no color. [CHAR LIMIT=35] -->
+ <!-- Label for default color. This lets the app pick the color. [CHAR LIMIT=35] -->
+ <string name="color_unspecified">Default</string>
+ <!-- Label for no color (transparent). [CHAR LIMIT=35] -->
<string name="color_none">None</string>
<!-- Label for the color white. [CHAR LIMIT=35] -->
<string name="color_white">White</string>
@@ -3539,8 +3547,18 @@
<xliff:g id="state">%2$s</xliff:g></string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
<string name="power_charging_duration"><xliff:g id="level">%1$d</xliff:g>%% -
- <xliff:g id="state">%2$s</xliff:g>
- (<xliff:g id="time">%3$s</xliff:g> until full)</string>
+ <xliff:g id="time">%2$s</xliff:g> until full</string>
+ <!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
+ <string name="power_charging_duration_ac"><xliff:g id="level">%1$d</xliff:g>%% -
+ <xliff:g id="time">%2$s</xliff:g> until full on AC</string>
+ <!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
+ <string name="power_charging_duration_usb"><xliff:g id="level">%1$d</xliff:g>%% -
+ <xliff:g id="time">%2$s</xliff:g> until full over USB</string>
+ <!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
+ <string name="power_charging_duration_wireless"><xliff:g id="level">%1$d</xliff:g>%% -
+ <xliff:g id="time">%2$s</xliff:g> until full from wireless</string>
+ <!-- [CHAR_LIMIT=40] Label for list of apps using battery in power use UI -->
+ <string name="power_usage_list_summary">Use since last full charge</string>
<!-- Battery usage since unplugged -->
<string name="battery_since_unplugged">Battery use since unplugged</string>
<!-- Battery usage since user reset the stats -->
@@ -3985,6 +4003,8 @@
<string name="trusted_credentials">Trusted credentials</string>
<!-- Summary of preference to display trusted credentials (aka CA certificates) [CHAR LIMIT=NONE] -->
<string name="trusted_credentials_summary">Display trusted CA certificates</string>
+ <!-- Title of preference group for advance security settings [CHAR LIMIT=30] -->
+ <string name="advanced_security_title">Advanced</string>
<!-- Title of preference of what type of credential storage this device has: hardware or software [CHAR LIMIT=30] -->
<string name="credential_storage_type">Storage type</string>
<!-- Summary text for preference showing what type of credential storage this device has when it is stored in a hardware-backed storage (as opposed to "software only") [CHAR LIMIT=NONE] -->
@@ -4101,7 +4121,7 @@
<string name="untitled_apn">Untitled</string>
<string name="sound_category_sound_title">General</string>
- <string name="sound_category_notification_title">Notifications</string>
+ <string name="notification_log_title">Notification log</string>
<!-- Category title for phone call's ringtone and vibration settings in the Sound Setting.
[CHAR LIMIT=40] -->
@@ -4217,6 +4237,8 @@
<string name="accessibility_sync_enabled">Sync enabled</string>
<!-- Content description of the disabled sync icon for accessibility. [CHAR LIMIT=NONE] -->
<string name="accessibility_sync_disabled">Sync disabled</string>
+ <!-- Content description of the in progress sync icon for accessibility. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_sync_in_progress">Syncing now</string>
<!-- Content description of the disabled sync icon for accessibility. [CHAR LIMIT=NONE] -->
<string name="accessibility_sync_error">Sync error.</string>
<!-- Image description for the sync failed icon. -->
@@ -5067,99 +5089,120 @@
<!-- Sounds and Notifications -->
- <!-- Sounds & notifications: Settings header. [CHAR LIMIT=20] -->
- <string name="notification_settings">Sounds & Notifications</string>
+ <!-- Sound & notifications: Settings header. [CHAR LIMIT=20] -->
+ <string name="notification_settings">Sound & Notifications</string>
- <!-- Sounds & notifications: Title for the option managing media volume. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the option managing media volume. [CHAR LIMIT=30] -->
<string name="media_volume_option_title">Media volume</string>
- <!-- Sounds & notifications: Title for the option managing alarm volume. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the option managing alarm volume. [CHAR LIMIT=30] -->
<string name="alarm_volume_option_title">Alarm volume</string>
- <!-- Sounds & notifications: Title for the option managing ringer volume. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the option managing ringer volume. [CHAR LIMIT=30] -->
<string name="ring_volume_option_title">Ring volume</string>
- <!-- Sounds & notifications: Title for the option managing notification volume. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the option managing notification volume. [CHAR LIMIT=30] -->
<string name="notification_volume_option_title">Notification volume</string>
- <!-- Sounds & notifications: Title for the Do not disturb option and associated settings page. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the Do not disturb option and associated settings page. [CHAR LIMIT=30] -->
<string name="zen_mode_settings_title">Do not disturb</string>
- <!-- Sounds & notifications: Title for the ringer mode option. [CHAR LIMIT=60] -->
+ <!-- Sound & notifications: Title for the ringer mode option. [CHAR LIMIT=60] -->
<string name="ringer_mode_title">When calls and notifications arrive</string>
- <!-- Sounds & notifications: Title for the ringer mode option on devices without voice. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the ringer mode option on devices without voice. [CHAR LIMIT=30] -->
<string name="ringer_mode_title_novoice">When notifications arrive</string>
- <!-- Sounds & notifications: Value for the ringer mode option when audible. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Value for the ringer mode option when audible. [CHAR LIMIT=30] -->
<string name="ringer_mode_audible">Ring</string>
- <!-- Sounds & notifications: Value for the ringer mode option when vibrate. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Value for the ringer mode option when vibrate. [CHAR LIMIT=30] -->
<string name="ringer_mode_vibrate">Vibrate instead of ringing</string>
- <!-- Sounds & notifications: Value for the ringer mode option when silent. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Value for the ringer mode option when silent. [CHAR LIMIT=30] -->
<string name="ringer_mode_silent">Don\'t ring or vibrate</string>
- <!-- Sounds & notifications: Title for the option defining the phone ringtone. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the option defining the phone ringtone. [CHAR LIMIT=30] -->
<string name="ringtone_title">Phone ringtone</string>
- <!-- Sounds & notifications: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
<string name="notification_ringtone_title">Default notification ringtone</string>
- <!-- Sounds & notifications: Title for the option managing whether or not to vibrate when ringing. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the option managing whether or not to vibrate when ringing. [CHAR LIMIT=30] -->
<string name="vibrate_when_ringing_title">Vibrate when ringing</string>
- <!-- Sounds & notifications: Title for the showing notifications option and associated settings page. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications: Title for the showing notifications option and associated settings page. [CHAR LIMIT=30] -->
<string name="notification_display_settings">Showing notifications</string>
- <!-- Sounds & notifications > Showing notifications: Title for the pulse notification light option. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications > Showing notifications: Title for the pulse notification light option. [CHAR LIMIT=30] -->
<string name="notification_pulse_title">Pulse notification light</string>
- <!-- Sounds & notifications > Showing notifications: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications > Showing notifications: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] -->
<string name="lock_screen_notifications_title">When device is locked</string>
- <!-- Sounds & notifications > Showing notifications: Value for lockscreen notifications: all information will be
+ <!-- Sound & notifications > Showing notifications: Value for lockscreen notifications: all information will be
shown in notifications shown on a secure lock screen
[CHAR LIMIT=50] -->
<string name="lock_screen_notifications_summary_show">Show all notification content</string>
- <!-- Sounds & notifications > Showing notifications: Value for lockscreen notifications: sensitive information will be
+ <!-- Sound & notifications > Showing notifications: Value for lockscreen notifications: sensitive information will be
hidden or redacted from notifications shown on a secure lock screen
[CHAR LIMIT=50] -->
<string name="lock_screen_notifications_summary_hide">Hide sensitive notification content</string>
- <!-- Sounds & notifications > Showing notifications: Value for lockscreen notifications: notifications will not appear on a secure lock screen
+ <!-- Sound & notifications > Showing notifications: Value for lockscreen notifications: notifications will not appear on a secure lock screen
[CHAR LIMIT=50] -->
<string name="lock_screen_notifications_summary_disable">Don\'t show notifications at all</string>
- <!-- Sounds & notifications > Showing notifications: Title for the option managing notification display in zen mode. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications > Showing notifications: Title for the option managing notification display in zen mode. [CHAR LIMIT=30] -->
<string name="zen_mode_notifications_title">When do not disturb is on</string>
- <!-- Sounds & notifications > Showing notifications: Value for zen mode notifications: notifications will be suppressed in zen mode [CHAR LIMIT=50] -->
+ <!-- Sound & notifications > Showing notifications: Value for zen mode notifications: notifications will be suppressed in zen mode [CHAR LIMIT=50] -->
<string name="zen_mode_notifications_summary_hide">Hide new notifications from the list</string>
- <!-- Sounds & notifications > Showing notifications: Value for zen mode notifications: notifications will be displayed in zen mode [CHAR LIMIT=50] -->
+ <!-- Sound & notifications > Showing notifications: Value for zen mode notifications: notifications will be displayed in zen mode [CHAR LIMIT=50] -->
<string name="zen_mode_notifications_summary_show">Show all notifications in the list</string>
- <!-- Sounds & notifications > Showing notifications: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications > Showing notifications: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
<string name="app_notifications_title">App notifications</string>
- <!-- Sounds & notifications: Title for the touch sounds option and associated settings page. [CHAR LIMIT=30] -->
- <string name="touch_sound_settings">Touch sounds</string>
+ <!-- Sound & notifications: Title for the other sounds option and associated settings page. [CHAR LIMIT=30] -->
+ <string name="other_sound_settings">Other sounds</string>
- <!-- Sounds & notifications > Touch sounds: Title for the option enabling touch sounds for dial pad tones. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications > Other sounds: Title for the option enabling touch sounds for dial pad tones. [CHAR LIMIT=30] -->
<string name="dial_pad_tones_title">Dial pad tones</string>
- <!-- Sounds & notifications > Touch sounds: Title for the option enabling touch sounds for screen locking and unlocking. [CHAR LIMIT=30] -->
- <string name="screen_locking_sounds_title">Screen locking & unlocking</string>
+ <!-- Sound & notifications > Other sounds: Title for the option enabling touch sounds for screen locking sounds. [CHAR LIMIT=30] -->
+ <string name="screen_locking_sounds_title">Screen locking sounds</string>
- <!-- Sounds & notifications > Touch sounds: Title for the option enabling other touch sounds. [CHAR LIMIT=30] -->
- <string name="other_touch_sounds_title">Other touch sounds</string>
+ <!-- Sound & notifications > Other sounds: Title for the option enabling docking sounds. [CHAR LIMIT=30] -->
+ <string name="docking_sounds_title">Docking sounds</string>
- <!-- Sounds & notifications > Touch sounds: Title for the option enabling haptic feedback on touch. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications > Other sounds: Title for the option enabling touch sounds. [CHAR LIMIT=30] -->
+ <string name="touch_sounds_title">Touch sounds</string>
+
+ <!-- Sound & notifications > Other sounds: Title for the option enabling haptic feedback on touch. [CHAR LIMIT=30] -->
<string name="vibrate_on_touch_title">Vibrate on touch</string>
- <!-- Sounds & notifications: Title for managing notification listeners option. [CHAR LIMIT=30] -->
+ <!-- Sound & notifications > Other sounds: Title for the option enabling dock audio media. [CHAR LIMIT=30] -->
+ <string name="dock_audio_media_title">Dock speaker plays</string>
+
+ <!-- Sound & notifications > Other sounds: Value for the dock audio media with value 0: disabled. [CHAR LIMIT=30] -->
+ <string name="dock_audio_media_disabled">All audio</string>
+
+ <!-- Sound & notifications > Other sounds: Value for the dock audio media with value 1: enabled. [CHAR LIMIT=30] -->
+ <string name="dock_audio_media_enabled">Media audio only</string>
+
+ <!-- Sound & notifications > Other sounds: Value for the emergency tone option with value 0: silent. [CHAR LIMIT=30] -->
+ <string name="emergency_tone_silent">Silent</string>
+
+ <!-- Sound & notifications > Other sounds: Value for the emergency tone option with value 1: alert. [CHAR LIMIT=30] -->
+ <string name="emergency_tone_alert">Alert</string>
+
+ <!-- Sound & notifications > Other sounds: Value for the emergency tone option with value 2: vibrate. [CHAR LIMIT=30] -->
+ <string name="emergency_tone_vibrate">Vibrate</string>
+
+ <!-- Sound & notifications: Title for managing notification listeners option. [CHAR LIMIT=30] -->
<string name="manage_notification_access_title">Notification access</string>
<!-- Summary of preference to manage notification listeners, when none are enabled -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 568297f..26b0ef3 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -57,7 +57,7 @@
</style>
- <style name="TextAppearance" parent="android:TextAppearance.Quantum">
+ <style name="TextAppearance" parent="android:TextAppearance.Material">
</style>
<style name="TextAppearance.info_label">
@@ -75,7 +75,7 @@
<item name="android:textStyle">normal</item>
</style>
- <style name="TextAppearance.PasswordEntry" parent="android:TextAppearance.Quantum">
+ <style name="TextAppearance.PasswordEntry" parent="android:TextAppearance.Material">
<item name="android:gravity">center</item>
<item name="android:singleLine">true</item>
<item name="android:textStyle">bold</item>
@@ -202,18 +202,18 @@
<item name="android:windowIsFloating">true</item>
</style>
- <style name="CryptKeeperBlankTheme" parent="@android:style/Theme.Quantum.Light.NoActionBar">
+ <style name="CryptKeeperBlankTheme" parent="@android:style/Theme.Material.Light.NoActionBar">
<item name="android:background">#ff000000</item>
</style>
- <style name="SecurityPreferenceButtonContainer" parent="@android:style/Widget.Quantum.Light.SegmentedButton">
+ <style name="SecurityPreferenceButtonContainer" parent="@android:style/Widget.Material.Light.SegmentedButton">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:weightSum">2</item>
<item name="android:dividerPadding">8dip</item>
</style>
- <style name="SecurityPreferenceButton" parent="@android:style/Widget.Quantum.Light.Button.Borderless">
+ <style name="SecurityPreferenceButton" parent="@android:style/Widget.Material.Light.Button.Borderless">
<item name="android:layout_width">0dip</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">wrap_content</item>
@@ -239,7 +239,7 @@
<item name="android:widgetLayout">@layout/preference_inputmethod_widget</item>
</style>
- <style name="TextAppearance.PagerTabs" parent="@android:style/TextAppearance.Quantum.Small">
+ <style name="TextAppearance.PagerTabs" parent="@android:style/TextAppearance.Material.Small">
<item name="android:textAllCaps">true</item>
<item name="android:textStyle">bold</item>
</style>
@@ -255,13 +255,30 @@
<item name="android:layout">@layout/apn_preference_layout</item>
</style>
- <style name="TextAppearance.Medium" parent="@android:style/TextAppearance.Quantum.Medium">
+ <style name="TextAppearance.Medium" parent="@android:style/TextAppearance.Material.Medium">
</style>
- <style name="TextAppearance.Small" parent="@android:style/TextAppearance.Quantum.Small">
+ <style name="TextAppearance.Small" parent="@android:style/TextAppearance.Material.Small">
</style>
<style name="TextAppearance.Switch" parent="TextAppearance.Medium">
</style>
+ <style name="TextAppearance.CategoryTitle" parent="@android:style/TextAppearance.Material.Small">
+ <item name="android:textColor">#FF009688</item>
+ </style>
+
+ <style name="TextAppearance.TileTitle" parent="@android:style/TextAppearance.Material.Medium">
+ </style>
+
+ <style name="TextAppearance.TileSubTitle" parent="@android:style/TextAppearance.Material.Small">
+ </style>
+
+ <style name="TextAppearance.RecentsTitle" parent="TextAppearance.CategoryTitle">
+ </style>
+
+ <style name="TextAppearance.ResultTitle" parent="TextAppearance.CategoryTitle">
+ </style>
+
+
</resources>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index c39910b..82f0bc1 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -21,57 +21,58 @@
<attr name="setup_divider_color" format="reference" />
<attr name="wifi_signal" format="reference" />
- <style name="SetupWizardWifiTheme" parent="android:Theme.Quantum.NoActionBar">
+ <style name="SetupWizardWifiTheme" parent="android:Theme.Material.NoActionBar">
<item name="android:windowSoftInputMode">adjustPan</item>
<item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
<item name="android:alertDialogTheme">@style/Theme.WifiDialog</item>
<item name="ic_menu_add">@drawable/ic_menu_add_dark</item>
- <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_quantum</item>
+ <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
<item name="ic_wps">@drawable/ic_wps_dark</item>
<item name="setup_divider_color">@color/setup_divider_color_dark</item>
<item name="wifi_signal">@drawable/wifi_signal_dark</item>
</style>
- <style name="SetupWizardWifiTheme.Light" parent="android:Theme.Quantum.Light.NoActionBar">
+ <style name="SetupWizardWifiTheme.Light" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:windowSoftInputMode">adjustPan</item>
<item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
<item name="android:alertDialogTheme">@style/Theme.Light.WifiDialog</item>
<item name="ic_menu_add">@drawable/ic_menu_add_light</item>
- <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_quantum</item>
+ <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
<item name="ic_wps">@drawable/ic_wps_light</item>
<item name="setup_divider_color">@color/setup_divider_color_light</item>
<item name="wifi_signal">@drawable/wifi_signal_light</item>
</style>
- <style name="Theme.WifiDialog" parent="@*android:style/Theme.Quantum.Dialog.Alert">
+ <style name="Theme.WifiDialog" parent="@*android:style/Theme.Material.Dialog.Alert">
<item name="android:windowSoftInputMode">adjustResize</item>
<item name="ic_menu_add">@drawable/ic_menu_add_dark</item>
- <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_quantum</item>
+ <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
<item name="ic_wps">@drawable/ic_wps_dark</item>
<item name="wifi_signal">@drawable/wifi_signal_dark</item>
</style>
- <style name="Theme.Light.WifiDialog" parent="@*android:style/Theme.Quantum.Light.Dialog.Alert">
+ <style name="Theme.Light.WifiDialog" parent="@*android:style/Theme.Material.Light.Dialog.Alert">
<item name="android:windowSoftInputMode">adjustResize</item>
<item name="ic_menu_add">@drawable/ic_menu_add_light</item>
- <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_quantum</item>
+ <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
<item name="ic_wps">@drawable/ic_wps_light</item>
<item name="wifi_signal">@drawable/wifi_signal_light</item>
</style>
- <style name="Theme.CreateShortCut" parent="android:Theme.Quantum.Light.DialogWhenLarge">
- <item name="android:actionBarWidgetTheme">@android:style/ThemeOverlay.Quantum.ActionBarWidget</item>
- <item name="android:actionBarTheme">@android:style/ThemeOverlay.Quantum.Dark</item>
-
- <item name="android:colorPrimary">@color/actionbar_background_color</item>
- <!-- Used by the bouncing effect for ListView and ScrollView -->
- <item name="android:colorPrimaryLight">@color/actionbar_background_color</item>
- <!-- Used by the StatusBar and NavBar -->
- <item name="android:colorPrimaryDark">@color/actionbar_background_color</item>
- <item name="android:colorAccent">@color/quantum_orange_A200</item>
+ <!-- Theme with no local references, used by AccountPreferenceBase where we have to inflate
+ layouts against a remote context using our local theme colors. Due to the implementation
+ details of Theme, we can't reference any local resources and MUST instead use the values
+ directly. So use #ff263238 instead of @color/theme_primary and so on. -->
+ <style name="Theme.SettingsBase" parent="@android:style/Theme.Material.Light.DarkActionBar">
+ <!-- Should match @color/theme_primary. -->
+ <item name="android:colorPrimary">#ff263238</item>
+ <!-- Should match @color/theme_primary_dark. -->
+ <item name="android:colorPrimaryDark">#ff263238</item>
+ <!-- Should match @color/theme_accent. -->
+ <item name="android:colorAccent">#ff009688</item>
</style>
- <style name="Theme.Settings" parent="@android:style/Theme.Quantum.Light.DarkActionBar">
+ <style name="Theme.Settings" parent="Theme.SettingsBase">
<item name="@*android:preferenceHeaderPanelStyle">@style/PreferenceHeaderPanelSinglePane</item>
<item name="@*android:preferencePanelStyle">@style/PreferencePanelSinglePane</item>
<item name="@*android:preferenceListStyle">@style/PreferenceHeaderListSinglePane</item>
@@ -83,12 +84,51 @@
<item name="ic_wps">@drawable/ic_wps_dark</item>
<item name="wifi_signal">@drawable/wifi_signal_dark</item>
- <item name="android:colorPrimary">@color/actionbar_background_color</item>
- <!-- Used by the bouncing effect for ListView and ScrollView -->
- <item name="android:colorPrimaryLight">@color/actionbar_background_color</item>
- <!-- Used by the StatusBar and NavBar -->
- <item name="android:colorPrimaryDark">@color/actionbar_background_color</item>
- <item name="android:colorAccent">@color/quantum_orange_A200</item>
+ <!-- Redefine the ActionBar style for contentInsetStart -->
+ <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
+
+ <item name="android:alertDialogTheme">@style/Theme.AlertDialog</item>
+
+ <!-- LockPatternView colors -->
+ <item name="@*android:regularColor">@color/lock_pattern_view_regular_color</item>
+ <item name="@*android:successColor">@color/lock_pattern_view_success_color</item>
+ <item name="@*android:errorColor">@color/lock_pattern_view_error_color</item>
+
+ </style>
+
+ <style name="Theme.ActionBar" parent="@android:style/Widget.Material.Light.ActionBar.Solid">
+ <item name="android:contentInsetStart">@dimen/actionbar_contentInsetStart</item>
+ </style>
+
+ <style name="Theme.DialogWhenLarge" parent="android:style/Theme.Material.Light.DialogWhenLarge">
+ <!-- Used by the ActionBar -->
+ <item name="android:colorPrimary">@color/theme_primary</item>
+ <!-- Used by the StatusBar -->
+ <item name="android:colorPrimaryDark">@color/theme_primary_dark</item>
+ <!-- Used by controls, e.g. CheckBox, ProgressBar, etc. -->
+ <item name="android:colorAccent">@color/theme_accent</item>
+
+ <!-- Redefine the ActionBar style for contentInsetStart -->
+ <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
+ </style>
+
+ <style name="Theme.SubSettingsDialogWhenLarge" parent="Theme.DialogWhenLarge">
+ <item name="android:actionBarWidgetTheme">@null</item>
+ <item name="android:actionBarTheme">@android:style/ThemeOverlay.Material.Dark.ActionBar</item>
+ </style>
+
+ <style name="Theme.AlertDialog" parent="@*android:style/Theme.Material.Light.Dialog.Alert">
+ <item name="android:windowSoftInputMode">adjustResize</item>
+
+ <!-- Used by the ActionBar -->
+ <item name="android:colorPrimary">@color/theme_primary</item>
+ <!-- Used by the StatusBar -->
+ <item name="android:colorPrimaryDark">@color/theme_primary_dark</item>
+ <!-- Used by controls, e.g. CheckBox, ProgressBar, etc. -->
+ <item name="android:colorAccent">@color/theme_accent</item>
+
+ <!-- Redefine the ActionBar style for contentInsetStart -->
+ <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
</style>
</resources>
diff --git a/res/xml/accessibility_daltonizer_settings.xml b/res/xml/accessibility_daltonizer_settings.xml
index 2e8ad34..30a5444 100644
--- a/res/xml/accessibility_daltonizer_settings.xml
+++ b/res/xml/accessibility_daltonizer_settings.xml
@@ -17,11 +17,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/accessibility_display_daltonizer_preference_title" >
- <CheckBoxPreference
- android:key="enable_quick_setting"
- android:persistent="false"
- android:title="@string/enable_quick_setting" />
-
<ListPreference
android:entries="@array/daltonizer_type_entries"
android:entryValues="@array/daltonizer_type_values"
diff --git a/res/xml/account_settings.xml b/res/xml/account_settings.xml
new file mode 100644
index 0000000..236a26d
--- /dev/null
+++ b/res/xml/account_settings.xml
@@ -0,0 +1,51 @@
+<?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.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="account"
+ android:title="@string/account_settings_title">
+
+ <Preference
+ android:key="add_account"
+ android:title="@string/add_account_label"
+ android:icon="@drawable/ic_menu_add_dark"
+ android:order="2147483648" />
+
+ <PreferenceCategory
+ android:key="account_personal"
+ android:title="@string/category_personal" >
+
+ <Preference
+ android:key="add_account_personal"
+ android:title="@string/add_account_label"
+ android:icon="@drawable/ic_menu_add_dark"
+ android:order="2147483648" />
+
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:key="account_work"
+ android:title="@string/category_work" >
+
+ <Preference
+ android:key="add_account_work"
+ android:title="@string/add_account_label"
+ android:icon="@drawable/ic_menu_add_dark"
+ android:order="2147483648" />
+
+ </PreferenceCategory>
+
+</PreferenceScreen>
diff --git a/res/xml/dashboard_categories.xml b/res/xml/dashboard_categories.xml
index 4180f14..ab669d1 100644
--- a/res/xml/dashboard_categories.xml
+++ b/res/xml/dashboard_categories.xml
@@ -76,14 +76,6 @@
android:icon="@drawable/ic_settings_home"
/>
- <!-- Sound -->
- <dashboard-tile
- android:id="@+id/sound_settings"
- android:title="@string/sound_settings"
- android:fragment="com.android.settings.SoundSettings"
- android:icon="@drawable/ic_settings_sound"
- />
-
<!-- Display -->
<dashboard-tile
android:id="@+id/display_settings"
@@ -170,6 +162,15 @@
android:icon="@drawable/ic_settings_security"
/>
+ <!-- Account -->
+ <!-- TODO: add accounts icon -->
+ <dashboard-tile
+ android:id="@+id/account_settings"
+ android:title="@string/account_settings_title"
+ android:fragment="com.android.settings.accounts.AccountSettings"
+ android:icon="@null"
+ />
+
<!-- Language -->
<dashboard-tile
android:id="@+id/language_settings"
diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml
index 0261b67..c9a9a48 100644
--- a/res/xml/device_info_settings.xml
+++ b/res/xml/device_info_settings.xml
@@ -80,15 +80,6 @@
<intent android:action="android.settings.SAFETY" />
</PreferenceScreen>
- <!-- Contributors -->
- <!--
- <PreferenceScreen
- android:key="contributors"
- android:title="@string/contributors_title">
- <intent android:action="android.settings.TEAM" />
- </PreferenceScreen>
- -->
-
<PreferenceScreen
android:key="regulatory_info"
android:title="@string/regulatory_information">
diff --git a/res/xml/notification_settings.xml b/res/xml/notification_settings.xml
index 865138f..176c822 100644
--- a/res/xml/notification_settings.xml
+++ b/res/xml/notification_settings.xml
@@ -88,10 +88,10 @@
<!-- Touch sounds -->
<Preference
- android:key="touch_sounds"
- android:title="@string/touch_sound_settings"
+ android:key="other_sounds"
+ android:title="@string/other_sound_settings"
android:persistent="false"
- android:fragment="com.android.settings.notification.TouchSoundSettings" />
+ android:fragment="com.android.settings.notification.OtherSoundSettings" />
<!-- Notification access -->
<Preference
diff --git a/res/xml/touch_sound_settings.xml b/res/xml/other_sound_settings.xml
similarity index 64%
rename from res/xml/touch_sound_settings.xml
rename to res/xml/other_sound_settings.xml
index d10ef0d..08679db 100644
--- a/res/xml/touch_sound_settings.xml
+++ b/res/xml/other_sound_settings.xml
@@ -15,8 +15,8 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- android:title="@string/touch_sound_settings"
- android:key="touch_sound_settings"
+ android:title="@string/other_sound_settings"
+ android:key="other_sound_settings"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<!-- Dial pad tones -->
@@ -27,7 +27,7 @@
android:switchTextOn=""
android:persistent="false" />
- <!-- Screen locking / unlocking -->
+ <!-- Screen locking sounds -->
<SwitchPreference
android:key="screen_locking_sounds"
android:title="@string/screen_locking_sounds_title"
@@ -35,10 +35,18 @@
android:switchTextOn=""
android:persistent="false" />
- <!-- Other touch sounds -->
+ <!-- Docking sounds -->
<SwitchPreference
- android:key="other_touch_sounds"
- android:title="@string/other_touch_sounds_title"
+ android:key="docking_sounds"
+ android:title="@string/docking_sounds_title"
+ android:switchTextOff=""
+ android:switchTextOn=""
+ android:persistent="false" />
+
+ <!-- Touch sounds -->
+ <SwitchPreference
+ android:key="touch_sounds"
+ android:title="@string/touch_sounds_title"
android:switchTextOff=""
android:switchTextOn=""
android:persistent="false" />
@@ -51,4 +59,16 @@
android:switchTextOn=""
android:persistent="false" />
+ <!-- Dock speaker plays -->
+ <com.android.settings.notification.DropDownPreference
+ android:key="dock_audio_media"
+ android:title="@string/dock_audio_media_title"
+ android:persistent="false" />
+
+ <!-- Emergency tone -->
+ <com.android.settings.notification.DropDownPreference
+ android:key="emergency_tone"
+ android:title="@string/emergency_tone_title"
+ android:persistent="false" />
+
</PreferenceScreen>
diff --git a/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index 84ce96c..c8f3e02 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -47,12 +47,6 @@
android:persistent="false"
android:fragment="com.android.settings.DeviceAdminSettings"/>
- <Preference android:key="manage_trust_agents"
- android:title="@string/manage_trust_agents"
- android:summary="@string/manage_trust_agents_summary"
- android:persistent="false"
- android:fragment="com.android.settings.TrustAgentSettings"/>
-
<CheckBoxPreference android:key="toggle_install_applications"
android:title="@string/install_applications"
android:summaryOff="@string/install_unknown_applications"
@@ -64,7 +58,6 @@
android:summaryOff="@string/verify_applications_summary"
android:summaryOn="@string/verify_applications_summary"
android:persistent="false" />
-
</PreferenceCategory>
<PreferenceCategory android:key="credentials_management"
@@ -99,4 +92,14 @@
android:targetClass="com.android.settings.CredentialStorage"/>
</Preference>
</PreferenceCategory>
+
+ <PreferenceCategory android:key="advanced_security"
+ android:title="@string/advanced_security_title"
+ android:persistent="false">
+ <Preference android:key="manage_trust_agents"
+ android:title="@string/manage_trust_agents"
+ android:summary="@string/manage_trust_agents_summary"
+ android:persistent="false"
+ android:fragment="com.android.settings.AdvancedSecuritySettings"/>
+ </PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
deleted file mode 100644
index 26e2e20..0000000
--- a/res/xml/sound_settings.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- android:title="@string/sound_settings"
- android:key="sound_settings"
- xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
-
- <com.android.settings.RingerVolumePreference
- android:key="ring_volume"
- android:title="@string/all_volume_title"
- android:dialogTitle="@string/all_volume_title"
- android:persistent="false"
- android:streamType="ring" />
-
- <Preference
- android:key="musicfx"
- android:title="@string/musicfx_title">
- <intent android:targetPackage="com.android.musicfx"
- android:targetClass="com.android.musicfx.ControlPanelPicker" />
- </Preference>
-
- <PreferenceCategory
- android:key="category_calls_and_notification"
- android:title="@string/sound_category_call_ringtone_vibrate_title"/>
-
- <!-- Do not nest these, or removals in code will break -->
- <com.android.settings.DefaultRingtonePreference
- android:key="ringtone"
- android:title="@string/ringtone_title"
- android:dialogTitle="@string/ringtone_title"
- android:persistent="false"
- android:ringtoneType="ringtone" />
-
- <CheckBoxPreference
- android:key="vibrate_when_ringing"
- android:title="@string/vibrate_when_ringing_title"
- android:persistent="false" />
-
- <PreferenceCategory
- android:title="@string/sound_category_system_title"/>
-
- <!-- Do not nest these, or removals in code will break -->
-
- <com.android.settings.DefaultRingtonePreference
- android:key="notification_sound"
- android:title="@string/notification_sound_title"
- android:dialogTitle="@string/notification_sound_dialog_title"
- android:persistent="false"
- android:ringtoneType="notification" />
-
- <CheckBoxPreference
- android:key="dtmf_tone"
- android:title="@string/dtmf_tone_enable_title"
- android:defaultValue="true" />
-
- <CheckBoxPreference
- android:key="sound_effects"
- android:title="@string/sound_effects_enable_title"
- android:defaultValue="true" />
-
- <CheckBoxPreference
- android:key="lock_sounds"
- android:title="@string/lock_sounds_enable_title"
- android:defaultValue="true" />
-
- <CheckBoxPreference
- android:key="haptic_feedback"
- android:title="@string/haptic_feedback_enable_title"
- android:defaultValue="true" />
-
- <ListPreference
- android:key="emergency_tone"
- android:title="@string/emergency_tone_title"
- android:entries="@array/emergency_tone_entries"
- android:entryValues="@array/emergency_tone_values" />
-
- <!-- Dock -->
- <PreferenceCategory
- android:key="dock_category"
- android:title="@string/dock_settings"/>
-
- <!-- Do not nest these, or removals in code will break -->
- <PreferenceScreen
- android:key="dock_audio"
- android:title="@string/dock_audio_settings_title">
- <CheckBoxPreference
- android:title="@string/bluetooth_dock_settings_a2dp"
- android:key="dock_audio_media_enabled"
- android:enabled="true"
- />
- </PreferenceScreen>
-
- <CheckBoxPreference
- android:key="dock_sounds"
- android:title="@string/dock_sounds_enable_title"
- android:defaultValue="false" />
-
-</PreferenceScreen>
diff --git a/src/com/android/settings/AccountPreference.java b/src/com/android/settings/AccountPreference.java
index 2cc013c..7547721 100644
--- a/src/com/android/settings/AccountPreference.java
+++ b/src/com/android/settings/AccountPreference.java
@@ -140,6 +140,8 @@
return getContext().getString(R.string.accessibility_sync_disabled);
case SYNC_ERROR:
return getContext().getString(R.string.accessibility_sync_error);
+ case SYNC_IN_PROGRESS:
+ return getContext().getString(R.string.accessibility_sync_in_progress);
default:
Log.e(TAG, "Unknown sync status: " + status);
return getContext().getString(R.string.accessibility_sync_error);
diff --git a/src/com/android/settings/TrustAgentSettings.java b/src/com/android/settings/AdvancedSecuritySettings.java
similarity index 69%
rename from src/com/android/settings/TrustAgentSettings.java
rename to src/com/android/settings/AdvancedSecuritySettings.java
index d31436d..2a8c623 100644
--- a/src/com/android/settings/TrustAgentSettings.java
+++ b/src/com/android/settings/AdvancedSecuritySettings.java
@@ -18,26 +18,17 @@
import com.android.internal.widget.LockPatternUtils;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
import android.app.ListFragment;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.service.trust.TrustAgentService;
import android.util.ArrayMap;
import android.util.ArraySet;
-import android.util.AttributeSet;
-import android.util.Slog;
-import android.util.Xml;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -46,15 +37,12 @@
import android.widget.ImageView;
import android.widget.TextView;
-import java.io.IOException;
import java.util.List;
-public class TrustAgentSettings extends ListFragment implements View.OnClickListener {
- static final String TAG = "TrustAgentSettings";
+public class AdvancedSecuritySettings extends ListFragment implements View.OnClickListener {
+ static final String TAG = "AdvancedSecuritySettings";
private static final String SERVICE_INTERFACE = TrustAgentService.SERVICE_INTERFACE;
- private static final String TRUST_AGENT_META_DATA = TrustAgentService.TRUST_AGENT_META_DATA;
-
private final ArraySet<ComponentName> mActiveAgents = new ArraySet<ComponentName>();
private final ArrayMap<ComponentName, AgentInfo> mAvailableAgents
@@ -94,7 +82,7 @@
container.getContext().getApplicationContext());
}
setListAdapter(new AgentListAdapter());
- return inflater.inflate(R.layout.trust_agent_settings, container, false);
+ return inflater.inflate(R.layout.advanced_security_settings, container, false);
}
@Override
@@ -121,70 +109,22 @@
for (ResolveInfo resolveInfo : resolveInfos) {
if (resolveInfo.serviceInfo == null) continue;
- ComponentName name = getComponentName(resolveInfo);
+ if (!TrustAgentUtils.checkProvidePermission(resolveInfo, pm)) continue;
+ ComponentName name = TrustAgentUtils.getComponentName(resolveInfo);
if (!mAvailableAgents.containsKey(name)) {
AgentInfo agentInfo = new AgentInfo();
agentInfo.label = resolveInfo.loadLabel(pm);
agentInfo.icon = resolveInfo.loadIcon(pm);
agentInfo.component = name;
- agentInfo.settings = getSettingsComponentName(pm, resolveInfo);
+ TrustAgentUtils.TrustAgentComponentInfo trustAgentComponentInfo =
+ TrustAgentUtils.getSettingsComponent(pm, resolveInfo);
+ agentInfo.settings = trustAgentComponentInfo.componentName;
mAvailableAgents.put(name, agentInfo);
}
}
((BaseAdapter) getListAdapter()).notifyDataSetChanged();
}
- private ComponentName getComponentName(ResolveInfo resolveInfo) {
- if (resolveInfo == null || resolveInfo.serviceInfo == null) return null;
- return new ComponentName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name);
- }
-
- private ComponentName getSettingsComponentName(PackageManager pm, ResolveInfo resolveInfo) {
- if (resolveInfo == null || resolveInfo.serviceInfo == null
- || resolveInfo.serviceInfo.metaData == null) return null;
- String cn = null;
- XmlResourceParser parser = null;
- Exception caughtException = null;
- try {
- parser = resolveInfo.serviceInfo.loadXmlMetaData(pm, TRUST_AGENT_META_DATA);
- if (parser == null) {
- Slog.w(TAG, "Can't find " + TRUST_AGENT_META_DATA + " meta-data");
- return null;
- }
- Resources res = pm.getResourcesForApplication(resolveInfo.serviceInfo.applicationInfo);
- AttributeSet attrs = Xml.asAttributeSet(parser);
- int type;
- while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
- && type != XmlPullParser.START_TAG) {
- }
- String nodeName = parser.getName();
- if (!"trust-agent".equals(nodeName)) {
- Slog.w(TAG, "Meta-data does not start with trust-agent tag");
- return null;
- }
- TypedArray sa = res
- .obtainAttributes(attrs, com.android.internal.R.styleable.TrustAgent);
- cn = sa.getString(com.android.internal.R.styleable.TrustAgent_settingsActivity);
- sa.recycle();
- } catch (PackageManager.NameNotFoundException e) {
- caughtException = e;
- } catch (IOException e) {
- caughtException = e;
- } catch (XmlPullParserException e) {
- caughtException = e;
- } finally {
- if (parser != null) parser.close();
- }
- if (caughtException != null) {
- Slog.w(TAG, "Error parsing : " + resolveInfo.serviceInfo.packageName, caughtException);
- return null;
- }
- if (cn != null && cn.indexOf('/') < 0) {
- cn = resolveInfo.serviceInfo.packageName + "/" + cn;
- }
- return cn == null ? null : ComponentName.unflattenFromString(cn);
- }
-
@Override
public void onClick(View view) {
ViewHolder h = (ViewHolder) view.getTag();
@@ -282,10 +222,10 @@
h.name = (TextView)v.findViewById(R.id.name);
h.checkbox = (CheckBox)v.findViewById(R.id.checkbox);
h.clickable = v.findViewById(R.id.clickable);
- h.clickable.setOnClickListener(TrustAgentSettings.this);
+ h.clickable.setOnClickListener(AdvancedSecuritySettings.this);
h.description = (TextView)v.findViewById(R.id.description);
h.settings = v.findViewById(R.id.settings);
- h.settings.setOnClickListener(TrustAgentSettings.this);
+ h.settings.setOnClickListener(AdvancedSecuritySettings.this);
v.setTag(h);
h.settings.setTag(h);
h.clickable.setTag(h);
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 661e304..d24c741 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -58,7 +58,6 @@
import android.widget.TextView;
import com.android.internal.statusbar.StatusBarIcon;
-import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.widget.LockPatternUtils;
@@ -409,6 +408,7 @@
final TextView status = (TextView) findViewById(R.id.owner_info);
status.setText(owner_info);
+ status.setSelected(true); // Required for marquee'ing to work
passwordEntryInit();
}
}.execute();
@@ -605,8 +605,7 @@
}
// Disable the Emergency call button if the device has no voice telephone capability
- final TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- if (!tm.isVoiceCapable()) {
+ if (!getTelephonyManager().isVoiceCapable()) {
final View emergencyCall = findViewById(R.id.emergencyCallButton);
if (emergencyCall != null) {
Log.d(TAG, "Removing the emergency Call button");
@@ -760,7 +759,7 @@
*/
private final void setAirplaneModeIfNecessary() {
final boolean isLteDevice =
- TelephonyManager.getDefault().getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
+ getTelephonyManager().getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
if (!isLteDevice) {
Log.d(TAG, "Going into airplane mode.");
Settings.Global.putInt(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
@@ -796,7 +795,7 @@
return;
}
- final int newState = TelephonyManager.getDefault().getCallState();
+ final int newState = getTelephonyManager().getCallState();
int textId;
if (newState == TelephonyManager.CALL_STATE_OFFHOOK) {
// Show "return to call" text and show phone icon
@@ -816,23 +815,14 @@
}
private void takeEmergencyCallAction() {
- if (TelephonyManager.getDefault().getCallState() == TelephonyManager.CALL_STATE_OFFHOOK) {
- resumeCall();
+ TelephonyManager telephonyManager = getTelephonyManager();
+ if (telephonyManager.getCallState() == TelephonyManager.CALL_STATE_OFFHOOK) {
+ telephonyManager.showCallScreen();
} else {
launchEmergencyDialer();
}
}
- private void resumeCall() {
- final ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
- if (phone != null) {
- try {
- phone.showCallScreen();
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony service: " + e);
- }
- }
- }
private void launchEmergencyDialer() {
final Intent intent = new Intent(ACTION_EMERGENCY_DIAL);
@@ -841,6 +831,10 @@
startActivity(intent);
}
+ private TelephonyManager getTelephonyManager() {
+ return (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
+ }
+
/**
* Listen to key events so we can disable sounds when we get a keyinput in EditText.
*/
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 52c4338..2643793 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -99,7 +99,7 @@
private static final String KEEP_SCREEN_ON = "keep_screen_on";
private static final String BT_HCI_SNOOP_LOG = "bt_hci_snoop_log";
private static final String SELECT_RUNTIME_KEY = "select_runtime";
- private static final String SELECT_RUNTIME_PROPERTY = "persist.sys.dalvik.vm.lib.1";
+ private static final String SELECT_RUNTIME_PROPERTY = "persist.sys.dalvik.vm.lib.2";
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
private static final String HDCP_CHECKING_KEY = "hdcp_checking";
private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
@@ -168,6 +168,7 @@
private WifiManager mWifiManager;
private SwitchBar mSwitchBar;
+ private Switch mEnabledSwitch;
private boolean mLastEnabledState;
private boolean mHaveDebugSettings;
private boolean mDontPokeProperties;
@@ -388,8 +389,9 @@
final SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
+ mEnabledSwitch = mSwitchBar.getSwitch();
if (mUnavailable) {
- mSwitchBar.setSwitchEnabled(false);
+ mEnabledSwitch.setEnabled(false);
return;
}
}
@@ -442,7 +444,7 @@
final ContentResolver cr = getActivity().getContentResolver();
mLastEnabledState = Settings.Global.getInt(cr,
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
- mSwitchBar.setSwitchChecked(mLastEnabledState);
+ mEnabledSwitch.setChecked(mLastEnabledState);
setPrefsEnabledState(mLastEnabledState);
if (mHaveDebugSettings && !mLastEnabledState) {
@@ -453,7 +455,7 @@
Settings.Global.putInt(getActivity().getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
mLastEnabledState = true;
- mSwitchBar.setSwitchChecked(mLastEnabledState);
+ mEnabledSwitch.setChecked(mLastEnabledState);
setPrefsEnabledState(mLastEnabledState);
}
@@ -1226,6 +1228,9 @@
@Override
public void onSwitchChanged(Switch switchView, boolean isChecked) {
+ if (switchView != mEnabledSwitch) {
+ return;
+ }
if (isChecked != mLastEnabledState) {
if (isChecked) {
mDialogClicked = false;
@@ -1480,7 +1485,7 @@
setPrefsEnabledState(mLastEnabledState);
} else {
// Reset the toggle
- mSwitchBar.setSwitchChecked(false);
+ mEnabledSwitch.setChecked(false);
}
}
}
@@ -1494,7 +1499,7 @@
mAdbDialog = null;
} else if (dialog == mEnableDialog) {
if (!mDialogClicked) {
- mSwitchBar.setSwitchChecked(false);
+ mEnabledSwitch.setChecked(false);
}
mEnableDialog = null;
}
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 9d10ecb..c26e4ab 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -35,27 +35,30 @@
import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
+import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class DeviceInfoSettings extends SettingsPreferenceFragment {
+public class DeviceInfoSettings extends SettingsPreferenceFragment implements Indexable {
private static final String LOG_TAG = "DeviceInfoSettings";
private static final String FILENAME_PROC_VERSION = "/proc/version";
private static final String FILENAME_MSV = "/sys/board_properties/soc/msv";
private static final String KEY_CONTAINER = "container";
- private static final String KEY_TEAM = "team";
- private static final String KEY_CONTRIBUTORS = "contributors";
private static final String KEY_REGULATORY_INFO = "regulatory_info";
private static final String KEY_TERMS = "terms";
private static final String KEY_LICENSE = "license";
@@ -73,6 +76,7 @@
private static final String KEY_EQUIPMENT_ID = "fcc_equipment_id";
private static final String PROPERTY_EQUIPMENT_ID = "ro.ril.fccid";
private static final String KEY_DEVICE_FEEDBACK = "device_feedback";
+ private static final String KEY_SAFETY_LEGAL = "safetylegal";
static final int TAPS_TO_BE_A_DEVELOPER = 7;
@@ -109,7 +113,7 @@
PROPERTY_SELINUX_STATUS);
// Remove Safety information preference if PROPERTY_URL_SAFETYLEGAL is not set
- removePreferenceIfPropertyMissing(getPreferenceScreen(), "safetylegal",
+ removePreferenceIfPropertyMissing(getPreferenceScreen(), KEY_SAFETY_LEGAL,
PROPERTY_URL_SAFETYLEGAL);
// Remove Equipment id preference if FCC ID is not set by RIL
@@ -139,8 +143,6 @@
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_COPYRIGHT,
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
- Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_TEAM,
- Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
// These are contained by the root preference screen
parentPreference = getPreferenceScreen();
@@ -152,8 +154,6 @@
// Remove for secondary users
removePreference(KEY_SYSTEM_UPDATE_SETTINGS);
}
- Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_CONTRIBUTORS,
- Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
// Read platform settings for additional system update setting
removePreferenceIfBoolFalse(KEY_UPDATE_SETTING,
@@ -365,7 +365,7 @@
}
private static String getFeedbackReporterPackage(Context context) {
- String feedbackReporter =
+ final String feedbackReporter =
context.getResources().getString(R.string.oem_preferred_feedback_reporter);
if (TextUtils.isEmpty(feedbackReporter)) {
// Reporter not configured. Return.
@@ -373,7 +373,7 @@
}
// Additional checks to ensure the reporter is on system image, and reporter is
// configured to listen to the intent. Otherwise, dont show the "send feedback" option.
- Intent intent = new Intent(Intent.ACTION_BUG_REPORT);
+ final Intent intent = new Intent(Intent.ACTION_BUG_REPORT);
PackageManager pm = context.getPackageManager();
List<ResolveInfo> resolvedPackages =
@@ -398,5 +398,83 @@
}
return null;
}
+
+ /**
+ * For Search.
+ */
+ public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+
+ @Override
+ public List<SearchIndexableResource> getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+ final SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.device_info_settings;
+ return Arrays.asList(sir);
+ }
+
+ @Override
+ public List<String> getNonIndexableKeys(Context context) {
+ final List<String> keys = new ArrayList<String>();
+ if (isPropertyMissing(PROPERTY_SELINUX_STATUS)) {
+ keys.add(KEY_SELINUX_STATUS);
+ }
+ if (isPropertyMissing(PROPERTY_URL_SAFETYLEGAL)) {
+ keys.add(KEY_SAFETY_LEGAL);
+ }
+ if (isPropertyMissing(PROPERTY_EQUIPMENT_ID)) {
+ keys.add(KEY_EQUIPMENT_ID);
+ }
+ // Remove Baseband version if wifi-only device
+ if (Utils.isWifiOnly(context)) {
+ keys.add((KEY_BASEBAND_VERSION));
+ }
+ // Dont show feedback option if there is no reporter.
+ if (TextUtils.isEmpty(getFeedbackReporterPackage(context))) {
+ keys.add(KEY_DEVICE_FEEDBACK);
+ }
+ if (!checkIntentAction(context, "android.settings.TERMS")) {
+ keys.add(KEY_TERMS);
+ }
+ if (!checkIntentAction(context, "android.settings.LICENSE")) {
+ keys.add(KEY_LICENSE);
+ }
+ if (!checkIntentAction(context, "android.settings.COPYRIGHT")) {
+ keys.add(KEY_COPYRIGHT);
+ }
+ if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
+ keys.add(KEY_SYSTEM_UPDATE_SETTINGS);
+ }
+ if (!context.getResources().getBoolean(
+ R.bool.config_additional_system_update_setting_enable)) {
+ keys.add(KEY_UPDATE_SETTING);
+ }
+ return keys;
+ }
+
+ private boolean isPropertyMissing(String property) {
+ return SystemProperties.get(property).equals("");
+ }
+
+ private boolean checkIntentAction(Context context, String action) {
+ final Intent intent = new Intent(action);
+
+ // Find the activity that is in the system image
+ final PackageManager pm = context.getPackageManager();
+ final List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
+ final int listSize = list.size();
+
+ for (int i = 0; i < listSize; i++) {
+ ResolveInfo resolveInfo = list.get(i);
+ if ((resolveInfo.activityInfo.applicationInfo.flags &
+ ApplicationInfo.FLAG_SYSTEM) != 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ };
+
}
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 3bf7cce..75236de 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -16,6 +16,9 @@
package com.android.settings;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
@@ -36,13 +39,15 @@
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceScreen;
+import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.util.Log;
import java.util.ArrayList;
+import java.util.List;
public class DisplaySettings extends SettingsPreferenceFragment implements
- Preference.OnPreferenceChangeListener, OnPreferenceClickListener {
+ Preference.OnPreferenceChangeListener, OnPreferenceClickListener, Indexable {
private static final String TAG = "DisplaySettings";
/** If there is no setting in the provider, use this. */
@@ -90,9 +95,7 @@
mFontSizePref.setOnPreferenceChangeListener(this);
mFontSizePref.setOnPreferenceClickListener(this);
- boolean automaticBrightnessAvailable = getResources().getBoolean(
- com.android.internal.R.bool.config_automatic_brightness_available);
- if (automaticBrightnessAvailable) {
+ if (isAutomaticBrightnessAvailable(getResources())) {
mAutoBrightnessPreference = (CheckBoxPreference) findPreference(KEY_AUTO_BRIGHTNESS);
mAutoBrightnessPreference.setOnPreferenceChangeListener(this);
} else {
@@ -100,6 +103,10 @@
}
}
+ private static boolean isAutomaticBrightnessAvailable(Resources res) {
+ return res.getBoolean(com.android.internal.R.bool.config_automatic_brightness_available);
+ }
+
private void updateTimeoutPreferenceDescription(long currentTimeout) {
ListPreference preference = mScreenTimeoutPreference;
String summary;
@@ -286,4 +293,28 @@
}
return false;
}
+
+ public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+ @Override
+ public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
+ boolean enabled) {
+ ArrayList<SearchIndexableResource> result = new ArrayList<>(1);
+
+ SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.display_settings;
+ result.add(sir);
+
+ return result;
+ }
+
+ @Override
+ public List<String> getNonIndexableKeys(Context context) {
+ ArrayList<String> nonIndexableKeys = new ArrayList<>(1);
+ if (!isAutomaticBrightnessAvailable(context.getResources())) {
+ nonIndexableKeys.add(KEY_AUTO_BRIGHTNESS);
+ }
+ return nonIndexableKeys;
+ }
+ };
}
diff --git a/src/com/android/settings/DreamSettings.java b/src/com/android/settings/DreamSettings.java
index d97e616..1175639 100644
--- a/src/com/android/settings/DreamSettings.java
+++ b/src/com/android/settings/DreamSettings.java
@@ -61,6 +61,7 @@
private DreamBackend mBackend;
private DreamInfoAdapter mAdapter;
private SwitchBar mSwitchBar;
+ private Switch mSwitch;
private MenuItem[] mMenuItemsWhenEnabled;
private boolean mRefreshing;
@@ -123,6 +124,7 @@
final SettingsActivity sa = (SettingsActivity) getActivity();
mSwitchBar = sa.getSwitchBar();
+ mSwitch = mSwitchBar.getSwitch();
}
@Override
@@ -261,8 +263,8 @@
logd("refreshFromBackend()");
mRefreshing = true;
boolean dreamsEnabled = mBackend.isEnabled();
- if (mSwitchBar.isSwitchChecked() != dreamsEnabled)
- mSwitchBar.setSwitchChecked(dreamsEnabled);
+ if (mSwitch.isChecked() != dreamsEnabled)
+ mSwitch.setChecked(dreamsEnabled);
mAdapter.clear();
if (dreamsEnabled) {
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 00d1d89..b35a362 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -41,6 +41,7 @@
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.security.KeyStore;
+import android.service.trust.TrustAgentService;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -58,6 +59,8 @@
public class SecuritySettings extends RestrictedSettingsFragment
implements OnPreferenceChangeListener, DialogInterface.OnClickListener, Indexable {
static final String TAG = "SecuritySettings";
+ private static final Intent TRUST_AGENT_INTENT =
+ new Intent(TrustAgentService.SERVICE_INTERFACE);
// Lock Settings
private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change";
@@ -74,6 +77,7 @@
private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123;
private static final int CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_IMPROVE_REQUEST = 124;
private static final int CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_LIVELINESS_OFF = 125;
+ private static final int CHANGE_TRUST_AGENT_SETTINGS = 126;
// Misc Settings
private static final String KEY_SIM_LOCK = "sim_lock";
@@ -86,6 +90,7 @@
private static final String KEY_POWER_INSTANTLY_LOCKS = "power_button_instantly_locks";
private static final String KEY_CREDENTIALS_MANAGER = "credentials_management";
private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
+ private static final String KEY_TRUST_AGENT = "trust_agent";
private DevicePolicyManager mDPM;
@@ -161,7 +166,7 @@
/**
* Important!
*
- * Dont forget to update the SecuritySearchIndexProvider if you are doing any change in the
+ * Don't forget to update the SecuritySearchIndexProvider if you are doing any change in the
* logic or adding/removing preferences here.
*/
private PreferenceScreen createPreferenceHierarchy() {
@@ -270,7 +275,7 @@
}
// Application install
- PreferenceGroup deviceAdminCategory= (PreferenceGroup)
+ PreferenceGroup deviceAdminCategory = (PreferenceGroup)
root.findPreference(KEY_DEVICE_ADMIN_CATEGORY);
mToggleAppInstallation = (CheckBoxPreference) findPreference(
KEY_TOGGLE_INSTALL_APPLICATIONS);
@@ -303,6 +308,37 @@
protectByRestrictions(root.findPreference(KEY_CREDENTIALS_INSTALL));
}
+ // Trust Agent preferences
+ PreferenceGroup securityCategory = (PreferenceGroup)
+ root.findPreference(KEY_SECURITY_CATEGORY);
+ if (securityCategory != null) {
+ PackageManager pm = getPackageManager();
+ List<ResolveInfo> resolveInfos = pm.queryIntentServices(TRUST_AGENT_INTENT,
+ PackageManager.GET_META_DATA);
+ for (ResolveInfo resolveInfo : resolveInfos) {
+ if (resolveInfo.serviceInfo == null) continue;
+ if (!TrustAgentUtils.checkProvidePermission(resolveInfo, pm)) continue;
+ TrustAgentUtils.TrustAgentComponentInfo trustAgentComponentInfo =
+ TrustAgentUtils.getSettingsComponent(pm, resolveInfo);
+ if (trustAgentComponentInfo.componentName == null ||
+ trustAgentComponentInfo.title == null ||
+ trustAgentComponentInfo.title == "") continue;
+ Preference trustAgentPreference =
+ new Preference(securityCategory.getContext());
+ trustAgentPreference.setKey(KEY_TRUST_AGENT);
+ trustAgentPreference.setTitle(trustAgentComponentInfo.title);
+ trustAgentPreference.setSummary(trustAgentComponentInfo.summary);
+ // Create intent for this preference.
+ Intent intent = new Intent();
+ intent.setComponent(trustAgentComponentInfo.componentName);
+ intent.setAction(Intent.ACTION_MAIN);
+ trustAgentPreference.setIntent(intent);
+ // Add preference to the settings menu.
+ securityCategory.addPreference(trustAgentPreference);
+ break; // Only render the first one.
+ }
+ }
+
return root;
}
@@ -522,6 +558,13 @@
} else if (KEY_TOGGLE_VERIFY_APPLICATIONS.equals(key)) {
Settings.Global.putInt(getContentResolver(), Settings.Global.PACKAGE_VERIFIER_ENABLE,
mToggleVerifyApps.isChecked() ? 1 : 0);
+ } else if (KEY_TRUST_AGENT.equals(key)) {
+ ChooseLockSettingsHelper helper =
+ new ChooseLockSettingsHelper(this.getActivity(), this);
+ if (!helper.launchConfirmationActivity(CHANGE_TRUST_AGENT_SETTINGS, null, null)) {
+ // If this returns false, it means no password confirmation is required.
+ startActivity(preference.getIntent());
+ }
} else {
// If we didn't handle it, let preferences handle it.
return super.onPreferenceTreeClick(preferenceScreen, preference);
@@ -552,6 +595,14 @@
// is called by grabbing the value from lockPatternUtils. We can't set it here
// because mBiometricWeakLiveliness could be null
return;
+ } else if (requestCode == CHANGE_TRUST_AGENT_SETTINGS && resultCode == Activity.RESULT_OK) {
+ Preference preference = getPreferenceScreen().findPreference(KEY_TRUST_AGENT);
+ if (preference != null) {
+ Intent intent = preference.getIntent();
+ if (intent != null) {
+ startActivity(intent);
+ }
+ }
}
createPreferenceHierarchy();
}
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 38176eb..22ae719 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -40,7 +40,6 @@
public static class SpellCheckersSettingsActivity extends SettingsActivity { /* empty */ }
public static class LocalePickerActivity extends SettingsActivity { /* empty */ }
public static class UserDictionarySettingsActivity extends SettingsActivity { /* empty */ }
- public static class SoundSettingsActivity extends SettingsActivity { /* empty */ }
public static class DisplaySettingsActivity extends SettingsActivity { /* empty */ }
public static class DeviceInfoSettingsActivity extends SettingsActivity { /* empty */ }
public static class ApplicationSettingsActivity extends SettingsActivity { /* empty */ }
@@ -90,7 +89,7 @@
public static class NotificationSettingsActivity extends SettingsActivity { /* empty */ }
public static class NotificationDisplaySettingsActivity extends SettingsActivity { /* empty */ }
public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
- public static class TouchSoundSettingsActivity extends SettingsActivity { /* empty */ }
+ public static class OtherSoundSettingsActivity extends SettingsActivity { /* empty */ }
public static class TopLevelSettings extends SettingsActivity { /* empty */ }
}
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index a4aa60f..ad7d473 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -133,6 +133,7 @@
private static final String SAVE_KEY_SEARCH_MENU_EXPANDED = ":settings:search_menu_expanded";
private static final String SAVE_KEY_SEARCH_QUERY = ":settings:search_query";
private static final String SAVE_KEY_SHOW_HOME_AS_UP = ":settings:show_home_as_up";
+ private static final String SAVE_KEY_SHOW_SEARCH = ":settings:show_search";
/**
* When starting this activity, the invoking Intent can contain this extra
@@ -200,7 +201,7 @@
R.id.data_usage_settings,
R.id.wireless_settings,
R.id.device_section,
- R.id.sound_settings,
+ R.id.notification_settings,
R.id.display_settings,
R.id.storage_settings,
R.id.application_settings,
@@ -236,7 +237,6 @@
SpellCheckersSettings.class.getName(),
UserDictionaryList.class.getName(),
UserDictionarySettings.class.getName(),
- SoundSettings.class.getName(),
DisplaySettings.class.getName(),
DeviceInfoSettings.class.getName(),
ManageApplications.class.getName(),
@@ -307,7 +307,9 @@
private SwitchBar mSwitchBar;
private Button mNextButton;
+
private boolean mDisplayHomeAsUpEnabled;
+ private boolean mDisplaySearch;
private boolean mIsShowingDashboard;
@@ -402,6 +404,10 @@
@Override
public boolean onCreateOptionsMenu(Menu menu) {
+ if (!mDisplaySearch) {
+ return false;
+ }
+
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options_menu, menu);
@@ -455,6 +461,7 @@
getFragmentManager().addOnBackStackChangedListener(this);
mDisplayHomeAsUpEnabled = true;
+ mDisplaySearch = true;
// Getting Intent properties can only be done after the super.onCreate(...)
final String initialFragmentName = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
@@ -462,7 +469,7 @@
mIsShowingDashboard = (initialFragmentName == null);
if (mIsShowingDashboard) {
- Index.getInstance(this).update();
+ Index.getInstance(getApplicationContext()).update();
}
if (savedState != null) {
@@ -484,12 +491,14 @@
}
mDisplayHomeAsUpEnabled = savedState.getBoolean(SAVE_KEY_SHOW_HOME_AS_UP);
+ mDisplaySearch = savedState.getBoolean(SAVE_KEY_SHOW_SEARCH);
} else {
if (!mIsShowingDashboard) {
final ComponentName cn = getIntent().getComponent();
- // No UP is we are launched thru a Settings shortcut
+ // No UP nor Search is shown we are launched thru a Settings "shortcut"
if (!cn.getClassName().equals(SubSettings.class.getName())) {
mDisplayHomeAsUpEnabled = false;
+ mDisplaySearch = false;
}
final String initialTitle = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE);
mInitialTitle = (initialTitle != null) ? initialTitle : getTitle();
@@ -611,17 +620,20 @@
}
outState.putBoolean(SAVE_KEY_SHOW_HOME_AS_UP, mDisplayHomeAsUpEnabled);
+ outState.putBoolean(SAVE_KEY_SHOW_SEARCH, mDisplaySearch);
- // The option menus are created if the ActionBar is visible and they are also created
- // asynchronously. If you launch Settings with an Intent action like
- // android.intent.action.POWER_USAGE_SUMMARY and at the same time your device is locked
- // thru a LockScreen, onCreateOptionsMenu() is not yet called and references to the search
- // menu item and search view are null.
- boolean isExpanded = (mSearchMenuItem != null) && mSearchMenuItem.isActionViewExpanded();
- outState.putBoolean(SAVE_KEY_SEARCH_MENU_EXPANDED, isExpanded);
+ if (mDisplaySearch) {
+ // The option menus are created if the ActionBar is visible and they are also created
+ // asynchronously. If you launch Settings with an Intent action like
+ // android.intent.action.POWER_USAGE_SUMMARY and at the same time your device is locked
+ // thru a LockScreen, onCreateOptionsMenu() is not yet called and references to the search
+ // menu item and search view are null.
+ boolean isExpanded = (mSearchMenuItem != null) && mSearchMenuItem.isActionViewExpanded();
+ outState.putBoolean(SAVE_KEY_SEARCH_MENU_EXPANDED, isExpanded);
- String query = (mSearchView != null) ? mSearchView.getQuery().toString() : EMPTY_QUERY;
- outState.putString(SAVE_KEY_SEARCH_QUERY, query);
+ String query = (mSearchView != null) ? mSearchView.getQuery().toString() : EMPTY_QUERY;
+ outState.putString(SAVE_KEY_SEARCH_QUERY, query);
+ }
}
@Override
@@ -631,6 +643,7 @@
mDevelopmentPreferencesListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ setNeedToRebuildCategories(true);
invalidateCategories();
}
};
@@ -641,7 +654,7 @@
mDynamicIndexableContentMonitor.register(this);
- if(!TextUtils.isEmpty(mSearchQuery)) {
+ if(mDisplaySearch && !TextUtils.isEmpty(mSearchQuery)) {
onQueryTextSubmit(mSearchQuery);
}
}
@@ -1030,8 +1043,12 @@
category.removeTile(n);
}
} else if (id == R.id.user_settings) {
+ boolean hasMultipleUsers =
+ ((UserManager) getSystemService(Context.USER_SERVICE))
+ .getUserCount() > 1;
if (!UserHandle.MU_ENABLED
- || !UserManager.supportsMultipleUsers()
+ || (!UserManager.supportsMultipleUsers()
+ && !hasMultipleUsers)
|| Utils.isMonkeyRunning()) {
category.removeTile(n);
}
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java
deleted file mode 100644
index eadd482..0000000
--- a/src/com/android/settings/SoundSettings.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-package com.android.settings;
-
-import com.android.settings.bluetooth.DockEventReceiver;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.bluetooth.BluetoothDevice;
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteException;
-import android.media.AudioManager;
-import android.media.RingtoneManager;
-import android.media.audiofx.AudioEffect;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.os.Vibrator;
-import android.preference.CheckBoxPreference;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
-import android.provider.MediaStore;
-import android.provider.Settings;
-import android.telephony.TelephonyManager;
-import android.util.Log;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settings.search.Indexable;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SoundSettings extends SettingsPreferenceFragment implements
- Preference.OnPreferenceChangeListener, Indexable {
- private static final String TAG = "SoundSettings";
-
- private static final int DIALOG_NOT_DOCKED = 1;
-
- /** If there is no setting in the provider, use this. */
- private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0;
-
- private static final String KEY_VIBRATE = "vibrate_when_ringing";
- private static final String KEY_RING_VOLUME = "ring_volume";
- private static final String KEY_MUSICFX = "musicfx";
- private static final String KEY_DTMF_TONE = "dtmf_tone";
- private static final String KEY_SOUND_EFFECTS = "sound_effects";
- private static final String KEY_HAPTIC_FEEDBACK = "haptic_feedback";
- private static final String KEY_EMERGENCY_TONE = "emergency_tone";
- private static final String KEY_SOUND_SETTINGS = "sound_settings";
- private static final String KEY_LOCK_SOUNDS = "lock_sounds";
- private static final String KEY_RINGTONE = "ringtone";
- private static final String KEY_NOTIFICATION_SOUND = "notification_sound";
- private static final String KEY_CATEGORY_CALLS = "category_calls_and_notification";
- private static final String KEY_DOCK_CATEGORY = "dock_category";
- private static final String KEY_DOCK_AUDIO_SETTINGS = "dock_audio";
- private static final String KEY_DOCK_SOUNDS = "dock_sounds";
- private static final String KEY_DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
-
- private static final String[] NEED_VOICE_CAPABILITY = {
- KEY_RINGTONE, KEY_DTMF_TONE, KEY_CATEGORY_CALLS,
- KEY_EMERGENCY_TONE, KEY_VIBRATE
- };
-
- private static final int MSG_UPDATE_RINGTONE_SUMMARY = 1;
- private static final int MSG_UPDATE_NOTIFICATION_SUMMARY = 2;
-
- private CheckBoxPreference mVibrateWhenRinging;
- private CheckBoxPreference mDtmfTone;
- private CheckBoxPreference mSoundEffects;
- private CheckBoxPreference mHapticFeedback;
- private Preference mMusicFx;
- private CheckBoxPreference mLockSounds;
- private Preference mRingtonePreference;
- private Preference mNotificationPreference;
-
- private Runnable mRingtoneLookupRunnable;
-
- private AudioManager mAudioManager;
-
- private Preference mDockAudioSettings;
- private CheckBoxPreference mDockSounds;
- private Intent mDockIntent;
- private CheckBoxPreference mDockAudioMediaEnabled;
-
- private Handler mHandler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case MSG_UPDATE_RINGTONE_SUMMARY:
- mRingtonePreference.setSummary((CharSequence) msg.obj);
- break;
- case MSG_UPDATE_NOTIFICATION_SUMMARY:
- mNotificationPreference.setSummary((CharSequence) msg.obj);
- break;
- }
- }
- };
-
- private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent.getAction().equals(Intent.ACTION_DOCK_EVENT)) {
- handleDockChange(intent);
- }
- }
- };
-
- private PreferenceGroup mSoundSettings;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- ContentResolver resolver = getContentResolver();
- int activePhoneType = TelephonyManager.getDefault().getCurrentPhoneType();
-
- mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-
- addPreferencesFromResource(R.xml.sound_settings);
-
- if (TelephonyManager.PHONE_TYPE_CDMA != activePhoneType) {
- // device is not CDMA, do not display CDMA emergency_tone
- Preference pref = findPreference(KEY_EMERGENCY_TONE);
- if (pref != null) {
- getPreferenceScreen().removePreference(pref);
- }
- }
-
- if (!getResources().getBoolean(R.bool.has_silent_mode)) {
- findPreference(KEY_RING_VOLUME).setDependency(null);
- }
-
- if (getResources().getBoolean(com.android.internal.R.bool.config_useFixedVolume)) {
- // device with fixed volume policy, do not display volumes submenu
- Preference pref = findPreference(KEY_RING_VOLUME);
- if (pref != null) {
- getPreferenceScreen().removePreference(pref);
- }
- }
-
- mVibrateWhenRinging = (CheckBoxPreference) findPreference(KEY_VIBRATE);
- mVibrateWhenRinging.setPersistent(false);
- mVibrateWhenRinging.setChecked(Settings.System.getInt(resolver,
- Settings.System.VIBRATE_WHEN_RINGING, 0) != 0);
-
- mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
- mDtmfTone.setPersistent(false);
- mDtmfTone.setChecked(Settings.System.getInt(resolver,
- Settings.System.DTMF_TONE_WHEN_DIALING, 1) != 0);
- mSoundEffects = (CheckBoxPreference) findPreference(KEY_SOUND_EFFECTS);
- mSoundEffects.setPersistent(false);
- mSoundEffects.setChecked(Settings.System.getInt(resolver,
- Settings.System.SOUND_EFFECTS_ENABLED, 1) != 0);
- mHapticFeedback = (CheckBoxPreference) findPreference(KEY_HAPTIC_FEEDBACK);
- mHapticFeedback.setPersistent(false);
- mHapticFeedback.setChecked(Settings.System.getInt(resolver,
- Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0);
- mLockSounds = (CheckBoxPreference) findPreference(KEY_LOCK_SOUNDS);
- mLockSounds.setPersistent(false);
- mLockSounds.setChecked(Settings.System.getInt(resolver,
- Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) != 0);
-
- mRingtonePreference = findPreference(KEY_RINGTONE);
- mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);
-
- Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
- if (vibrator == null || !vibrator.hasVibrator()) {
- removePreference(KEY_VIBRATE);
- removePreference(KEY_HAPTIC_FEEDBACK);
- }
-
- if (TelephonyManager.PHONE_TYPE_CDMA == activePhoneType) {
- ListPreference emergencyTonePreference =
- (ListPreference) findPreference(KEY_EMERGENCY_TONE);
- emergencyTonePreference.setValue(String.valueOf(Settings.Global.getInt(
- resolver, Settings.Global.EMERGENCY_TONE, FALLBACK_EMERGENCY_TONE_VALUE)));
- emergencyTonePreference.setOnPreferenceChangeListener(this);
- }
-
- mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);
-
- mMusicFx = mSoundSettings.findPreference(KEY_MUSICFX);
- Intent i = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
- PackageManager p = getPackageManager();
- List<ResolveInfo> ris = p.queryIntentActivities(i, PackageManager.GET_DISABLED_COMPONENTS);
- if (ris.size() <= 2) {
- // no need to show the item if there is no choice for the user to make
- // note: the built in musicfx panel has two activities (one being a
- // compatibility shim that launches either the other activity, or a
- // third party one), hence the check for <=2. If the implementation
- // of the compatbility layer changes, this check may need to be updated.
- mSoundSettings.removePreference(mMusicFx);
- }
-
- if (!Utils.isVoiceCapable(getActivity())) {
- for (String prefKey : NEED_VOICE_CAPABILITY) {
- Preference pref = findPreference(prefKey);
- if (pref != null) {
- getPreferenceScreen().removePreference(pref);
- }
- }
- }
-
- mRingtoneLookupRunnable = new Runnable() {
- public void run() {
- if (mRingtonePreference != null) {
- updateRingtoneName(RingtoneManager.TYPE_RINGTONE, mRingtonePreference,
- MSG_UPDATE_RINGTONE_SUMMARY);
- }
- if (mNotificationPreference != null) {
- updateRingtoneName(RingtoneManager.TYPE_NOTIFICATION, mNotificationPreference,
- MSG_UPDATE_NOTIFICATION_SUMMARY);
- }
- }
- };
-
- initDockSettings();
- }
-
- @Override
- public void onResume() {
- super.onResume();
-
- lookupRingtoneNames();
-
- IntentFilter filter = new IntentFilter(Intent.ACTION_DOCK_EVENT);
- getActivity().registerReceiver(mReceiver, filter);
- }
-
- @Override
- public void onPause() {
- super.onPause();
-
- getActivity().unregisterReceiver(mReceiver);
- }
-
- private void updateRingtoneName(int type, Preference preference, int msg) {
- if (preference == null) return;
- final CharSequence summary = updateRingtoneName(getActivity(), type);
- if (summary == null) return;
- mHandler.sendMessage(mHandler.obtainMessage(msg, summary));
- }
-
- public static CharSequence updateRingtoneName(Context context, int type) {
- if (context == null) return null;
- Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type);
- CharSequence summary = context.getString(com.android.internal.R.string.ringtone_unknown);
- // Is it a silent ringtone?
- if (ringtoneUri == null) {
- summary = context.getString(com.android.internal.R.string.ringtone_silent);
- } else {
- // Fetch the ringtone title from the media provider
- try {
- Cursor cursor = context.getContentResolver().query(ringtoneUri,
- new String[] { MediaStore.Audio.Media.TITLE }, null, null, null);
- if (cursor != null) {
- if (cursor.moveToFirst()) {
- summary = cursor.getString(0);
- }
- cursor.close();
- }
- } catch (SQLiteException sqle) {
- // Unknown title for the ringtone
- }
- }
- return summary;
- }
-
- private void lookupRingtoneNames() {
- new Thread(mRingtoneLookupRunnable).start();
- }
-
- @Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- if (preference == mVibrateWhenRinging) {
- Settings.System.putInt(getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING,
- mVibrateWhenRinging.isChecked() ? 1 : 0);
- } else if (preference == mDtmfTone) {
- Settings.System.putInt(getContentResolver(), Settings.System.DTMF_TONE_WHEN_DIALING,
- mDtmfTone.isChecked() ? 1 : 0);
-
- } else if (preference == mSoundEffects) {
- if (mSoundEffects.isChecked()) {
- mAudioManager.loadSoundEffects();
- } else {
- mAudioManager.unloadSoundEffects();
- }
- Settings.System.putInt(getContentResolver(), Settings.System.SOUND_EFFECTS_ENABLED,
- mSoundEffects.isChecked() ? 1 : 0);
-
- } else if (preference == mHapticFeedback) {
- Settings.System.putInt(getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED,
- mHapticFeedback.isChecked() ? 1 : 0);
-
- } else if (preference == mLockSounds) {
- Settings.System.putInt(getContentResolver(), Settings.System.LOCKSCREEN_SOUNDS_ENABLED,
- mLockSounds.isChecked() ? 1 : 0);
-
- } else if (preference == mMusicFx) {
- // let the framework fire off the intent
- return false;
- } else if (preference == mDockAudioSettings) {
- int dockState = mDockIntent != null
- ? mDockIntent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0)
- : Intent.EXTRA_DOCK_STATE_UNDOCKED;
-
- if (dockState == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
- showDialog(DIALOG_NOT_DOCKED);
- } else {
- boolean isBluetooth = mDockIntent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) != null;
-
- if (isBluetooth) {
- Intent i = new Intent(mDockIntent);
- i.setAction(DockEventReceiver.ACTION_DOCK_SHOW_UI);
- i.setClass(getActivity(), DockEventReceiver.class);
- getActivity().sendBroadcast(i);
- } else {
- PreferenceScreen ps = (PreferenceScreen)mDockAudioSettings;
- Bundle extras = ps.getExtras();
- extras.putBoolean("checked",
- Settings.Global.getInt(getContentResolver(),
- Settings.Global.DOCK_AUDIO_MEDIA_ENABLED, 0) == 1);
- super.onPreferenceTreeClick(ps, ps);
- }
- }
- } else if (preference == mDockSounds) {
- Settings.Global.putInt(getContentResolver(), Settings.Global.DOCK_SOUNDS_ENABLED,
- mDockSounds.isChecked() ? 1 : 0);
- } else if (preference == mDockAudioMediaEnabled) {
- Settings.Global.putInt(getContentResolver(), Settings.Global.DOCK_AUDIO_MEDIA_ENABLED,
- mDockAudioMediaEnabled.isChecked() ? 1 : 0);
- }
- return true;
- }
-
- public boolean onPreferenceChange(Preference preference, Object objValue) {
- final String key = preference.getKey();
- if (KEY_EMERGENCY_TONE.equals(key)) {
- try {
- int value = Integer.parseInt((String) objValue);
- Settings.Global.putInt(getContentResolver(),
- Settings.Global.EMERGENCY_TONE, value);
- } catch (NumberFormatException e) {
- Log.e(TAG, "could not persist emergency tone setting", e);
- }
- }
-
- return true;
- }
-
- @Override
- protected int getHelpResource() {
- return R.string.help_url_sound;
- }
-
- private boolean needsDockSettings() {
- return getResources().getBoolean(R.bool.has_dock_settings);
- }
-
- private void initDockSettings() {
- ContentResolver resolver = getContentResolver();
-
- if (needsDockSettings()) {
- mDockSounds = (CheckBoxPreference) findPreference(KEY_DOCK_SOUNDS);
- mDockSounds.setPersistent(false);
- mDockSounds.setChecked(Settings.Global.getInt(resolver,
- Settings.Global.DOCK_SOUNDS_ENABLED, 0) != 0);
- mDockAudioSettings = findPreference(KEY_DOCK_AUDIO_SETTINGS);
- mDockAudioSettings.setEnabled(false);
- } else {
- getPreferenceScreen().removePreference(findPreference(KEY_DOCK_CATEGORY));
- getPreferenceScreen().removePreference(findPreference(KEY_DOCK_AUDIO_SETTINGS));
- getPreferenceScreen().removePreference(findPreference(KEY_DOCK_SOUNDS));
- Settings.Global.putInt(resolver, Settings.Global.DOCK_AUDIO_MEDIA_ENABLED, 1);
- }
- }
-
- private void handleDockChange(Intent intent) {
- if (mDockAudioSettings != null) {
- int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0);
-
- boolean isBluetooth =
- intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) != null;
-
- mDockIntent = intent;
-
- if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
- // remove undocked dialog if currently showing.
- try {
- removeDialog(DIALOG_NOT_DOCKED);
- } catch (IllegalArgumentException iae) {
- // Maybe it was already dismissed
- }
-
- if (isBluetooth) {
- mDockAudioSettings.setEnabled(true);
- } else {
- if (dockState == Intent.EXTRA_DOCK_STATE_LE_DESK) {
- ContentResolver resolver = getContentResolver();
- mDockAudioSettings.setEnabled(true);
- if (Settings.Global.getInt(resolver,
- Settings.Global.DOCK_AUDIO_MEDIA_ENABLED, -1) == -1) {
- Settings.Global.putInt(resolver,
- Settings.Global.DOCK_AUDIO_MEDIA_ENABLED, 0);
- }
- mDockAudioMediaEnabled =
- (CheckBoxPreference) findPreference(KEY_DOCK_AUDIO_MEDIA_ENABLED);
- mDockAudioMediaEnabled.setPersistent(false);
- mDockAudioMediaEnabled.setChecked(
- Settings.Global.getInt(resolver,
- Settings.Global.DOCK_AUDIO_MEDIA_ENABLED, 0) != 0);
- } else {
- mDockAudioSettings.setEnabled(false);
- }
- }
- } else {
- mDockAudioSettings.setEnabled(false);
- }
- }
- }
-
- @Override
- public Dialog onCreateDialog(int id) {
- if (id == DIALOG_NOT_DOCKED) {
- return createUndockedMessage();
- }
- return null;
- }
-
- private Dialog createUndockedMessage() {
- final AlertDialog.Builder ab = new AlertDialog.Builder(getActivity());
- ab.setTitle(R.string.dock_not_found_title);
- ab.setMessage(R.string.dock_not_found_text);
- ab.setPositiveButton(android.R.string.ok, null);
- return ab.create();
- }
-
- public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider() {
- @Override
- public List<String> getNonIndexableKeys(Context context) {
- final List<String> keys = new ArrayList<String>();
-
- int activePhoneType = TelephonyManager.getDefault().getCurrentPhoneType();
-
- if (TelephonyManager.PHONE_TYPE_CDMA != activePhoneType) {
- // device is not CDMA, do not display CDMA emergency_tone
- keys.add(KEY_EMERGENCY_TONE);
- }
-
- return keys;
- }
- };
-
-}
-
diff --git a/src/com/android/settings/TrustAgentUtils.java b/src/com/android/settings/TrustAgentUtils.java
new file mode 100644
index 0000000..31a073c
--- /dev/null
+++ b/src/com/android/settings/TrustAgentUtils.java
@@ -0,0 +1,119 @@
+/*
+ * 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
+ */
+
+package com.android.settings;
+
+import android.content.ComponentName;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.content.res.XmlResourceParser;
+import android.service.trust.TrustAgentService;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.util.Slog;
+import android.util.Xml;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+
+public class TrustAgentUtils {
+ static final String TAG = "TrustAgentUtils";
+
+ private static final String TRUST_AGENT_META_DATA = TrustAgentService.TRUST_AGENT_META_DATA;
+ private static final String PERMISSION_PROVIDE_AGENT = android.Manifest.permission.PROVIDE_TRUST_AGENT;
+
+ /**
+ * @return true, if the service in resolveInfo has the permission to provide a trust agent.
+ */
+ public static boolean checkProvidePermission(ResolveInfo resolveInfo, PackageManager pm) {
+ String packageName = resolveInfo.serviceInfo.packageName;
+ if (pm.checkPermission(PERMISSION_PROVIDE_AGENT, packageName)
+ != PackageManager.PERMISSION_GRANTED) {
+ Log.w(TAG, "Skipping agent because package " + packageName
+ + " does not have permission " + PERMISSION_PROVIDE_AGENT + ".");
+ return false;
+ }
+ return true;
+ }
+
+ public static class TrustAgentComponentInfo {
+ ComponentName componentName;
+ String title;
+ String summary;
+ }
+
+ public static ComponentName getComponentName(ResolveInfo resolveInfo) {
+ if (resolveInfo == null || resolveInfo.serviceInfo == null) return null;
+ return new ComponentName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name);
+ }
+
+ public static TrustAgentComponentInfo getSettingsComponent(
+ PackageManager pm, ResolveInfo resolveInfo) {
+ if (resolveInfo == null || resolveInfo.serviceInfo == null
+ || resolveInfo.serviceInfo.metaData == null) return null;
+ String cn = null;
+ TrustAgentComponentInfo trustAgentComponentInfo = new TrustAgentComponentInfo();
+ XmlResourceParser parser = null;
+ Exception caughtException = null;
+ try {
+ parser = resolveInfo.serviceInfo.loadXmlMetaData(pm, TRUST_AGENT_META_DATA);
+ if (parser == null) {
+ Slog.w(TAG, "Can't find " + TRUST_AGENT_META_DATA + " meta-data");
+ return null;
+ }
+ Resources res = pm.getResourcesForApplication(resolveInfo.serviceInfo.applicationInfo);
+ AttributeSet attrs = Xml.asAttributeSet(parser);
+ int type;
+ while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+ && type != XmlPullParser.START_TAG) {
+ }
+ String nodeName = parser.getName();
+ if (!"trust-agent".equals(nodeName)) {
+ Slog.w(TAG, "Meta-data does not start with trust-agent tag");
+ return null;
+ }
+ TypedArray sa =
+ res.obtainAttributes(attrs, com.android.internal.R.styleable.TrustAgent);
+ trustAgentComponentInfo.summary =
+ sa.getString(com.android.internal.R.styleable.TrustAgent_summary);
+ trustAgentComponentInfo.title =
+ sa.getString(com.android.internal.R.styleable.TrustAgent_title);
+ cn = sa.getString(com.android.internal.R.styleable.TrustAgent_settingsActivity);
+ sa.recycle();
+ } catch (PackageManager.NameNotFoundException e) {
+ caughtException = e;
+ } catch (IOException e) {
+ caughtException = e;
+ } catch (XmlPullParserException e) {
+ caughtException = e;
+ } finally {
+ if (parser != null) parser.close();
+ }
+ if (caughtException != null) {
+ Slog.w(TAG, "Error parsing : " + resolveInfo.serviceInfo.packageName, caughtException);
+ return null;
+ }
+ if (cn != null && cn.indexOf('/') < 0) {
+ cn = resolveInfo.serviceInfo.packageName + "/" + cn;
+ }
+ trustAgentComponentInfo.componentName = (cn == null) ? null : ComponentName.unflattenFromString(cn);
+ return trustAgentComponentInfo;
+ }
+}
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 436b7bc..507445f 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -30,6 +30,7 @@
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.nfc.NfcAdapter;
+import android.nfc.NfcManager;
import android.os.Bundle;
import android.os.SystemProperties;
import android.os.UserHandle;
@@ -38,6 +39,7 @@
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceScreen;
+import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -48,11 +50,16 @@
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import com.android.settings.nfc.NfcEnabler;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
public class WirelessSettings extends RestrictedSettingsFragment
- implements OnPreferenceChangeListener {
+ implements OnPreferenceChangeListener, Indexable {
private static final String TAG = "WirelessSettings";
private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane";
@@ -273,7 +280,7 @@
Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
//enable/disable wimax depending on the value in config.xml
- boolean isWimaxEnabled = !isSecondaryUser && this.getResources().getBoolean(
+ final boolean isWimaxEnabled = !isSecondaryUser && this.getResources().getBoolean(
com.android.internal.R.bool.config_wimaxEnabled);
if (!isWimaxEnabled) {
PreferenceScreen root = getPreferenceScreen();
@@ -308,7 +315,7 @@
findPreference(KEY_ANDROID_BEAM_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
}
- // Remove NFC if its not available
+ // Remove NFC if not available
mNfcAdapter = NfcAdapter.getDefaultAdapter(activity);
if (mNfcAdapter == null) {
getPreferenceScreen().removePreference(nfc);
@@ -325,7 +332,7 @@
}
// Remove Mobile Network Settings and Manage Mobile Plan
// if config_show_mobile_plan sets false.
- boolean isMobilePlanEnabled = this.getResources().getBoolean(
+ final boolean isMobilePlanEnabled = this.getResources().getBoolean(
R.bool.config_show_mobile_plan);
if (!isMobilePlanEnabled) {
Preference pref = findPreference(KEY_MANAGE_MOBILE_PLAN);
@@ -346,14 +353,14 @@
// Enable Proxy selector settings if allowed.
Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS);
- DevicePolicyManager mDPM = (DevicePolicyManager)
+ final DevicePolicyManager mDPM = (DevicePolicyManager)
activity.getSystemService(Context.DEVICE_POLICY_SERVICE);
// proxy UI disabled until we have better app support
getPreferenceScreen().removePreference(mGlobalProxy);
mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null);
// Disable Tethering if it's not allowed or if it's a wifi-only device
- ConnectivityManager cm =
+ final ConnectivityManager cm =
(ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
if (isSecondaryUser || !cm.isTetheringSupported()
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {
@@ -450,4 +457,103 @@
}
return false;
}
+
+ /**
+ * For Search.
+ */
+ public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+ @Override
+ public List<SearchIndexableResource> getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+ SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.wireless_settings;
+ return Arrays.asList(sir);
+ }
+
+ @Override
+ public List<String> getNonIndexableKeys(Context context) {
+ final ArrayList<String> result = new ArrayList<String>();
+
+ result.add(KEY_TOGGLE_NSD);
+
+ final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER;
+ final boolean isWimaxEnabled = !isSecondaryUser && context.getResources().getBoolean(
+ com.android.internal.R.bool.config_wimaxEnabled);
+ if (!isWimaxEnabled) {
+ result.add(KEY_WIMAX_SETTINGS);
+ }
+
+ if (isSecondaryUser) { // Disable VPN
+ result.add(KEY_VPN_SETTINGS);
+ }
+
+ // Remove NFC if not available
+ final NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
+ if (manager != null) {
+ NfcAdapter adapter = manager.getDefaultAdapter();
+ if (adapter == null) {
+ result.add(KEY_TOGGLE_NFC);
+ result.add(KEY_ANDROID_BEAM_SETTINGS);
+ }
+ }
+
+ // Remove Mobile Network Settings and Manage Mobile Plan if it's a wifi-only device.
+ if (isSecondaryUser || Utils.isWifiOnly(context)) {
+ result.add(KEY_MOBILE_NETWORK_SETTINGS);
+ result.add(KEY_MANAGE_MOBILE_PLAN);
+ }
+
+ // Remove Mobile Network Settings and Manage Mobile Plan
+ // if config_show_mobile_plan sets false.
+ final boolean isMobilePlanEnabled = context.getResources().getBoolean(
+ R.bool.config_show_mobile_plan);
+ if (!isMobilePlanEnabled) {
+ result.add(KEY_MANAGE_MOBILE_PLAN);
+ }
+
+ // Remove SMS Application if the device does not support SMS
+ TelephonyManager tm =
+ (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+ if (!tm.isSmsCapable()) {
+ result.add(KEY_SMS_APPLICATION);
+ }
+
+ final PackageManager pm = context.getPackageManager();
+
+ // Remove Airplane Mode settings if it's a stationary device such as a TV.
+ if (pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
+ result.add(KEY_TOGGLE_AIRPLANE);
+ }
+
+ // proxy UI disabled until we have better app support
+ result.add(KEY_PROXY_SETTINGS);
+
+ // Disable Tethering if it's not allowed or if it's a wifi-only device
+ ConnectivityManager cm =
+ (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (isSecondaryUser || !cm.isTetheringSupported()) {
+ result.add(KEY_TETHER_SETTINGS);
+ }
+
+ // Enable link to CMAS app settings depending on the value in config.xml.
+ boolean isCellBroadcastAppLinkEnabled = context.getResources().getBoolean(
+ com.android.internal.R.bool.config_cellBroadcastAppLinks);
+ try {
+ if (isCellBroadcastAppLinkEnabled) {
+ if (pm.getApplicationEnabledSetting("com.android.cellbroadcastreceiver")
+ == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
+ isCellBroadcastAppLinkEnabled = false; // CMAS app disabled
+ }
+ }
+ } catch (IllegalArgumentException ignored) {
+ isCellBroadcastAppLinkEnabled = false; // CMAS app not installed
+ }
+ if (isSecondaryUser || !isCellBroadcastAppLinkEnabled) {
+ result.add(KEY_CELL_BROADCAST_SETTINGS);
+ }
+
+ return result;
+ }
+ };
}
diff --git a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
index 937f3b7..41c80ae 100644
--- a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
+++ b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
@@ -29,6 +29,7 @@
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnLayoutChangeListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.accessibility.CaptioningManager;
@@ -64,12 +65,15 @@
private static final String PREF_PRESET = "captioning_preset";
private static final String PREF_CUSTOM = "custom";
- private static final float DEFAULT_FONT_SIZE = 48f;
+ /** WebVtt specifies line height as 5.3% of the viewport height. */
+ private static final float LINE_HEIGHT_RATIO = 0.0533f;
private CaptioningManager mCaptioningManager;
private SubtitleView mPreviewText;
private View mPreviewWindow;
+ private View mPreviewViewport;
private SwitchBar mSwitchBar;
+ private ToggleSwitch mToggleSwitch;
// Standard options.
private LocalePreference mLocale;
@@ -129,11 +133,20 @@
mPreviewText = (SubtitleView) view.findViewById(R.id.preview_text);
mPreviewText.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
+ mPreviewWindow = view.findViewById(R.id.preview_window);
+ mPreviewViewport = view.findViewById(R.id.preview_viewport);
+ mPreviewViewport.addOnLayoutChangeListener(new OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ refreshPreviewText();
+ }
+ });
+
SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
- mSwitchBar.setSwitchChecked(enabled);
-
- mPreviewWindow = view.findViewById(R.id.preview_window);
+ mToggleSwitch = mSwitchBar.getSwitch();
+ mToggleSwitch.setCheckedInternal(enabled);
getPreferenceScreen().setEnabled(enabled);
@@ -162,7 +175,7 @@
final SubtitleView preview = mPreviewText;
if (preview != null) {
final int styleId = mCaptioningManager.getRawUserStyle();
- applyCaptionProperties(mCaptioningManager, preview, styleId);
+ applyCaptionProperties(mCaptioningManager, preview, mPreviewViewport, styleId);
final Locale locale = mCaptioningManager.getLocale();
if (locale != null) {
@@ -174,18 +187,29 @@
}
final CaptionStyle style = mCaptioningManager.getUserStyle();
- mPreviewWindow.setBackgroundColor(style.windowColor);
+ if (style.hasWindowColor()) {
+ mPreviewWindow.setBackgroundColor(style.windowColor);
+ } else {
+ final CaptionStyle defStyle = CaptionStyle.DEFAULT;
+ mPreviewWindow.setBackgroundColor(defStyle.windowColor);
+ }
}
}
- public static void applyCaptionProperties(
- CaptioningManager manager, SubtitleView previewText, int styleId) {
+ public static void applyCaptionProperties(CaptioningManager manager, SubtitleView previewText,
+ View previewWindow, int styleId) {
previewText.setStyle(styleId);
final Context context = previewText.getContext();
final ContentResolver cr = context.getContentResolver();
final float fontScale = manager.getFontScale();
- previewText.setTextSize(fontScale * DEFAULT_FONT_SIZE);
+ if (previewWindow != null) {
+ previewText.setTextSize(previewWindow.getHeight() * LINE_HEIGHT_RATIO * fontScale);
+ } else {
+ final float textSize = context.getResources().getDimension(
+ R.dimen.caption_preview_text_size);
+ previewText.setTextSize(textSize * fontScale);
+ }
final Locale locale = manager.getLocale();
if (locale != null) {
@@ -198,10 +222,10 @@
}
protected void onInstallSwitchBarToggleSwitch() {
- mSwitchBar.setSwitchOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
+ mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
@Override
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
- mSwitchBar.setSwitchChecked(checked);
+ toggleSwitch.setCheckedInternal(checked);
Settings.Secure.putInt(getActivity().getContentResolver(),
Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, checked ? 1 : 0);
getPreferenceScreen().setEnabled(checked);
@@ -220,7 +244,7 @@
private void removeSwitchBarToggleSwitch() {
mSwitchBar.hide();
- mSwitchBar.setSwitchOnBeforeCheckedChangeListener(null);
+ mToggleSwitch.setOnBeforeCheckedChangeListener(null);
}
private void initializeAllPreferences() {
@@ -339,7 +363,7 @@
final int opacityValue = opacity.getValue();
final int value;
if (Color.alpha(colorValue) == 0) {
- value = Color.alpha(opacityValue);
+ value = colorValue & 0x00FFFF00 | Color.alpha(opacityValue);
} else {
value = colorValue & 0x00FFFFFF | opacityValue & 0xFF000000;
}
diff --git a/src/com/android/settings/accessibility/ColorPreference.java b/src/com/android/settings/accessibility/ColorPreference.java
index f4a5ba7..39e555a 100644
--- a/src/com/android/settings/accessibility/ColorPreference.java
+++ b/src/com/android/settings/accessibility/ColorPreference.java
@@ -60,7 +60,7 @@
@Override
public boolean shouldDisableDependents() {
- return getValue() == Color.TRANSPARENT || super.shouldDisableDependents();
+ return Color.alpha(getValue()) == 0 || super.shouldDisableDependents();
}
@Override
diff --git a/src/com/android/settings/accessibility/PresetPreference.java b/src/com/android/settings/accessibility/PresetPreference.java
index 9f1aee3..fe5ca68 100644
--- a/src/com/android/settings/accessibility/PresetPreference.java
+++ b/src/com/android/settings/accessibility/PresetPreference.java
@@ -49,10 +49,11 @@
@Override
protected void onBindListItem(View view, int index) {
+ final View previewViewport = view.findViewById(R.id.preview_viewport);
final SubtitleView previewText = (SubtitleView) view.findViewById(R.id.preview);
final int value = getValueAt(index);
CaptionPropertiesFragment.applyCaptionProperties(
- mCaptioningManager, previewText, value);
+ mCaptioningManager, previewText, previewViewport, value);
final float density = getContext().getResources().getDisplayMetrics().density;
previewText.setTextSize(DEFAULT_FONT_SIZE * density);
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index d18c7f3..a446f49 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -58,7 +58,7 @@
String settingValue = Settings.Secure.getString(getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
final boolean enabled = settingValue.contains(mComponentName.flattenToString());
- mSwitchBar.setSwitchChecked(enabled);
+ mToggleSwitch.setCheckedInternal(enabled);
}
};
@@ -265,13 +265,13 @@
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
checked = (mShownDialogId == DIALOG_ID_ENABLE_WARNING);
- mSwitchBar.setSwitchChecked(checked);
+ mToggleSwitch.setCheckedInternal(checked);
getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, checked);
onPreferenceToggled(mPreferenceKey, checked);
break;
case DialogInterface.BUTTON_NEGATIVE:
checked = (mShownDialogId == DIALOG_ID_DISABLE_WARNING);
- mSwitchBar.setSwitchChecked(checked);
+ mToggleSwitch.setCheckedInternal(checked);
getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, checked);
onPreferenceToggled(mPreferenceKey, checked);
break;
@@ -283,15 +283,15 @@
@Override
protected void onInstallSwitchBarToggleSwitch() {
super.onInstallSwitchBarToggleSwitch();
- mSwitchBar.setSwitchOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
+ mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
@Override
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
if (checked) {
- mSwitchBar.setSwitchChecked(false);
+ toggleSwitch.setCheckedInternal(false);
getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, false);
showDialog(DIALOG_ID_ENABLE_WARNING);
} else {
- mSwitchBar.setSwitchChecked(true);
+ toggleSwitch.setCheckedInternal(true);
getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, true);
showDialog(DIALOG_ID_DISABLE_WARNING);
}
diff --git a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
index a39c5d8..54a34f2 100644
--- a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
@@ -17,7 +17,6 @@
package com.android.settings.accessibility;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.provider.Settings;
@@ -32,11 +31,8 @@
implements Preference.OnPreferenceChangeListener, SwitchBar.OnSwitchChangeListener {
private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED;
private static final String TYPE = Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER;
- private static final String QUICK_SETTING_ENABLED =
- Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_QUICK_SETTING_ENABLED;
private static final int DEFAULT_TYPE = AccessibilityManager.DALTONIZER_CORRECT_DEUTERANOMALY;
- private CheckBoxPreference mEnableQuickSetting;
private ListPreference mType;
@Override
@@ -45,7 +41,6 @@
addPreferencesFromResource(R.xml.accessibility_daltonizer_settings);
- mEnableQuickSetting = (CheckBoxPreference) findPreference("enable_quick_setting");
mType = (ListPreference) findPreference("type");
initPreferences();
@@ -58,10 +53,7 @@
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
- if (preference == mEnableQuickSetting) {
- Settings.Secure.putInt(
- getContentResolver(), QUICK_SETTING_ENABLED, ((Boolean) newValue) ? 1 : 0);
- } else if (preference == mType) {
+ if (preference == mType) {
Settings.Secure.putInt(getContentResolver(), TYPE, Integer.parseInt((String) newValue));
preference.setSummary("%s");
}
@@ -80,7 +72,7 @@
protected void onInstallSwitchBarToggleSwitch() {
super.onInstallSwitchBarToggleSwitch();
- mSwitchBar.setSwitchChecked(
+ mToggleSwitch.setCheckedInternal(
Settings.Secure.getInt(getContentResolver(), ENABLED, 0) == 1);
mSwitchBar.addOnSwitchChangeListener(this);
}
@@ -92,10 +84,6 @@
}
private void initPreferences() {
- mEnableQuickSetting.setChecked(
- Settings.Secure.getInt(getContentResolver(), QUICK_SETTING_ENABLED, 0) == 1);
- mEnableQuickSetting.setOnPreferenceChangeListener(this);
-
final String value = Integer.toString(
Settings.Secure.getInt(getContentResolver(), TYPE, DEFAULT_TYPE));
mType.setValue(value);
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index cc81289..331c0e3 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -40,6 +40,7 @@
extends SettingsPreferenceFragment {
protected SwitchBar mSwitchBar;
+ protected ToggleSwitch mToggleSwitch;
protected String mPreferenceKey;
protected Preference mSummaryPreference;
@@ -88,6 +89,7 @@
SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
+ mToggleSwitch = mSwitchBar.getSwitch();
onProcessArguments(getArguments());
}
@@ -130,7 +132,7 @@
}
private void removeActionBarToggleSwitch() {
- mSwitchBar.setSwitchOnBeforeCheckedChangeListener(null);
+ mToggleSwitch.setOnBeforeCheckedChangeListener(null);
onRemoveSwitchBarToggleSwitch();
mSwitchBar.hide();
}
@@ -151,7 +153,7 @@
// Enabled.
if (arguments.containsKey(AccessibilitySettings.EXTRA_CHECKED)) {
final boolean enabled = arguments.getBoolean(AccessibilitySettings.EXTRA_CHECKED);
- mSwitchBar.setSwitchChecked(enabled);
+ mToggleSwitch.setCheckedInternal(enabled);
}
// Title.
diff --git a/src/com/android/settings/accessibility/ToggleGlobalGesturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleGlobalGesturePreferenceFragment.java
index d815e50..782e7a5 100644
--- a/src/com/android/settings/accessibility/ToggleGlobalGesturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleGlobalGesturePreferenceFragment.java
@@ -32,10 +32,10 @@
@Override
protected void onInstallSwitchBarToggleSwitch() {
super.onInstallSwitchBarToggleSwitch();
- mSwitchBar.setSwitchOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
+ mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
@Override
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
- mSwitchBar.setSwitchChecked(checked);
+ toggleSwitch.setCheckedInternal(checked);
getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, checked);
onPreferenceToggled(mPreferenceKey, checked);
return false;
diff --git a/src/com/android/settings/accessibility/ToggleInversionPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleInversionPreferenceFragment.java
index 594ed22..b6d5569 100644
--- a/src/com/android/settings/accessibility/ToggleInversionPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleInversionPreferenceFragment.java
@@ -71,7 +71,7 @@
protected void onInstallSwitchBarToggleSwitch() {
super.onInstallSwitchBarToggleSwitch();
- mSwitchBar.setSwitchChecked(
+ mToggleSwitch.setCheckedInternal(
Settings.Secure.getInt(getContentResolver(), ENABLED, 0) == 1);
mSwitchBar.addOnSwitchChangeListener(this);
}
diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
index 7c01d0e..8202a2a 100644
--- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
@@ -32,10 +32,10 @@
@Override
protected void onInstallSwitchBarToggleSwitch() {
super.onInstallSwitchBarToggleSwitch();
- mSwitchBar.setSwitchOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
+ mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
@Override
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
- mSwitchBar.setSwitchChecked(checked);
+ toggleSwitch.setCheckedInternal(checked);
getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, checked);
onPreferenceToggled(mPreferenceKey, checked);
return false;
diff --git a/src/com/android/settings/accounts/AccountPreferenceBase.java b/src/com/android/settings/accounts/AccountPreferenceBase.java
index f533263..37dffca 100644
--- a/src/com/android/settings/accounts/AccountPreferenceBase.java
+++ b/src/com/android/settings/accounts/AccountPreferenceBase.java
@@ -22,6 +22,7 @@
import java.util.Map;
import com.android.settings.SettingsPreferenceFragment;
+
import com.google.android.collect.Maps;
import android.accounts.Account;
@@ -35,12 +36,14 @@
import android.content.SyncStatusObserver;
import android.content.pm.PackageManager;
import android.content.res.Resources;
+import android.content.res.Resources.Theme;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceScreen;
import android.text.format.DateFormat;
import android.util.Log;
+import android.view.ContextThemeWrapper;
class AccountPreferenceBase extends SettingsPreferenceFragment
implements OnAccountsUpdateListener {
@@ -147,8 +150,19 @@
try {
desc = mAuthenticatorHelper.getAccountTypeDescription(accountType);
if (desc != null && desc.accountPreferencesId != 0) {
- Context authContext = getActivity().createPackageContext(desc.packageName, 0);
- prefs = getPreferenceManager().inflateFromResource(authContext,
+ // Load the context of the target package, then apply the
+ // base Settings theme (no references to local resources)
+ // and create a context theme wrapper so that we get the
+ // correct text colors. Control colors will still be wrong,
+ // but there's not much we can do about it since we can't
+ // reference local color resources.
+ final Context targetCtx = getActivity().createPackageContext(
+ desc.packageName, 0);
+ final Theme baseTheme = getResources().newTheme();
+ baseTheme.applyStyle(com.android.settings.R.style.Theme_SettingsBase, true);
+ final Context themedCtx = new ContextThemeWrapper(targetCtx, 0);
+ themedCtx.getTheme().setTo(baseTheme);
+ prefs = getPreferenceManager().inflateFromResource(themedCtx,
desc.accountPreferencesId, parent);
}
} catch (PackageManager.NameNotFoundException e) {
diff --git a/src/com/android/settings/accounts/AccountSettings.java b/src/com/android/settings/accounts/AccountSettings.java
new file mode 100644
index 0000000..2477877
--- /dev/null
+++ b/src/com/android/settings/accounts/AccountSettings.java
@@ -0,0 +1,249 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.accounts;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.OnAccountsUpdateListener;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.UserManager;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceGroup;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * Settings screen for the account types on the device.
+ * This shows all account types available for personal and work profiles.
+ */
+public class AccountSettings extends SettingsPreferenceFragment
+ implements OnAccountsUpdateListener, OnPreferenceClickListener {
+ public static final String TAG = "AccountSettings";
+
+ private static final String KEY_ACCOUNT = "account";
+ private static final String KEY_ADD_ACCOUNT = "add_account";
+
+ private static final String KEY_CATEGORY_PERSONAL = "account_personal";
+ private static final String KEY_ADD_ACCOUNT_PERSONAL = "add_account_personal";
+ private static final String KEY_CATEGORY_WORK = "account_work";
+
+ private AuthenticatorHelper mAuthenticatorHelper;
+ private boolean mListeningToAccountUpdates;
+
+ private PreferenceGroup mAccountTypesForUser;
+ private Preference mAddAccountForUser;
+
+ private UserManager mUm;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mUm = (UserManager) getSystemService(Context.USER_SERVICE);
+
+ mAuthenticatorHelper = new AuthenticatorHelper();
+ mAuthenticatorHelper.updateAuthDescriptions(getActivity());
+ mAuthenticatorHelper.onAccountsUpdated(getActivity(), null);
+
+ // Load the preferences from an XML resource
+ addPreferencesFromResource(R.xml.account_settings);
+
+ if(mUm.isLinkedUser()) {
+ // Restricted user or similar
+ // TODO: Do we disallow modifying accounts for restricted profiles?
+ mAccountTypesForUser = (PreferenceGroup) findPreference(KEY_ACCOUNT);
+ if (mUm.hasUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS)) {
+ removePreference(KEY_ADD_ACCOUNT);
+ } else {
+ mAddAccountForUser = findPreference(KEY_ADD_ACCOUNT);
+ mAddAccountForUser.setOnPreferenceClickListener(this);
+ }
+ removePreference(KEY_CATEGORY_PERSONAL);
+ removePreference(KEY_CATEGORY_WORK);
+ } else {
+ mAccountTypesForUser = (PreferenceGroup) findPreference(KEY_CATEGORY_PERSONAL);
+ mAddAccountForUser = findPreference(KEY_ADD_ACCOUNT_PERSONAL);
+ mAddAccountForUser.setOnPreferenceClickListener(this);
+
+ // TODO: Show the work accounts also
+ // TODO: Handle the case where there is only one account
+ removePreference(KEY_CATEGORY_WORK);
+ removePreference(KEY_ADD_ACCOUNT);
+ }
+ updateAccountTypes(mAccountTypesForUser);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopListeningToAccountUpdates();
+ }
+
+ @Override
+ public void onAccountsUpdated(Account[] accounts) {
+ // TODO: watch for package upgrades to invalidate cache; see 7206643
+ mAuthenticatorHelper.updateAuthDescriptions(getActivity());
+ mAuthenticatorHelper.onAccountsUpdated(getActivity(), accounts);
+ listenToAccountUpdates();
+ updateAccountTypes(mAccountTypesForUser);
+ }
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ // Check the preference
+ if (preference == mAddAccountForUser) {
+ Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");
+ startActivity(intent);
+ return true;
+ }
+ return false;
+ }
+
+ private void updateAccountTypes(PreferenceGroup preferenceGroup) {
+ preferenceGroup.removeAll();
+ preferenceGroup.setOrderingAsAdded(true);
+ for (AccountPreference preference : getAccountTypePreferences()) {
+ preferenceGroup.addPreference(preference);
+ }
+ if (mAddAccountForUser != null) {
+ preferenceGroup.addPreference(mAddAccountForUser);
+ }
+ }
+
+ private List<AccountPreference> getAccountTypePreferences() {
+ String[] accountTypes = mAuthenticatorHelper.getEnabledAccountTypes();
+ List<AccountPreference> accountTypePreferences =
+ new ArrayList<AccountPreference>(accountTypes.length);
+ for (String accountType : accountTypes) {
+ CharSequence label = mAuthenticatorHelper.getLabelForType(getActivity(), accountType);
+ if (label == null) {
+ continue;
+ }
+
+ Account[] accounts = AccountManager.get(getActivity()).getAccountsByType(accountType);
+ boolean skipToAccount = accounts.length == 1
+ && !mAuthenticatorHelper.hasAccountPreferences(accountType);
+
+ if (skipToAccount) {
+ Bundle fragmentArguments = new Bundle();
+ fragmentArguments.putParcelable(AccountSyncSettings.ACCOUNT_KEY,
+ accounts[0]);
+
+ accountTypePreferences.add(new AccountPreference(
+ getActivity(),
+ label,
+ accountType,
+ AccountSyncSettings.class.getName(),
+ fragmentArguments));
+ } else {
+ Bundle fragmentArguments = new Bundle();
+ fragmentArguments.putString(ManageAccountsSettings.KEY_ACCOUNT_TYPE, accountType);
+ fragmentArguments.putString(ManageAccountsSettings.KEY_ACCOUNT_LABEL,
+ label.toString());
+
+ accountTypePreferences.add(new AccountPreference(
+ getActivity(),
+ label,
+ accountType,
+ ManageAccountsSettings.class.getName(),
+ fragmentArguments));
+ }
+ mAuthenticatorHelper.preloadDrawableForType(getActivity(), accountType);
+ }
+ // Sort by label
+ Collections.sort(accountTypePreferences, new Comparator<AccountPreference>() {
+ @Override
+ public int compare(AccountPreference t1, AccountPreference t2) {
+ return t1.mTitle.toString().compareTo(t2.mTitle.toString());
+ }
+ });
+ return accountTypePreferences;
+ }
+
+ private void listenToAccountUpdates() {
+ if (!mListeningToAccountUpdates) {
+ AccountManager.get(getActivity()).addOnAccountsUpdatedListener(this, null, true);
+ mListeningToAccountUpdates = true;
+ }
+ }
+
+ private void stopListeningToAccountUpdates() {
+ if (mListeningToAccountUpdates) {
+ AccountManager.get(getActivity()).removeOnAccountsUpdatedListener(this);
+ mListeningToAccountUpdates = false;
+ }
+ }
+
+ private class AccountPreference extends Preference implements OnPreferenceClickListener {
+ /**
+ * Title of the tile that is shown to the user.
+ * @attr ref android.R.styleable#PreferenceHeader_title
+ */
+ private final CharSequence mTitle;
+
+ /**
+ * Full class name of the fragment to display when this tile is
+ * selected.
+ * @attr ref android.R.styleable#PreferenceHeader_fragment
+ */
+ private final String mFragment;
+
+ /**
+ * Optional arguments to supply to the fragment when it is
+ * instantiated.
+ */
+ private final Bundle mFragmentArguments;
+
+
+ public AccountPreference(Context context, CharSequence title,
+ String accountType, String fragment, Bundle fragmentArguments) {
+ super(context);
+ mTitle = title;
+ mFragment = fragment;
+ mFragmentArguments = fragmentArguments;
+ setWidgetLayoutResource(R.layout.account_type_preference);
+
+ Drawable drawable = mAuthenticatorHelper.getDrawableForType(context, accountType);
+ setTitle(title);
+ setIcon(drawable);
+
+ setOnPreferenceClickListener(this);
+ }
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ if (mFragment != null) {
+ Utils.startWithFragment(
+ getContext(), mFragment, mFragmentArguments, null, 0, mTitle);
+ return true;
+ }
+ return false;
+ }
+ }
+ // TODO Implement a {@link SearchIndexProvider} to allow Indexing and Search of account types
+ // See http://b/15403806
+}
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index 4626ed4..be03b63 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -40,6 +40,7 @@
*/
public final class BluetoothEnabler implements SwitchBar.OnSwitchChangeListener {
private Context mContext;
+ private Switch mSwitch;
private SwitchBar mSwitchBar;
private boolean mValidListener;
private final LocalBluetoothAdapter mLocalAdapter;
@@ -74,13 +75,14 @@
public BluetoothEnabler(Context context, SwitchBar switchBar) {
mContext = context;
mSwitchBar = switchBar;
+ mSwitch = switchBar.getSwitch();
mValidListener = false;
LocalBluetoothManager manager = LocalBluetoothManager.getInstance(context);
if (manager == null) {
// Bluetooth is not supported
mLocalAdapter = null;
- mSwitchBar.setSwitchEnabled(false);
+ mSwitch.setEnabled(false);
} else {
mLocalAdapter = manager.getBluetoothAdapter();
}
@@ -89,7 +91,7 @@
public void resume(Context context) {
if (mLocalAdapter == null) {
- mSwitchBar.setSwitchEnabled(false);
+ mSwitch.setEnabled(false);
return;
}
@@ -120,36 +122,36 @@
void handleStateChanged(int state) {
switch (state) {
case BluetoothAdapter.STATE_TURNING_ON:
- mSwitchBar.setSwitchEnabled(false);
+ mSwitch.setEnabled(false);
break;
case BluetoothAdapter.STATE_ON:
setChecked(true);
- mSwitchBar.setSwitchEnabled(true);
+ mSwitch.setEnabled(true);
updateSearchIndex(true);
break;
case BluetoothAdapter.STATE_TURNING_OFF:
- mSwitchBar.setSwitchEnabled(false);
+ mSwitch.setEnabled(false);
break;
case BluetoothAdapter.STATE_OFF:
setChecked(false);
- mSwitchBar.setSwitchEnabled(true);
+ mSwitch.setEnabled(true);
updateSearchIndex(false);
break;
default:
setChecked(false);
- mSwitchBar.setSwitchEnabled(true);
+ mSwitch.setEnabled(true);
updateSearchIndex(false);
}
}
private void setChecked(boolean isChecked) {
- if (isChecked != mSwitchBar.isSwitchChecked()) {
+ if (isChecked != mSwitch.isChecked()) {
// set listener to null, so onCheckedChanged won't be called
// if the checked status on Switch isn't changed by user click
if (mValidListener) {
mSwitchBar.removeOnSwitchChangeListener(this);
}
- mSwitchBar.setSwitchChecked(isChecked);
+ mSwitch.setChecked(isChecked);
if (mValidListener) {
mSwitchBar.addOnSwitchChangeListener(this);
}
@@ -178,6 +180,6 @@
if (mLocalAdapter != null) {
mLocalAdapter.setBluetoothEnabled(isChecked);
}
- mSwitchBar.setSwitchEnabled(false);
+ mSwitch.setEnabled(false);
}
}
diff --git a/src/com/android/settings/dashboard/SearchResultsSummary.java b/src/com/android/settings/dashboard/SearchResultsSummary.java
index 1bd0bf0..910d661 100644
--- a/src/com/android/settings/dashboard/SearchResultsSummary.java
+++ b/src/com/android/settings/dashboard/SearchResultsSummary.java
@@ -572,7 +572,6 @@
View view;
TextView textTitle;
- TextView textSummary;
ImageView imageView;
if (convertView == null) {
@@ -580,35 +579,13 @@
} else {
view = convertView;
}
+
textTitle = (TextView) view.findViewById(R.id.title);
- textSummary = (TextView) view.findViewById(R.id.summary);
imageView = (ImageView) view.findViewById(R.id.icon);
- SearchResult result = (SearchResult) getItem(position);
-
+ final SearchResult result = (SearchResult) getItem(position);
textTitle.setText(result.title);
- String summaryOn = result.summaryOn;
- String entries = result.entries;
-
- final StringBuilder sb = new StringBuilder();
-
- if (!TextUtils.isEmpty(summaryOn) &&
- !summaryOn.contains(PERCENT_RECLACE) && !summaryOn.contains(DOLLAR_REPLACE)) {
- sb.append(summaryOn);
- sb.append(ELLIPSIS);
- } else if (!TextUtils.isEmpty(entries)) {
- final int index = entries.indexOf(Index.ENTRIES_SEPARATOR);
- if (index > 0) {
- final String firstEntriesValue = entries.substring(0, index);
- sb.append(firstEntriesValue);
- } else {
- sb.append(entries);
- }
- sb.append(ELLIPSIS);
- }
- textSummary.setText(sb.toString());
-
if (result.iconResId != R.drawable.empty_icon) {
final Context packageContext = result.context;
final Drawable drawable;
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
index 47e887a..4c6a503 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
@@ -117,9 +117,6 @@
static final int SERIF = 2;
static final int MONOSPACE = 3;
- static final int BATTERY_WARN = 29;
- static final int BATTERY_CRITICAL = 14;
-
// First value if for phone off; first value is "scanning"; following values
// are battery stats signal strength buckets.
static final int NUM_PHONE_SIGNALS = 7;
@@ -167,7 +164,13 @@
String mWifiRunningLabel;
String mCpuRunningLabel;
String mPhoneSignalLabel;
-
+
+ int mChartMinHeight;
+ int mHeaderHeight;
+
+ int mBatteryWarnLevel;
+ int mBatteryCriticalLevel;
+
int mTextAscent;
int mTextDescent;
int mHeaderTextAscent;
@@ -352,19 +355,24 @@
public BatteryHistoryChart(Context context, AttributeSet attrs) {
super(context, attrs);
-
+
+ mBatteryWarnLevel = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_lowBatteryWarningLevel);
+ mBatteryCriticalLevel = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_criticalBatteryWarningLevel);
+
mThinLineWidth = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
2, getResources().getDisplayMetrics());
- mBatteryBackgroundPaint.setColor(0xff263238);
+ mBatteryBackgroundPaint.setColor(0xFF009688);
mBatteryBackgroundPaint.setStyle(Paint.Style.FILL);
- mBatteryGoodPaint.setARGB(128, 0, 255, 0);
+ mBatteryGoodPaint.setARGB(128, 0, 128, 0);
mBatteryGoodPaint.setStyle(Paint.Style.STROKE);
- mBatteryWarnPaint.setARGB(128, 255, 255, 0);
+ mBatteryWarnPaint.setARGB(128, 128, 128, 0);
mBatteryWarnPaint.setStyle(Paint.Style.STROKE);
- mBatteryCriticalPaint.setARGB(192, 255, 0, 0);
+ mBatteryCriticalPaint.setARGB(192, 128, 0, 0);
mBatteryCriticalPaint.setStyle(Paint.Style.STROKE);
- mTimeRemainPaint.setColor(0xffA5B1B7);
+ mTimeRemainPaint.setColor(0xFFCED7BB);
mTimeRemainPaint.setStyle(Paint.Style.FILL);
mChargingPaint.setARGB(255, 0, 128, 0);
mChargingPaint.setStyle(Paint.Style.STROKE);
@@ -431,6 +439,18 @@
mainTextAttrs.styleIndex = a.getInt(attr, mainTextAttrs.styleIndex);
headTextAttrs.styleIndex = a.getInt(attr, headTextAttrs.styleIndex);
break;
+
+ case R.styleable.BatteryHistoryChart_barPrimaryColor:
+ mBatteryBackgroundPaint.setColor(a.getInt(attr, 0));
+ break;
+
+ case R.styleable.BatteryHistoryChart_barPredictionColor:
+ mTimeRemainPaint.setColor(a.getInt(attr, 0));
+ break;
+
+ case R.styleable.BatteryHistoryChart_chartMinHeight:
+ mChartMinHeight = a.getDimensionPixelSize(attr, 0);
+ break;
}
}
@@ -502,8 +522,19 @@
remainingTimeUs = chargeTime;
String timeString = Formatter.formatShortElapsedTime(getContext(),
chargeTime / 1000);
+ int plugType = mBatteryBroadcast.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);
+ int resId;
+ if (plugType == BatteryManager.BATTERY_PLUGGED_AC) {
+ resId = R.string.power_charging_duration_ac;
+ } else if (plugType == BatteryManager.BATTERY_PLUGGED_USB) {
+ resId = R.string.power_charging_duration_usb;
+ } else if (plugType == BatteryManager.BATTERY_PLUGGED_WIRELESS) {
+ resId = R.string.power_charging_duration_wireless;
+ } else {
+ resId = R.string.power_charging_duration;
+ }
mChargeLabelString = getContext().getResources().getString(
- R.string.power_charging_duration, batteryLevel, statusLabel, timeString);
+ resId, batteryLevel, timeString);
} else {
mChargeLabelString = getContext().getResources().getString(
R.string.power_charging, batteryLevel, statusLabel);
@@ -562,19 +593,12 @@
mHavePhoneSignal = true;
}
if (mHistEnd <= mHistStart) mHistEnd = mHistStart+1;
-
- //String durationString = Utils.formatElapsedTime(getContext(), mStatsPeriod / 1000, true);
- //mDurationString = getContext().getString(R.string.battery_stats_on_battery,
- // durationString);
- mDurationString = Utils.formatElapsedTime(getContext(), mHistEnd - mHistStart, true);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mMaxPercentLabelStringWidth = (int)mTextPaint.measureText(mMaxPercentLabelString);
mMinPercentLabelStringWidth = (int)mTextPaint.measureText(mMinPercentLabelString);
- mDurationStringWidth = (int)mTextPaint.measureText(mDurationString);
mDrainStringWidth = (int)mHeaderTextPaint.measureText(mDrainString);
mChargeLabelStringWidth = (int)mHeaderTextPaint.measureText(mChargeLabelString);
mChargeDurationStringWidth = (int)mHeaderTextPaint.measureText(mChargeDurationString);
@@ -582,6 +606,10 @@
mTextDescent = (int)mTextPaint.descent();
mHeaderTextAscent = (int)mHeaderTextPaint.ascent();
mHeaderTextDescent = (int)mHeaderTextPaint.descent();
+ int headerTextHeight = mHeaderTextDescent - mHeaderTextAscent;
+ mHeaderHeight = headerTextHeight*2 - mTextAscent;
+ setMeasuredDimension(getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec),
+ getDefaultSize(mChartMinHeight+mHeaderHeight, heightMeasureSpec));
}
void finishPaths(int w, int h, int levelh, int startX, int y, Path curLevelPath,
@@ -669,8 +697,7 @@
mLastHeight = h;
int textHeight = mTextDescent - mTextAscent;
- int headerTextHeight = mHeaderTextDescent - mHeaderTextAscent;
- if (h > (textHeight*12)) {
+ if (h > ((textHeight*10)+mChartMinHeight)) {
mLargeMode = true;
if (h > (textHeight*15)) {
// Plenty of room for the chart.
@@ -693,7 +720,7 @@
}
if (mLineWidth <= 0) mLineWidth = 1;
- mLevelTop = headerTextHeight*2 - mTextAscent;
+ mLevelTop = mHeaderHeight;
mLevelLeft = mMaxPercentLabelStringWidth + mThinLineWidth*3;
mLevelRight = w;
int levelWidth = mLevelRight-mLevelLeft;
@@ -798,17 +825,19 @@
// Don't plot changes within a pixel.
Path path;
byte value = rec.batteryLevel;
- if (value <= BATTERY_CRITICAL) path = mBatCriticalPath;
- else if (value <= BATTERY_WARN) path = mBatWarnPath;
- else path = mBatGoodPath;
+ if (value <= mBatteryCriticalLevel) path = mBatCriticalPath;
+ else if (value <= mBatteryWarnLevel) path = mBatWarnPath;
+ else path = null; //mBatGoodPath;
if (path != lastLinePath) {
if (lastLinePath != null) {
lastLinePath.lineTo(x, y);
}
- path.moveTo(x, y);
+ if (path != null) {
+ path.moveTo(x, y);
+ }
lastLinePath = path;
- } else {
+ } else if (path != null) {
path.lineTo(x, y);
}
@@ -937,54 +966,67 @@
mTimeRemainPath.close();
}
- // Create the time labels at the bottom.
- boolean is24hr = is24Hour();
- Calendar calStart = Calendar.getInstance();
- calStart.setTimeInMillis(mStartWallTime);
- calStart.set(Calendar.MILLISECOND, 0);
- calStart.set(Calendar.SECOND, 0);
- calStart.set(Calendar.MINUTE, 0);
- long startRoundTime = calStart.getTimeInMillis();
- if (startRoundTime < mStartWallTime) {
- calStart.set(Calendar.HOUR_OF_DAY, calStart.get(Calendar.HOUR_OF_DAY)+1);
- startRoundTime = calStart.getTimeInMillis();
- }
- Calendar calEnd = Calendar.getInstance();
- calEnd.setTimeInMillis(mEndWallTime);
- calEnd.set(Calendar.MILLISECOND, 0);
- calEnd.set(Calendar.SECOND, 0);
- calEnd.set(Calendar.MINUTE, 0);
- long endRoundTime = calEnd.getTimeInMillis();
- if (startRoundTime < endRoundTime) {
- addTimeLabel(calStart, mLevelLeft, mLevelRight, is24hr);
- Calendar calMid = Calendar.getInstance();
- calMid.setTimeInMillis(mStartWallTime+((mEndWallTime-mStartWallTime)/2));
- calMid.set(Calendar.MILLISECOND, 0);
- calMid.set(Calendar.SECOND, 0);
- calMid.set(Calendar.MINUTE, 0);
- long calMidMillis = calMid.getTimeInMillis();
- if (calMidMillis > startRoundTime && calMidMillis < endRoundTime) {
- addTimeLabel(calMid, mLevelLeft, mLevelRight, is24hr);
- }
- addTimeLabel(calEnd, mLevelLeft, mLevelRight, is24hr);
- }
-
- // Create the date labels if the chart includes multiple days
- if (calStart.get(Calendar.DAY_OF_YEAR) != calEnd.get(Calendar.DAY_OF_YEAR) ||
- calStart.get(Calendar.YEAR) != calEnd.get(Calendar.YEAR)) {
- boolean isDayFirst = isDayFirst();
- calStart.set(Calendar.HOUR_OF_DAY, 0);
- startRoundTime = calStart.getTimeInMillis();
+ if (mStartWallTime > 0) {
+ // Create the time labels at the bottom.
+ boolean is24hr = is24Hour();
+ Calendar calStart = Calendar.getInstance();
+ calStart.setTimeInMillis(mStartWallTime);
+ calStart.set(Calendar.MILLISECOND, 0);
+ calStart.set(Calendar.SECOND, 0);
+ calStart.set(Calendar.MINUTE, 0);
+ long startRoundTime = calStart.getTimeInMillis();
if (startRoundTime < mStartWallTime) {
- calStart.set(Calendar.DAY_OF_YEAR, calStart.get(Calendar.DAY_OF_YEAR) + 1);
+ calStart.set(Calendar.HOUR_OF_DAY, calStart.get(Calendar.HOUR_OF_DAY)+1);
startRoundTime = calStart.getTimeInMillis();
}
- calEnd.set(Calendar.HOUR_OF_DAY, 0);
- endRoundTime = calEnd.getTimeInMillis();
+ Calendar calEnd = Calendar.getInstance();
+ calEnd.setTimeInMillis(mEndWallTime);
+ calEnd.set(Calendar.MILLISECOND, 0);
+ calEnd.set(Calendar.SECOND, 0);
+ calEnd.set(Calendar.MINUTE, 0);
+ long endRoundTime = calEnd.getTimeInMillis();
if (startRoundTime < endRoundTime) {
- addDateLabel(calStart, mLevelLeft, mLevelRight, isDayFirst);
+ addTimeLabel(calStart, mLevelLeft, mLevelRight, is24hr);
+ Calendar calMid = Calendar.getInstance();
+ calMid.setTimeInMillis(mStartWallTime+((mEndWallTime-mStartWallTime)/2));
+ calMid.set(Calendar.MILLISECOND, 0);
+ calMid.set(Calendar.SECOND, 0);
+ calMid.set(Calendar.MINUTE, 0);
+ long calMidMillis = calMid.getTimeInMillis();
+ if (calMidMillis > startRoundTime && calMidMillis < endRoundTime) {
+ addTimeLabel(calMid, mLevelLeft, mLevelRight, is24hr);
+ }
+ addTimeLabel(calEnd, mLevelLeft, mLevelRight, is24hr);
}
- addDateLabel(calEnd, mLevelLeft, mLevelRight, isDayFirst);
+
+ // Create the date labels if the chart includes multiple days
+ if (calStart.get(Calendar.DAY_OF_YEAR) != calEnd.get(Calendar.DAY_OF_YEAR) ||
+ calStart.get(Calendar.YEAR) != calEnd.get(Calendar.YEAR)) {
+ boolean isDayFirst = isDayFirst();
+ calStart.set(Calendar.HOUR_OF_DAY, 0);
+ startRoundTime = calStart.getTimeInMillis();
+ if (startRoundTime < mStartWallTime) {
+ calStart.set(Calendar.DAY_OF_YEAR, calStart.get(Calendar.DAY_OF_YEAR) + 1);
+ startRoundTime = calStart.getTimeInMillis();
+ }
+ calEnd.set(Calendar.HOUR_OF_DAY, 0);
+ endRoundTime = calEnd.getTimeInMillis();
+ if (startRoundTime < endRoundTime) {
+ addDateLabel(calStart, mLevelLeft, mLevelRight, isDayFirst);
+ }
+ addDateLabel(calEnd, mLevelLeft, mLevelRight, isDayFirst);
+ }
+ }
+
+ if (mTimeLabels.size() < 2) {
+ // If there are fewer than 2 time labels, then they are useless. Just
+ // show an axis label giving the entire duration.
+ mDurationString = Formatter.formatShortElapsedTime(getContext(),
+ mEndWallTime - mStartWallTime);
+ mDurationStringWidth = (int)mTextPaint.measureText(mDurationString);
+ } else {
+ mDurationString = null;
+ mDurationStringWidth = 0;
}
}
@@ -1031,9 +1073,7 @@
if (DEBUG) Log.d(TAG, "Drawing time remain path.");
canvas.drawPath(mTimeRemainPath, mTimeRemainPaint);
}
- int durationHalfWidth = mDurationStringWidth / 2;
- if (layoutRtl) durationHalfWidth = -durationHalfWidth;
- if (mTimeLabels.size() > 0) {
+ if (mTimeLabels.size() > 1) {
int y = mLevelBottom - mTextAscent + (mThinLineWidth*4);
int ytick = mLevelBottom+mThinLineWidth+(mThinLineWidth/2);
mTextPaint.setTextAlign(Paint.Align.LEFT);
@@ -1072,31 +1112,24 @@
canvas.drawLine(label.x, ytick, label.x, ytick+mThinLineWidth, mTextPaint);
}
}
- }
-
- if (false) {
- // Old code for printing label.
- mTextPaint.setTextAlign(textAlignLeft);
- if (mLargeMode) {
- canvas.drawText(mDurationString, (width / 2) - durationHalfWidth,
- mLevelBottom - mTextAscent + mThinLineWidth, mTextPaint);
- } else {
- canvas.drawText(mDurationString, (width / 2) - durationHalfWidth,
- mLevelTop + ((height-mLevelTop) / 2) - ((mTextDescent - mTextAscent) / 2)
- - mTextAscent, mTextPaint);
- }
+ } else if (mDurationString != null) {
+ int y = mLevelBottom - mTextAscent + (mThinLineWidth*4);
+ mTextPaint.setTextAlign(Paint.Align.LEFT);
+ canvas.drawText(mDurationString,
+ mLevelLeft + (mLevelRight-mLevelLeft)/2 - mDurationStringWidth/2,
+ y, mTextPaint);
}
int headerTop = -mHeaderTextAscent + (mHeaderTextDescent-mHeaderTextAscent)/3;
mHeaderTextPaint.setTextAlign(textAlignLeft);
if (DEBUG) Log.d(TAG, "Drawing charge label string: " + mChargeLabelString);
canvas.drawText(mChargeLabelString, textStartX, headerTop, mHeaderTextPaint);
- durationHalfWidth = mChargeDurationStringWidth / 2;
- if (layoutRtl) durationHalfWidth = -durationHalfWidth;
+ int stringHalfWidth = mChargeDurationStringWidth / 2;
+ if (layoutRtl) stringHalfWidth = -stringHalfWidth;
int headerCenter = ((width-mChargeDurationStringWidth-mDrainStringWidth)/2)
+ (layoutRtl ? mDrainStringWidth : mChargeLabelStringWidth);
if (DEBUG) Log.d(TAG, "Drawing charge duration string: " + mChargeDurationString);
- canvas.drawText(mChargeDurationString, headerCenter - durationHalfWidth, headerTop,
+ canvas.drawText(mChargeDurationString, headerCenter - stringHalfWidth, headerTop,
mHeaderTextPaint);
mHeaderTextPaint.setTextAlign(textAlignRight);
if (DEBUG) Log.d(TAG, "Drawing drain string: " + mDrainString);
@@ -1181,7 +1214,7 @@
canvas.drawText(mMinPercentLabelString,
mMaxPercentLabelStringWidth-mMinPercentLabelStringWidth,
mLevelBottom - mThinLineWidth, mTextPaint);
- canvas.drawLine(0, mLevelBottom+mThinLineWidth, width,
+ canvas.drawLine(mLevelLeft/2, mLevelBottom+mThinLineWidth, width,
mLevelBottom+mThinLineWidth, mTextPaint);
if (mDateLabels.size() > 0) {
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java b/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java
index 0cbb9b7..248d471 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java
@@ -48,7 +48,7 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.preference_batteryhistory, null);
+ View view = inflater.inflate(R.layout.battery_history_chart, null);
BatteryHistoryChart chart = (BatteryHistoryChart)view.findViewById(
R.id.battery_history_chart);
chart.setStats(mStats, mBatteryBroadcast);
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java b/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
index bdea852..fd7d87a 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
@@ -37,6 +37,9 @@
final private BatteryStats mStats;
final private Intent mBatteryBroadcast;
+ private boolean mHideLabels;
+ private View mLabelHeader;
+
public BatteryHistoryPreference(Context context, BatteryStats stats, Intent batteryBroadcast) {
super(context);
setLayoutResource(R.layout.preference_batteryhistory);
@@ -48,6 +51,15 @@
return mStats;
}
+ public void setHideLabels(boolean hide) {
+ if (mHideLabels != hide) {
+ mHideLabels = hide;
+ if (mLabelHeader != null) {
+ mLabelHeader.setVisibility(hide ? View.GONE : View.VISIBLE);
+ }
+ }
+ }
+
@Override
protected void onBindView(View view) {
super.onBindView(view);
@@ -55,5 +67,7 @@
BatteryHistoryChart chart = (BatteryHistoryChart)view.findViewById(
R.id.battery_history_chart);
chart.setStats(mStats, mBatteryBroadcast);
+ mLabelHeader = view.findViewById(R.id.labelsHeader);
+ mLabelHeader.setVisibility(mHideLabels ? View.GONE : View.VISIBLE);
}
}
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index e00e20b..e4e2b0a 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -64,6 +64,7 @@
private UserManager mUm;
+ private BatteryHistoryPreference mHistPref;
private PreferenceGroup mAppListGroup;
private String mBatteryLevel;
private String mBatteryStatus;
@@ -210,6 +211,7 @@
private void addNotAvailableMessage() {
Preference notAvailable = new Preference(getActivity());
notAvailable.setTitle(R.string.power_usage_not_available);
+ mHistPref.setHideLabels(true);
mAppListGroup.addPreference(notAvailable);
}
@@ -233,16 +235,17 @@
mStatsHelper.refreshStats(BatteryStats.STATS_SINCE_CHARGED, UserHandle.myUserId());
- BatteryHistoryPreference hist = new BatteryHistoryPreference(
+ mHistPref = new BatteryHistoryPreference(
getActivity(), mStatsHelper.getStats(), mStatsHelper.getBatteryBroadcast());
- hist.setOrder(-1);
- mAppListGroup.addPreference(hist);
+ mHistPref.setOrder(-1);
+ mAppListGroup.addPreference(mHistPref);
if (mStatsHelper.getPowerProfile().getAveragePower(
PowerProfile.POWER_SCREEN_FULL) < 10) {
addNotAvailableMessage();
return;
}
+ boolean addedSome = false;
final int dischargeAmount = mStatsHelper.getStats().getDischargeAmount(mStatsType);
List<BatterySipper> usageList = mStatsHelper.getUsageList();
for (int i=0; i<usageList.size(); i++) {
@@ -263,9 +266,13 @@
if (sipper.uidObj != null) {
pref.setKey(Integer.toString(sipper.uidObj.getUid()));
}
+ addedSome = true;
mAppListGroup.addPreference(pref);
if (mAppListGroup.getPreferenceCount() > (MAX_ITEMS_TO_LIST+1)) break;
}
+ if (!addedSome) {
+ addNotAvailableMessage();
+ }
BatteryEntry.startRequestQueue();
}
diff --git a/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java b/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
index d81703e..638818a 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
@@ -146,7 +146,9 @@
// should not insert, because either A. the word exists with no shortcut, in which
// case the exact same thing we want to insert is already there, or B. the word
// exists with at least one shortcut, in which case it has priority on our word.
- if (hasWord(newWord, context)) return UserDictionaryAddWordActivity.CODE_ALREADY_PRESENT;
+ if (TextUtils.isEmpty(newShortcut) && hasWord(newWord, context)) {
+ return UserDictionaryAddWordActivity.CODE_ALREADY_PRESENT;
+ }
// Disallow duplicates. If the same word with no shortcut is defined, remove it; if
// the same word with the same shortcut is defined, remove it; but we don't mind if
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index 6eabf36..8794a8d 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -53,6 +53,7 @@
private static final String KEY_LOCATION_SERVICES = "location_services";
private SwitchBar mSwitchBar;
+ private Switch mSwitch;
private boolean mValidListener;
private Preference mLocationMode;
private PreferenceCategory mCategoryRecentLocationRequests;
@@ -71,6 +72,7 @@
final SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
+ mSwitch = mSwitchBar.getSwitch();
}
@Override
@@ -219,16 +221,16 @@
// corner cases, the location might still be enabled. In such case the master switch should
// be disabled but checked.
boolean enabled = (mode != android.provider.Settings.Secure.LOCATION_MODE_OFF);
- mSwitchBar.setSwitchEnabled(!restricted);
+ mSwitch.setEnabled(!restricted);
mLocationMode.setEnabled(enabled && !restricted);
mCategoryRecentLocationRequests.setEnabled(enabled);
- if (enabled != mSwitchBar.isSwitchChecked()) {
+ if (enabled != mSwitch.isChecked()) {
// set listener to null so that that code below doesn't trigger onCheckedChanged()
if (mValidListener) {
mSwitchBar.removeOnSwitchChangeListener(this);
}
- mSwitchBar.setSwitchChecked(enabled);
+ mSwitch.setChecked(enabled);
if (mValidListener) {
mSwitchBar.addOnSwitchChangeListener(this);
}
diff --git a/src/com/android/settings/nfc/AndroidBeam.java b/src/com/android/settings/nfc/AndroidBeam.java
index b63a975..eb3ff9b 100644
--- a/src/com/android/settings/nfc/AndroidBeam.java
+++ b/src/com/android/settings/nfc/AndroidBeam.java
@@ -33,6 +33,7 @@
private View mView;
private NfcAdapter mNfcAdapter;
private SwitchBar mSwitchBar;
+ private Switch mSwitch;
private CharSequence mOldActivityTitle;
@Override
@@ -62,7 +63,8 @@
SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
- mSwitchBar.setSwitchChecked(mNfcAdapter.isNdefPushEnabled());
+ mSwitch = mSwitchBar.getSwitch();
+ mSwitch.setChecked(mNfcAdapter.isNdefPushEnabled());
}
@Override
@@ -92,15 +94,15 @@
@Override
public void onSwitchChanged(Switch switchView, boolean desiredState) {
boolean success = false;
- mSwitchBar.setSwitchEnabled(false);
+ mSwitch.setEnabled(false);
if (desiredState) {
success = mNfcAdapter.enableNdefPush();
} else {
success = mNfcAdapter.disableNdefPush();
}
if (success) {
- mSwitchBar.setSwitchChecked(desiredState);
+ mSwitch.setChecked(desiredState);
}
- mSwitchBar.setSwitchEnabled(true);
+ mSwitch.setEnabled(true);
}
}
diff --git a/src/com/android/settings/notification/NotificationSettings.java b/src/com/android/settings/notification/NotificationSettings.java
index e32419d..8caa420 100644
--- a/src/com/android/settings/notification/NotificationSettings.java
+++ b/src/com/android/settings/notification/NotificationSettings.java
@@ -23,6 +23,8 @@
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.database.ContentObserver;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteException;
import android.media.AudioManager;
import android.media.RingtoneManager;
import android.net.Uri;
@@ -36,16 +38,15 @@
import android.preference.PreferenceScreen;
import android.preference.SeekBarVolumizer;
import android.preference.TwoStatePreference;
+import android.provider.MediaStore;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.SoundSettings;
import com.android.settings.Utils;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
-import com.android.settings.search.Indexable.SearchIndexProvider;
import java.util.ArrayList;
import java.util.Arrays;
@@ -201,14 +202,14 @@
@Override
public void run() {
if (mPhoneRingtonePreference != null) {
- final CharSequence summary = SoundSettings.updateRingtoneName(
+ final CharSequence summary = updateRingtoneName(
mContext, RingtoneManager.TYPE_RINGTONE);
if (summary != null) {
mHandler.obtainMessage(H.UPDATE_PHONE_RINGTONE, summary).sendToTarget();
}
}
if (mNotificationRingtonePreference != null) {
- final CharSequence summary = SoundSettings.updateRingtoneName(
+ final CharSequence summary = updateRingtoneName(
mContext, RingtoneManager.TYPE_NOTIFICATION);
if (summary != null) {
mHandler.obtainMessage(H.UPDATE_NOTIFICATION_RINGTONE, summary).sendToTarget();
@@ -217,6 +218,35 @@
}
};
+ private static CharSequence updateRingtoneName(Context context, int type) {
+ if (context == null) return null;
+ Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type);
+ CharSequence summary = context.getString(com.android.internal.R.string.ringtone_unknown);
+ // Is it a silent ringtone?
+ if (ringtoneUri == null) {
+ summary = context.getString(com.android.internal.R.string.ringtone_silent);
+ } else {
+ // Fetch the ringtone title from the media provider
+ Cursor cursor = null;
+ try {
+ cursor = context.getContentResolver().query(ringtoneUri,
+ new String[] { MediaStore.Audio.Media.TITLE }, null, null, null);
+ if (cursor != null) {
+ if (cursor.moveToFirst()) {
+ summary = cursor.getString(0);
+ }
+ }
+ } catch (SQLiteException sqle) {
+ // Unknown title for the ringtone
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ }
+ return summary;
+ }
+
// === Vibrate when ringing ===
private void initVibrateWhenRinging(PreferenceScreen root) {
diff --git a/src/com/android/settings/notification/OtherSoundSettings.java b/src/com/android/settings/notification/OtherSoundSettings.java
new file mode 100644
index 0000000..de5c917
--- /dev/null
+++ b/src/com/android/settings/notification/OtherSoundSettings.java
@@ -0,0 +1,242 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.notification;
+
+import static com.android.settings.notification.SettingPref.TYPE_GLOBAL;
+import static com.android.settings.notification.SettingPref.TYPE_SYSTEM;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.ContentObserver;
+import android.media.AudioManager;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Vibrator;
+import android.provider.SearchIndexableResource;
+import android.provider.Settings.Global;
+import android.provider.Settings.System;
+import android.telephony.TelephonyManager;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class OtherSoundSettings extends SettingsPreferenceFragment implements Indexable {
+ private static final String TAG = "OtherSoundSettings";
+
+ private static final int DEFAULT_ON = 1;
+
+ private static final int EMERGENCY_TONE_SILENT = 0;
+ private static final int EMERGENCY_TONE_ALERT = 1;
+ private static final int EMERGENCY_TONE_VIBRATE = 2;
+ private static final int DEFAULT_EMERGENCY_TONE = EMERGENCY_TONE_SILENT;
+
+ private static final int DOCK_AUDIO_MEDIA_DISABLED = 0;
+ private static final int DOCK_AUDIO_MEDIA_ENABLED = 1;
+ private static final int DEFAULT_DOCK_AUDIO_MEDIA = DOCK_AUDIO_MEDIA_DISABLED;
+
+ private static final String KEY_DIAL_PAD_TONES = "dial_pad_tones";
+ private static final String KEY_SCREEN_LOCKING_SOUNDS = "screen_locking_sounds";
+ private static final String KEY_DOCKING_SOUNDS = "docking_sounds";
+ private static final String KEY_TOUCH_SOUNDS = "touch_sounds";
+ private static final String KEY_VIBRATE_ON_TOUCH = "vibrate_on_touch";
+ private static final String KEY_DOCK_AUDIO_MEDIA = "dock_audio_media";
+ private static final String KEY_EMERGENCY_TONE = "emergency_tone";
+
+ private static final SettingPref PREF_DIAL_PAD_TONES = new SettingPref(
+ TYPE_SYSTEM, KEY_DIAL_PAD_TONES, System.DTMF_TONE_WHEN_DIALING, DEFAULT_ON) {
+ @Override
+ public boolean isApplicable(Context context) {
+ return Utils.isVoiceCapable(context);
+ }
+ };
+
+ private static final SettingPref PREF_SCREEN_LOCKING_SOUNDS = new SettingPref(
+ TYPE_SYSTEM, KEY_SCREEN_LOCKING_SOUNDS, System.LOCKSCREEN_SOUNDS_ENABLED, DEFAULT_ON);
+
+ private static final SettingPref PREF_DOCKING_SOUNDS = new SettingPref(
+ TYPE_GLOBAL, KEY_DOCKING_SOUNDS, Global.DOCK_SOUNDS_ENABLED, DEFAULT_ON) {
+ @Override
+ public boolean isApplicable(Context context) {
+ return hasDockSettings(context);
+ }
+ };
+
+ private static final SettingPref PREF_TOUCH_SOUNDS = new SettingPref(
+ TYPE_SYSTEM, KEY_TOUCH_SOUNDS, System.SOUND_EFFECTS_ENABLED, DEFAULT_ON) {
+ @Override
+ protected boolean setSetting(Context context, int value) {
+ final AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+ if (value != 0) {
+ am.loadSoundEffects();
+ } else {
+ am.unloadSoundEffects();
+ }
+ return super.setSetting(context, value);
+ }
+ };
+
+ private static final SettingPref PREF_VIBRATE_ON_TOUCH = new SettingPref(
+ TYPE_SYSTEM, KEY_VIBRATE_ON_TOUCH, System.HAPTIC_FEEDBACK_ENABLED, DEFAULT_ON) {
+ @Override
+ public boolean isApplicable(Context context) {
+ return hasHaptic(context);
+ }
+ };
+
+ private static final SettingPref PREF_DOCK_AUDIO_MEDIA = new SettingPref(
+ TYPE_GLOBAL, KEY_DOCK_AUDIO_MEDIA, Global.DOCK_AUDIO_MEDIA_ENABLED,
+ DEFAULT_DOCK_AUDIO_MEDIA, DOCK_AUDIO_MEDIA_DISABLED, DOCK_AUDIO_MEDIA_ENABLED) {
+ @Override
+ public boolean isApplicable(Context context) {
+ return hasDockSettings(context);
+ }
+
+ @Override
+ protected int getResId(Context context, int value) {
+ if (value == DOCK_AUDIO_MEDIA_DISABLED) return R.string.dock_audio_media_disabled;
+ if (value == DOCK_AUDIO_MEDIA_ENABLED) return R.string.dock_audio_media_enabled;
+ throw new IllegalArgumentException();
+ }
+ };
+
+ private static final SettingPref PREF_EMERGENCY_TONE = new SettingPref(
+ TYPE_GLOBAL, KEY_EMERGENCY_TONE, Global.EMERGENCY_TONE, DEFAULT_EMERGENCY_TONE,
+ EMERGENCY_TONE_ALERT, EMERGENCY_TONE_VIBRATE, EMERGENCY_TONE_SILENT) {
+ @Override
+ public boolean isApplicable(Context context) {
+ final int activePhoneType = TelephonyManager.getDefault().getCurrentPhoneType();
+ return activePhoneType == TelephonyManager.PHONE_TYPE_CDMA;
+ }
+
+ @Override
+ protected int getResId(Context context, int value) {
+ if (value == EMERGENCY_TONE_SILENT) return R.string.emergency_tone_silent;
+ if (value == EMERGENCY_TONE_ALERT) return R.string.emergency_tone_alert;
+ if (value == EMERGENCY_TONE_VIBRATE) return R.string.emergency_tone_vibrate;
+ throw new IllegalArgumentException();
+ }
+ };
+
+ private static final SettingPref[] PREFS = {
+ PREF_DIAL_PAD_TONES,
+ PREF_SCREEN_LOCKING_SOUNDS,
+ PREF_DOCKING_SOUNDS,
+ PREF_TOUCH_SOUNDS,
+ PREF_VIBRATE_ON_TOUCH,
+ PREF_DOCK_AUDIO_MEDIA,
+ PREF_EMERGENCY_TONE,
+ };
+
+ private final SettingsObserver mSettingsObserver = new SettingsObserver();
+
+ private Context mContext;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.other_sound_settings);
+
+ mContext = getActivity();
+
+ for (SettingPref pref : PREFS) {
+ pref.init(this);
+ }
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ mSettingsObserver.register(true);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ mSettingsObserver.register(false);
+ }
+
+ private static boolean hasDockSettings(Context context) {
+ return context.getResources().getBoolean(R.bool.has_dock_settings);
+ }
+
+ private static boolean hasHaptic(Context context) {
+ final Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
+ return vibrator != null && vibrator.hasVibrator();
+ }
+
+ // === Callbacks ===
+
+ private final class SettingsObserver extends ContentObserver {
+ public SettingsObserver() {
+ super(new Handler());
+ }
+
+ public void register(boolean register) {
+ final ContentResolver cr = getContentResolver();
+ if (register) {
+ for (SettingPref pref : PREFS) {
+ cr.registerContentObserver(pref.getUri(), false, this);
+ }
+ } else {
+ cr.unregisterContentObserver(this);
+ }
+ }
+
+ @Override
+ public void onChange(boolean selfChange, Uri uri) {
+ super.onChange(selfChange, uri);
+ for (SettingPref pref : PREFS) {
+ if (pref.getUri().equals(uri)) {
+ pref.update(mContext);
+ return;
+ }
+ }
+ }
+ }
+
+ // === Indexing ===
+
+ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+
+ public List<SearchIndexableResource> getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+ final SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.other_sound_settings;
+ return Arrays.asList(sir);
+ }
+
+ public List<String> getNonIndexableKeys(Context context) {
+ final ArrayList<String> rt = new ArrayList<String>();
+ for (SettingPref pref : PREFS) {
+ if (!pref.isApplicable(context)) {
+ rt.add(pref.getKey());
+ }
+ }
+ return rt;
+ }
+ };
+}
diff --git a/src/com/android/settings/notification/SettingPref.java b/src/com/android/settings/notification/SettingPref.java
new file mode 100644
index 0000000..1e50e2b
--- /dev/null
+++ b/src/com/android/settings/notification/SettingPref.java
@@ -0,0 +1,146 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.notification;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.net.Uri;
+import android.preference.Preference;
+import android.preference.TwoStatePreference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.provider.Settings.Global;
+import android.provider.Settings.System;
+
+import com.android.settings.SettingsPreferenceFragment;
+
+/** Helper to manage a two-state or dropdown preference bound to a global or system setting. */
+public class SettingPref {
+ public static final int TYPE_GLOBAL = 1;
+ public static final int TYPE_SYSTEM = 2;
+
+ private final int mType;
+ private final String mKey;
+ private final String mSetting;
+ private final int mDefault;
+ private final int[] mValues;
+ private final Uri mUri;
+
+ private TwoStatePreference mTwoState;
+ private DropDownPreference mDropDown;
+
+ public SettingPref(int type, String key, String setting, int def, int... values) {
+ mType = type;
+ mKey = key;
+ mSetting = setting;
+ mDefault = def;
+ mValues = values;
+ mUri = getUriFor(mType, mSetting);
+ }
+
+ public boolean isApplicable(Context context) {
+ return true;
+ }
+
+ protected int getResId(Context context, int value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void init(SettingsPreferenceFragment settings) {
+ final Context context = settings.getActivity();
+ Preference p = settings.getPreferenceScreen().findPreference(mKey);
+ if (p != null && !isApplicable(context)) {
+ settings.getPreferenceScreen().removePreference(p);
+ p = null;
+ }
+ if (p instanceof TwoStatePreference) {
+ mTwoState = (TwoStatePreference) p;
+ } else if (p instanceof DropDownPreference) {
+ mDropDown = (DropDownPreference) p;
+ for (int value : mValues) {
+ mDropDown.addItem(getResId(context, value), value);
+ }
+ }
+ update(context);
+ if (mTwoState != null) {
+ p.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ setSetting(context, (Boolean) newValue ? 1 : 0);
+ return true;
+ }
+ });
+ } else if (mDropDown != null) {
+ mDropDown.setCallback(new DropDownPreference.Callback() {
+ @Override
+ public boolean onItemSelected(int pos, Object value) {
+ return setSetting(context, (Integer) value);
+ }
+ });
+ }
+ }
+
+ protected boolean setSetting(Context context, int value) {
+ return putInt(mType, context.getContentResolver(), mSetting, value);
+ }
+
+ public Uri getUri() {
+ return mUri;
+ }
+
+ public String getKey() {
+ return mKey;
+ }
+
+ public void update(Context context) {
+ final int val = getInt(mType, context.getContentResolver(), mSetting, mDefault);
+ if (mTwoState != null) {
+ mTwoState.setChecked(val != 0);
+ } else if (mDropDown != null) {
+ mDropDown.setSelectedValue(val);
+ }
+ }
+
+ private static Uri getUriFor(int type, String setting) {
+ switch(type) {
+ case TYPE_GLOBAL:
+ return Global.getUriFor(setting);
+ case TYPE_SYSTEM:
+ return System.getUriFor(setting);
+ }
+ throw new IllegalArgumentException();
+ }
+
+ private static boolean putInt(int type, ContentResolver cr, String setting, int value) {
+ switch(type) {
+ case TYPE_GLOBAL:
+ return Global.putInt(cr, setting, value);
+ case TYPE_SYSTEM:
+ return System.putInt(cr, setting, value);
+ }
+ throw new IllegalArgumentException();
+ }
+
+ private static int getInt(int type, ContentResolver cr, String setting, int def) {
+ switch(type) {
+ case TYPE_GLOBAL:
+ return Global.getInt(cr, setting, def);
+ case TYPE_SYSTEM:
+ return System.getInt(cr, setting, def);
+ }
+ throw new IllegalArgumentException();
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/notification/TouchSoundSettings.java b/src/com/android/settings/notification/TouchSoundSettings.java
deleted file mode 100644
index 2d7149e..0000000
--- a/src/com/android/settings/notification/TouchSoundSettings.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.settings.notification;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.database.ContentObserver;
-import android.media.AudioManager;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Vibrator;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.TwoStatePreference;
-import android.provider.Settings.System;
-
-import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.Utils;
-
-public class TouchSoundSettings extends SettingsPreferenceFragment {
- private static final String TAG = "TouchSoundSettings";
-
- private static final String KEY_DIAL_PAD_TONES = "dial_pad_tones";
- private static final String KEY_SCREEN_LOCKING_SOUNDS = "screen_locking_sounds";
- private static final String KEY_OTHER_TOUCH_SOUNDS = "other_touch_sounds";
- private static final String KEY_VIBRATE_ON_TOUCH = "vibrate_on_touch";
-
- private final Handler mHandler = new Handler();
- private final SettingsObserver mSettingsObserver = new SettingsObserver();
-
- private AudioManager mAudioManager;
- private SystemSettingPref mDialPadTones;
- private SystemSettingPref mScreenLockingSounds;
- private SystemSettingPref mOtherTouchSounds;
- private SystemSettingPref mVibrateOnTouch;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- addPreferencesFromResource(R.xml.touch_sound_settings);
-
- mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-
- final boolean hasVoice = Utils.isVoiceCapable(getActivity());
- final Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
- final boolean hasHaptic = vibrator != null && vibrator.hasVibrator();
-
- mDialPadTones = new SystemSettingPref(hasVoice,
- KEY_DIAL_PAD_TONES, System.DTMF_TONE_WHEN_DIALING);
-
- mScreenLockingSounds = new SystemSettingPref(true,
- KEY_SCREEN_LOCKING_SOUNDS, System.LOCKSCREEN_SOUNDS_ENABLED);
-
- mOtherTouchSounds = new SystemSettingPref(true,
- KEY_OTHER_TOUCH_SOUNDS,System.SOUND_EFFECTS_ENABLED) {
- @Override
- protected void setSetting(boolean value) {
- if (value) {
- mAudioManager.loadSoundEffects();
- } else {
- mAudioManager.unloadSoundEffects();
- }
- super.setSetting(value);
- }
- };
-
- mVibrateOnTouch = new SystemSettingPref(hasHaptic,
- KEY_VIBRATE_ON_TOUCH, System.HAPTIC_FEEDBACK_ENABLED);
- }
-
- @Override
- public void onResume() {
- super.onResume();
- mSettingsObserver.register(true);
- }
-
- @Override
- public void onPause() {
- super.onPause();
- mSettingsObserver.register(false);
- }
-
- // === Common system setting preference helper ===
-
- private class SystemSettingPref {
- private final String mSetting;
- private final Uri mUri;
-
- private TwoStatePreference mPref;
-
- private SystemSettingPref(boolean applicable, String key, String setting) {
- mSetting = setting;
- mUri = System.getUriFor(mSetting);
- if (!applicable) removePreference(key);
- mPref = (TwoStatePreference) getPreferenceScreen().findPreference(key);
- if (mPref == null) return;
- update();
- mPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- setSetting((Boolean)newValue);
- return true;
- }
- });
- }
-
- protected void setSetting(boolean value) {
- System.putInt(getContentResolver(), mSetting, value ? 1 : 0);
- }
-
- private Uri getUri() {
- return mUri;
- }
-
- private void update() {
- if (mPref == null) return;
- mPref.setChecked(System.getInt(getContentResolver(), mSetting, 1) != 0);
- }
- }
-
- // === Callbacks ===
-
- private final class SettingsObserver extends ContentObserver {
- public SettingsObserver() {
- super(mHandler);
- }
-
- public void register(boolean register) {
- final ContentResolver cr = getContentResolver();
- if (register) {
- cr.registerContentObserver(mDialPadTones.getUri(), false, this);
- cr.registerContentObserver(mScreenLockingSounds.getUri(), false, this);
- cr.registerContentObserver(mOtherTouchSounds.getUri(), false, this);
- cr.registerContentObserver(mVibrateOnTouch.getUri(), false, this);
- } else {
- cr.unregisterContentObserver(this);
- }
- }
-
- @Override
- public void onChange(boolean selfChange, Uri uri) {
- super.onChange(selfChange, uri);
- if (mDialPadTones.getUri().equals(uri)) {
- mDialPadTones.update();
- }
- if (mScreenLockingSounds.getUri().equals(uri)) {
- mScreenLockingSounds.update();
- }
- if (mOtherTouchSounds.getUri().equals(uri)) {
- mOtherTouchSounds.update();
- }
- if (mVibrateOnTouch.getUri().equals(uri)) {
- mVibrateOnTouch.update();
- }
- }
- }
-}
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index 7b7c9ee..e9323d8 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -70,10 +70,12 @@
SwitchBar.OnSwitchChangeListener {
private static final String TAG = "ZenModeSettings";
private static final boolean DEBUG = true;
+ private static final boolean SHOW_CONDITION_DIALOG = false;
private static final String KEY_GENERAL = "general";
private static final String KEY_CALLS = "phone_calls";
private static final String KEY_MESSAGES = "messages";
+ private static final String KEY_STARRED = "starred";
private static final String KEY_AUTOMATIC = "automatic";
private static final String KEY_WHEN = "when";
@@ -91,6 +93,7 @@
rt.put(R.string.zen_mode_phone_calls, KEY_CALLS);
}
rt.put(R.string.zen_mode_messages, KEY_MESSAGES);
+ rt.put(R.string.zen_mode_from_starred, KEY_STARRED);
rt.put(R.string.zen_mode_automatic_category, KEY_AUTOMATIC);
rt.put(R.string.zen_mode_when, KEY_WHEN);
rt.put(R.string.zen_mode_start_time, KEY_START_TIME);
@@ -104,6 +107,7 @@
private final SettingsObserver mSettingsObserver = new SettingsObserver();
private SwitchBar mSwitchBar;
+ private Switch mSwitch;
private Context mContext;
private PackageManager mPM;
private ZenModeConfig mConfig;
@@ -133,7 +137,7 @@
final int v = isChecked ? Global.ZEN_MODE_ON : Global.ZEN_MODE_OFF;
putZenModeSetting(v);
final int n = ConditionProviderSettings.getEnabledProviderCount(mContext);
- if (n > 0) {
+ if (SHOW_CONDITION_DIALOG && n > 0) {
mHandler.post(isChecked ? mShowDialog : mHideDialog);
}
}
@@ -155,6 +159,7 @@
if (DEBUG) Log.d(TAG, "Loaded mConfig=" + mConfig);
mSwitchBar = ((SettingsActivity) mContext).getSwitchBar();
+ mSwitch = mSwitchBar.getSwitch();
final PreferenceCategory general = (PreferenceCategory) root.findPreference(KEY_GENERAL);
@@ -192,12 +197,25 @@
});
mStarred = new DropDownPreference(mContext);
- mStarred.setEnabled(false);
+ mStarred.setKey(KEY_STARRED);
mStarred.setTitle(R.string.zen_mode_from);
mStarred.setDropDownWidth(R.dimen.zen_mode_dropdown_width);
- mStarred.addItem(R.string.zen_mode_from_anyone, null);
- mStarred.addItem(R.string.zen_mode_from_starred, null);
- mStarred.addItem(R.string.zen_mode_from_contacts, null);
+ mStarred.addItem(R.string.zen_mode_from_anyone, ZenModeConfig.SOURCE_ANYONE);
+ mStarred.addItem(R.string.zen_mode_from_starred, ZenModeConfig.SOURCE_STAR);
+ mStarred.addItem(R.string.zen_mode_from_contacts, ZenModeConfig.SOURCE_CONTACT);
+ mStarred.setCallback(new DropDownPreference.Callback() {
+ @Override
+ public boolean onItemSelected(int pos, Object newValue) {
+ if (mDisableListeners) return true;
+ final int val = (Integer) newValue;
+ if (val == mConfig.allowFrom) return true;
+ if (DEBUG) Log.d(TAG, "onPrefChange allowFrom=" +
+ ZenModeConfig.sourceToString(val));
+ final ZenModeConfig newConfig = mConfig.copy();
+ newConfig.allowFrom = val;
+ return setZenModeConfig(newConfig);
+ }
+ });
general.addPreference(mStarred);
final Preference alarmInfo = new Preference(mContext) {
@@ -264,7 +282,6 @@
mEnd = new TimePickerPreference(mContext, mgr);
mEnd.setKey(KEY_END_TIME);
mEnd.setTitle(R.string.zen_mode_end_time);
- mEnd.setSummaryFormat(R.string.zen_mode_end_time_summary_format);
mEnd.setCallback(new TimePickerPreference.Callback() {
@Override
public boolean onSetTime(int hour, int minute) {
@@ -309,18 +326,26 @@
updateControls();
}
+ private void updateEndSummary() {
+ final int startMin = 60 * mConfig.sleepStartHour + mConfig.sleepStartMinute;
+ final int endMin = 60 * mConfig.sleepEndHour + mConfig.sleepEndMinute;
+ final boolean nextDay = startMin >= endMin;
+ mEnd.setSummaryFormat(nextDay ? R.string.zen_mode_end_time_summary_format : 0);
+ }
+
private void updateControls() {
mDisableListeners = true;
if (mCalls != null) {
mCalls.setChecked(mConfig.allowCalls);
}
mMessages.setChecked(mConfig.allowMessages);
- mStarred.setSelectedItem(0);
+ mStarred.setSelectedValue(mConfig.allowFrom);
mWhen.setSelectedValue(mConfig.sleepMode);
mStart.setTime(mConfig.sleepStartHour, mConfig.sleepStartMinute);
mEnd.setTime(mConfig.sleepEndHour, mConfig.sleepEndMinute);
mDisableListeners = false;
refreshAutomationSection();
+ updateEndSummary();
}
private void refreshAutomationSection() {
@@ -390,8 +415,8 @@
private void updateZenMode() {
final boolean zenMode = Global.getInt(getContentResolver(),
Global.ZEN_MODE, Global.ZEN_MODE_OFF) != Global.ZEN_MODE_OFF;
- if (mSwitchBar.isSwitchChecked() != zenMode) {
- mSwitchBar.setSwitchChecked(zenMode);
+ if (mSwitch.isChecked() != zenMode) {
+ mSwitch.setChecked(zenMode);
mIgnoreNext = true;
}
}
@@ -423,6 +448,7 @@
if (success) {
mConfig = config;
if (DEBUG) Log.d(TAG, "Saved mConfig=" + mConfig);
+ updateEndSummary();
}
return success;
} catch (Exception e) {
diff --git a/src/com/android/settings/print/PrintServiceSettingsFragment.java b/src/com/android/settings/print/PrintServiceSettingsFragment.java
index c1ebcb9..9a991dd 100644
--- a/src/com/android/settings/print/PrintServiceSettingsFragment.java
+++ b/src/com/android/settings/print/PrintServiceSettingsFragment.java
@@ -112,6 +112,7 @@
};
private SwitchBar mSwitchBar;
+ private ToggleSwitch mToggleSwitch;
private String mPreferenceKey;
@@ -208,13 +209,13 @@
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
checked = true;
- mSwitchBar.setSwitchChecked(checked);
+ mToggleSwitch.setCheckedInternal(checked);
getArguments().putBoolean(PrintSettingsFragment.EXTRA_CHECKED, checked);
onPreferenceToggled(mPreferenceKey, checked);
break;
case DialogInterface.BUTTON_NEGATIVE:
checked = false;
- mSwitchBar.setSwitchChecked(checked);
+ mToggleSwitch.setCheckedInternal(checked);
getArguments().putBoolean(PrintSettingsFragment.EXTRA_CHECKED, checked);
onPreferenceToggled(mPreferenceKey, checked);
break;
@@ -227,7 +228,7 @@
ListView listView = getListView();
ViewGroup contentRoot = (ViewGroup) listView.getParent();
View emptyView = listView.getEmptyView();
- if (!mSwitchBar.isSwitchChecked()) {
+ if (!mToggleSwitch.isChecked()) {
if (emptyView != null && emptyView.getId() != R.id.empty_print_state) {
contentRoot.removeView(emptyView);
emptyView = null;
@@ -276,10 +277,10 @@
List<ComponentName> services = PrintSettingsUtils.readEnabledPrintServices(getActivity());
mServiceEnabled = services.contains(mComponentName);
if (mServiceEnabled) {
- mSwitchBar.setSwitchChecked(true);
+ mToggleSwitch.setCheckedInternal(true);
mPrintersAdapter.enable();
} else {
- mSwitchBar.setSwitchChecked(false);
+ mToggleSwitch.setCheckedInternal(false);
mPrintersAdapter.disable();
}
getActivity().invalidateOptionsMenu();
@@ -292,12 +293,14 @@
final SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
- mSwitchBar.setSwitchOnBeforeCheckedChangeListener(new ToggleSwitch.OnBeforeCheckedChangeListener() {
+
+ mToggleSwitch = mSwitchBar.getSwitch();
+ mToggleSwitch.setOnBeforeCheckedChangeListener(new ToggleSwitch.OnBeforeCheckedChangeListener() {
@Override
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
if (checked) {
if (!TextUtils.isEmpty(mEnableWarningMessage)) {
- mSwitchBar.setSwitchChecked(false);
+ toggleSwitch.setCheckedInternal(false);
getArguments().putBoolean(PrintSettingsFragment.EXTRA_CHECKED, false);
showDialog(DIALOG_ID_ENABLE_WARNING);
return true;
@@ -328,7 +331,7 @@
// Enabled.
final boolean enabled = arguments.getBoolean(PrintSettingsFragment.EXTRA_CHECKED);
- mSwitchBar.setSwitchChecked(enabled);
+ mToggleSwitch.setCheckedInternal(enabled);
// Settings title and intent.
String settingsTitle = arguments.getString(PrintSettingsFragment.EXTRA_SETTINGS_TITLE);
@@ -737,7 +740,7 @@
}
});
}
- mDiscoverySession.startPrinterDisovery(null);
+ mDiscoverySession.startPrinterDiscovery(null);
}
}
}
diff --git a/src/com/android/settings/print/PrintSettingsFragment.java b/src/com/android/settings/print/PrintSettingsFragment.java
index 3f7362c..f512db5 100644
--- a/src/com/android/settings/print/PrintSettingsFragment.java
+++ b/src/com/android/settings/print/PrintSettingsFragment.java
@@ -154,7 +154,7 @@
Settings.Secure.PRINT_SERVICE_SEARCH_URI);
if (!TextUtils.isEmpty(searchUri)) {
MenuItem menuItem = menu.add(R.string.print_menu_item_add_service);
- menuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ menuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_NEVER);
menuItem.setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(searchUri)));
}
}
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java
index adddb39..9723fbf 100644
--- a/src/com/android/settings/search/Index.java
+++ b/src/com/android/settings/search/Index.java
@@ -45,6 +45,7 @@
import java.io.IOException;
import java.lang.reflect.Field;
+import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -54,6 +55,7 @@
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.regex.Pattern;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_NON_INDEXABLE_KEYS_KEY_VALUE;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_RANK;
@@ -137,6 +139,8 @@
// Max number of proposed suggestions
private static final int MAX_PROPOSED_SUGGESTIONS = 5;
+ private static final String BASE_AUTHORITY = "com.android.settings";
+
private static final String EMPTY = "";
private static final String NON_BREAKING_HYPHEN = "\u2011";
private static final String HYPHEN = "-";
@@ -150,11 +154,15 @@
private static final List<String> EMPTY_LIST = Collections.<String>emptyList();
-
private static Index sInstance;
+
+ private static final Pattern REMOVE_DIACRITICALS_PATTERN
+ = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
+
private final AtomicBoolean mIsAvailable = new AtomicBoolean(false);
private final UpdateData mDataToProcess = new UpdateData();
private Context mContext;
+ private final String mBaseAuthority;
/**
* A private class to describe the update data for the Index database
@@ -185,15 +193,16 @@
*/
public static Index getInstance(Context context) {
if (sInstance == null) {
- sInstance = new Index(context);
+ sInstance = new Index(context, BASE_AUTHORITY);
} else {
sInstance.setContext(context);
}
return sInstance;
}
- public Index(Context context) {
+ public Index(Context context, String baseAuthority) {
mContext = context;
+ mBaseAuthority = baseAuthority;
}
public void setContext(Context context) {
@@ -279,15 +288,18 @@
private boolean addIndexablesFromRemoteProvider(String packageName, String authority) {
try {
- final Context packageContext = mContext.createPackageContext(packageName, 0);
+ final int baseRank = Ranking.getBaseRankForAuthority(authority);
+
+ final Context context = mBaseAuthority.equals(authority) ?
+ mContext : mContext.createPackageContext(packageName, 0);
final Uri uriForResources = buildUriForXmlResources(authority);
- addIndexablesForXmlResourceUri(packageContext, packageName, uriForResources,
- SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS);
+ addIndexablesForXmlResourceUri(context, packageName, uriForResources,
+ SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS, baseRank);
final Uri uriForRawData = buildUriForRawData(authority);
- addIndexablesForRawDataUri(packageContext, packageName, uriForRawData,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS);
+ addIndexablesForRawDataUri(context, packageName, uriForRawData,
+ SearchIndexablesContract.INDEXABLES_RAW_COLUMNS, baseRank);
return true;
} catch (PackageManager.NameNotFoundException e) {
Log.w(LOG_TAG, "Could not create context for " + packageName + ": "
@@ -496,7 +508,7 @@
}
private void addIndexablesForXmlResourceUri(Context packageContext, String packageName,
- Uri uri, String[] projection) {
+ Uri uri, String[] projection, int baseRank) {
final ContentResolver resolver = packageContext.getContentResolver();
final Cursor cursor = resolver.query(uri, projection, null, null, null);
@@ -510,7 +522,9 @@
final int count = cursor.getCount();
if (count > 0) {
while (cursor.moveToNext()) {
- final int rank = cursor.getInt(COLUMN_INDEX_XML_RES_RANK);
+ final int providerRank = cursor.getInt(COLUMN_INDEX_XML_RES_RANK);
+ final int rank = (providerRank > 0) ? baseRank + providerRank : baseRank;
+
final int xmlResId = cursor.getInt(COLUMN_INDEX_XML_RES_RESID);
final String className = cursor.getString(COLUMN_INDEX_XML_RES_CLASS_NAME);
@@ -541,7 +555,7 @@
}
private void addIndexablesForRawDataUri(Context packageContext, String packageName,
- Uri uri, String[] projection) {
+ Uri uri, String[] projection, int baseRank) {
final ContentResolver resolver = packageContext.getContentResolver();
final Cursor cursor = resolver.query(uri, projection, null, null, null);
@@ -555,7 +569,9 @@
final int count = cursor.getCount();
if (count > 0) {
while (cursor.moveToNext()) {
- final int rank = cursor.getInt(COLUMN_INDEX_RAW_RANK);
+ final int providerRank = cursor.getInt(COLUMN_INDEX_RAW_RANK);
+ final int rank = (providerRank > 0) ? baseRank + providerRank : baseRank;
+
final String title = cursor.getString(COLUMN_INDEX_RAW_TITLE);
final String summaryOn = cursor.getString(COLUMN_INDEX_RAW_SUMMARY_ON);
final String summaryOff = cursor.getString(COLUMN_INDEX_RAW_SUMMARY_OFF);
@@ -914,31 +930,13 @@
String intentAction, String intentTargetPackage, String intentTargetClass,
boolean enabled, String key) {
- String updatedTitle;
- if (title != null) {
- updatedTitle = title.replaceAll(NON_BREAKING_HYPHEN, HYPHEN);
- }
- else {
- updatedTitle = EMPTY;
- }
+ final String updatedTitle = normalizeHyphen(title);
+ final String updatedSummaryOn = normalizeHyphen(summaryOn);
+ final String updatedSummaryOff = normalizeHyphen(summaryOff);
- String updatedSummaryOn;
- if (summaryOn != null) {
- updatedSummaryOn = summaryOn.replaceAll(NON_BREAKING_HYPHEN, HYPHEN);
- } else {
- updatedSummaryOn = EMPTY;
- }
-
- String updatedSummaryOff;
- if (summaryOff != null) {
- updatedSummaryOff = summaryOff.replaceAll(NON_BREAKING_HYPHEN, HYPHEN);
- } else {
- updatedSummaryOff = EMPTY;
- }
-
- String normalizedTitle = updatedTitle.replaceAll(HYPHEN, EMPTY);
- String normalizedSummaryOn = updatedSummaryOn.replaceAll(HYPHEN, EMPTY);
- String normalizedSummaryOff = updatedSummaryOff.replaceAll(HYPHEN, EMPTY);
+ final String normalizedTitle = normalizeString(updatedTitle);
+ final String normalizedSummaryOn = normalizeString(updatedSummaryOn);
+ final String normalizedSummaryOff = normalizeString(updatedSummaryOff);
updateOneRow(database, locale,
updatedTitle, normalizedTitle, updatedSummaryOn, normalizedSummaryOn,
@@ -947,6 +945,17 @@
rank, keywords, intentAction, intentTargetPackage, intentTargetClass, enabled, key);
}
+ private static String normalizeHyphen(String input) {
+ return (input != null) ? input.replaceAll(NON_BREAKING_HYPHEN, HYPHEN) : EMPTY;
+ }
+
+ private static String normalizeString(String input) {
+ final String nohyphen = (input != null) ? input.replaceAll(HYPHEN, EMPTY) : EMPTY;
+ final String normalized = Normalizer.normalize(nohyphen, Normalizer.Form.NFD);
+
+ return REMOVE_DIACRITICALS_PATTERN.matcher(normalized).replaceAll("").toLowerCase();
+ }
+
private void updateOneRow(SQLiteDatabase database, String locale,
String updatedTitle, String normalizedTitle,
String updatedSummaryOn, String normalizedSummaryOn,
@@ -1133,7 +1142,12 @@
final int count = dataToUpdate.size();
for (int n = 0; n < count; n++) {
final SearchIndexableData data = dataToUpdate.get(n);
- indexOneSearchIndexableData(database, localeStr, data, nonIndexableKeys);
+ try {
+ indexOneSearchIndexableData(database, localeStr, data, nonIndexableKeys);
+ } catch (Exception e) {
+ Log.e(LOG_TAG,
+ "Cannot index: " + data.className + " for locale: " + localeStr, e);
+ }
}
final long now = System.currentTimeMillis();
diff --git a/src/com/android/settings/search/Ranking.java b/src/com/android/settings/search/Ranking.java
new file mode 100644
index 0000000..074a8d7
--- /dev/null
+++ b/src/com/android/settings/search/Ranking.java
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.search;
+
+import com.android.settings.ChooseLockGeneric;
+import com.android.settings.DataUsageSummary;
+import com.android.settings.DateTimeSettings;
+import com.android.settings.DevelopmentSettings;
+import com.android.settings.DeviceInfoSettings;
+import com.android.settings.DisplaySettings;
+import com.android.settings.HomeSettings;
+import com.android.settings.PrivacySettings;
+import com.android.settings.SecuritySettings;
+import com.android.settings.WallpaperTypeSettings;
+import com.android.settings.WirelessSettings;
+import com.android.settings.accessibility.AccessibilitySettings;
+import com.android.settings.bluetooth.BluetoothSettings;
+import com.android.settings.deviceinfo.Memory;
+import com.android.settings.fuelgauge.PowerUsageSummary;
+import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
+import com.android.settings.location.LocationSettings;
+import com.android.settings.notification.NotificationDisplaySettings;
+import com.android.settings.notification.NotificationSettings;
+import com.android.settings.notification.OtherSoundSettings;
+import com.android.settings.notification.ZenModeSettings;
+import com.android.settings.print.PrintSettingsFragment;
+import com.android.settings.users.UserSettings;
+import com.android.settings.wifi.AdvancedWifiSettings;
+import com.android.settings.wifi.WifiSettings;
+
+import java.util.HashMap;
+
+/**
+ * Utility class for dealing with Search Ranking.
+ */
+public final class Ranking {
+
+ public static final int RANK_WIFI = 1;
+ public static final int RANK_BT = 2;
+ public static final int RANK_DATA_USAGE = 3;
+ public static final int RANK_WIRELESS = 4;
+ public static final int RANK_HOME = 5;
+ public static final int RANK_DISPLAY = 6;
+ public static final int RANK_WALLPAPER = 7;
+ public static final int RANK_NOTIFICATIONS = 8;
+ public static final int RANK_MEMORY = 9;
+ public static final int RANK_POWER_USAGE = 10;
+ public static final int RANK_USERS = 11;
+ public static final int RANK_LOCATION = 12;
+ public static final int RANK_SECURITY = 13;
+ public static final int RANK_IME = 14;
+ public static final int RANK_PRIVACY = 15;
+ public static final int RANK_DATE_TIME = 16;
+ public static final int RANK_ACCESSIBILITY = 17;
+ public static final int RANK_PRINTING = 18;
+ public static final int RANK_DEVELOPEMENT = 19;
+ public static final int RANK_DEVICE_INFO = 20;
+
+ public static final int RANK_UNDEFINED = -1;
+ public static final int RANK_OTHERS = 1024;
+ public static final int BASE_RANK_DEFAULT = 2048;
+
+ public static int sCurrentBaseRank = BASE_RANK_DEFAULT;
+
+ private static HashMap<String, Integer> sRankMap = new HashMap<String, Integer>();
+ private static HashMap<String, Integer> sBaseRankMap = new HashMap<String, Integer>();
+
+ static {
+ sRankMap.put(WifiSettings.class.getName(), RANK_WIFI);
+ sRankMap.put(AdvancedWifiSettings.class.getName(), RANK_WIFI);
+
+ sRankMap.put(BluetoothSettings.class.getName(), RANK_BT);
+
+ sRankMap.put(DataUsageSummary.class.getName(), RANK_DATA_USAGE);
+
+ sRankMap.put(WirelessSettings.class.getName(), RANK_WIRELESS);
+
+ sRankMap.put(HomeSettings.class.getName(), RANK_HOME);
+
+ sRankMap.put(DisplaySettings.class.getName(), RANK_DISPLAY);
+
+ sRankMap.put(WallpaperTypeSettings.class.getName(), RANK_WALLPAPER);
+
+ sRankMap.put(NotificationSettings.class.getName(), RANK_NOTIFICATIONS);
+ sRankMap.put(NotificationDisplaySettings.class.getName(), RANK_NOTIFICATIONS);
+ sRankMap.put(OtherSoundSettings.class.getName(), RANK_NOTIFICATIONS);
+ sRankMap.put(ZenModeSettings.class.getName(), RANK_NOTIFICATIONS);
+
+ sRankMap.put(Memory.class.getName(), RANK_MEMORY);
+
+ sRankMap.put(PowerUsageSummary.class.getName(), RANK_POWER_USAGE);
+
+ sRankMap.put(UserSettings.class.getName(), RANK_USERS);
+
+ sRankMap.put(LocationSettings.class.getName(), RANK_LOCATION);
+
+ sRankMap.put(SecuritySettings.class.getName(), RANK_SECURITY);
+ sRankMap.put(ChooseLockGeneric.ChooseLockGenericFragment.class.getName(), RANK_SECURITY);
+
+ sRankMap.put(InputMethodAndLanguageSettings.class.getName(), RANK_IME);
+
+ sRankMap.put(PrivacySettings.class.getName(), RANK_PRIVACY);
+
+ sRankMap.put(DateTimeSettings.class.getName(), RANK_DATE_TIME);
+
+ sRankMap.put(AccessibilitySettings.class.getName(), RANK_ACCESSIBILITY);
+
+ sRankMap.put(PrintSettingsFragment.class.getName(), RANK_PRINTING);
+
+ sRankMap.put(DevelopmentSettings.class.getName(), RANK_DEVELOPEMENT);
+
+ sRankMap.put(DeviceInfoSettings.class.getName(), RANK_DEVICE_INFO);
+
+ sBaseRankMap.put("com.android.settings", 0);
+ }
+
+ public static int getRankForClassName(String className) {
+ Integer rank = sRankMap.get(className);
+ return (rank != null) ? (int) rank: RANK_OTHERS;
+ }
+
+ public static int getBaseRankForAuthority(String authority) {
+ synchronized (sBaseRankMap) {
+ Integer base = sBaseRankMap.get(authority);
+ if (base != null) {
+ return base;
+ }
+ sCurrentBaseRank++;
+ sBaseRankMap.put(authority, sCurrentBaseRank);
+ return sCurrentBaseRank;
+ }
+ }
+}
diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java
index 7ba6371..7c96a4a 100644
--- a/src/com/android/settings/search/SearchIndexableResources.java
+++ b/src/com/android/settings/search/SearchIndexableResources.java
@@ -28,7 +28,6 @@
import com.android.settings.PrivacySettings;
import com.android.settings.R;
import com.android.settings.SecuritySettings;
-import com.android.settings.SoundSettings;
import com.android.settings.WallpaperTypeSettings;
import com.android.settings.WirelessSettings;
import com.android.settings.accessibility.AccessibilitySettings;
@@ -39,7 +38,7 @@
import com.android.settings.location.LocationSettings;
import com.android.settings.notification.NotificationDisplaySettings;
import com.android.settings.notification.NotificationSettings;
-import com.android.settings.notification.TouchSoundSettings;
+import com.android.settings.notification.OtherSoundSettings;
import com.android.settings.notification.ZenModeSettings;
import com.android.settings.print.PrintSettingsFragment;
import com.android.settings.users.UserSettings;
@@ -53,186 +52,183 @@
public static int NO_DATA_RES_ID = 0;
- public static final int RANK_WIFI = 1;
- public static final int RANK_BT = 2;
- public static final int RANK_DATA_USAGE = 3;
- public static final int RANK_WIRELESS = 4;
- public static final int RANK_HOME = 5;
- public static final int RANK_SOUND = 6;
- public static final int RANK_DISPLAY = 7;
- public static final int RANK_WALLPAPER = 7;
- public static final int RANK_NOTIFICATIONS = 8;
- public static final int RANK_MEMORY = 9;
- public static final int RANK_POWER_USAGE = 10;
- public static final int RANK_USERS = 11;
- public static final int RANK_LOCATION = 12;
- public static final int RANK_SECURITY = 13;
- public static final int RANK_IME = 14;
- public static final int RANK_PRIVACY = 15;
- public static final int RANK_DATE_TIME = 16;
- public static final int RANK_ACCESSIBILITY = 17;
- public static final int RANK_PRINTING = 18;
- public static final int RANK_DEVELOPEMENT = 19;
- public static final int RANK_DEVICE_INFO = 20;
-
private static HashMap<String, SearchIndexableResource> sResMap =
new HashMap<String, SearchIndexableResource>();
-
static {
sResMap.put(WifiSettings.class.getName(),
- new SearchIndexableResource(RANK_WIFI,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(WifiSettings.class.getName()),
NO_DATA_RES_ID,
WifiSettings.class.getName(),
R.drawable.ic_settings_wireless));
sResMap.put(WifiSettings.class.getName(),
- new SearchIndexableResource(RANK_WIFI,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(AdvancedWifiSettings.class.getName()),
R.xml.wifi_advanced_settings,
AdvancedWifiSettings.class.getName(),
R.drawable.ic_settings_wireless));
sResMap.put(BluetoothSettings.class.getName(),
- new SearchIndexableResource(RANK_BT,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(BluetoothSettings.class.getName()),
NO_DATA_RES_ID,
BluetoothSettings.class.getName(),
R.drawable.ic_settings_bluetooth2));
sResMap.put(DataUsageSummary.class.getName(),
- new SearchIndexableResource(RANK_DATA_USAGE,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(DataUsageSummary.class.getName()),
NO_DATA_RES_ID,
DataUsageSummary.class.getName(),
R.drawable.ic_settings_data_usage));
sResMap.put(WirelessSettings.class.getName(),
- new SearchIndexableResource(RANK_WIRELESS,
- R.xml.wireless_settings,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(WirelessSettings.class.getName()),
+ NO_DATA_RES_ID,
WirelessSettings.class.getName(),
- R.drawable.empty_icon));
+ R.drawable.ic_settings_more));
sResMap.put(HomeSettings.class.getName(),
- new SearchIndexableResource(RANK_HOME,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(HomeSettings.class.getName()),
R.xml.home_selection,
HomeSettings.class.getName(),
R.drawable.ic_settings_home));
- sResMap.put(SoundSettings.class.getName(),
- new SearchIndexableResource(RANK_SOUND,
- R.xml.sound_settings,
- SoundSettings.class.getName(),
- R.drawable.ic_settings_sound));
-
sResMap.put(DisplaySettings.class.getName(),
- new SearchIndexableResource(RANK_DISPLAY,
- R.xml.display_settings,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(DisplaySettings.class.getName()),
+ NO_DATA_RES_ID,
DisplaySettings.class.getName(),
R.drawable.ic_settings_display));
sResMap.put(WallpaperTypeSettings.class.getName(),
- new SearchIndexableResource(RANK_WALLPAPER,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(WallpaperTypeSettings.class.getName()),
NO_DATA_RES_ID,
WallpaperTypeSettings.class.getName(),
R.drawable.ic_settings_display));
sResMap.put(NotificationSettings.class.getName(),
- new SearchIndexableResource(RANK_NOTIFICATIONS,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(NotificationSettings.class.getName()),
NO_DATA_RES_ID,
NotificationSettings.class.getName(),
R.drawable.ic_settings_notifications));
sResMap.put(NotificationDisplaySettings.class.getName(),
- new SearchIndexableResource(RANK_NOTIFICATIONS,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(NotificationDisplaySettings.class.getName()),
R.xml.notification_display_settings,
NotificationDisplaySettings.class.getName(),
R.drawable.ic_settings_notifications));
- sResMap.put(TouchSoundSettings.class.getName(),
- new SearchIndexableResource(RANK_NOTIFICATIONS,
- R.xml.touch_sound_settings,
- TouchSoundSettings.class.getName(),
+ sResMap.put(OtherSoundSettings.class.getName(),
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(OtherSoundSettings.class.getName()),
+ NO_DATA_RES_ID,
+ OtherSoundSettings.class.getName(),
R.drawable.ic_settings_notifications));
sResMap.put(ZenModeSettings.class.getName(),
- new SearchIndexableResource(RANK_NOTIFICATIONS,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(ZenModeSettings.class.getName()),
NO_DATA_RES_ID,
ZenModeSettings.class.getName(),
R.drawable.ic_settings_notifications));
sResMap.put(Memory.class.getName(),
- new SearchIndexableResource(RANK_MEMORY,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(Memory.class.getName()),
NO_DATA_RES_ID,
Memory.class.getName(),
R.drawable.ic_settings_storage));
sResMap.put(PowerUsageSummary.class.getName(),
- new SearchIndexableResource(RANK_POWER_USAGE,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(PowerUsageSummary.class.getName()),
R.xml.power_usage_summary,
PowerUsageSummary.class.getName(),
R.drawable.ic_settings_battery));
sResMap.put(UserSettings.class.getName(),
- new SearchIndexableResource(RANK_USERS,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(UserSettings.class.getName()),
R.xml.user_settings,
UserSettings.class.getName(),
R.drawable.ic_settings_multiuser));
sResMap.put(LocationSettings.class.getName(),
- new SearchIndexableResource(RANK_LOCATION,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(LocationSettings.class.getName()),
R.xml.location_settings,
LocationSettings.class.getName(),
R.drawable.ic_settings_location));
sResMap.put(SecuritySettings.class.getName(),
- new SearchIndexableResource(RANK_SECURITY,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(SecuritySettings.class.getName()),
NO_DATA_RES_ID,
SecuritySettings.class.getName(),
R.drawable.ic_settings_security));
sResMap.put(ChooseLockGeneric.ChooseLockGenericFragment.class.getName(),
- new SearchIndexableResource(RANK_SECURITY,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(
+ ChooseLockGeneric.ChooseLockGenericFragment.class.getName()),
R.xml.security_settings_picker,
ChooseLockGeneric.ChooseLockGenericFragment.class.getName(),
R.drawable.ic_settings_security));
sResMap.put(InputMethodAndLanguageSettings.class.getName(),
- new SearchIndexableResource(RANK_IME,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(InputMethodAndLanguageSettings.class.getName()),
NO_DATA_RES_ID,
InputMethodAndLanguageSettings.class.getName(),
R.drawable.ic_settings_language));
sResMap.put(PrivacySettings.class.getName(),
- new SearchIndexableResource(RANK_PRIVACY,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(PrivacySettings.class.getName()),
R.xml.privacy_settings,
PrivacySettings.class.getName(),
R.drawable.ic_settings_backup));
sResMap.put(DateTimeSettings.class.getName(),
- new SearchIndexableResource(RANK_DATE_TIME,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(DateTimeSettings.class.getName()),
R.xml.date_time_prefs,
DateTimeSettings.class.getName(),
R.drawable.ic_settings_date_time));
sResMap.put(AccessibilitySettings.class.getName(),
- new SearchIndexableResource(RANK_ACCESSIBILITY,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(AccessibilitySettings.class.getName()),
NO_DATA_RES_ID,
AccessibilitySettings.class.getName(),
R.drawable.ic_settings_accessibility));
sResMap.put(PrintSettingsFragment.class.getName(),
- new SearchIndexableResource(RANK_PRINTING,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(PrintSettingsFragment.class.getName()),
NO_DATA_RES_ID,
PrintSettingsFragment.class.getName(),
R.drawable.ic_settings_print));
sResMap.put(DevelopmentSettings.class.getName(),
- new SearchIndexableResource(RANK_DEVELOPEMENT,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(DevelopmentSettings.class.getName()),
R.xml.development_prefs,
DevelopmentSettings.class.getName(),
R.drawable.ic_settings_development));
sResMap.put(DeviceInfoSettings.class.getName(),
- new SearchIndexableResource(RANK_DEVICE_INFO,
- R.xml.device_info_settings,
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(DeviceInfoSettings.class.getName()),
+ NO_DATA_RES_ID,
DeviceInfoSettings.class.getName(),
R.drawable.ic_settings_about));
}
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index 1d4fe71..4a98661 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -28,6 +28,7 @@
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Intent;
+import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -164,6 +165,9 @@
setTtsUtteranceProgressListener();
initSettings();
+
+ // Prevent restarting the TTS connection on rotation
+ setRetainInstance(true);
}
@Override
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index a05aaa9..901ee50 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -186,7 +186,9 @@
}
final Context context = getActivity();
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
- if (!mUserManager.supportsMultipleUsers() || Utils.isMonkeyRunning()) {
+ boolean hasMultipleUsers = mUserManager.getUserCount() > 1;
+ if ((!UserManager.supportsMultipleUsers() && !hasMultipleUsers)
+ || Utils.isMonkeyRunning()) {
mEnabled = false;
return;
}
@@ -201,7 +203,8 @@
mMePreference.setSummary(R.string.user_owner);
}
mAddUser = findPreference(KEY_ADD_USER);
- if (!mIsOwner || UserManager.getMaxSupportedUsers() < 2) {
+ if (!mIsOwner || UserManager.getMaxSupportedUsers() < 2
+ || !UserManager.supportsMultipleUsers()) {
removePreference(KEY_ADD_USER);
} else {
mAddUser.setOnPreferenceClickListener(this);
diff --git a/src/com/android/settings/widget/ProportionalOuterFrame.java b/src/com/android/settings/widget/ProportionalOuterFrame.java
new file mode 100644
index 0000000..d23d2c4
--- /dev/null
+++ b/src/com/android/settings/widget/ProportionalOuterFrame.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 Google Inc.
+ *
+ * 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.
+ */
+
+package com.android.settings.widget;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.RelativeLayout;
+
+import com.android.settings.R;
+
+/**
+ * Used as the outer frame of all setup wizard pages that need to adjust their margins based
+ * on the total size of the available display. (e.g. side margins set to 10% of total width.)
+ */
+public class ProportionalOuterFrame extends RelativeLayout {
+ public ProportionalOuterFrame(Context context) {
+ super(context);
+ }
+
+ public ProportionalOuterFrame(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public ProportionalOuterFrame(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ /**
+ * Set our margins and title area height proportionally to the available display size
+ */
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ final int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
+ final int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
+ final Resources res = getContext().getResources();
+ final float titleHeight = res.getFraction(R.dimen.setup_title_height, 1, 1);
+ final float sideMargin = res.getFraction(R.dimen.setup_border_width, 1, 1);
+ final int bottom = res.getDimensionPixelSize(R.dimen.setup_margin_bottom);
+ setPaddingRelative((int) (parentWidth * sideMargin), 0,
+ (int) (parentWidth * sideMargin), bottom);
+ final View title = findViewById(R.id.title_area);
+ if (title != null) {
+ title.setMinimumHeight((int) (parentHeight * titleHeight));
+ }
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+}
diff --git a/src/com/android/settings/widget/SwitchBar.java b/src/com/android/settings/widget/SwitchBar.java
index 1675f2a..bc06d87 100644
--- a/src/com/android/settings/widget/SwitchBar.java
+++ b/src/com/android/settings/widget/SwitchBar.java
@@ -20,6 +20,7 @@
import android.transition.TransitionManager;
import android.util.AttributeSet;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
@@ -31,7 +32,8 @@
import java.util.ArrayList;
-public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedChangeListener {
+public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedChangeListener,
+ View.OnClickListener {
private ToggleSwitch mSwitch;
private TextView mTextView;
@@ -82,9 +84,14 @@
mSwitch.setTrackResource(R.drawable.switch_track);
mSwitch.setThumbResource(R.drawable.switch_inner);
+ setOnClickListener(this);
+
// Default is hide
setVisibility(View.GONE);
- mSwitch.setVisibility(View.GONE);
+ }
+
+ public ToggleSwitch getSwitch() {
+ return mSwitch;
}
public void show() {
@@ -102,13 +109,23 @@
}
@Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ public void onClick(View v) {
+ final boolean isChecked = !mSwitch.isChecked();
+ mSwitch.setChecked(isChecked);
+ }
+
+ public void propagateChecked(boolean isChecked) {
final int count = mSwitchChangeListeners.size();
for (int n = 0; n < count; n++) {
- mSwitchChangeListeners.get(n).onSwitchChanged(mSwitch,isChecked);
+ mSwitchChangeListeners.get(n).onSwitchChanged(mSwitch, isChecked);
}
}
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ propagateChecked(isChecked);
+ }
+
public void addOnSwitchChangeListener(OnSwitchChangeListener listener) {
if (mSwitchChangeListeners.contains(listener)) {
throw new IllegalStateException("Cannot add twice the same OnSwitchChangeListener");
@@ -122,39 +139,4 @@
}
mSwitchChangeListeners.remove(listener);
}
-
- public void setSwitchOnBeforeCheckedChangeListener(
- ToggleSwitch.OnBeforeCheckedChangeListener listener) {
- mSwitch.setOnBeforeCheckedChangeListener(listener);
- }
-
- public void setSwitchChecked(boolean checked) {
- setSwitchChecked(checked, false);
- }
-
- public void setSwitchChecked(boolean checked, boolean checkBefore) {
- if (checkBefore) {
- ToggleSwitch.OnBeforeCheckedChangeListener listener =
- mSwitch.getOnBeforeCheckedChangeListener();
- if (listener != null && listener.onBeforeCheckedChanged(mSwitch, checked)) {
- return;
- }
-
- }
- mSwitch.setCheckedInternal(checked);
- if (mSwitch.getVisibility() == View.GONE) {
- mSwitch.setVisibility(View.VISIBLE);
- }
- }
-
- public void setSwitchEnabled(boolean enabled) {
- mSwitch.setEnabled(enabled);
- if (mSwitch.getVisibility() == View.GONE) {
- mSwitch.setVisibility(View.VISIBLE);
- }
- }
-
- public boolean isSwitchChecked() {
- return mSwitch.isChecked();
- }
}
diff --git a/src/com/android/settings/widget/ToggleSwitch.java b/src/com/android/settings/widget/ToggleSwitch.java
index ab0c37e..8232ff1 100644
--- a/src/com/android/settings/widget/ToggleSwitch.java
+++ b/src/com/android/settings/widget/ToggleSwitch.java
@@ -48,10 +48,6 @@
mOnBeforeListener = listener;
}
- public OnBeforeCheckedChangeListener getOnBeforeCheckedChangeListener() {
- return mOnBeforeListener;
- }
-
@Override
public void setChecked(boolean checked) {
if (mOnBeforeListener != null
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 8779798..497132c 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -561,7 +561,7 @@
} catch (IllegalArgumentException e) {
return R.string.wifi_ip_settings_invalid_dns;
}
- linkProperties.addDns(dnsAddr);
+ linkProperties.addDnsServer(dnsAddr);
}
if (mDns2View.length() > 0) {
@@ -571,7 +571,7 @@
} catch (IllegalArgumentException e) {
return R.string.wifi_ip_settings_invalid_dns;
}
- linkProperties.addDns(dnsAddr);
+ linkProperties.addDnsServer(dnsAddr);
}
return 0;
}
@@ -798,7 +798,7 @@
}
}
- Iterator<InetAddress> dnsIterator = linkProperties.getDnses().iterator();
+ Iterator<InetAddress> dnsIterator = linkProperties.getDnsServers().iterator();
if (dnsIterator.hasNext()) {
mDns1View.setText(dnsIterator.next().getHostAddress());
}
diff --git a/src/com/android/settings/wifi/WifiEnabler.java b/src/com/android/settings/wifi/WifiEnabler.java
index 1e86761..d190045 100644
--- a/src/com/android/settings/wifi/WifiEnabler.java
+++ b/src/com/android/settings/wifi/WifiEnabler.java
@@ -27,6 +27,8 @@
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
+import android.view.View;
+import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.Toast;
@@ -39,6 +41,7 @@
public class WifiEnabler implements SwitchBar.OnSwitchChangeListener {
private Context mContext;
+ private Switch mSwitch;
private SwitchBar mSwitchBar;
private AtomicBoolean mConnected = new AtomicBoolean(false);
@@ -85,6 +88,12 @@
public WifiEnabler(Context context, SwitchBar switchBar) {
mContext = context;
mSwitchBar = switchBar;
+ mSwitch = switchBar.getSwitch();
+ // This is a trick: as the Wi-Fi initial state is asynchronously coming from the
+ // BroadcastReceiver we cannot have the Switch visible at first otherwise you will notice
+ // its state change later on. So start it as VIEW.GONE and make it View.VISIBLE later
+ // when its state is defined.
+ mSwitch.setVisibility(View.GONE);
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
mIntentFilter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION);
@@ -110,26 +119,27 @@
private void handleWifiStateChanged(int state) {
switch (state) {
case WifiManager.WIFI_STATE_ENABLING:
- mSwitchBar.setSwitchEnabled(false);
+ mSwitch.setEnabled(false);
break;
case WifiManager.WIFI_STATE_ENABLED:
setSwitchChecked(true);
- mSwitchBar.setSwitchEnabled(true);
+ mSwitch.setEnabled(true);
updateSearchIndex(true);
break;
case WifiManager.WIFI_STATE_DISABLING:
- mSwitchBar.setSwitchEnabled(false);
+ mSwitch.setEnabled(false);
break;
case WifiManager.WIFI_STATE_DISABLED:
setSwitchChecked(false);
- mSwitchBar.setSwitchEnabled(true);
+ mSwitch.setEnabled(true);
updateSearchIndex(false);
break;
default:
setSwitchChecked(false);
- mSwitchBar.setSwitchEnabled(true);
+ mSwitch.setEnabled(true);
updateSearchIndex(false);
}
+ mSwitch.setVisibility(View.VISIBLE);
}
private void updateSearchIndex(boolean isWiFiOn) {
@@ -142,9 +152,9 @@
}
private void setSwitchChecked(boolean checked) {
- if (checked != mSwitchBar.isSwitchChecked()) {
+ if (checked != mSwitch.isChecked()) {
mStateMachineEvent = true;
- mSwitchBar.setSwitchChecked(checked);
+ mSwitch.setChecked(checked);
mStateMachineEvent = false;
}
}
@@ -186,10 +196,10 @@
mWifiManager.setWifiApEnabled(null, false);
}
- mSwitchBar.setSwitchEnabled(false);
+ mSwitch.setEnabled(false);
if (!mWifiManager.setWifiEnabled(isChecked)) {
// Error
- mSwitchBar.setSwitchEnabled(true);
+ mSwitch.setEnabled(true);
Toast.makeText(mContext, R.string.wifi_error, Toast.LENGTH_SHORT).show();
}
}
diff --git a/src/com/android/settings/wifi/WifiPickerActivity.java b/src/com/android/settings/wifi/WifiPickerActivity.java
index 6dea82e..4cb78bd 100644
--- a/src/com/android/settings/wifi/WifiPickerActivity.java
+++ b/src/com/android/settings/wifi/WifiPickerActivity.java
@@ -21,22 +21,28 @@
import android.content.Intent;
+import java.lang.Class;
+
public class WifiPickerActivity extends SettingsActivity implements ButtonBarHandler {
@Override
public Intent getIntent() {
Intent modIntent = new Intent(super.getIntent());
if (!modIntent.hasExtra(EXTRA_SHOW_FRAGMENT)) {
- modIntent.putExtra(EXTRA_SHOW_FRAGMENT, WifiSettings.class.getName());
+ modIntent.putExtra(EXTRA_SHOW_FRAGMENT, getWifiSettingsClass().getName());
}
return modIntent;
}
@Override
protected boolean isValidFragment(String fragmentName) {
- if (WifiSettings.class.getName().equals(fragmentName)
+ if (getWifiSettingsClass().getName().equals(fragmentName)
|| WifiP2pSettings.class.getName().equals(fragmentName)
|| AdvancedWifiSettings.class.getName().equals(fragmentName)) return true;
return false;
}
+
+ /* package */ Class getWifiSettingsClass() {
+ return WifiSettings.class;
+ }
}
\ No newline at end of file
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index a653910..3420f36 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -29,7 +29,6 @@
import com.android.settings.wifi.p2p.WifiP2pSettings;
import android.app.Activity;
-import android.app.AlertDialog;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -40,7 +39,6 @@
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.location.LocationManager;
-import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo.DetailedState;
import android.net.wifi.ScanResult;
@@ -54,23 +52,14 @@
import android.os.Message;
import android.preference.Preference;
import android.preference.PreferenceScreen;
-import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
-import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
import android.widget.AdapterView.AdapterContextMenuInfo;
-import android.widget.Button;
-import android.widget.ImageButton;
-import android.widget.PopupMenu;
-import android.widget.PopupMenu.OnMenuItemClickListener;
-import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -93,10 +82,10 @@
implements DialogInterface.OnClickListener, Indexable {
private static final String TAG = "WifiSettings";
- private static final int MENU_ID_WPS_PBC = Menu.FIRST;
+ /* package */ static final int MENU_ID_WPS_PBC = Menu.FIRST;
private static final int MENU_ID_WPS_PIN = Menu.FIRST + 1;
private static final int MENU_ID_P2P = Menu.FIRST + 2;
- private static final int MENU_ID_ADD_NETWORK = Menu.FIRST + 3;
+ /* package */ static final int MENU_ID_ADD_NETWORK = Menu.FIRST + 3;
private static final int MENU_ID_ADVANCED = Menu.FIRST + 4;
private static final int MENU_ID_SCAN = Menu.FIRST + 5;
private static final int MENU_ID_CONNECT = Menu.FIRST + 6;
@@ -105,10 +94,10 @@
private static final int MENU_ID_WRITE_NFC = Menu.FIRST + 9;
private static final int WIFI_DIALOG_ID = 1;
- private static final int WPS_PBC_DIALOG_ID = 2;
+ /* package */ static final int WPS_PBC_DIALOG_ID = 2;
private static final int WPS_PIN_DIALOG_ID = 3;
- private static final int WIFI_SKIPPED_DIALOG_ID = 4;
- private static final int WIFI_AND_MOBILE_SKIPPED_DIALOG_ID = 5;
+ /* package */ static final int WIFI_SKIPPED_DIALOG_ID = 4;
+ /* package */ static final int WIFI_AND_MOBILE_SKIPPED_DIALOG_ID = 5;
private static final int WRITE_NFC_DIALOG_ID = 6;
// Combo scans can take 5-6s to complete - set to 10s.
@@ -118,14 +107,11 @@
private static final String SAVE_DIALOG_EDIT_MODE = "edit_mode";
private static final String SAVE_DIALOG_ACCESS_POINT_STATE = "wifi_ap_state";
- // Activity result when pressing the Skip button
- private static final int RESULT_SKIP = Activity.RESULT_FIRST_USER;
-
private final IntentFilter mFilter;
private final BroadcastReceiver mReceiver;
private final Scanner mScanner;
- private WifiManager mWifiManager;
+ /* package */ WifiManager mWifiManager;
private WifiManager.ActionListener mConnectListener;
private WifiManager.ActionListener mSaveListener;
private WifiManager.ActionListener mForgetListener;
@@ -145,37 +131,11 @@
private TextView mEmptyView;
- /* Used in Wifi Setup context */
-
- // this boolean extra specifies whether to disable the Next button when not connected
- private static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
-
- // this boolean extra specifies whether to auto finish when connection is established
- private static final String EXTRA_AUTO_FINISH_ON_CONNECT = "wifi_auto_finish_on_connect";
-
- // this boolean extra shows a custom button that we can control
- protected static final String EXTRA_SHOW_CUSTOM_BUTTON = "wifi_show_custom_button";
-
- // show a text regarding data charges when wifi connection is required during setup wizard
- protected static final String EXTRA_SHOW_WIFI_REQUIRED_INFO = "wifi_show_wifi_required_info";
-
- // this boolean extra is set if we are being invoked by the Setup Wizard
- private static final String EXTRA_IS_FIRST_RUN = "firstRun";
-
- // should Next button only be enabled when we have a connection?
- private boolean mEnableNextOnConnection;
-
- // should activity finish once we have a connection?
- private boolean mAutoFinishOnConnection;
-
// Save the dialog details
private boolean mDlgEdit;
private AccessPoint mDlgAccessPoint;
private Bundle mAccessPointSavedState;
- // the action bar uses a different set of controls for Setup Wizard
- private boolean mSetupWizardMode;
-
private SwitchBar mSwitchBar;
/** verbose logging flag. this flag is set thru developer debugging options
@@ -207,93 +167,6 @@
}
@Override
- public void onCreate(Bundle icicle) {
- // Set this flag early, as it's needed by getHelpResource(), which is called by super
- mSetupWizardMode = getActivity().getIntent().getBooleanExtra(EXTRA_IS_FIRST_RUN, false);
- super.onCreate(icicle);
- }
-
- @Override
- public View onCreateView(final LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- if (mSetupWizardMode) {
- View view = inflater.inflate(R.layout.setup_preference, container, false);
- View other = view.findViewById(R.id.other_network);
- other.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mWifiManager.isWifiEnabled()) {
- onAddNetworkPressed();
- }
- }
- });
- final ImageButton b = (ImageButton) view.findViewById(R.id.more);
- if (b != null) {
- b.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mWifiManager.isWifiEnabled()) {
- PopupMenu pm = new PopupMenu(inflater.getContext(), b);
- pm.inflate(R.menu.wifi_setup);
- pm.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- if (R.id.wifi_wps == item.getItemId()) {
- showDialog(WPS_PBC_DIALOG_ID);
- return true;
- }
- return false;
- }
- });
- pm.show();
- }
- }
- });
- }
-
- Intent intent = getActivity().getIntent();
- if (intent.getBooleanExtra(EXTRA_SHOW_CUSTOM_BUTTON, false)) {
- view.findViewById(R.id.button_bar).setVisibility(View.VISIBLE);
- view.findViewById(R.id.back_button).setVisibility(View.INVISIBLE);
- view.findViewById(R.id.skip_button).setVisibility(View.INVISIBLE);
- view.findViewById(R.id.next_button).setVisibility(View.INVISIBLE);
-
- Button customButton = (Button) view.findViewById(R.id.custom_button);
- customButton.setVisibility(View.VISIBLE);
- customButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- boolean isConnected = false;
- Activity activity = getActivity();
- final ConnectivityManager connectivity = (ConnectivityManager)
- activity.getSystemService(Context.CONNECTIVITY_SERVICE);
- if (connectivity != null) {
- final NetworkInfo info = connectivity.getActiveNetworkInfo();
- isConnected = (info != null) && info.isConnected();
- }
- if (isConnected) {
- // Warn of possible data charges
- showDialog(WIFI_SKIPPED_DIALOG_ID);
- } else {
- // Warn of lack of updates
- showDialog(WIFI_AND_MOBILE_SKIPPED_DIALOG_ID);
- }
- }
- });
- }
-
- if (intent.getBooleanExtra(EXTRA_SHOW_WIFI_REQUIRED_INFO, false)) {
- view.findViewById(R.id.wifi_required_info).setVisibility(View.VISIBLE);
- }
-
- return view;
- } else {
- return super.onCreateView(inflater, container, savedInstanceState);
- }
- }
-
- @Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
@@ -351,60 +224,11 @@
mAccessPointSavedState = savedInstanceState.getBundle(SAVE_DIALOG_ACCESS_POINT_STATE);
}
- final Activity activity = getActivity();
- final Intent intent = activity.getIntent();
-
- // first if we're supposed to finish once we have a connection
- mAutoFinishOnConnection = intent.getBooleanExtra(EXTRA_AUTO_FINISH_ON_CONNECT, false);
-
- if (mAutoFinishOnConnection) {
- // Hide the next button
- if (hasNextButton()) {
- getNextButton().setVisibility(View.GONE);
- }
-
- final ConnectivityManager connectivity = (ConnectivityManager)
- activity.getSystemService(Context.CONNECTIVITY_SERVICE);
- if (connectivity != null
- && connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) {
- activity.setResult(Activity.RESULT_OK);
- activity.finish();
- return;
- }
- }
-
- // if we're supposed to enable/disable the Next button based on our current connection
- // state, start it off in the right state
- mEnableNextOnConnection = intent.getBooleanExtra(EXTRA_ENABLE_NEXT_ON_CONNECT, false);
-
- if (mEnableNextOnConnection) {
- if (hasNextButton()) {
- final ConnectivityManager connectivity = (ConnectivityManager)
- activity.getSystemService(Context.CONNECTIVITY_SERVICE);
- if (connectivity != null) {
- NetworkInfo info = connectivity.getNetworkInfo(
- ConnectivityManager.TYPE_WIFI);
- changeNextButtonState(info.isConnected());
- }
- }
- }
-
addPreferencesFromResource(R.xml.wifi_settings);
- if (mSetupWizardMode) {
- getView().setSystemUiVisibility(
- View.STATUS_BAR_DISABLE_HOME |
- View.STATUS_BAR_DISABLE_RECENT |
- View.STATUS_BAR_DISABLE_NOTIFICATION_ALERTS |
- View.STATUS_BAR_DISABLE_CLOCK);
- }
-
mEmptyView = (TextView) getView().findViewById(android.R.id.empty);
getListView().setEmptyView(mEmptyView);
-
- if (!mSetupWizardMode) {
- registerForContextMenu(getListView());
- }
+ registerForContextMenu(getListView());
setHasOptionsMenu(true);
}
@@ -412,13 +236,16 @@
public void onStart() {
super.onStart();
- // On/off switch is hidden for Setup Wizard
- if (!mSetupWizardMode) {
- final SettingsActivity activity = (SettingsActivity) getActivity();
+ // On/off switch is hidden for Setup Wizard (returns null)
+ mWifiEnabler = createWifiEnabler();
+ }
- mSwitchBar = activity.getSwitchBar();
- mWifiEnabler = new WifiEnabler(activity, mSwitchBar);
- }
+ /**
+ * @return new WifiEnabler or null (as overridden by WifiSettingsForSetupWizard)
+ */
+ /* package */ WifiEnabler createWifiEnabler() {
+ final SettingsActivity activity = (SettingsActivity) getActivity();
+ return new WifiEnabler(activity, activity.getSwitchBar());
}
@Override
@@ -449,44 +276,41 @@
// If the user is not allowed to configure wifi, do not show the menu.
if (isRestrictedAndNotPinProtected()) return;
+ addOptionsMenuItems(menu);
+ super.onCreateOptionsMenu(menu, inflater);
+ }
+
+ /**
+ * @param menu
+ */
+ void addOptionsMenuItems(Menu menu) {
final boolean wifiIsEnabled = mWifiManager.isWifiEnabled();
TypedArray ta = getActivity().getTheme().obtainStyledAttributes(
new int[] {R.attr.ic_menu_add, R.attr.ic_wps});
- if (mSetupWizardMode) {
- menu.add(Menu.NONE, MENU_ID_WPS_PBC, 0, R.string.wifi_menu_wps_pbc)
- .setIcon(ta.getDrawable(1))
+ menu.add(Menu.NONE, MENU_ID_WPS_PBC, 0, R.string.wifi_menu_wps_pbc)
+ .setIcon(ta.getDrawable(1))
+ .setEnabled(wifiIsEnabled)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+ menu.add(Menu.NONE, MENU_ID_ADD_NETWORK, 0, R.string.wifi_add_network)
+ .setIcon(ta.getDrawable(0))
+ .setEnabled(wifiIsEnabled)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+ menu.add(Menu.NONE, MENU_ID_SCAN, 0, R.string.wifi_menu_scan)
+ //.setIcon(R.drawable.ic_menu_scan_network)
+ .setEnabled(wifiIsEnabled)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+ menu.add(Menu.NONE, MENU_ID_WPS_PIN, 0, R.string.wifi_menu_wps_pin)
+ .setEnabled(wifiIsEnabled)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+ if (mP2pSupported) {
+ menu.add(Menu.NONE, MENU_ID_P2P, 0, R.string.wifi_menu_p2p)
.setEnabled(wifiIsEnabled)
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
- menu.add(Menu.NONE, MENU_ID_ADD_NETWORK, 0, R.string.wifi_add_network)
- .setEnabled(wifiIsEnabled)
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
- } else {
- menu.add(Menu.NONE, MENU_ID_WPS_PBC, 0, R.string.wifi_menu_wps_pbc)
- .setIcon(ta.getDrawable(1))
- .setEnabled(wifiIsEnabled)
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- menu.add(Menu.NONE, MENU_ID_ADD_NETWORK, 0, R.string.wifi_add_network)
- .setIcon(ta.getDrawable(0))
- .setEnabled(wifiIsEnabled)
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- menu.add(Menu.NONE, MENU_ID_SCAN, 0, R.string.wifi_menu_scan)
- //.setIcon(R.drawable.ic_menu_scan_network)
- .setEnabled(wifiIsEnabled)
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- menu.add(Menu.NONE, MENU_ID_WPS_PIN, 0, R.string.wifi_menu_wps_pin)
- .setEnabled(wifiIsEnabled)
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- if (mP2pSupported) {
- menu.add(Menu.NONE, MENU_ID_P2P, 0, R.string.wifi_menu_p2p)
- .setEnabled(wifiIsEnabled)
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- }
- menu.add(Menu.NONE, MENU_ID_ADVANCED, 0, R.string.wifi_menu_advanced)
- //.setIcon(android.R.drawable.ic_menu_manage)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
}
+ menu.add(Menu.NONE, MENU_ID_ADVANCED, 0, R.string.wifi_menu_advanced)
+ //.setIcon(android.R.drawable.ic_menu_manage)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
ta.recycle();
- super.onCreateOptionsMenu(menu, inflater);
}
@Override
@@ -667,44 +491,6 @@
return new WpsDialog(getActivity(), WpsInfo.PBC);
case WPS_PIN_DIALOG_ID:
return new WpsDialog(getActivity(), WpsInfo.DISPLAY);
- case WIFI_SKIPPED_DIALOG_ID:
- return new AlertDialog.Builder(getActivity())
- .setMessage(R.string.wifi_skipped_message)
- .setCancelable(false)
- .setNegativeButton(R.string.wifi_skip_anyway,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- getActivity().setResult(RESULT_SKIP);
- getActivity().finish();
- }
- })
- .setPositiveButton(R.string.wifi_dont_skip,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- }
- })
- .create();
- case WIFI_AND_MOBILE_SKIPPED_DIALOG_ID:
- return new AlertDialog.Builder(getActivity())
- .setMessage(R.string.wifi_and_mobile_skipped_message)
- .setCancelable(false)
- .setNegativeButton(R.string.wifi_skip_anyway,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- getActivity().setResult(RESULT_SKIP);
- getActivity().finish();
- }
- })
- .setPositiveButton(R.string.wifi_dont_skip,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- }
- })
- .create();
case WRITE_NFC_DIALOG_ID:
if (mSelectedAccessPoint != null) {
mWifiToNfcDialog = new WriteWifiConfigToNfcDialog(
@@ -717,7 +503,7 @@
}
/**
- * Shows the latest access points available with supplimental information like
+ * Shows the latest access points available with supplemental information like
* the strength of network and the security for it.
*/
private void updateAccessPoints() {
@@ -882,17 +668,8 @@
NetworkInfo info = (NetworkInfo) intent.getParcelableExtra(
WifiManager.EXTRA_NETWORK_INFO);
mConnected.set(info.isConnected());
- changeNextButtonState(info.isConnected());
updateAccessPoints();
updateConnectionState(info.getDetailedState());
- if (mAutoFinishOnConnection && info.isConnected()) {
- Activity activity = getActivity();
- if (activity != null) {
- activity.setResult(Activity.RESULT_OK);
- activity.finish();
- }
- return;
- }
} else if (WifiManager.RSSI_CHANGED_ACTION.equals(action)) {
updateConnectionState(null);
}
@@ -986,18 +763,6 @@
}
}
- /**
- * Renames/replaces "Next" button when appropriate. "Next" button usually exists in
- * Wifi setup screens, not in usual wifi settings screen.
- *
- * @param connected true when the device is connected to a wifi network.
- */
- private void changeNextButtonState(boolean connected) {
- if (mEnableNextOnConnection && hasNextButton()) {
- getNextButton().setEnabled(connected);
- }
- }
-
@Override
public void onClick(DialogInterface dialogInterface, int button) {
if (button == WifiDialog.BUTTON_FORGET && mSelectedAccessPoint != null) {
@@ -1039,7 +804,7 @@
/* package */ void forget() {
if (mSelectedAccessPoint.networkId == INVALID_NETWORK_ID) {
- // Should not happen, but a monkey seems to triger it
+ // Should not happen, but a monkey seems to trigger it
Log.e(TAG, "Failed to forget invalid network " + mSelectedAccessPoint.getConfig());
return;
}
@@ -1050,9 +815,6 @@
mScanner.resume();
}
updateAccessPoints();
-
- // We need to rename/replace "Next" button in wifi setup context.
- changeNextButtonState(false);
}
/**
@@ -1104,51 +866,9 @@
@Override
protected int getHelpResource() {
- if (mSetupWizardMode) {
- return 0;
- }
return R.string.help_url_wifi;
}
- /**
- * Used as the outer frame of all setup wizard pages that need to adjust their margins based
- * on the total size of the available display. (e.g. side margins set to 10% of total width.)
- */
- public static class ProportionalOuterFrame extends RelativeLayout {
- public ProportionalOuterFrame(Context context) {
- super(context);
- }
- public ProportionalOuterFrame(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
- public ProportionalOuterFrame(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- /**
- * Set our margins and title area height proportionally to the available display size
- */
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
- int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
- final Resources res = getContext().getResources();
- float titleHeight = res.getFraction(R.dimen.setup_title_height, 1, 1);
- float sideMargin = res.getFraction(R.dimen.setup_border_width, 1, 1);
- int bottom = res.getDimensionPixelSize(R.dimen.setup_margin_bottom);
- setPaddingRelative(
- (int) (parentWidth * sideMargin),
- 0,
- (int) (parentWidth * sideMargin),
- bottom);
- View title = findViewById(R.id.title_area);
- if (title != null) {
- title.setMinimumHeight((int) (parentHeight * titleHeight));
- }
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- }
- }
-
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java
new file mode 100644
index 0000000..17fca9f
--- /dev/null
+++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java
@@ -0,0 +1,397 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.wifi;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.res.TypedArray;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.PopupMenu;
+import android.widget.PopupMenu.OnMenuItemClickListener;
+
+import com.android.settings.R;
+
+/**
+ * This customized version of WifiSettings is shown to the user only during Setup Wizard. Menu
+ * selections are limited, clicking on an access point will auto-advance to the next screen (once
+ * connected), and, if the user opts to skip ahead without a wifi connection, a warning message
+ * alerts of possible carrier data charges or missing software updates.
+ */
+public class WifiSettingsForSetupWizard extends WifiSettings {
+
+ private static final String TAG = "WifiSettingsForSetupWizard";
+
+ /* Used in Wifi Setup context */
+
+ // this boolean extra specifies whether to disable the Next button when not connected
+ private static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
+
+ // this boolean extra specifies whether to auto finish when connection is established
+ private static final String EXTRA_AUTO_FINISH_ON_CONNECT = "wifi_auto_finish_on_connect";
+
+ // this boolean extra shows a custom button that we can control
+ protected static final String EXTRA_SHOW_CUSTOM_BUTTON = "wifi_show_custom_button";
+
+ // show a text regarding data charges when wifi connection is required during setup wizard
+ protected static final String EXTRA_SHOW_WIFI_REQUIRED_INFO = "wifi_show_wifi_required_info";
+
+ // this boolean extra is set if we are being invoked by the Setup Wizard
+ private static final String EXTRA_IS_FIRST_RUN = "firstRun";
+
+ // Activity result when pressing the Skip button
+ private static final int RESULT_SKIP = Activity.RESULT_FIRST_USER;
+
+ // From WizardManager (must match constants maintained there)
+ private static final String ACTION_NEXT = "com.android.wizard.NEXT";
+ private static final String EXTRA_SCRIPT_URI = "scriptUri";
+ private static final String EXTRA_ACTION_ID = "actionId";
+ private static final String EXTRA_RESULT_CODE = "com.android.setupwizard.ResultCode";
+ private static final int NEXT_REQUEST = 10000;
+
+ // should Next button only be enabled when we have a connection?
+ private boolean mEnableNextOnConnection;
+
+ // should activity finish once we have a connection?
+ private boolean mAutoFinishOnConnection;
+
+ private final IntentFilter mFilter;
+ private final BroadcastReceiver mReceiver;
+
+ public WifiSettingsForSetupWizard() {
+ super();
+
+ mFilter = new IntentFilter();
+ mFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
+
+ mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ NetworkInfo info = (NetworkInfo) intent.getParcelableExtra(
+ WifiManager.EXTRA_NETWORK_INFO);
+ changeNextButtonState(info.isConnected());
+ if (mAutoFinishOnConnection && info.isConnected()) {
+ Log.d(TAG, "mReceiver.onReceive context=" + context + " intent=" + intent);
+ finishOrNext(Activity.RESULT_OK);
+ }
+ }
+ };
+ }
+
+ @Override
+ public View onCreateView(final LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ final View view = inflater.inflate(R.layout.setup_preference, container, false);
+ final View other = view.findViewById(R.id.other_network);
+ other.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mWifiManager.isWifiEnabled()) {
+ onAddNetworkPressed();
+ }
+ }
+ });
+ final ImageButton b = (ImageButton) view.findViewById(R.id.more);
+ if (b != null) {
+ b.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mWifiManager.isWifiEnabled()) {
+ PopupMenu pm = new PopupMenu(inflater.getContext(), b);
+ pm.inflate(R.menu.wifi_setup);
+ pm.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ if (R.id.wifi_wps == item.getItemId()) {
+ showDialog(WPS_PBC_DIALOG_ID);
+ return true;
+ }
+ return false;
+ }
+ });
+ pm.show();
+ }
+ }
+ });
+ }
+
+ final Intent intent = getActivity().getIntent();
+ if (intent.getBooleanExtra(EXTRA_SHOW_CUSTOM_BUTTON, false)) {
+ view.findViewById(R.id.button_bar).setVisibility(View.VISIBLE);
+ view.findViewById(R.id.back_button).setVisibility(View.INVISIBLE);
+ view.findViewById(R.id.skip_button).setVisibility(View.INVISIBLE);
+ view.findViewById(R.id.next_button).setVisibility(View.INVISIBLE);
+
+ Button customButton = (Button) view.findViewById(R.id.custom_button);
+ customButton.setVisibility(View.VISIBLE);
+ customButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ boolean isConnected = false;
+ Activity activity = getActivity();
+ final ConnectivityManager connectivity = (ConnectivityManager)
+ activity.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (connectivity != null) {
+ final NetworkInfo info = connectivity.getActiveNetworkInfo();
+ isConnected = (info != null) && info.isConnected();
+ }
+ if (isConnected) {
+ // Warn of possible data charges
+ showDialog(WIFI_SKIPPED_DIALOG_ID);
+ } else {
+ // Warn of lack of updates
+ showDialog(WIFI_AND_MOBILE_SKIPPED_DIALOG_ID);
+ }
+ }
+ });
+ }
+
+ if (intent.getBooleanExtra(EXTRA_SHOW_WIFI_REQUIRED_INFO, false)) {
+ view.findViewById(R.id.wifi_required_info).setVisibility(View.VISIBLE);
+ }
+
+ return view;
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ getView().setSystemUiVisibility(
+ View.STATUS_BAR_DISABLE_HOME |
+ View.STATUS_BAR_DISABLE_RECENT |
+ View.STATUS_BAR_DISABLE_NOTIFICATION_ALERTS |
+ View.STATUS_BAR_DISABLE_CLOCK);
+
+ final Activity activity = getActivity();
+ final Intent intent = activity.getIntent();
+
+ // first if we're supposed to finish once we have a connection
+ mAutoFinishOnConnection = intent.getBooleanExtra(EXTRA_AUTO_FINISH_ON_CONNECT, false);
+
+ /*
+ * When entering with a savedInstanceState, we may be returning from a later activity in the
+ * setup flow. It's not clear yet if there are other possible circumstances. It's not
+ * appropriate to refire our activity results, so we skip that here.
+ */
+ if (mAutoFinishOnConnection && null == savedInstanceState) {
+ // Hide the next button
+ if (hasNextButton()) {
+ getNextButton().setVisibility(View.GONE);
+ }
+
+ final ConnectivityManager connectivity = (ConnectivityManager)
+ activity.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (connectivity != null
+ && connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) {
+ Log.d(TAG, "onActivityCreated Auto-finishing");
+ finishOrNext(Activity.RESULT_OK);
+ return;
+ }
+ }
+
+ // if we're supposed to enable/disable the Next button based on our current connection
+ // state, start it off in the right state
+ mEnableNextOnConnection = intent.getBooleanExtra(EXTRA_ENABLE_NEXT_ON_CONNECT, false);
+
+ if (mEnableNextOnConnection) {
+ if (hasNextButton()) {
+ final ConnectivityManager connectivity = (ConnectivityManager)
+ activity.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (connectivity != null) {
+ NetworkInfo info = connectivity.getNetworkInfo(
+ ConnectivityManager.TYPE_WIFI);
+ changeNextButtonState(info.isConnected());
+ }
+ }
+ }
+ }
+
+ @Override
+ public Dialog onCreateDialog(int dialogId) {
+ switch (dialogId) {
+ case WIFI_SKIPPED_DIALOG_ID:
+ return new AlertDialog.Builder(getActivity())
+ .setMessage(R.string.wifi_skipped_message)
+ .setCancelable(false)
+ .setNegativeButton(R.string.wifi_skip_anyway,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ finishOrNext(RESULT_SKIP);
+ }
+ })
+ .setPositiveButton(R.string.wifi_dont_skip,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ }
+ })
+ .create();
+ case WIFI_AND_MOBILE_SKIPPED_DIALOG_ID:
+ return new AlertDialog.Builder(getActivity())
+ .setMessage(R.string.wifi_and_mobile_skipped_message)
+ .setCancelable(false)
+ .setNegativeButton(R.string.wifi_skip_anyway,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ finishOrNext(RESULT_SKIP);
+ }
+ })
+ .setPositiveButton(R.string.wifi_dont_skip,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ }
+ })
+ .create();
+ }
+ return super.onCreateDialog(dialogId);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ getActivity().registerReceiver(mReceiver, mFilter);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ getActivity().unregisterReceiver(mReceiver);
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (resultCode == Activity.RESULT_CANCELED) {
+ // Before returning to the settings panel, forget any current access point so it will
+ // not attempt to automatically reconnect and advance
+ // FIXME: when coming back, it would be better to keep the current connection and
+ // override the auto-advance feature
+ final WifiInfo info = mWifiManager.getConnectionInfo();
+ if (null != info) {
+ int netId = info.getNetworkId();
+ if (netId != WifiConfiguration.INVALID_NETWORK_ID) {
+ mWifiManager.forget(netId, null);
+ }
+ }
+ }
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+
+ @Override
+ public void registerForContextMenu(View view) {
+ // Suppressed during setup wizard
+ }
+
+ @Override
+ /* package */ WifiEnabler createWifiEnabler() {
+ // Not shown during setup wizard
+ return null;
+ }
+
+ @Override
+ /* package */ void addOptionsMenuItems(Menu menu) {
+ final boolean wifiIsEnabled = mWifiManager.isWifiEnabled();
+ final TypedArray ta = getActivity().getTheme()
+ .obtainStyledAttributes(new int[] {R.attr.ic_wps});
+ menu.add(Menu.NONE, MENU_ID_WPS_PBC, 0, R.string.wifi_menu_wps_pbc)
+ .setIcon(ta.getDrawable(0))
+ .setEnabled(wifiIsEnabled)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+ menu.add(Menu.NONE, MENU_ID_ADD_NETWORK, 0, R.string.wifi_add_network)
+ .setEnabled(wifiIsEnabled)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+ ta.recycle();
+ }
+
+ @Override
+ /* package */ void forget() {
+ super.forget();
+
+ // We need to rename/replace "Next" button in wifi setup context.
+ changeNextButtonState(false);
+ }
+
+ /**
+ * Renames/replaces "Next" button when appropriate. "Next" button usually exists in
+ * Wifi setup screens, not in usual wifi settings screen.
+ *
+ * @param enabled true when the device is connected to a wifi network.
+ */
+ private void changeNextButtonState(boolean enabled) {
+ if (mEnableNextOnConnection && hasNextButton()) {
+ getNextButton().setEnabled(enabled);
+ }
+ }
+
+ /**
+ * Complete this activity and return the results to the caller. If using WizardManager, this
+ * will invoke the next scripted action; otherwise, we simply finish.
+ */
+ private void finishOrNext(int resultCode) {
+ Log.d(TAG, "finishOrNext resultCode=" + resultCode
+ + " isUsingWizardManager=" + isUsingWizardManager());
+ if (isUsingWizardManager()) {
+ sendResultsToSetupWizard(resultCode);
+ } else {
+ Activity activity = getActivity();
+ activity.setResult(resultCode);
+ activity.finish();
+ }
+ }
+
+ private boolean isUsingWizardManager() {
+ return getActivity().getIntent().hasExtra(EXTRA_SCRIPT_URI);
+ }
+
+ /**
+ * Send the results of this activity to WizardManager, which will then send out the next
+ * scripted activity. WizardManager does not actually return an activity result, but if we
+ * invoke WizardManager without requesting a result, the framework will choose not to issue a
+ * call to onActivityResult with RESULT_CANCELED when navigating backward.
+ */
+ private void sendResultsToSetupWizard(int resultCode) {
+ final Intent intent = getActivity().getIntent();
+ final Intent nextIntent = new Intent(ACTION_NEXT);
+ nextIntent.putExtra(EXTRA_SCRIPT_URI, intent.getStringExtra(EXTRA_SCRIPT_URI));
+ nextIntent.putExtra(EXTRA_ACTION_ID, intent.getStringExtra(EXTRA_ACTION_ID));
+ nextIntent.putExtra(EXTRA_RESULT_CODE, resultCode);
+ startActivityForResult(nextIntent, NEXT_REQUEST);
+ }
+}
diff --git a/src/com/android/settings/wifi/WifiSetupActivity.java b/src/com/android/settings/wifi/WifiSetupActivity.java
index 70ee56d..d4811ed 100644
--- a/src/com/android/settings/wifi/WifiSetupActivity.java
+++ b/src/com/android/settings/wifi/WifiSetupActivity.java
@@ -19,6 +19,8 @@
import android.content.res.Resources;
+import java.lang.Class;
+
public class WifiSetupActivity extends WifiPickerActivity implements ButtonBarHandler {
// Extra containing the resource name of the theme to be used
private static final String EXTRA_THEME = "theme";
@@ -41,4 +43,9 @@
}
super.onApplyThemeResource(theme, resid, first);
}
+
+ @Override
+ /* package */ Class getWifiSettingsClass() {
+ return WifiSettingsForSetupWizard.class;
+ }
}