Merge "Import translations. DO NOT MERGE" into lmp-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2d2f9b4..6ff3639 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -469,6 +469,21 @@
android:value="true" />
</activity>
+ <activity android:name="Settings$VoiceInputSettingsActivity"
+ android:label="@string/voice_input_settings_title"
+ android:taskAffinity="com.android.settings"
+ android:parentActivityName="Settings$InputMethodAndLanguageSettingsActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <action android:name="android.settings.VOICE_INPUT_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.voice.VoiceInputSettings" />
+ <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
+ android:resource="@id/language_settings" />
+ </activity>
+
<activity android:name="Settings$KeyboardLayoutPickerActivity"
android:label="@string/keyboard_layout_picker_title"
android:clearTaskOnLaunch="true">
@@ -984,6 +999,21 @@
</intent-filter>
</activity>
+ <activity android:name="Settings$UsageAccessSettingsActivity"
+ android:label="@string/usage_access_title"
+ android:taskAffinity="com.android.settings"
+ android:parentActivityName="Settings$SecuritySettingsActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <action android:name="android.settings.USAGE_ACCESS_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.UsageAccessSettings" />
+ <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
+ android:resource="@id/security_settings" />
+ </activity>
+
<activity-alias android:name="SetProfileOwner"
android:label="@string/profile_owner_add_title"
android:targetActivity="DeviceAdminAdd">
@@ -1079,7 +1109,11 @@
<!-- Lock screen settings -->
<activity android:name="ConfirmDeviceCredentialActivity"
android:exported="true">
- <!-- Use high-priority to prevent an installed activity from masquerading as this one. -->
+ <intent-filter>
+ <action android:name="android.app.action.CONFIRM_DEVICE_CREDENTIAL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <!-- TODO: Remove this once new API is being used -->
<intent-filter android:priority="1000">
<action android:name="android.intent.action.CONFIRM_DEVICE_CREDENTIAL" />
<category android:name="android.intent.category.DEFAULT" />
diff --git a/res/drawable-nodpi/grass_tile.jpg b/res/drawable-nodpi/grass_tile.jpg
deleted file mode 100644
index 7aef32c..0000000
--- a/res/drawable-nodpi/grass_tile.jpg
+++ /dev/null
Binary files differ
diff --git a/res/drawable-nodpi/illustration_wifi.jpg b/res/drawable-nodpi/illustration_wifi.jpg
deleted file mode 100644
index 0c03199..0000000
--- a/res/drawable-nodpi/illustration_wifi.jpg
+++ /dev/null
Binary files differ
diff --git a/res/drawable-nodpi/illustration_wifi_wide.jpg b/res/drawable-nodpi/illustration_wifi_wide.jpg
deleted file mode 100644
index 722fdfd..0000000
--- a/res/drawable-nodpi/illustration_wifi_wide.jpg
+++ /dev/null
Binary files differ
diff --git a/res/drawable-nodpi/setup_illustration_tile.png b/res/drawable-nodpi/setup_illustration_tile.png
new file mode 100644
index 0000000..ae6d244
--- /dev/null
+++ b/res/drawable-nodpi/setup_illustration_tile.png
Binary files differ
diff --git a/res/drawable-nodpi/setup_illustration_wifi.jpg b/res/drawable-nodpi/setup_illustration_wifi.jpg
new file mode 100644
index 0000000..2579225
--- /dev/null
+++ b/res/drawable-nodpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-nodpi/setup_illustration_wifi_wide.jpg b/res/drawable-nodpi/setup_illustration_wifi_wide.jpg
new file mode 100644
index 0000000..b876fa6
--- /dev/null
+++ b/res/drawable-nodpi/setup_illustration_wifi_wide.jpg
Binary files differ
diff --git a/res/drawable/grass.xml b/res/drawable/setup_illustration_bg.xml
similarity index 93%
rename from res/drawable/grass.xml
rename to res/drawable/setup_illustration_bg.xml
index 2fb5bd9..0a229c7 100644
--- a/res/drawable/grass.xml
+++ b/res/drawable/setup_illustration_bg.xml
@@ -16,5 +16,5 @@
-->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@drawable/grass_tile"
+ android:src="@drawable/setup_illustration_tile"
android:tileMode="repeat" />
diff --git a/res/drawable/wifi_signal_colored.xml b/res/drawable/wifi_signal_colored.xml
new file mode 100644
index 0000000..4eb41c0
--- /dev/null
+++ b/res/drawable/wifi_signal_colored.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+ <item settings:state_encrypted="true">
+ <level-list>
+ <item android:maxLevel="0">
+ <bitmap
+ android:src="@drawable/ic_wifi_lock_signal_1_light"
+ android:tint="?attr/wifi_signal_color" />
+ </item>
+ <item android:maxLevel="1">
+ <bitmap
+ android:src="@drawable/ic_wifi_lock_signal_2_light"
+ android:tint="?attr/wifi_signal_color" />
+ </item>
+ <item android:maxLevel="2">
+ <bitmap
+ android:src="@drawable/ic_wifi_lock_signal_3_light"
+ android:tint="?attr/wifi_signal_color" />
+ </item>
+ <item android:maxLevel="3">
+ <bitmap
+ android:src="@drawable/ic_wifi_lock_signal_4_light"
+ android:tint="?attr/wifi_signal_color" />
+ </item>
+ </level-list>
+ </item>
+ <item settings:state_encrypted="false">
+ <level-list>
+ <item android:maxLevel="0">
+ <bitmap
+ android:src="@drawable/ic_wifi_signal_1_light"
+ android:tint="?attr/wifi_signal_color" />
+ </item>
+ <item android:maxLevel="1">
+ <bitmap
+ android:src="@drawable/ic_wifi_signal_2_light"
+ android:tint="?attr/wifi_signal_color" />
+ </item>
+ <item android:maxLevel="2">
+ <bitmap
+ android:src="@drawable/ic_wifi_signal_3_light"
+ android:tint="?attr/wifi_signal_color" />
+ </item>
+ <item android:maxLevel="3">
+ <bitmap
+ android:src="@drawable/ic_wifi_signal_4_light"
+ android:tint="?attr/wifi_signal_color" />
+ </item>
+ </level-list>
+ </item>
+</selector>
+
diff --git a/res/layout-land/setup_preference.xml b/res/layout-land/setup_preference.xml
index e79f5c1..b2e1cc7 100644
--- a/res/layout-land/setup_preference.xml
+++ b/res/layout-land/setup_preference.xml
@@ -25,7 +25,7 @@
android:id="@+id/title_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/grass">
+ android:background="@drawable/setup_illustration_bg">
<TextView
android:id="@+id/title"
diff --git a/res/layout-sw600dp-land/setup_preference.xml b/res/layout-sw600dp-land/setup_preference.xml
index 90bd443..1c39405 100644
--- a/res/layout-sw600dp-land/setup_preference.xml
+++ b/res/layout-sw600dp-land/setup_preference.xml
@@ -16,6 +16,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:id="@+id/fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -25,8 +26,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
- android:foreground="@drawable/illustration_wifi_wide"
- android:background="@drawable/grass">
+ android:foreground="@drawable/setup_illustration_wifi_wide"
+ android:background="@drawable/setup_illustration_bg"
+ settings:autoMirrored="true">
<LinearLayout
android:layout_width="match_parent"
diff --git a/res/layout-sw600dp/crypt_keeper_pattern_entry.xml b/res/layout-sw600dp/crypt_keeper_pattern_entry.xml
index 4685ebf..3937008 100644
--- a/res/layout-sw600dp/crypt_keeper_pattern_entry.xml
+++ b/res/layout-sw600dp/crypt_keeper_pattern_entry.xml
@@ -18,26 +18,24 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="@dimen/crypt_keeper_pattern_top_margin">
<include layout="@layout/crypt_keeper_status" />
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:layout_gravity="center_horizontal">
+ <LinearLayout
+ android:layout_width="@dimen/crypt_keeper_pattern_size"
+ android:layout_height="@dimen/crypt_keeper_pattern_size"
+ android:orientation="horizontal"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="@dimen/crypt_keeper_pattern_separator">
- <!-- Password entry field -->
- <LinearLayout
- android:layout_height="@dimen/crypt_keeper_pattern_size"
- android:layout_width="@dimen/crypt_keeper_pattern_size"
- android:layout_centerVertical="true"
- android:orientation="horizontal">
- <include layout="@layout/crypt_keeper_pattern_field" />
- </LinearLayout>
+ <include layout="@layout/crypt_keeper_pattern_field" />
- </RelativeLayout>
+ </LinearLayout>
+
+ <include layout="@layout/crypt_keeper_emergency_button" />
+
</LinearLayout>
diff --git a/res/layout/advanced_security_settings.xml b/res/layout/advanced_security_settings.xml
deleted file mode 100644
index 98ff43d..0000000
--- a/res/layout/advanced_security_settings.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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
- -->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingStart="@dimen/settings_side_margin"
- android:paddingEnd="@dimen/settings_side_margin">
-
- <ListView android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:drawSelectorOnTop="false"
- android:fastScrollEnabled="true" />
-
- <TextView android:id="@android:id/empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center"
- android:text="@string/no_trust_agents"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
-</FrameLayout>
diff --git a/res/layout/crypt_keeper_emergency_button.xml b/res/layout/crypt_keeper_emergency_button.xml
new file mode 100644
index 0000000..d0004de
--- /dev/null
+++ b/res/layout/crypt_keeper_emergency_button.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+**
+** Copyright 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.
+*/
+-->
+
+<!-- Emergency call button.
+ Text is set by CryptKeeper.updateEmergencyCallButtonState() -->
+<Button
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/emergencyCallButton"
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ android:layout_gravity="center_horizontal"
+ android:textSize="14sp"
+ android:fontFamily="sans-serif"
+ android:textColor="#FFFFFF"
+ android:layout_weight="1"
+ android:gravity="bottom"
+ style="?android:attr/borderlessButtonStyle" />
diff --git a/res/layout/crypt_keeper_password_entry.xml b/res/layout/crypt_keeper_password_entry.xml
index 6e99527..a7fecba 100644
--- a/res/layout/crypt_keeper_password_entry.xml
+++ b/res/layout/crypt_keeper_password_entry.xml
@@ -20,36 +20,23 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:layout_marginTop="@dimen/crypt_keeper_password_top_margin">
<include layout="@layout/crypt_keeper_status" />
<LinearLayout
- android:layout_height="0dp"
- android:layout_width="match_parent"
- android:layout_weight="1"
- android:layout_marginStart="@dimen/crypt_keeper_edit_text_margin"
- android:layout_marginEnd="@dimen/crypt_keeper_edit_text_margin"
- android:orientation="vertical"
- android:gravity="center_vertical">
+ android:layout_width="@dimen/crypt_keeper_password_width"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginTop="16dip"
+ android:layout_gravity="center_horizontal"
+ android:background="@color/crypt_keeper_password_background">
- <LinearLayout
- android:background="@color/crypt_keeper_password_background"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <include layout="@layout/crypt_keeper_password_field" />
- </LinearLayout>
+ <include layout="@layout/crypt_keeper_password_field" />
</LinearLayout>
- <!-- Emergency call button.
- Text is set by CryptKeeper.updateEmergencyCallButtonState() -->
- <Button android:id="@+id/emergencyCallButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="@dimen/crypt_keeper_emergency_call_space_above"
- style="?android:attr/borderlessButtonStyle" />
+ <include layout="@layout/crypt_keeper_emergency_button" />
</LinearLayout>
diff --git a/res/layout/crypt_keeper_pattern_entry.xml b/res/layout/crypt_keeper_pattern_entry.xml
index 80e318f..00d3d6e 100644
--- a/res/layout/crypt_keeper_pattern_entry.xml
+++ b/res/layout/crypt_keeper_pattern_entry.xml
@@ -20,35 +20,22 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:layout_marginTop="@dimen/crypt_keeper_pattern_top_margin">
<include layout="@layout/crypt_keeper_status" />
<LinearLayout
- android:layout_height="0dp"
android:layout_width="match_parent"
- android:layout_weight="1"
- android:orientation="vertical"
- android:gravity="center_vertical">
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/crypt_keeper_pattern_margin"
+ android:layout_marginEnd="@dimen/crypt_keeper_pattern_margin"
+ android:orientation="horizontal">
- <LinearLayout
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_marginStart="@dimen/crypt_keeper_edit_text_margin"
- android:layout_marginEnd="@dimen/crypt_keeper_edit_text_margin"
- android:orientation="horizontal" >
- <include layout="@layout/crypt_keeper_pattern_field" />
- </LinearLayout>
+ <include layout="@layout/crypt_keeper_pattern_field" />
</LinearLayout>
- <!-- Emergency call button.
- Text and icon are set by CryptKeeper.updateEmergencyCallButtonState() -->
- <Button android:id="@+id/emergencyCallButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginTop="@dimen/crypt_keeper_emergency_call_space_above"
- style="?android:attr/borderlessButtonStyle" />
+ <include layout="@layout/crypt_keeper_emergency_button" />
</LinearLayout>
diff --git a/res/layout/crypt_keeper_pin_entry.xml b/res/layout/crypt_keeper_pin_entry.xml
index 0bcbec5..3926ab0 100644
--- a/res/layout/crypt_keeper_pin_entry.xml
+++ b/res/layout/crypt_keeper_pin_entry.xml
@@ -20,36 +20,23 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:layout_marginTop="@dimen/crypt_keeper_password_top_margin">
<include layout="@layout/crypt_keeper_status" />
<LinearLayout
- android:layout_height="0dp"
- android:layout_width="match_parent"
- android:layout_weight="1"
- android:layout_marginStart="@dimen/crypt_keeper_edit_text_margin"
- android:layout_marginEnd="@dimen/crypt_keeper_edit_text_margin"
- android:orientation="vertical"
- android:gravity="center_vertical">
+ android:layout_width="@dimen/crypt_keeper_password_width"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dip"
+ android:orientation="horizontal"
+ android:layout_gravity="center_horizontal"
+ android:background="@color/crypt_keeper_password_background">
- <LinearLayout
- android:background="@color/crypt_keeper_password_background"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <include layout="@layout/crypt_keeper_pin_field" />
- </LinearLayout>
+ <include layout="@layout/crypt_keeper_pin_field" />
</LinearLayout>
- <!-- Emergency call button.
- Text is set by CryptKeeper.updateEmergencyCallButtonState() -->
- <Button android:id="@+id/emergencyCallButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="@dimen/crypt_keeper_emergency_call_space_above"
- style="?android:attr/borderlessButtonStyle" />
+ <include layout="@layout/crypt_keeper_emergency_button" />
</LinearLayout>
diff --git a/res/layout/crypt_keeper_status.xml b/res/layout/crypt_keeper_status.xml
index c366b57..bddff1a 100644
--- a/res/layout/crypt_keeper_status.xml
+++ b/res/layout/crypt_keeper_status.xml
@@ -31,11 +31,11 @@
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="10dip"
android:layout_marginStart="8dip"
android:layout_marginEnd="8dip"
- android:textSize="18sp"
- android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="16sp"
+ android:fontFamily="sans-serif"
+ android:textColor="@android:color/white"
android:text="@string/enter_password"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal" />
@@ -51,6 +51,8 @@
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:textSize="16sp"
- android:textAppearance="?android:attr/textAppearanceMedium" />
+ android:fontFamily="sans-serif"
+ android:textColor="#B3FFFFFF"
+ android:gravity="center_horizontal" />
</LinearLayout>
diff --git a/res/layout/mac_preference.xml b/res/layout/mac_preference.xml
new file mode 100644
index 0000000..f096b07
--- /dev/null
+++ b/res/layout/mac_preference.xml
@@ -0,0 +1,79 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:gravity="center_vertical"
+ android:orientation="vertical"
+ android:background="?android:attr/selectableItemBackground">
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="@dimen/wifi_divider_height"
+ android:background="@color/wifi_divider" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:gravity="center_vertical"
+ android:background="?android:attr/selectableItemBackground">
+
+ <RelativeLayout
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingTop="6dip"
+ android:paddingBottom="6dip">
+
+ <TextView
+ android:id="@+android:id/title"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingStart="16dip"
+ android:paddingEnd="16dip"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal" />
+
+ <TextView
+ android:id="@android:id/summary"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@android:id/title"
+ android:layout_alignStart="@android:id/title"
+ android:paddingStart="16dip"
+ android:layout_marginEnd="16dip"
+ android:visibility="gone"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="4" />
+
+ </RelativeLayout>
+
+ <LinearLayout
+ android:id="@android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="vertical" />
+
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/res/layout/radio_info.xml b/res/layout/radio_info.xml
index 760cf80..d81dad6 100644
--- a/res/layout/radio_info.xml
+++ b/res/layout/radio_info.xml
@@ -234,14 +234,6 @@
android:layout_height="wrap_content"
/>
- <!-- Dial over PS (i.e. MO VoLTE) -->
- <Button android:id="@+id/mo_over_volte"
- android:textSize="14sp"
- android:layout_marginTop="8dip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- />
-
<!-- LTE ram dump -->
<Button android:id="@+id/lte_ram_dump"
android:textSize="14sp"
diff --git a/res/layout/setup_wizard_header.xml b/res/layout/setup_wizard_header.xml
index ebc2304..90818cd 100644
--- a/res/layout/setup_wizard_header.xml
+++ b/res/layout/setup_wizard_header.xml
@@ -21,10 +21,11 @@
android:id="@+id/title_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/grass"
- android:foreground="@drawable/illustration_wifi"
+ android:background="@drawable/setup_illustration_bg"
+ android:foreground="@drawable/setup_illustration_wifi"
android:tag="stickyContainer"
- settings:aspectRatio="2.0">
+ settings:aspectRatio="2.0"
+ settings:autoMirrored="true">
<TextView
android:id="@+id/title"
diff --git a/res/layout/wifi_assistant_card.xml b/res/layout/wifi_assistant_card.xml
index 529f9e9..7c9af17 100644
--- a/res/layout/wifi_assistant_card.xml
+++ b/res/layout/wifi_assistant_card.xml
@@ -32,7 +32,7 @@
<ImageView
android:id="@+id/cardBackground"
- android:background="@color/setup_add_wifi_network_text_color"
+ android:background="@color/wifi_assistant_color_accent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
diff --git a/res/values-sw600dp-land/dimens.xml b/res/values-sw600dp-land/dimens.xml
index c0a79ad..eb37d0f 100755
--- a/res/values-sw600dp-land/dimens.xml
+++ b/res/values-sw600dp-land/dimens.xml
@@ -20,4 +20,11 @@
<dimen name="screen_margin_bottom">48dip</dimen>
<dimen name="appwidget_preview_height">80dip</dimen>
<dimen name="keyguard_appwidget_picker_width">720dip</dimen>
+
+ <!-- CryptKeeper top margin for password/pin screen -->
+ <dimen name="crypt_keeper_password_top_margin">116dip</dimen>
+
+ <!-- CryptKeeper top margin for pattern screen -->
+ <dimen name="crypt_keeper_pattern_top_margin">128dip</dimen>
+
</resources>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index e040167..e1bb33e 100755
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -55,6 +55,18 @@
<dimen name="dashboard_tile_image_margin_start">8dp</dimen>
<dimen name="dashboard_tile_image_margin_end">32dp</dimen>
+ <!-- CryptKeeper top margin for password/pin screen -->
+ <dimen name="crypt_keeper_password_top_margin">256dip</dimen>
+
+ <!-- CryptKeeper top margin for pattern screen -->
+ <dimen name="crypt_keeper_pattern_top_margin">256dip</dimen>
+
+ <!-- CryptKeeper separation between status and pattern -->
+ <dimen name="crypt_keeper_pattern_separator">100dip</dimen>
+
+ <!-- CryptKeeper password/pin width -->
+ <dimen name="crypt_keeper_password_width">512dip</dimen>
+
<!-- SwitchBar margin start / end -->
<dimen name="switchbar_margin_start">24dp</dimen>
<dimen name="switchbar_margin_end">24dp</dimen>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 1fe36d6..8d17a28 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -24,6 +24,7 @@
<declare-styleable name="SetupWizardIllustration">
<attr name="aspectRatio" format="float" />
+ <attr name="autoMirrored" format="boolean" />
</declare-styleable>
<declare-styleable name="BatteryHistoryChart">
diff --git a/res/values/colors.xml b/res/values/colors.xml
index df61730..cba8483 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -40,8 +40,12 @@
<color name="title_color">@android:color/holo_blue_light</color>
<color name="setup_divider_color_dark">#33ffffff</color>
<color name="setup_divider_color_light">#33000000</color>
- <color name="setup_add_wifi_network_text_color">#ff009587</color>
- <color name="setup_add_wifi_network_background_color">#ff009587</color>
+ <color name="setup_wizard_color_accent_dark">#ff00e4ff</color>
+ <color name="setup_wizard_color_accent_light">#ff00828e</color>
+ <color name="setup_wizard_wifi_color_dark">#ff00e4ff</color>
+ <color name="setup_wizard_wifi_color_light">#ff0096a6</color>
+
+ <color name="wifi_assistant_color_accent">#ff009587</color>
<color name="circle_avatar_frame_color">#ffffffff</color>
<color name="circle_avatar_frame_shadow_color">#80000000</color>
@@ -66,13 +70,16 @@
<color name="theme_accent">#ff009688</color>
<color name="dashboard_background_color">#ffe1e1e0</color>
- <color name="switchbar_background_color">#ff384248</color>
+ <color name="switchbar_background_color">#ff37474f</color>
<color name="switch_accent_color">#ff7fcac3</color>
<color name="default_preference_background_color">@*android:color/background_material_light</color>
<color name="preference_background_color">@color/default_preference_background_color</color>
<color name="search_panel_list_background_color">@color/default_preference_background_color</color>
+ <color name="setup_wizard_preference_background_color_dark">@*android:color/background_material_dark</color>
+ <color name="setup_wizard_preference_background_color_light">@*android:color/background_material_light</color>
+
<!-- Default avatar colors -->
<color name="pink_500">#ffe91e63</color>
<color name="indigo_500">#ff3f51b5</color>
@@ -85,4 +92,6 @@
<!-- Avatar color used for guest -->
<color name="grey_500">@*android:color/material_grey_500</color>
+ <color name="wifi_divider">#ffe0e0e0</color>
+
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index cb87bf0..865b029 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -168,8 +168,14 @@
<dimen name="wifi_assistant_padding">25dp</dimen>
<dimen name="wifi_assistant_text_padding">16dp</dimen>
- <!-- CryptKeeper edit text margin -->
- <dimen name="crypt_keeper_edit_text_margin">16dip</dimen>
+ <!-- CryptKeeper top margin for password/pin screen -->
+ <dimen name="crypt_keeper_password_top_margin">88dip</dimen>
+
+ <!-- CryptKeeper top margin for pattern screen -->
+ <dimen name="crypt_keeper_pattern_top_margin">88dip</dimen>
+
+ <!-- CryptKeeper password/pin width -->
+ <dimen name="crypt_keeper_password_width">280dip</dimen>
<!-- CryptKeeper emergency call button dimensions -->
<dimen name="crypt_keeper_emergency_call_space_above">16dip</dimen>
@@ -177,6 +183,9 @@
<!-- CryptKeeper edit text ime icon padding -->
<dimen name="crypt_keeper_edit_text_ime_padding">8dip</dimen>
+ <!-- CryptKeeper pattern margin on phone -->
+ <dimen name="crypt_keeper_pattern_margin">8dip</dimen>
+
<!-- CryptKeeper pattern size for tablet -->
<dimen name="crypt_keeper_pattern_size">354dip</dimen>
@@ -208,4 +217,6 @@
<dimen name="bluetooth_dialog_padding">8dip</dimen>
<integer name="bluetooth_name_length">32</integer>
+ <dimen name="wifi_divider_height">1px</dimen>
+
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 864d83c..b71c344 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -67,11 +67,6 @@
<!-- Phone SMS over IMS off. Only shown in diagnostic screen, so precise translation is not needed. -->
<string name="sms_over_ims_off">Turn off SMS over IMS</string>
- <!-- MO over PS/VoLTE. Only shown in diagnostic screen, so precise translation is not needed. -->
- <string name="mo_over_volte_on">Enable MO over PS/VoLTE</string>
- <!-- MO over PS/VoLTE. Only shown in diagnostic screen, so precise translation is not needed. -->
- <string name="mo_over_volte_off">Disable MO over PS/VoLTE</string>
-
<!-- Phone SMS over IMS IMS registration required on. Only shown in diagnostic screen, so precise translation is not needed. -->
<string name="ims_reg_required_on">Turn on IMS registration required</string>
<!-- Phone IMS registration required off. Only shown in diagnostic screen, so precise translation is not needed. -->
@@ -275,7 +270,7 @@
<string name="bluetooth_empty_list_user_restricted">You don\'t have permission to change Bluetooth settings.</string>
<!-- Bluetooth Visibility message. This message informs the user that their device is now visible to other bluetooth devices. [CHAR LIMIT=50] -->
- <string name="bluetooth_is_visible_message"><xliff:g id="device_name">%1$s</xliff:g> is now visible to nearby devices.</string>
+ <string name="bluetooth_is_visible_message"><xliff:g id="device_name">%1$s</xliff:g> is visible to nearby devices while Bluetooth Settings is open.</string>
<!-- Bluetooth Visibility discoonect question. Asks the user if they wish to disconnect a paired bluetooth device. [CHAR LIMIT=50] -->
<string name="bluetooth_is_disconnect_question">Disconnect <xliff:g id="device_name">%1$s</xliff:g>?</string>
<!-- Bluetooth broadcasting settings, option to enable/disable broadcasting -->
@@ -319,8 +314,6 @@
<string name="bluetooth_notif_message">Touch to pair with <xliff:g id="device_name">%1$s</xliff:g>.</string>
<!-- Bluetooth settings screen, menu to show the list of received files [CHAR LIMIT=30] -->
<string name="bluetooth_show_received_files">Show received files</string>
- <!-- Bluetooth settings screen, menu to show the list of email accounts to pull messages from [CHAR LIMIT=30] -->
- <string name="bluetooth_show_message_access">Message access</string>
<!-- Strings for BluetoothDevicePicker -->
<string name="device_picker">Bluetooth device chooser</string>
@@ -331,8 +324,6 @@
<!-- Strings for asking to the user whether to allow an app to enable bluetooth -->
<string name="bluetooth_ask_enablement">An app wants to turn on Bluetooth.</string>
- <!-- String for informing the user that bluetooth devices must be granted permission. [CHAR LIMIT=100] -->
- <string name="bluetooth_message_access_notice">Bluetooth devices must ask for permission before accessing available accounts.</string>
<!-- Strings for asking to the user whether to allow an app to enable discovery mode -->
<string name="bluetooth_ask_discovery" product="tablet">An app wants to make your tablet visible to other Bluetooth devices for <xliff:g id="timeout">%1$d</xliff:g> seconds.</string>
<!-- Strings for asking to the user whether to allow an app to enable discovery mode -->
@@ -1212,8 +1203,6 @@
<string name="bluetooth_pairing_dialog_paring_request"><xliff:g id="device_name">%1$s</xliff:g> wants to pair with Bluetooth. When connected, it will have access to your contacts and call history.</string>
<!-- Bluetooth settings: The sub heading for devices which have already been paired with this device. [CHAR LIMIT=40] -->
<string name="bluetooth_preference_paired_devices">Paired devices</string>
- <!-- Bluetooth settings: The sub heading for messaging accesses. [CHAR LIMIT=50] -->
- <string name="bluetooth_message_access">Paired devices can view messages from</string>
<!-- Bluetooth settings: The sub heading for available devices during and after scanning. [CHAR LIMIT=40] -->
<string name="bluetooth_preference_found_devices">Available devices</string>
<!-- Bluetooth settings: The message displayed if no Bluetooth devices were found. [CHAR LIMIT=40] -->
@@ -1491,7 +1480,7 @@
<!-- Checkbox title for option to Automatically manage Wi\u2011Fi [CHAR LIMIT=40] -->
<string name="wifi_automatically_manage_title">Automatically manage Wi\u2011Fi</string>
<!-- Checkbox summary for option to Automatically manage Wi\u2011Fi [CHAR LIMIT=100] -->
- <string name="wifi_automatically_manage_summary">Let a Wi\u2011Fi assistant manage your Wi\u2011Fi connection</string>
+ <string name="wifi_automatically_manage_summary">Let <xliff:g id="wifi_assistant">%1$s</xliff:g> manage your Wi\u2011Fi connection</string>
<!-- Checkbox title for option for Wi\u2011Fi Assistant [CHAR LIMIT=40] -->
<string name="wifi_assistant_setting_title">Wi\u2011Fi assistant</string>
<!-- Checkbox summary for option for Wi\u2011Fi Assistant [CHAR LIMIT=40] -->
@@ -1639,12 +1628,6 @@
<!-- Substring of wifi status when Wi-Fi Protected Setup (WPS) is available and
string is listed after a wifi_secured_* string-->
<string name="wifi_wps_available_second_item">\u0020(WPS available)</string>
- <!-- Substring of wifi status for wifi with authentication. This version is for when the
- string is first in the list (titlecase in english) -->
- <string name="wifi_secured_first_item">Secured with <xliff:g id="wifi_security_short">%1$s</xliff:g></string>
- <!-- Substring of wifi status for wifi with authentication. This version is for when the
- string is not first in the list (lowercase in english) -->
- <string name="wifi_secured_second_item">, secured with <xliff:g id="wifi_security_short">%1$s</xliff:g></string>
<!-- Message in WriteWifiConfigToNfcDialog when prompted to enter network password [CHAR_LIMIT=40] -->
<string name="wifi_wps_nfc_enter_password">Enter your network password</string>
@@ -4772,6 +4755,11 @@
<!-- UI debug setting: force use of NuPlayer summary [CHAR LIMIT=50] -->
<string name="use_nuplayer_summary">Use NuPlayer instead of AwesomePlayer</string>
+ <!-- UI debug setting: disable USB audio routing title [CHAR LIMIT=25] -->
+ <string name="usb_audio_disable_routing">Disable USB audio routing</string>
+ <!-- UI debug setting: disable USB audio routing summary [CHAR LIMIT=50] -->
+ <string name="usb_audio_disable_routing_summary">Disable automatic routing to USB audio peripherals</string>
+
<!-- UI debug setting: show layout bounds information [CHAR LIMIT=25] -->
<string name="debug_layout">Show layout bounds</string>
<!-- UI debug setting: show layout bounds information summary [CHAR LIMIT=50] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 566748a..1b08e0f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -192,7 +192,7 @@
<item name="android:paddingStart">@dimen/setup_list_no_icon_padding</item>
<item name="android:textAllCaps">true</item>
<item name="android:textAppearance">@android:style/TextAppearance.Small</item>
- <item name="android:textColor">@color/setup_add_wifi_network_text_color</item>
+ <item name="android:textColor">?android:attr/colorAccent</item>
</style>
<style name="wifi_item">
@@ -290,7 +290,7 @@
<style name="WifiAssistantButton">
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
- <item name="android:textColor">@color/setup_add_wifi_network_text_color</item>
+ <item name="android:textColor">@color/wifi_assistant_color_accent</item>
</style>
<!-- Scrollbar style OUTSIDE_OVERLAY -->
diff --git a/res/values/themes.xml b/res/values/themes.xml
index ed74308..aa46341 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -19,10 +19,12 @@
<attr name="ic_menu_moreoverflow" format="reference" />
<attr name="ic_wps" format="reference" />
<attr name="setup_divider_color" format="reference" />
+ <attr name="wifi_signal_color" format="reference" />
<attr name="wifi_signal" format="reference" />
<style name="SetupWizardWifiTheme" parent="android:Theme.Material.NoActionBar">
<item name="android:alertDialogTheme">@style/Theme.WifiDialog</item>
+ <item name="android:colorAccent">@color/setup_wizard_color_accent_dark</item>
<item name="android:listPreferredItemPaddingEnd">@dimen/setup_wizard_margin_sides</item>
<item name="android:listPreferredItemPaddingStart">@dimen/setup_wizard_margin_sides</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -32,12 +34,14 @@
<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>
- <item name="preferenceBackgroundColor">@drawable/preference_background</item>
+ <item name="wifi_signal_color">@color/setup_wizard_wifi_color_dark</item>
+ <item name="wifi_signal">@drawable/wifi_signal_colored</item>
+ <item name="preferenceBackgroundColor">@color/setup_wizard_preference_background_color_dark</item>
</style>
<style name="SetupWizardWifiTheme.Light" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:alertDialogTheme">@style/Theme.Light.WifiDialog</item>
+ <item name="android:colorAccent">@color/setup_wizard_color_accent_light</item>
<item name="android:listPreferredItemPaddingEnd">@dimen/setup_wizard_margin_sides</item>
<item name="android:listPreferredItemPaddingStart">@dimen/setup_wizard_margin_sides</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -47,8 +51,9 @@
<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>
- <item name="preferenceBackgroundColor">@drawable/preference_background</item>
+ <item name="wifi_signal_color">@color/setup_wizard_wifi_color_light</item>
+ <item name="wifi_signal">@drawable/wifi_signal_colored</item>
+ <item name="preferenceBackgroundColor">@color/setup_wizard_preference_background_color_light</item>
</style>
<style name="Theme.WifiDialog" parent="@*android:style/Theme.Material.Dialog.Alert">
diff --git a/res/xml/bluetooth_message_access.xml b/res/xml/bluetooth_message_access.xml
deleted file mode 100644
index d1da132..0000000
--- a/res/xml/bluetooth_message_access.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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:title="@string/bluetooth_show_message_access">
-
- <PreferenceCategory
- android:key="accounts"
- android:title="@string/bluetooth_message_access" />
-
- <Preference
- android:key="notice"
- android:title=""
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/colorForegroundInverse"
- android:selectable="false"
- android:summary="@string/bluetooth_message_access_notice" />
-
-</PreferenceScreen>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 854aa97..2a1a5bb 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -251,6 +251,11 @@
android:title="@string/use_nuplayer"
android:summary="@string/use_nuplayer_summary"/>
+ <CheckBoxPreference
+ android:key="usb_audio"
+ android:title="@string/usb_audio_disable_routing"
+ android:summary="@string/usb_audio_disable_routing_summary" />
+
</PreferenceCategory>
<PreferenceCategory android:key="debug_monitoring_category"
diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml
index 9d12857..b60dc5e 100644
--- a/res/xml/language_settings.xml
+++ b/res/xml/language_settings.xml
@@ -65,34 +65,6 @@
android:persistent="false">
<!-- Additional preference screens are inserted here programmatically
with low order values to set the key map of each attached keyboard. -->
-
- <CheckBoxPreference
- android:key="auto_replace"
- android:title="@string/auto_replace"
- android:summaryOn="@string/auto_replace_summary"
- android:summaryOff="@string/auto_replace_summary"
- android:order="1000"
- android:persistent="false"
- />
-
- <CheckBoxPreference
- android:key="auto_caps"
- android:title="@string/auto_caps"
- android:summaryOn="@string/auto_caps_summary"
- android:summaryOff="@string/auto_caps_summary"
- android:order="1001"
- android:persistent="false"
- />
-
- <CheckBoxPreference
- android:key="auto_punctuate"
- android:title="@string/auto_punctuate"
- android:summaryOn="@string/auto_punctuate_summary"
- android:summaryOff="@string/auto_punctuate_summary"
- android:order="1002"
- android:persistent="false"
- />
-
</PreferenceCategory>
<PreferenceCategory
diff --git a/res/xml/privacy_settings.xml b/res/xml/privacy_settings.xml
index 99fdc3f..44894e7 100644
--- a/res/xml/privacy_settings.xml
+++ b/res/xml/privacy_settings.xml
@@ -22,7 +22,7 @@
android:title="@string/backup_section_title">
<!-- Backup settings -->
- <CheckBoxPreference
+ <SwitchPreference
android:key="backup_data"
android:title="@string/backup_data_title"
android:summary="@string/backup_data_summary"
@@ -37,7 +37,7 @@
<intent android:action="dummy" />
</PreferenceScreen>
- <CheckBoxPreference
+ <SwitchPreference
android:key="auto_restore"
android:title="@string/auto_restore_title"
android:summary="@string/auto_restore_summary"
diff --git a/res/xml/security_settings_biometric_weak.xml b/res/xml/security_settings_biometric_weak.xml
index 750a270..4879fe6 100644
--- a/res/xml/security_settings_biometric_weak.xml
+++ b/res/xml/security_settings_biometric_weak.xml
@@ -31,12 +31,12 @@
android:key="biometric_weak_improve_matching"
android:title="@string/biometric_weak_improve_matching_title"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="biometric_weak_liveliness"
android:title="@string/biometric_weak_liveliness_title"
android:summary="@string/biometric_weak_liveliness_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="visiblepattern"
android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>
@@ -48,7 +48,7 @@
android:entryValues="@array/lock_after_timeout_values"
android:persistent="false"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
diff --git a/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index 7219a6c..1f280a9 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -36,7 +36,7 @@
<PreferenceCategory android:title="@string/security_passwords_title"
android:persistent="false">
- <CheckBoxPreference android:key="show_password"
+ <SwitchPreference android:key="show_password"
android:title="@string/show_password"
android:persistent="false"/>
@@ -52,7 +52,7 @@
android:persistent="false"
android:fragment="com.android.settings.DeviceAdminSettings"/>
- <CheckBoxPreference android:key="toggle_install_applications"
+ <SwitchPreference android:key="toggle_install_applications"
android:title="@string/install_applications"
android:summaryOff="@string/install_unknown_applications"
android:summaryOn="@string/install_unknown_applications"
@@ -107,7 +107,7 @@
android:title="@string/manage_trust_agents"
android:summary="@string/manage_trust_agents_summary"
android:persistent="false"
- android:fragment="com.android.settings.AdvancedSecuritySettings"/>
+ android:fragment="com.android.settings.TrustAgentSettings"/>
<PreferenceScreen
android:key="screen_pinning_settings"
diff --git a/res/xml/security_settings_password.xml b/res/xml/security_settings_password.xml
index bb9c360..b6ea76e 100644
--- a/res/xml/security_settings_password.xml
+++ b/res/xml/security_settings_password.xml
@@ -35,7 +35,7 @@
android:entryValues="@array/lock_after_timeout_values"
android:persistent="false"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
diff --git a/res/xml/security_settings_pattern.xml b/res/xml/security_settings_pattern.xml
index 168a685..cb848c6 100644
--- a/res/xml/security_settings_pattern.xml
+++ b/res/xml/security_settings_pattern.xml
@@ -27,7 +27,7 @@
android:summary="@string/unlock_set_unlock_mode_pattern"
android:persistent="false"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="visiblepattern"
android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>
@@ -39,7 +39,7 @@
android:entryValues="@array/lock_after_timeout_values"
android:persistent="false"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
diff --git a/res/xml/security_settings_pin.xml b/res/xml/security_settings_pin.xml
index 4ead03f..e45bdf5 100644
--- a/res/xml/security_settings_pin.xml
+++ b/res/xml/security_settings_pin.xml
@@ -35,7 +35,7 @@
android:entryValues="@array/lock_after_timeout_values"
android:persistent="false"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
diff --git a/res/drawable/grass.xml b/res/xml/trust_agent_settings.xml
similarity index 73%
copy from res/drawable/grass.xml
copy to res/xml/trust_agent_settings.xml
index 2fb5bd9..e9374f3 100644
--- a/res/drawable/grass.xml
+++ b/res/xml/trust_agent_settings.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2014 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.
@@ -15,6 +14,6 @@
limitations under the License.
-->
-<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@drawable/grass_tile"
- android:tileMode="repeat" />
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="trust_agents"
+ android:title="@string/manage_trust_agents" />
diff --git a/res/xml/wifi_advanced_settings.xml b/res/xml/wifi_advanced_settings.xml
index 118f691..f83a106 100644
--- a/res/xml/wifi_advanced_settings.xml
+++ b/res/xml/wifi_advanced_settings.xml
@@ -18,31 +18,30 @@
android:title="@string/wifi_advanced_titlebar">
<!-- android:dependency="enable_wifi" -->
- <CheckBoxPreference
+ <SwitchPreference
android:key="notify_open_networks"
android:title="@string/wifi_notify_open_networks"
android:summary="@string/wifi_notify_open_networks_summary"
android:persistent="false" />
+ <SwitchPreference
+ android:key="wifi_scan_always_available"
+ android:title="@string/wifi_scan_always_available"
+ android:summary="@string/wifi_scan_always_available_summary"
+ android:persistent="false" />
+
+ <SwitchPreference
+ android:key="wifi_assistant"
+ android:title="@string/wifi_automatically_manage_title"
+ android:summary="@string/wifi_assistant_setting_summary"
+ android:persistent="false" />
+
<ListPreference
android:key="sleep_policy"
android:title="@string/wifi_setting_sleep_policy_title"
android:persistent="false"
android:entries="@array/wifi_sleep_policy_entries"
- android:entryValues="@array/wifi_sleep_policy_values"
- />
- <CheckBoxPreference
- android:key="wifi_scan_always_available"
- android:title="@string/wifi_scan_always_available"
- android:summary="@string/wifi_scan_always_available_summary"
- android:persistent="false" />
-
- <!-- android:dependency="enable_wifi" -->
- <CheckBoxPreference
- android:key="wifi_poor_network_detection"
- android:title="@string/wifi_poor_network_detection"
- android:summary="@string/wifi_poor_network_detection_summary"
- android:persistent="false" />
+ android:entryValues="@array/wifi_sleep_policy_values" />
<ListPreference
android:key="frequency_band"
@@ -50,8 +49,7 @@
android:summary="@string/wifi_setting_frequency_band_summary"
android:persistent="false"
android:entries="@array/wifi_frequency_band_entries"
- android:entryValues="@array/wifi_frequency_band_values"
- />
+ android:entryValues="@array/wifi_frequency_band_values" />
<Preference
android:key="install_credentials"
@@ -73,16 +71,10 @@
android:title="@string/wifi_menu_wps_pin"
android:persistent="false" />
- <CheckBoxPreference
- android:key="suspend_optimizations"
- android:title="@string/wifi_suspend_optimizations"
- android:summary="@string/wifi_suspend_optimizations_summary"
- android:persistent="false" />
-
<Preference
android:key="mac_address"
android:title="@string/wifi_advanced_mac_address_title"
- android:layout="@layout/wifi_advance_layout" />
+ android:layout="@layout/mac_preference" />
<Preference
android:key="current_ip_address"
diff --git a/src/com/android/settings/AdvancedSecuritySettings.java b/src/com/android/settings/AdvancedSecuritySettings.java
deleted file mode 100644
index 3ddbf96..0000000
--- a/src/com/android/settings/AdvancedSecuritySettings.java
+++ /dev/null
@@ -1,221 +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;
-
-import com.android.internal.widget.LockPatternUtils;
-
-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.os.Bundle;
-import android.service.trust.TrustAgentService;
-import android.util.ArrayMap;
-import android.util.ArraySet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.CheckBox;
-import android.widget.TextView;
-
-import java.util.List;
-
-public class AdvancedSecuritySettings extends ListFragment implements View.OnClickListener {
- static final String TAG = "AdvancedSecuritySettings";
-
- private static final String SERVICE_INTERFACE = TrustAgentService.SERVICE_INTERFACE;
-
- private final ArraySet<ComponentName> mActiveAgents = new ArraySet<ComponentName>();
- private final ArrayMap<ComponentName, AgentInfo> mAvailableAgents
- = new ArrayMap<ComponentName, AgentInfo>();
-
- private LockPatternUtils mLockPatternUtils;
-
- public static final class AgentInfo {
- CharSequence label;
- ComponentName component; // service that implements ITrustAgent
-
- @Override
- public boolean equals(Object other) {
- if (other instanceof AgentInfo) {
- return component.equals(((AgentInfo)other).component);
- }
- return true;
- }
-
- public int compareTo(AgentInfo other) {
- return component.compareTo(other.component);
- }
- }
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- if (mLockPatternUtils == null) {
- mLockPatternUtils = new LockPatternUtils(
- container.getContext().getApplicationContext());
- }
- setListAdapter(new AgentListAdapter());
- return inflater.inflate(R.layout.advanced_security_settings, container, false);
- }
-
- @Override
- public void onResume() {
- super.onResume();
- updateList();
- }
-
- void updateList() {
- Context context = getActivity();
- if (context == null) {
- return;
- }
-
- loadActiveAgents();
-
- PackageManager pm = getActivity().getPackageManager();
- Intent trustAgentIntent = new Intent(SERVICE_INTERFACE);
- List<ResolveInfo> resolveInfos = pm.queryIntentServices(trustAgentIntent,
- PackageManager.GET_META_DATA);
-
- mAvailableAgents.clear();
- mAvailableAgents.ensureCapacity(resolveInfos.size());
-
- for (ResolveInfo resolveInfo : resolveInfos) {
- if (resolveInfo.serviceInfo == null) continue;
- 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.component = name;
- mAvailableAgents.put(name, agentInfo);
- }
- }
- ((BaseAdapter) getListAdapter()).notifyDataSetChanged();
- }
-
- @Override
- public void onClick(View view) {
- ViewHolder h = (ViewHolder) view.getTag();
-
- if (view.getId() == R.id.clickable) {
- boolean wasActive = mActiveAgents.contains(h.agentInfo.component);
- loadActiveAgents();
- if (!wasActive) {
- mActiveAgents.add(h.agentInfo.component);
- } else {
- mActiveAgents.remove(h.agentInfo.component);
- }
- saveActiveAgents();
- ((BaseAdapter) getListAdapter()).notifyDataSetChanged();
- }
- }
-
- private void loadActiveAgents() {
- mActiveAgents.clear();
- List<ComponentName> activeTrustAgents = mLockPatternUtils.getEnabledTrustAgents();
- if (activeTrustAgents != null) {
- mActiveAgents.addAll(activeTrustAgents);
- }
- }
-
- private void saveActiveAgents() {
- mLockPatternUtils.setEnabledTrustAgents(mActiveAgents);
- }
-
- static class ViewHolder {
- TextView name;
- CheckBox checkbox;
- TextView description;
- AgentInfo agentInfo;
- View clickable;
- }
-
- class AgentListAdapter extends BaseAdapter {
- final LayoutInflater mInflater;
-
- AgentListAdapter() {
- mInflater = (LayoutInflater)
- getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- }
-
- public boolean hasStableIds() {
- return false;
- }
-
- public int getCount() {
- return mAvailableAgents.size();
- }
-
- public Object getItem(int position) {
- return mAvailableAgents.valueAt(position);
- }
-
- public long getItemId(int position) {
- return position;
- }
-
- public boolean areAllItemsEnabled() {
- return false;
- }
-
- public boolean isEnabled(int position) {
- return true;
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- View v;
- if (convertView == null) {
- v = newView(parent);
- } else {
- v = convertView;
- }
- bindView(v, position);
- return v;
- }
-
- public View newView(ViewGroup parent) {
- View v = mInflater.inflate(R.layout.trust_agent_item, parent, false);
- ViewHolder h = new ViewHolder();
- 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(AdvancedSecuritySettings.this);
- h.description = (TextView)v.findViewById(R.id.description);
- v.setTag(h);
- h.clickable.setTag(h);
- return v;
- }
-
- public void bindView(View view, int position) {
- ViewHolder vh = (ViewHolder) view.getTag();
- AgentInfo item = mAvailableAgents.valueAt(position);
- vh.name.setText(item.label);
- vh.checkbox.setChecked(mActiveAgents.contains(item.component));
- vh.agentInfo = item;
- }
- }
-}
diff --git a/src/com/android/settings/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/ConfirmDeviceCredentialActivity.java
index 6a5c486..6b2bfd2 100644
--- a/src/com/android/settings/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/ConfirmDeviceCredentialActivity.java
@@ -18,6 +18,7 @@
package com.android.settings;
import android.app.Activity;
+import android.app.KeyguardManager;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
@@ -34,8 +35,8 @@
super.onCreate(savedInstanceState);
Intent intent = getIntent();
- String title = intent.getStringExtra(Intent.EXTRA_TITLE);
- String details = intent.getStringExtra(Intent.EXTRA_DETAILS);
+ String title = intent.getStringExtra(KeyguardManager.EXTRA_TITLE);
+ String details = intent.getStringExtra(KeyguardManager.EXTRA_DESCRIPTION);
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
if (!helper.launchConfirmationActivity(0 /* request code */, title, details)) {
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 129b201..c2295e6 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -170,6 +170,11 @@
} else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
// Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
+ } else if (failedAttempts == -1) {
+ // Right password, but decryption failed. Tell user bad news ...
+ setContentView(R.layout.crypt_keeper_progress);
+ showFactoryReset(true);
+ return;
} else {
// Wrong entry. Handle pattern case.
if (mLockPatternView != null) {
@@ -392,7 +397,7 @@
private void setupUi() {
if (mEncryptionGoneBad || isDebugView(FORCE_VIEW_ERROR)) {
setContentView(R.layout.crypt_keeper_progress);
- showFactoryReset();
+ showFactoryReset(false);
return;
}
@@ -508,7 +513,13 @@
updateProgress();
}
- private void showFactoryReset() {
+ /**
+ * Show factory reset screen allowing the user to reset their phone when
+ * there is nothing else we can do
+ * @param corrupt true if userdata is corrupt, false if encryption failed
+ * partway through
+ */
+ private void showFactoryReset(boolean corrupt) {
// Hide the encryption-bot to make room for the "factory reset" button
findViewById(R.id.encroid).setVisibility(View.GONE);
@@ -524,8 +535,13 @@
});
// Alert the user of the failure.
- ((TextView) findViewById(R.id.title)).setText(R.string.crypt_keeper_failed_title);
- ((TextView) findViewById(R.id.status)).setText(R.string.crypt_keeper_failed_summary);
+ if (corrupt) {
+ ((TextView) findViewById(R.id.title)).setText(R.string.crypt_keeper_data_corrupt_title);
+ ((TextView) findViewById(R.id.status)).setText(R.string.crypt_keeper_data_corrupt_summary);
+ } else {
+ ((TextView) findViewById(R.id.title)).setText(R.string.crypt_keeper_failed_title);
+ ((TextView) findViewById(R.id.status)).setText(R.string.crypt_keeper_failed_summary);
+ }
final View view = findViewById(R.id.bottom_divider);
// TODO(viki): Why would the bottom divider be missing in certain layouts? Investigate.
@@ -538,7 +554,7 @@
final String state = SystemProperties.get("vold.encrypt_progress");
if ("error_partially_encrypted".equals(state)) {
- showFactoryReset();
+ showFactoryReset(false);
return;
}
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index ba8e2f1..11dc3c6 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -117,6 +117,7 @@
private static final String DISABLE_OVERLAYS_KEY = "disable_overlays";
private static final String SIMULATE_COLOR_SPACE = "simulate_color_space";
private static final String USE_NUPLAYER_KEY = "use_nuplayer";
+ private static final String USB_AUDIO_KEY = "usb_audio";
private static final String USE_AWESOMEPLAYER_PROPERTY = "persist.sys.media.use-awesome";
private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage";
private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
@@ -222,6 +223,7 @@
private ListPreference mSimulateColorSpace;
private CheckBoxPreference mUseNuplayer;
+ private CheckBoxPreference mUSBAudio;
private CheckBoxPreference mImmediatelyDestroyActivities;
private ListPreference mAppProcessLimit;
@@ -343,6 +345,7 @@
mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY);
mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
mUseNuplayer = findAndInitCheckboxPref(USE_NUPLAYER_KEY);
+ mUSBAudio = findAndInitCheckboxPref(USB_AUDIO_KEY);
mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
@@ -366,12 +369,6 @@
mAllPrefs.add(mProcessStats);
mWebViewDataReductionProxy = findAndInitCheckboxPref(WEBVIEW_DATA_REDUCTION_PROXY_KEY);
- String key = Settings.Global.getString(getActivity().getContentResolver(),
- Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY);
- // Disable the selection if the key is not available for some reason.
- if (key == null || key.isEmpty()) {
- disableForUser(mWebViewDataReductionProxy);
- }
}
private ListPreference addListPreference(String prefKey) {
@@ -549,6 +546,7 @@
updateWifiAllowScansWithTrafficOptions();
updateSimulateColorSpace();
updateUseNuplayerOptions();
+ updateUSBAudioOptions();
}
private void resetDangerousOptions() {
@@ -1013,6 +1011,17 @@
pokeSystemProperties();
}
+ private void updateUSBAudioOptions() {
+ updateCheckBox(mUSBAudio, Settings.Secure.getInt(getContentResolver(),
+ Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, 0) != 0);
+ }
+
+ private void writeUSBAudioOptions() {
+ Settings.Secure.putInt(getContentResolver(),
+ Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED,
+ mUSBAudio.isChecked() ? 1 : 0);
+ }
+
private void updateForceRtlOptions() {
updateCheckBox(mForceRtlLayout, Settings.Global.getInt(getActivity().getContentResolver(),
Settings.Global.DEVELOPMENT_FORCE_RTL, 0) != 0);
@@ -1417,6 +1426,8 @@
writeWifiAllowScansWithTrafficOptions();
} else if (preference == mUseNuplayer) {
writeUseNuplayerOptions();
+ } else if (preference == mUSBAudio) {
+ writeUSBAudioOptions();
} else {
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
diff --git a/src/com/android/settings/DeviceAdminAdd.java b/src/com/android/settings/DeviceAdminAdd.java
index 0bd548f..ed95500 100644
--- a/src/com/android/settings/DeviceAdminAdd.java
+++ b/src/com/android/settings/DeviceAdminAdd.java
@@ -32,7 +32,10 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.os.Bundle;
@@ -103,6 +106,7 @@
mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
mAppOps = (AppOpsManager)getSystemService(Context.APP_OPS_SERVICE);
+ PackageManager packageManager = getPackageManager();
if ((getIntent().getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
Log.w(TAG, "Cannot start ADD_DEVICE_ADMIN as a new task");
@@ -120,6 +124,8 @@
}
if (action != null && action.equals(DevicePolicyManager.ACTION_SET_PROFILE_OWNER)) {
+ setResult(RESULT_CANCELED);
+ setFinishOnTouchOutside(true);
mAddingProfileOwner = true;
mProfileOwnerName =
getIntent().getStringExtra(DevicePolicyManager.EXTRA_PROFILE_OWNER_NAME);
@@ -129,11 +135,23 @@
finish();
return;
}
+ try {
+ PackageInfo packageInfo = packageManager.getPackageInfo(callingPackage, 0);
+ if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
+ Log.e(TAG, "Cannot set a non-system app as a profile owner");
+ finish();
+ return;
+ }
+ } catch (NameNotFoundException nnfe) {
+ Log.e(TAG, "Cannot find the package " + callingPackage);
+ finish();
+ return;
+ }
}
ActivityInfo ai;
try {
- ai = getPackageManager().getReceiverInfo(who, PackageManager.GET_META_DATA);
+ ai = packageManager.getReceiverInfo(who, PackageManager.GET_META_DATA);
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Unable to retrieve device policy " + who, e);
finish();
@@ -144,7 +162,7 @@
// No need to check this when deactivating, because it is safe to deactivate an active
// invalid device admin.
if (!mDPM.isAdminActive(who)) {
- List<ResolveInfo> avail = getPackageManager().queryBroadcastReceivers(
+ List<ResolveInfo> avail = packageManager.queryBroadcastReceivers(
new Intent(DeviceAdminReceiver.ACTION_DEVICE_ADMIN_ENABLED),
PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
int count = avail == null ? 0 : avail.size();
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java
index aac7638..95a81d1 100644
--- a/src/com/android/settings/PrivacySettings.java
+++ b/src/com/android/settings/PrivacySettings.java
@@ -27,9 +27,10 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserManager;
-import android.preference.CheckBoxPreference;
import android.preference.Preference;
+import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceScreen;
+import android.preference.SwitchPreference;
import android.provider.Settings;
/**
@@ -46,8 +47,8 @@
private static final String CONFIGURE_ACCOUNT = "configure_account";
private static final String PERSONAL_DATA_CATEGORY = "personal_data_category";
private IBackupManager mBackupManager;
- private CheckBoxPreference mBackup;
- private CheckBoxPreference mAutoRestore;
+ private SwitchPreference mBackup;
+ private SwitchPreference mAutoRestore;
private Dialog mConfirmDialog;
private PreferenceScreen mConfigure;
@@ -63,8 +64,12 @@
mBackupManager = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
- mBackup = (CheckBoxPreference) screen.findPreference(BACKUP_DATA);
- mAutoRestore = (CheckBoxPreference) screen.findPreference(AUTO_RESTORE);
+ mBackup = (SwitchPreference) screen.findPreference(BACKUP_DATA);
+ mBackup.setOnPreferenceChangeListener(preferenceChangeListener);
+
+ mAutoRestore = (SwitchPreference) screen.findPreference(AUTO_RESTORE);
+ mAutoRestore.setOnPreferenceChangeListener(preferenceChangeListener);
+
mConfigure = (PreferenceScreen) screen.findPreference(CONFIGURE_ACCOUNT);
if (UserManager.get(getActivity()).hasUserRestriction(
@@ -98,29 +103,34 @@
super.onStop();
}
- @Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
- Preference preference) {
- if (preference == mBackup) {
- if (!mBackup.isChecked()) {
- showEraseBackupDialog();
- } else {
- setBackupEnabled(true);
+ private OnPreferenceChangeListener preferenceChangeListener = new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if (!(preference instanceof SwitchPreference)) {
+ return true;
}
- } else if (preference == mAutoRestore) {
- boolean curState = mAutoRestore.isChecked();
- try {
- mBackupManager.setAutoRestore(curState);
- } catch (RemoteException e) {
- mAutoRestore.setChecked(!curState);
+ boolean nextValue = (Boolean) newValue;
+ boolean result = false;
+ if (preference == mBackup) {
+ if (nextValue == false) {
+ showEraseBackupDialog();
+ } else {
+ setBackupEnabled(true);
+ }
+ result = true;
+ } else if (preference == mAutoRestore) {
+ try {
+ mBackupManager.setAutoRestore(nextValue);
+ result = true;
+ } catch (RemoteException e) {
+ mAutoRestore.setChecked(!nextValue);
+ }
}
+ return result;
}
- return super.onPreferenceTreeClick(preferenceScreen, preference);
- }
+ };
private void showEraseBackupDialog() {
- mBackup.setChecked(true);
-
mDialogType = DIALOG_ERASE_BACKUP;
CharSequence msg = getResources().getText(R.string.backup_erase_dialog_message);
// TODO: DialogFragment?
@@ -159,7 +169,7 @@
mConfigure.setEnabled(configureEnabled);
mConfigure.setIntent(configIntent);
setConfigureSummary(configSummary);
-}
+ }
private void setConfigureSummary(String summary) {
if (summary != null) {
@@ -179,13 +189,20 @@
}
}
+ @Override
public void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- //updateProviders();
- if (mDialogType == DIALOG_ERASE_BACKUP) {
+ // Dialog is triggered before Switch status change, that means marking the Switch to
+ // true in showEraseBackupDialog() method will be override by following status change.
+ // So we do manual switching here due to users' response.
+ if (mDialogType == DIALOG_ERASE_BACKUP) {
+ // Accept turning off backup
+ if (which == DialogInterface.BUTTON_POSITIVE) {
setBackupEnabled(false);
- updateConfigureSummary();
+ } else if (which == DialogInterface.BUTTON_NEGATIVE) {
+ // Reject turning off backup
+ setBackupEnabled(true);
}
+ updateConfigureSummary();
}
mDialogType = 0;
}
@@ -214,4 +231,4 @@
protected int getHelpResource() {
return R.string.help_url_backup_reset;
}
-}
+}
\ No newline at end of file
diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java
index 75de222..b0a4a53 100644
--- a/src/com/android/settings/RadioInfo.java
+++ b/src/com/android/settings/RadioInfo.java
@@ -303,9 +303,6 @@
imsRegRequiredButton = (Button) findViewById(R.id.ims_reg_required);
imsRegRequiredButton.setOnClickListener(mImsRegRequiredHandler);
- moOverVolteButton = (Button) findViewById(R.id.mo_over_volte);
- moOverVolteButton.setOnClickListener(mMoOverVolteHandler);
-
smsOverImsButton = (Button) findViewById(R.id.sms_over_ims);
smsOverImsButton.setOnClickListener(mSmsOverImsHandler);
@@ -363,7 +360,6 @@
updatePowerState();
updateCellInfoListRate();
updateImsRegRequiredState();
- updateMoOverImsState();
updateSmsOverImsState();
updateLteRamDumpState();
updateProperties();
@@ -989,35 +985,6 @@
imsRegRequiredButton.setText(buttonText);
}
- private Button moOverVolteButton;
- OnClickListener mMoOverVolteHandler = new OnClickListener() {
- @Override
- public void onClick(View v) {
- boolean moOverVolteEnabled = isMoOverVolteEnabled();
- log(String.format("toggle %s: currently %s",
- TelephonyProperties.PROPERTY_DBG_IMS_VOLTE_ENABLE,
- (moOverVolteEnabled ? "on" : "off")));
- boolean newValue = !moOverVolteEnabled;
- SystemProperties.set(TelephonyProperties.PROPERTY_DBG_IMS_VOLTE_ENABLE,
- newValue ? "1" : "0");
- updateMoOverImsState();
- }
- };
-
- private boolean isMoOverVolteEnabled() {
- return SystemProperties.getInt(TelephonyProperties.PROPERTY_DBG_IMS_VOLTE_ENABLE,
- TelephonyProperties.PROPERTY_DBG_IMS_VOLTE_ENABLE_DEAFULT) == 1;
- }
-
- private void updateMoOverImsState() {
- boolean moOverVolteEnabled = isMoOverVolteEnabled();
- log("updateMoOverImsState isMoOverVolteEnabled()=" + moOverVolteEnabled);
- String buttonText = moOverVolteEnabled ?
- getString(R.string.mo_over_volte_off) :
- getString(R.string.mo_over_volte_on);
- moOverVolteButton.setText(buttonText);
- }
-
private Button smsOverImsButton;
static final String PROPERTY_SMS_OVER_IMS = "persist.radio.imsallowmtsms";
OnClickListener mSmsOverImsHandler = new OnClickListener() {
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 1fb5e13..f2a0bbb 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -31,7 +31,7 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.CheckBoxPreference;
+import android.preference.SwitchPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
@@ -99,6 +99,11 @@
private static final String KEY_TRUST_AGENT = "trust_agent";
private static final String KEY_SCREEN_PINNING = "screen_pinning_settings";
+ // These switch preferences need special handling since they're not all stored in Settings.
+ private static final String SWITCH_PREFERENCE_KEYS[] = { KEY_LOCK_AFTER_TIMEOUT,
+ KEY_LOCK_ENABLED, KEY_VISIBLE_PATTERN, KEY_BIOMETRIC_WEAK_LIVELINESS,
+ KEY_POWER_INSTANTLY_LOCKS, KEY_SHOW_PASSWORD, KEY_TOGGLE_INSTALL_APPLICATIONS };
+
// Only allow one trust agent on the platform.
private static final boolean ONLY_ONE_TRUST_AGENT = true;
@@ -108,17 +113,17 @@
private LockPatternUtils mLockPatternUtils;
private ListPreference mLockAfter;
- private CheckBoxPreference mBiometricWeakLiveliness;
- private CheckBoxPreference mVisiblePattern;
+ private SwitchPreference mBiometricWeakLiveliness;
+ private SwitchPreference mVisiblePattern;
- private CheckBoxPreference mShowPassword;
+ private SwitchPreference mShowPassword;
private KeyStore mKeyStore;
private Preference mResetCredentials;
- private CheckBoxPreference mToggleAppInstallation;
+ private SwitchPreference mToggleAppInstallation;
private DialogInterface mWarnInstallApps;
- private CheckBoxPreference mPowerButtonInstantlyLocks;
+ private SwitchPreference mPowerButtonInstantlyLocks;
private boolean mIsPrimary;
@@ -249,13 +254,13 @@
// biometric weak liveliness
mBiometricWeakLiveliness =
- (CheckBoxPreference) root.findPreference(KEY_BIOMETRIC_WEAK_LIVELINESS);
+ (SwitchPreference) root.findPreference(KEY_BIOMETRIC_WEAK_LIVELINESS);
// visible pattern
- mVisiblePattern = (CheckBoxPreference) root.findPreference(KEY_VISIBLE_PATTERN);
+ mVisiblePattern = (SwitchPreference) root.findPreference(KEY_VISIBLE_PATTERN);
// lock instantly on power key press
- mPowerButtonInstantlyLocks = (CheckBoxPreference) root.findPreference(
+ mPowerButtonInstantlyLocks = (SwitchPreference) root.findPreference(
KEY_POWER_INSTANTLY_LOCKS);
Preference trustAgentPreference = root.findPreference(KEY_TRUST_AGENT);
if (mPowerButtonInstantlyLocks != null &&
@@ -291,18 +296,14 @@
root.findPreference(KEY_SIM_LOCK).setEnabled(false);
}
}
- try {
- if (Settings.System.getInt(getContentResolver(), Settings.System.LOCK_TO_APP_ENABLED)
- != 0) {
- root.findPreference(KEY_SCREEN_PINNING).setSummary(
- getResources().getString(R.string.switch_on_text));
- }
- } catch (SettingNotFoundException e) {
- Log.w(TAG, "No Lock-to-app enabled setting", e);
+ if (Settings.System.getInt(getContentResolver(),
+ Settings.System.LOCK_TO_APP_ENABLED, 0) != 0) {
+ root.findPreference(KEY_SCREEN_PINNING).setSummary(
+ getResources().getString(R.string.switch_on_text));
}
// Show password
- mShowPassword = (CheckBoxPreference) root.findPreference(KEY_SHOW_PASSWORD);
+ mShowPassword = (SwitchPreference) root.findPreference(KEY_SHOW_PASSWORD);
mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS);
// Credential storage
@@ -326,7 +327,7 @@
// Application install
PreferenceGroup deviceAdminCategory = (PreferenceGroup)
root.findPreference(KEY_DEVICE_ADMIN_CATEGORY);
- mToggleAppInstallation = (CheckBoxPreference) findPreference(
+ mToggleAppInstallation = (SwitchPreference) findPreference(
KEY_TOGGLE_INSTALL_APPLICATIONS);
mToggleAppInstallation.setChecked(isNonMarketAppsAllowed());
// Side loading of apps.
@@ -341,7 +342,7 @@
(PreferenceGroup)root.findPreference(KEY_ADVANCED_SECURITY);
if (advancedCategory != null && !mLockPatternUtils.isSecure()) {
Preference manageAgents = advancedCategory.findPreference(KEY_MANAGE_TRUST_AGENTS);
- if (advancedCategory != null) advancedCategory.removePreference(manageAgents);
+ if (manageAgents != null) advancedCategory.removePreference(manageAgents);
}
// The above preferences come and go based on security state, so we need to update
@@ -350,6 +351,10 @@
Index.getInstance(getActivity())
.updateFromClassNameResource(SecuritySettings.class.getName(), true, true);
+ for (int i = 0; i < SWITCH_PREFERENCE_KEYS.length; i++) {
+ final Preference pref = findPreference(SWITCH_PREFERENCE_KEYS[i]);
+ if (pref != null) pref.setOnPreferenceChangeListener(this);
+ }
return root;
}
@@ -399,16 +404,17 @@
.setIcon(com.android.internal.R.drawable.ic_dialog_alert)
.setMessage(getResources().getString(R.string.install_all_warning))
.setPositiveButton(android.R.string.yes, this)
- .setNegativeButton(android.R.string.no, null)
+ .setNegativeButton(android.R.string.no, this)
.show();
}
@Override
public void onClick(DialogInterface dialog, int which) {
- if (dialog == mWarnInstallApps && which == DialogInterface.BUTTON_POSITIVE) {
- setNonMarketAppsAllowed(true);
+ if (dialog == mWarnInstallApps) {
+ boolean turnOn = which == DialogInterface.BUTTON_POSITIVE;
+ setNonMarketAppsAllowed(turnOn);
if (mToggleAppInstallation != null) {
- mToggleAppInstallation.setChecked(true);
+ mToggleAppInstallation.setChecked(turnOn);
}
}
}
@@ -523,8 +529,6 @@
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
final String key = preference.getKey();
-
- final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
R.string.lock_settings_picker_title, SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
@@ -539,42 +543,6 @@
// can't be reached, but is here in case things change in the future
startBiometricWeakImprove();
}
- } else if (KEY_BIOMETRIC_WEAK_LIVELINESS.equals(key)) {
- if (isToggled(preference)) {
- lockPatternUtils.setBiometricWeakLivelinessEnabled(true);
- } else {
- // In this case the user has just unchecked the checkbox, but this action requires
- // them to confirm their password. We need to re-check the checkbox until
- // they've confirmed their password
- mBiometricWeakLiveliness.setChecked(true);
- ChooseLockSettingsHelper helper =
- new ChooseLockSettingsHelper(this.getActivity(), this);
- if (!helper.launchConfirmationActivity(
- CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_LIVELINESS_OFF, null, null)) {
- // If this returns false, it means no password confirmation is required, so
- // go ahead and uncheck it here.
- // Note: currently a backup is required for biometric_weak so this code path
- // can't be reached, but is here in case things change in the future
- lockPatternUtils.setBiometricWeakLivelinessEnabled(false);
- mBiometricWeakLiveliness.setChecked(false);
- }
- }
- } else if (KEY_LOCK_ENABLED.equals(key)) {
- lockPatternUtils.setLockPatternEnabled(isToggled(preference));
- } else if (KEY_VISIBLE_PATTERN.equals(key)) {
- lockPatternUtils.setVisiblePatternEnabled(isToggled(preference));
- } else if (KEY_POWER_INSTANTLY_LOCKS.equals(key)) {
- lockPatternUtils.setPowerButtonInstantlyLocks(isToggled(preference));
- } else if (preference == mShowPassword) {
- Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
- mShowPassword.isChecked() ? 1 : 0);
- } else if (preference == mToggleAppInstallation) {
- if (mToggleAppInstallation.isChecked()) {
- mToggleAppInstallation.setChecked(false);
- warnAppInstallation();
- } else {
- setNonMarketAppsAllowed(false);
- }
} else if (KEY_TRUST_AGENT.equals(key)) {
ChooseLockSettingsHelper helper =
new ChooseLockSettingsHelper(this.getActivity(), this);
@@ -589,14 +557,9 @@
// If we didn't handle it, let preferences handle it.
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
-
return true;
}
- private boolean isToggled(Preference pref) {
- return ((CheckBoxPreference) pref).isChecked();
- }
-
/**
* see confirmPatternThenDisableAndClear
*/
@@ -629,7 +592,9 @@
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
- if (preference == mLockAfter) {
+ final String key = preference.getKey();
+ final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
+ if (KEY_LOCK_AFTER_TIMEOUT.equals(key)) {
int timeout = Integer.parseInt((String) value);
try {
Settings.Secure.putInt(getContentResolver(),
@@ -638,6 +603,42 @@
Log.e("SecuritySettings", "could not persist lockAfter timeout setting", e);
}
updateLockAfterPreferenceSummary();
+ } else if (KEY_LOCK_ENABLED.equals(key)) {
+ lockPatternUtils.setLockPatternEnabled((Boolean) value);
+ } else if (KEY_VISIBLE_PATTERN.equals(key)) {
+ lockPatternUtils.setVisiblePatternEnabled((Boolean) value);
+ } else if (KEY_BIOMETRIC_WEAK_LIVELINESS.equals(key)) {
+ if ((Boolean) value) {
+ lockPatternUtils.setBiometricWeakLivelinessEnabled(true);
+ } else {
+ // In this case the user has just unchecked the checkbox, but this action requires
+ // them to confirm their password. We need to re-check the checkbox until
+ // they've confirmed their password
+ mBiometricWeakLiveliness.setChecked(true);
+ ChooseLockSettingsHelper helper =
+ new ChooseLockSettingsHelper(this.getActivity(), this);
+ if (!helper.launchConfirmationActivity(
+ CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_LIVELINESS_OFF, null, null)) {
+ // If this returns false, it means no password confirmation is required, so
+ // go ahead and uncheck it here.
+ // Note: currently a backup is required for biometric_weak so this code path
+ // can't be reached, but is here in case things change in the future
+ lockPatternUtils.setBiometricWeakLivelinessEnabled(false);
+ mBiometricWeakLiveliness.setChecked(false);
+ }
+ }
+ } else if (KEY_POWER_INSTANTLY_LOCKS.equals(key)) {
+ mLockPatternUtils.setPowerButtonInstantlyLocks((Boolean) value);
+ } else if (KEY_SHOW_PASSWORD.equals(key)) {
+ Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
+ ((Boolean) value) ? 1 : 0);
+ } else if (KEY_TOGGLE_INSTALL_APPLICATIONS.equals(key)) {
+ if ((Boolean) value) {
+ mToggleAppInstallation.setChecked(false);
+ warnAppInstallation();
+ } else {
+ setNonMarketAppsAllowed(false);
+ }
}
return true;
}
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 123d4fe..3a69125 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -38,6 +38,7 @@
public static class InputMethodAndLanguageSettingsActivity extends SettingsActivity { /* empty */ }
public static class KeyboardLayoutPickerActivity extends SettingsActivity { /* empty */ }
public static class InputMethodAndSubtypeEnablerActivity extends SettingsActivity { /* empty */ }
+ public static class VoiceInputSettingsActivity extends SettingsActivity { /* empty */ }
public static class SpellCheckersSettingsActivity extends SettingsActivity { /* empty */ }
public static class LocalePickerActivity extends SettingsActivity { /* empty */ }
public static class UserDictionarySettingsActivity extends SettingsActivity { /* empty */ }
@@ -63,6 +64,7 @@
public static class AccessibilityContrastSettingsActivity extends SettingsActivity { /* empty */ }
public static class AccessibilityDaltonizerSettingsActivity extends SettingsActivity { /* empty */ }
public static class SecuritySettingsActivity extends SettingsActivity { /* empty */ }
+ public static class UsageAccessSettingsActivity extends SettingsActivity { /* empty */ }
public static class LocationSettingsActivity extends SettingsActivity { /* empty */ }
public static class PrivacySettingsActivity extends SettingsActivity { /* empty */ }
public static class RunningServicesActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index bf0d9a1..e0ab5bc 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -72,7 +72,6 @@
import com.android.settings.applications.ManageApplications;
import com.android.settings.applications.ProcessStatsUi;
import com.android.settings.bluetooth.BluetoothSettings;
-import com.android.settings.bluetooth.MessageAccessSettings;
import com.android.settings.dashboard.DashboardCategory;
import com.android.settings.dashboard.DashboardSummary;
import com.android.settings.dashboard.DashboardTile;
@@ -105,6 +104,7 @@
import com.android.settings.sim.SimSettings;
import com.android.settings.tts.TextToSpeechSettings;
import com.android.settings.users.UserSettings;
+import com.android.settings.voice.VoiceInputSettings;
import com.android.settings.vpn2.VpnSettings;
import com.android.settings.wfd.WifiDisplaySettings;
import com.android.settings.widget.SwitchBar;
@@ -237,7 +237,6 @@
AdvancedWifiSettings.class.getName(),
SavedAccessPointsWifiSettings.class.getName(),
BluetoothSettings.class.getName(),
- MessageAccessSettings.class.getName(),
SimSettings.class.getName(),
TetherSettings.class.getName(),
WifiP2pSettings.class.getName(),
@@ -245,6 +244,7 @@
DateTimeSettings.class.getName(),
LocalePicker.class.getName(),
InputMethodAndLanguageSettings.class.getName(),
+ VoiceInputSettings.class.getName(),
SpellCheckersSettings.class.getName(),
UserDictionaryList.class.getName(),
UserDictionarySettings.class.getName(),
@@ -256,6 +256,7 @@
NotificationStation.class.getName(),
LocationSettings.class.getName(),
SecuritySettings.class.getName(),
+ UsageAccessSettings.class.getName(),
PrivacySettings.class.getName(),
DeviceAdminSettings.class.getName(),
AccessibilitySettings.class.getName(),
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index f89b72e..83b3a68 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -66,7 +66,7 @@
private boolean mPreferenceHighlighted = false;
private Drawable mHighlightDrawable;
- private Object mRegisterLock = new Object();
+ private ListAdapter mCurrentRootAdapter;
private boolean mIsDataSetObserverRegistered = false;
private DataSetObserver mDataSetObserver = new DataSetObserver() {
@Override
@@ -147,6 +147,11 @@
}
@Override
+ protected void onUnbindPreferences() {
+ unregisterObserverIfNeeded();
+ }
+
+ @Override
public void onStop() {
super.onStop();
@@ -154,20 +159,23 @@
}
public void registerObserverIfNeeded() {
- synchronized (mRegisterLock) {
- if (!mIsDataSetObserverRegistered) {
- getPreferenceScreen().getRootAdapter().registerDataSetObserver(mDataSetObserver);
- mIsDataSetObserverRegistered = true;
+ if (!mIsDataSetObserverRegistered) {
+ if (mCurrentRootAdapter != null) {
+ mCurrentRootAdapter.unregisterDataSetObserver(mDataSetObserver);
}
+ mCurrentRootAdapter = getPreferenceScreen().getRootAdapter();
+ mCurrentRootAdapter.registerDataSetObserver(mDataSetObserver);
+ mIsDataSetObserverRegistered = true;
}
}
public void unregisterObserverIfNeeded() {
- synchronized (mRegisterLock) {
- if (mIsDataSetObserverRegistered) {
- getPreferenceScreen().getRootAdapter().unregisterDataSetObserver(mDataSetObserver);
- mIsDataSetObserverRegistered = false;
+ if (mIsDataSetObserverRegistered) {
+ if (mCurrentRootAdapter != null) {
+ mCurrentRootAdapter.unregisterDataSetObserver(mDataSetObserver);
+ mCurrentRootAdapter = null;
}
+ mIsDataSetObserverRegistered = false;
}
}
diff --git a/src/com/android/settings/TrustAgentSettings.java b/src/com/android/settings/TrustAgentSettings.java
new file mode 100644
index 0000000..54fef36
--- /dev/null
+++ b/src/com/android/settings/TrustAgentSettings.java
@@ -0,0 +1,157 @@
+/*
+ * 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 java.util.List;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.PreferenceGroup;
+import android.preference.SwitchPreference;
+import android.service.trust.TrustAgentService;
+import android.util.ArrayMap;
+import android.util.ArraySet;
+
+import com.android.internal.widget.LockPatternUtils;
+
+public class TrustAgentSettings extends SettingsPreferenceFragment implements
+ Preference.OnPreferenceChangeListener {
+ private static final String SERVICE_INTERFACE = TrustAgentService.SERVICE_INTERFACE;
+ private ArrayMap<ComponentName, AgentInfo> mAvailableAgents;
+ private final ArraySet<ComponentName> mActiveAgents = new ArraySet<ComponentName>();
+ private LockPatternUtils mLockPatternUtils;
+
+ public static final class AgentInfo {
+ CharSequence label;
+ ComponentName component; // service that implements ITrustAgent
+ SwitchPreference preference;
+ public Drawable icon;
+
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof AgentInfo) {
+ return component.equals(((AgentInfo)other).component);
+ }
+ return true;
+ }
+
+ public int compareTo(AgentInfo other) {
+ return component.compareTo(other.component);
+ }
+ }
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ addPreferencesFromResource(R.xml.trust_agent_settings);
+ }
+
+ public void onResume() {
+ super.onResume();
+ updateAgents();
+ };
+
+ private void updateAgents() {
+ final Context context = getActivity();
+ if (mAvailableAgents == null) {
+ mAvailableAgents = findAvailableTrustAgents();
+ }
+ if (mLockPatternUtils == null) {
+ mLockPatternUtils = new LockPatternUtils(getActivity());
+ }
+ loadActiveAgents();
+ PreferenceGroup category =
+ (PreferenceGroup) getPreferenceScreen().findPreference("trust_agents");
+ category.removeAll();
+ final int count = mAvailableAgents.size();
+ for (int i = 0; i < count; i++) {
+ AgentInfo agent = mAvailableAgents.valueAt(i);
+ final SwitchPreference preference = new SwitchPreference(context);
+ agent.preference = preference;
+ preference.setPersistent(false);
+ preference.setTitle(agent.label);
+ preference.setIcon(agent.icon);
+ preference.setPersistent(false);
+ preference.setOnPreferenceChangeListener(this);
+ preference.setChecked(mActiveAgents.contains(agent.component));
+ category.addPreference(agent.preference);
+ }
+ }
+
+ private void loadActiveAgents() {
+ List<ComponentName> activeTrustAgents = mLockPatternUtils.getEnabledTrustAgents();
+ if (activeTrustAgents != null) {
+ mActiveAgents.addAll(activeTrustAgents);
+ }
+ }
+
+ private void saveActiveAgents() {
+ mLockPatternUtils.setEnabledTrustAgents(mActiveAgents);
+ }
+
+ ArrayMap<ComponentName, AgentInfo> findAvailableTrustAgents() {
+ PackageManager pm = getActivity().getPackageManager();
+ Intent trustAgentIntent = new Intent(SERVICE_INTERFACE);
+ List<ResolveInfo> resolveInfos = pm.queryIntentServices(trustAgentIntent,
+ PackageManager.GET_META_DATA);
+
+ ArrayMap<ComponentName, AgentInfo> agents = new ArrayMap<ComponentName, AgentInfo>();
+ final int count = resolveInfos.size();
+ agents.ensureCapacity(count);
+ for (int i = 0; i < count; i++ ) {
+ ResolveInfo resolveInfo = resolveInfos.get(i);
+ if (resolveInfo.serviceInfo == null) continue;
+ if (!TrustAgentUtils.checkProvidePermission(resolveInfo, pm)) continue;
+ ComponentName name = TrustAgentUtils.getComponentName(resolveInfo);
+ AgentInfo agentInfo = new AgentInfo();
+ agentInfo.label = resolveInfo.loadLabel(pm);
+ agentInfo.icon = resolveInfo.loadIcon(pm);
+ agentInfo.component = name;
+ agents.put(name, agentInfo);
+ }
+ return agents;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if (preference instanceof SwitchPreference) {
+ final int count = mAvailableAgents.size();
+ for (int i = 0; i < count; i++) {
+ AgentInfo agent = mAvailableAgents.valueAt(i);
+ if (agent.preference == preference) {
+ if ((Boolean) newValue) {
+ if (!mActiveAgents.contains(agent.component)) {
+ mActiveAgents.add(agent.component);
+ }
+ } else {
+ mActiveAgents.remove(agent.component);
+ }
+ saveActiveAgents();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java
index b80e42a..4466aea 100644
--- a/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java
@@ -92,7 +92,6 @@
mDeviceNameEdited = savedInstanceState.getBoolean(KEY_NAME_EDITED, false);
}
mAlertDialog = new AlertDialog.Builder(getActivity())
- .setIcon(android.R.drawable.ic_dialog_info)
.setTitle(R.string.bluetooth_rename_device)
.setView(createDialogView(deviceName))
.setPositiveButton(R.string.bluetooth_rename_button,
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 4b278ac..3c62ba9 100755
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -69,7 +69,6 @@
private static final int MENU_ID_SCAN = Menu.FIRST;
private static final int MENU_ID_RENAME_DEVICE = Menu.FIRST + 1;
private static final int MENU_ID_SHOW_RECEIVED = Menu.FIRST + 2;
- private static final int MENU_ID_MESSAGE_ACCESS = Menu.FIRST + 3;
/* Private intent to show the list of received files */
private static final String BTOPP_ACTION_OPEN_RECEIVED_FILES =
@@ -205,12 +204,6 @@
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
menu.add(Menu.NONE, MENU_ID_SHOW_RECEIVED, 0, R.string.bluetooth_show_received_files)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- // Message Access API is still not finished, once completed we undo this check.
- // Bug 16232864
- if (android.os.SystemProperties.get("show_bluetooth_message_access").equals("true")){
- menu.add(Menu.NONE, MENU_ID_MESSAGE_ACCESS, 0, R.string.bluetooth_show_message_access)
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- }
super.onCreateOptionsMenu(menu, inflater);
}
@@ -232,14 +225,6 @@
Intent intent = new Intent(BTOPP_ACTION_OPEN_RECEIVED_FILES);
getActivity().sendBroadcast(intent);
return true;
-
- case MENU_ID_MESSAGE_ACCESS:
- if (getActivity() instanceof SettingsActivity) {
- ((SettingsActivity) getActivity()).startPreferencePanel(
- MessageAccessSettings.class.getCanonicalName(), null,
- R.string.bluetooth_show_message_access, null, this, 0);
- }
- return true;
}
return super.onOptionsItemSelected(item);
}
@@ -249,6 +234,8 @@
if (!mAvailableDevicesCategoryIsPresent) {
getPreferenceScreen().addPreference(mAvailableDevicesCategory);
}
+ mLocalManager.getCachedDeviceManager().clearCachedDevices();
+ mAvailableDevicesCategory.removeAll();
mLocalAdapter.startScanning(true);
}
@@ -375,7 +362,6 @@
}
}
- @Override
public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) {
setDeviceListGroup(getPreferenceScreen());
removeAllDevices();
@@ -405,7 +391,7 @@
LayoutInflater inflater = getActivity().getLayoutInflater();
mSettingsDialogView = inflater.inflate(R.layout.bluetooth_device_picker, null);
profileFrag = (DeviceProfilesSettings)activity.getFragmentManager()
- .findFragmentById(R.id.bluetooth_fragment_settings);
+ .findFragmentById(R.id.bluetooth_fragment_settings);
}
final View dialogLayout = mSettingsDialogView;
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index a7104df..3b64ade 100755
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -539,7 +539,7 @@
if (bondState == BluetoothDevice.BOND_NONE) {
mProfiles.clear();
mConnectAfterPairing = false; // cancel auto-connect
- setPhonebookPermissionChoice(ACCESS_ALLOWED);
+ setPhonebookPermissionChoice(ACCESS_UNKNOWN);
setMessagePermissionChoice(ACCESS_UNKNOWN);
mPhonebookRejectedTimes = 0;
savePhonebookRejectTimes();
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
index ff282cc..0b53b1a 100755
--- a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
@@ -86,7 +86,9 @@
BluetoothDevice device) {
CachedBluetoothDevice newDevice = new CachedBluetoothDevice(mContext, adapter,
profileManager, device);
- mCachedDevices.add(newDevice);
+ synchronized (mCachedDevices) {
+ mCachedDevices.add(newDevice);
+ }
return newDevice;
}
@@ -110,6 +112,10 @@
return device.getAddress();
}
+ public synchronized void clearCachedDevices() {
+ mCachedDevices.clear();
+ }
+
public synchronized void onScanningStateChanged(boolean started) {
if (!started) return;
diff --git a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
index f482ecd..e7208b5 100644
--- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
+++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
@@ -167,6 +167,12 @@
}
void createDevicePreference(CachedBluetoothDevice cachedDevice) {
+ if (mDeviceListGroup == null) {
+ Log.w(TAG, "Trying to create a device preference before the list group/category "
+ + "exists!");
+ return;
+ }
+
BluetoothDevicePreference preference = new BluetoothDevicePreference(
getActivity(), cachedDevice);
diff --git a/src/com/android/settings/bluetooth/MessageAccessSettings.java b/src/com/android/settings/bluetooth/MessageAccessSettings.java
deleted file mode 100644
index 913357c..0000000
--- a/src/com/android/settings/bluetooth/MessageAccessSettings.java
+++ /dev/null
@@ -1,167 +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.bluetooth;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.app.ActivityManagerNative;
-import android.content.Context;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.graphics.drawable.Drawable;
-import android.os.Bundle;
-import android.os.UserHandle;
-import android.preference.SwitchPreference;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
-import android.provider.SearchIndexableResource;
-import android.util.Log;
-
-import com.android.settings.accounts.AuthenticatorHelper;
-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.List;
-
-public class MessageAccessSettings extends SettingsPreferenceFragment
- implements AuthenticatorHelper.OnAccountsUpdateListener, Indexable {
- private static final String TAG = "MessageAccessSettings";
- private static final String GMAIL_PACKAGE_NAME = "com.google.android.gm";
- private static final String EMAIL_PACKAGE_NAME = "com.google.android.email";
-
- private Account[] mAccounts;
- private UserHandle mUserHandle;
- private PreferenceGroup mAvailableAccounts;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // TODO: Define behavior for managed profile. See: http://b/16287773
- mUserHandle = new UserHandle(UserHandle.myUserId());
-
- addPreferencesFromResource(R.xml.bluetooth_message_access);
- }
-
- @Override
- public void onResume() {
- super.onResume();
- initPreferences();
- }
-
- @Override
- public void onAccountsUpdate(final UserHandle userHandle) {
- mAccounts = AccountManager.get(getActivity()).getAccountsAsUser(
- mUserHandle.getIdentifier());
-
- final int mAccountsSize = mAccounts.length;
- for (int i = 0; i < mAccountsSize; ++i){
- Log.d(TAG, String.format("account.type = %s\n", mAccounts[i].type));
- }
- }
-
- /**
- * Retrieves the email icon for a given account's email preference
- *
- * @param accountPref The user's account to retrieve the icon from.
- *
- * @return The drawable representing the icon of the user's email preference
- **/
- private Drawable getIcon(AccountPreference accountPref){
- Drawable icon = null;
-
- // Currently only two types of icons are allowed.
- final String packageName = accountPref.account.type.equals("com.google")
- ? GMAIL_PACKAGE_NAME : EMAIL_PACKAGE_NAME;
-
- try{
- icon = getPackageManager().getApplicationIcon(packageName);
- }catch(NameNotFoundException nnfe){
- icon = null;
- }
-
- return icon;
- }
-
- private void initPreferences() {
- final PreferenceScreen preferenceScreen = getPreferenceScreen();
- mAvailableAccounts = (PreferenceGroup)preferenceScreen.findPreference("accounts");
- mAccounts = AccountManager.get(getActivity()).getAccountsAsUser(
- mUserHandle.getIdentifier());
-
- final int mAccountsSize = mAccounts.length;
- for (int i = 0; i < mAccountsSize; ++i){
- AccountPreference accountPref = new AccountPreference(getActivity(), mAccounts[i]);
- Drawable icon = getIcon(accountPref);
- if (icon != null){
- accountPref.setIcon(icon);
- }
- mAvailableAccounts.addPreference(accountPref);
- }
- }
-
- private class AccountPreference extends SwitchPreference
- implements Preference.OnPreferenceChangeListener{
- private Account account;
-
- AccountPreference(Context context, Account account){
- super(context);
- this.account = account;
- setTitle(account.type);
- setSummary(account.name);
-
- setOnPreferenceChangeListener(this);
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object val) {
- if (preference instanceof AccountPreference){
- final AccountPreference accountPref = (AccountPreference) preference;
-
- if (((Boolean)val).booleanValue()){
- // Enable paired deviced to connect, fill in once API is available
- Log.w(TAG, String.format(
- "User has turned on '%s' for Bluetooth message access.",
- accountPref.account.name));
- } else {
- // Disable paired deviced to connect, fill in once API is available
- Log.w(TAG, String.format(
- "User has turned off '%s' for Bluetooth message access.",
- accountPref.account.name));
- }
- }
- return true;
- }
- }
-
- public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider() {
- @Override
- public List<SearchIndexableResource> getXmlResourcesToIndex(
- Context context, boolean enabled) {
- List<SearchIndexableResource> indexables = new ArrayList<SearchIndexableResource>();
- SearchIndexableResource indexable = new SearchIndexableResource(context);
- indexable.xmlResId = R.xml.bluetooth_message_access;
- indexables.add(indexable);
- return indexables;
- }
- };
-}
diff --git a/src/com/android/settings/fuelgauge/BatteryEntry.java b/src/com/android/settings/fuelgauge/BatteryEntry.java
index 92eaade..4ff4dfd 100644
--- a/src/com/android/settings/fuelgauge/BatteryEntry.java
+++ b/src/com/android/settings/fuelgauge/BatteryEntry.java
@@ -16,15 +16,20 @@
package com.android.settings.fuelgauge;
+import android.app.AppGlobals;
import android.content.Context;
import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
import android.graphics.drawable.Drawable;
import android.os.BatteryStats;
import android.os.Handler;
+import android.os.RemoteException;
+import android.os.UserHandle;
import android.os.UserManager;
+import android.util.Log;
import com.android.internal.os.BatterySipper;
import com.android.settings.R;
@@ -256,9 +261,17 @@
System.arraycopy(sipper.mPackages, 0, packageLabels, 0, sipper.mPackages.length);
// Convert package names to user-facing labels where possible
+ IPackageManager ipm = AppGlobals.getPackageManager();
+ final int userId = UserHandle.getUserId(uid);
for (int i = 0; i < packageLabels.length; i++) {
try {
- ApplicationInfo ai = pm.getApplicationInfo(packageLabels[i], 0);
+ final ApplicationInfo ai = ipm.getApplicationInfo(packageLabels[i],
+ 0 /* no flags */, userId);
+ if (ai == null) {
+ Log.d(PowerUsageSummary.TAG, "Retrieving null app info for package "
+ + packageLabels[i] + ", user " + userId);
+ continue;
+ }
CharSequence label = ai.loadLabel(pm);
if (label != null) {
packageLabels[i] = label.toString();
@@ -268,10 +281,14 @@
icon = ai.loadIcon(pm);
break;
}
- } catch (PackageManager.NameNotFoundException e) {
+ } catch (RemoteException e) {
+ Log.d(PowerUsageSummary.TAG, "Error while retrieving app info for package "
+ + packageLabels[i] + ", user " + userId, e);
}
}
- if (icon == null) icon = defaultActivityIcon;
+ if (icon == null) {
+ icon = defaultActivityIcon;
+ }
if (packageLabels.length == 1) {
name = packageLabels[0];
@@ -279,7 +296,12 @@
// Look for an official name for this UID.
for (String pkgName : sipper.mPackages) {
try {
- final PackageInfo pi = pm.getPackageInfo(pkgName, 0);
+ final PackageInfo pi = ipm.getPackageInfo(pkgName, 0 /* no flags */, userId);
+ if (pi == null) {
+ Log.d(PowerUsageSummary.TAG, "Retrieving null package info for package "
+ + pkgName + ", user " + userId);
+ continue;
+ }
if (pi.sharedUserLabel != 0) {
final CharSequence nm = pm.getText(pkgName,
pi.sharedUserLabel, pi.applicationInfo);
@@ -292,7 +314,9 @@
break;
}
}
- } catch (PackageManager.NameNotFoundException e) {
+ } catch (RemoteException e) {
+ Log.d(PowerUsageSummary.TAG, "Error while retrieving package info for package "
+ + pkgName + ", user " + userId, e);
}
}
}
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index ad8afa5..b26ba65 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -54,7 +54,7 @@
private static final boolean DEBUG = false;
- private static final String TAG = "PowerUsageSummary";
+ static final String TAG = "PowerUsageSummary";
private static final String KEY_APP_LIST = "app_list";
@@ -293,7 +293,7 @@
}
final UserHandle userHandle = new UserHandle(UserHandle.getUserId(sipper.getUid()));
final BatteryEntry entry = new BatteryEntry(getActivity(), mHandler, mUm, sipper);
- final Drawable badgedIcon = mUm.getBadgedDrawableForUser(entry.getIcon(),
+ final Drawable badgedIcon = mUm.getBadgedIconForUser(entry.getIcon(),
userHandle);
final CharSequence contentDescription = mUm.getBadgedLabelForUser(entry.getLabel(),
userHandle);
@@ -337,7 +337,7 @@
if (pgp != null) {
final int userId = UserHandle.getUserId(entry.sipper.getUid());
final UserHandle userHandle = new UserHandle(userId);
- pgp.setIcon(mUm.getBadgedDrawableForUser(entry.getIcon(), userHandle));
+ pgp.setIcon(mUm.getBadgedIconForUser(entry.getIcon(), userHandle));
pgp.setTitle(entry.name);
}
break;
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index 1601cd0..3528c56 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -88,14 +88,6 @@
// false: on ICS or later
private static final boolean SHOW_INPUT_METHOD_SWITCHER_SETTINGS = false;
- private static final String[] sSystemSettingNames = {
- System.TEXT_AUTO_REPLACE, System.TEXT_AUTO_CAPS, System.TEXT_AUTO_PUNCTUATE,
- };
-
- private static final String[] sHardKeyboardKeys = {
- "auto_replace", "auto_caps", "auto_punctuate",
- };
-
private int mDefaultInputMethodSelectorVisibility = 0;
private ListPreference mShowInputMethodSelectorPref;
private PreferenceCategory mKeyboardSettingsCategory;
@@ -274,16 +266,6 @@
}
}
- // Hard keyboard
- if (!mHardKeyboardPreferenceList.isEmpty()) {
- for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
- CheckBoxPreference chkPref = (CheckBoxPreference)
- mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i]);
- chkPref.setChecked(
- System.getInt(getContentResolver(), sSystemSettingNames[i], 1) > 0);
- }
- }
-
updateInputDevices();
// Refresh internal states in mInputMethodSettingValues to keep the latest
@@ -339,15 +321,6 @@
}
} else if (preference instanceof CheckBoxPreference) {
final CheckBoxPreference chkPref = (CheckBoxPreference) preference;
- if (!mHardKeyboardPreferenceList.isEmpty()) {
- for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
- if (chkPref == mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i])) {
- System.putInt(getContentResolver(), sSystemSettingNames[i],
- chkPref.isChecked() ? 1 : 0);
- return true;
- }
- }
- }
if (chkPref == mGameControllerCategory.findPreference("vibrate_input_devices")) {
System.putInt(getContentResolver(), Settings.System.VIBRATE_INPUT_DEVICES,
chkPref.isChecked() ? 1 : 0);
@@ -564,35 +537,33 @@
private void updateHardKeyboards() {
mHardKeyboardPreferenceList.clear();
- if (getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY) {
- final int[] devices = InputDevice.getDeviceIds();
- for (int i = 0; i < devices.length; i++) {
- InputDevice device = InputDevice.getDevice(devices[i]);
- if (device != null
- && !device.isVirtual()
- && device.isFullKeyboard()) {
- final InputDeviceIdentifier identifier = device.getIdentifier();
- final String keyboardLayoutDescriptor =
- mIm.getCurrentKeyboardLayoutForInputDevice(identifier);
- final KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
- mIm.getKeyboardLayout(keyboardLayoutDescriptor) : null;
+ final int[] devices = InputDevice.getDeviceIds();
+ for (int i = 0; i < devices.length; i++) {
+ InputDevice device = InputDevice.getDevice(devices[i]);
+ if (device != null
+ && !device.isVirtual()
+ && device.isFullKeyboard()) {
+ final InputDeviceIdentifier identifier = device.getIdentifier();
+ final String keyboardLayoutDescriptor =
+ mIm.getCurrentKeyboardLayoutForInputDevice(identifier);
+ final KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
+ mIm.getKeyboardLayout(keyboardLayoutDescriptor) : null;
- final PreferenceScreen pref = new PreferenceScreen(getActivity(), null);
- pref.setTitle(device.getName());
- if (keyboardLayout != null) {
- pref.setSummary(keyboardLayout.toString());
- } else {
- pref.setSummary(R.string.keyboard_layout_default_label);
- }
- pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- showKeyboardLayoutDialog(identifier);
- return true;
- }
- });
- mHardKeyboardPreferenceList.add(pref);
+ final PreferenceScreen pref = new PreferenceScreen(getActivity(), null);
+ pref.setTitle(device.getName());
+ if (keyboardLayout != null) {
+ pref.setSummary(keyboardLayout.toString());
+ } else {
+ pref.setSummary(R.string.keyboard_layout_default_label);
}
+ pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ showKeyboardLayoutDialog(identifier);
+ return true;
+ }
+ });
+ mHardKeyboardPreferenceList.add(pref);
}
}
@@ -702,8 +673,8 @@
public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
List<SearchIndexableRaw> indexables = new ArrayList<>();
- Resources resources = context.getResources();
- String screenTitle = context.getString(R.string.language_keyboard_settings_title);
+ final Resources resources = context.getResources();
+ final String screenTitle = context.getString(R.string.language_keyboard_settings_title);
// Locale picker.
if (context.getAssets().getLocales().length > 1) {
@@ -795,116 +766,55 @@
// Hard keyboards
InputManager inputManager = (InputManager) context.getSystemService(
Context.INPUT_SERVICE);
- if (resources.getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY) {
- boolean hasHardKeyboards = false;
+ boolean hasHardKeyboards = false;
- final int[] devices = InputDevice.getDeviceIds();
- for (int i = 0; i < devices.length; i++) {
- InputDevice device = InputDevice.getDevice(devices[i]);
- if (device == null || device.isVirtual() || !device.isFullKeyboard()) {
- continue;
- }
-
- hasHardKeyboards = true;
-
- InputDeviceIdentifier identifier = device.getIdentifier();
- String keyboardLayoutDescriptor =
- inputManager.getCurrentKeyboardLayoutForInputDevice(identifier);
- KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
- inputManager.getKeyboardLayout(keyboardLayoutDescriptor) : null;
-
- String summary;
- if (keyboardLayout != null) {
- summary = keyboardLayout.toString();
- } else {
- summary = context.getString(R.string.keyboard_layout_default_label);
- }
-
- indexable = new SearchIndexableRaw(context);
- indexable.key = device.getName();
- indexable.title = device.getName();
- indexable.summaryOn = summary;
- indexable.summaryOff = summary;
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
+ final int[] devices = InputDevice.getDeviceIds();
+ for (int i = 0; i < devices.length; i++) {
+ InputDevice device = InputDevice.getDevice(devices[i]);
+ if (device == null || device.isVirtual() || !device.isFullKeyboard()) {
+ continue;
}
- if (hasHardKeyboards) {
- // Hard keyboard category.
- indexable = new SearchIndexableRaw(context);
- indexable.key = "builtin_keyboard_settings";
- indexable.title = context.getString(
- R.string.builtin_keyboard_settings_title);
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
+ hasHardKeyboards = true;
- // Auto replace.
- indexable = new SearchIndexableRaw(context);
- indexable.key = "auto_replace";
- indexable.title = context.getString(R.string.auto_replace);
- indexable.summaryOn = context.getString(R.string.auto_replace_summary);
- indexable.summaryOff = context.getString(R.string.auto_replace_summary);
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
+ InputDeviceIdentifier identifier = device.getIdentifier();
+ String keyboardLayoutDescriptor =
+ inputManager.getCurrentKeyboardLayoutForInputDevice(identifier);
+ KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
+ inputManager.getKeyboardLayout(keyboardLayoutDescriptor) : null;
- // Auto caps.
- indexable = new SearchIndexableRaw(context);
- indexable.key = "auto_caps";
- indexable.title = context.getString(R.string.auto_caps);
- indexable.summaryOn = context.getString(R.string.auto_caps_summary);
- indexable.summaryOff = context.getString(R.string.auto_caps_summary);
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
-
- // Auto punctuate.
- indexable = new SearchIndexableRaw(context);
- indexable.key = "auto_punctuate";
- indexable.title = context.getString(R.string.auto_punctuate);
- indexable.summaryOn = context.getString(R.string.auto_punctuate_summary);
- indexable.summaryOff = context.getString(R.string.auto_punctuate_summary);
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
+ String summary;
+ if (keyboardLayout != null) {
+ summary = keyboardLayout.toString();
+ } else {
+ summary = context.getString(R.string.keyboard_layout_default_label);
}
- }
- // Voice recognizers.
- List<ResolveInfo> recognizers = context.getPackageManager()
- .queryIntentServices(new Intent(RecognitionService.SERVICE_INTERFACE),
- PackageManager.GET_META_DATA);
-
- final int recognizerCount = recognizers.size();
-
- // Recognizer settings.
- if (recognizerCount > 0) {
indexable = new SearchIndexableRaw(context);
- indexable.key = "recognizer_settings";
- indexable.title = context.getString(R.string.recognizer_settings_title);
+ indexable.key = device.getName();
+ indexable.title = device.getName();
+ indexable.summaryOn = summary;
+ indexable.summaryOff = summary;
indexable.screenTitle = screenTitle;
indexables.add(indexable);
}
- if (recognizerCount > 1) {
- // Recognizer chooser.
+ if (hasHardKeyboards) {
+ // Hard keyboard category.
indexable = new SearchIndexableRaw(context);
- indexable.key = "recognizer_title";
- indexable.title = context.getString(R.string.recognizer_title);
+ indexable.key = "builtin_keyboard_settings";
+ indexable.title = context.getString(
+ R.string.builtin_keyboard_settings_title);
indexable.screenTitle = screenTitle;
indexables.add(indexable);
}
- for (int i = 0; i < recognizerCount; i++) {
- ResolveInfo recognizer = recognizers.get(i);
-
- ServiceInfo serviceInfo = recognizer.serviceInfo;
- ComponentName componentName = new ComponentName(serviceInfo.packageName,
- serviceInfo.name);
-
- indexable = new SearchIndexableRaw(context);
- indexable.key = componentName.flattenToString();
- indexable.title = recognizer.loadLabel(context.getPackageManager()).toString();
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
- }
+ // Voice input
+ indexable = new SearchIndexableRaw(context);
+ indexable.key = "voice_input_settings";
+ indexable.title = context.getString(R.string.voice_input_settings);
+ indexable.screenTitle = screenTitle;
+ indexables.add(indexable);
// Text-to-speech.
TtsEngines ttsEngines = new TtsEngines(context);
diff --git a/src/com/android/settings/location/RecentLocationApps.java b/src/com/android/settings/location/RecentLocationApps.java
index 13d282d..7c59927 100644
--- a/src/com/android/settings/location/RecentLocationApps.java
+++ b/src/com/android/settings/location/RecentLocationApps.java
@@ -203,6 +203,11 @@
IPackageManager ipm = AppGlobals.getPackageManager();
ApplicationInfo appInfo =
ipm.getApplicationInfo(packageName, PackageManager.GET_META_DATA, userId);
+ if (appInfo == null) {
+ Log.w(TAG, "Null application info retrieved for package " + packageName
+ + ", userId " + userId);
+ return null;
+ }
Resources res = mActivity.getResources();
final UserHandle userHandle = new UserHandle(userId);
@@ -214,7 +219,8 @@
appLabel, highBattery, badgedAppLabel,
new PackageEntryClickedListener(packageName));
} catch (RemoteException e) {
- Log.w(TAG, "Error while retrieving application info", e);
+ Log.w(TAG, "Error while retrieving application info for package " + packageName
+ + ", userId " + userId, e);
}
return preference;
diff --git a/src/com/android/settings/net/UidDetailProvider.java b/src/com/android/settings/net/UidDetailProvider.java
index b933025..4b54137 100644
--- a/src/com/android/settings/net/UidDetailProvider.java
+++ b/src/com/android/settings/net/UidDetailProvider.java
@@ -16,8 +16,10 @@
package com.android.settings.net;
+import android.app.AppGlobals;
import android.content.Context;
import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -28,7 +30,9 @@
import android.net.TrafficStats;
import android.os.UserManager;
import android.os.UserHandle;
+import android.os.RemoteException;
import android.text.TextUtils;
+import android.util.Log;
import android.util.SparseArray;
import com.android.settings.R;
@@ -39,6 +43,7 @@
* {@link TrafficStats#UID_TETHERING} and {@link UserInfo}.
*/
public class UidDetailProvider {
+ private static final String TAG = "DataUsage";
private final Context mContext;
private final SparseArray<UidDetail> mUidDetailCache;
@@ -148,31 +153,43 @@
final String[] packageNames = pm.getPackagesForUid(uid);
final int length = packageNames != null ? packageNames.length : 0;
try {
- final UserHandle userHandle = new UserHandle(UserHandle.getUserId(uid));
+ final int userId = UserHandle.getUserId(uid);
+ UserHandle userHandle = new UserHandle(userId);
+ IPackageManager ipm = AppGlobals.getPackageManager();
if (length == 1) {
- final ApplicationInfo info = pm.getApplicationInfo(packageNames[0], 0);
- detail.label = info.loadLabel(pm).toString();
- detail.icon = um.getBadgedDrawableForUser(info.loadIcon(pm), userHandle);
+ final ApplicationInfo info = ipm.getApplicationInfo(packageNames[0],
+ 0 /* no flags */, userId);
+ if (info != null) {
+ detail.label = info.loadLabel(pm).toString();
+ detail.icon = um.getBadgedIconForUser(info.loadIcon(pm),
+ new UserHandle(userId));
+ }
} else if (length > 1) {
detail.detailLabels = new CharSequence[length];
detail.detailContentDescriptions = new CharSequence[length];
for (int i = 0; i < length; i++) {
final String packageName = packageNames[i];
final PackageInfo packageInfo = pm.getPackageInfo(packageName, 0);
- final ApplicationInfo appInfo = pm.getApplicationInfo(packageName, 0);
+ final ApplicationInfo appInfo = ipm.getApplicationInfo(packageName,
+ 0 /* no flags */, userId);
- detail.detailLabels[i] = appInfo.loadLabel(pm).toString();
- detail.detailContentDescriptions[i] = um.getBadgedLabelForUser(
- detail.detailLabels[i], userHandle);
- if (packageInfo.sharedUserLabel != 0) {
- detail.label = pm.getText(packageName, packageInfo.sharedUserLabel,
- packageInfo.applicationInfo).toString();
- detail.icon = um.getBadgedDrawableForUser(appInfo.loadIcon(pm), userHandle);
+ if (appInfo != null) {
+ detail.detailLabels[i] = appInfo.loadLabel(pm).toString();
+ detail.detailContentDescriptions[i] = um.getBadgedLabelForUser(
+ detail.detailLabels[i], userHandle);
+ if (packageInfo.sharedUserLabel != 0) {
+ detail.label = pm.getText(packageName, packageInfo.sharedUserLabel,
+ packageInfo.applicationInfo).toString();
+ detail.icon = um.getBadgedIconForUser(appInfo.loadIcon(pm), userHandle);
+ }
}
}
}
detail.contentDescription = um.getBadgedLabelForUser(detail.label, userHandle);
} catch (NameNotFoundException e) {
+ Log.w(TAG, "Error while building UI detail for uid "+uid, e);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Error while building UI detail for uid "+uid, e);
}
if (TextUtils.isEmpty(detail.label)) {
diff --git a/src/com/android/settings/search/Ranking.java b/src/com/android/settings/search/Ranking.java
index 44717c1..2c76002 100644
--- a/src/com/android/settings/search/Ranking.java
+++ b/src/com/android/settings/search/Ranking.java
@@ -30,7 +30,6 @@
import com.android.settings.WirelessSettings;
import com.android.settings.accessibility.AccessibilitySettings;
import com.android.settings.bluetooth.BluetoothSettings;
-import com.android.settings.bluetooth.MessageAccessSettings;
import com.android.settings.deviceinfo.Memory;
import com.android.settings.fuelgauge.BatterySaverSettings;
import com.android.settings.fuelgauge.PowerUsageSummary;
@@ -43,6 +42,7 @@
import com.android.settings.print.PrintSettingsFragment;
import com.android.settings.sim.SimSettings;
import com.android.settings.users.UserSettings;
+import com.android.settings.voice.VoiceInputSettings;
import com.android.settings.wifi.AdvancedWifiSettings;
import com.android.settings.wifi.SavedAccessPointsWifiSettings;
import com.android.settings.wifi.WifiSettings;
@@ -93,7 +93,6 @@
// BT
sRankMap.put(BluetoothSettings.class.getName(), RANK_BT);
- sRankMap.put(MessageAccessSettings.class.getName(), RANK_BT);
// SIM Cards
sRankMap.put(SimSettings.class.getName(), RANK_SIM);
@@ -139,6 +138,7 @@
// IMEs
sRankMap.put(InputMethodAndLanguageSettings.class.getName(), RANK_IME);
+ sRankMap.put(VoiceInputSettings.class.getName(), RANK_IME);
// Privacy
sRankMap.put(PrivacySettings.class.getName(), RANK_PRIVACY);
diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java
index e0e09a8..5108da3 100644
--- a/src/com/android/settings/search/SearchIndexableResources.java
+++ b/src/com/android/settings/search/SearchIndexableResources.java
@@ -33,7 +33,6 @@
import com.android.settings.WirelessSettings;
import com.android.settings.accessibility.AccessibilitySettings;
import com.android.settings.bluetooth.BluetoothSettings;
-import com.android.settings.bluetooth.MessageAccessSettings;
import com.android.settings.deviceinfo.Memory;
import com.android.settings.fuelgauge.BatterySaverSettings;
import com.android.settings.fuelgauge.PowerUsageSummary;
@@ -46,6 +45,7 @@
import com.android.settings.print.PrintSettingsFragment;
import com.android.settings.sim.SimSettings;
import com.android.settings.users.UserSettings;
+import com.android.settings.voice.VoiceInputSettings;
import com.android.settings.wifi.AdvancedWifiSettings;
import com.android.settings.wifi.SavedAccessPointsWifiSettings;
import com.android.settings.wifi.WifiSettings;
@@ -96,13 +96,6 @@
SimSettings.class.getName(),
R.drawable.ic_sim_sd));
- sResMap.put(MessageAccessSettings.class.getName(),
- new SearchIndexableResource(
- Ranking.getRankForClassName(MessageAccessSettings.class.getName()),
- NO_DATA_RES_ID,
- MessageAccessSettings.class.getName(),
- R.drawable.ic_settings_bluetooth2));
-
sResMap.put(DataUsageSummary.class.getName(),
new SearchIndexableResource(
Ranking.getRankForClassName(DataUsageSummary.class.getName()),
@@ -230,6 +223,13 @@
InputMethodAndLanguageSettings.class.getName(),
R.drawable.ic_settings_language));
+ sResMap.put(VoiceInputSettings.class.getName(),
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(VoiceInputSettings.class.getName()),
+ NO_DATA_RES_ID,
+ VoiceInputSettings.class.getName(),
+ R.drawable.ic_settings_language));
+
sResMap.put(PrivacySettings.class.getName(),
new SearchIndexableResource(
Ranking.getRankForClassName(PrivacySettings.class.getName()),
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 93f9b0f..9ad34a9 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -790,6 +790,8 @@
} else {
setPhotoId(pref, user);
}
+ } else {
+ pref.setIcon(getEncircledDefaultAvatar());
}
}
@@ -833,7 +835,7 @@
if (missingIcons.size() > 0) {
loadIconsAsync(missingIcons);
}
- boolean moreUsers = mUserManager.getMaxSupportedUsers() > users.size();
+ boolean moreUsers = mUserManager.canAddMoreUsers();
mAddUser.setEnabled(moreUsers);
}
@@ -849,6 +851,9 @@
protected Void doInBackground(List<Integer>... values) {
for (int userId : values[0]) {
Bitmap bitmap = mUserManager.getUserIcon(userId);
+ if (bitmap == null) {
+ bitmap = createBitmapFromDrawable(R.drawable.ic_avatar_default_1);
+ }
mUserIcons.append(userId, bitmap);
}
return null;
diff --git a/src/com/android/settings/voice/VoiceInputSettings.java b/src/com/android/settings/voice/VoiceInputSettings.java
index 309c6e9..aa85024 100644
--- a/src/com/android/settings/voice/VoiceInputSettings.java
+++ b/src/com/android/settings/voice/VoiceInputSettings.java
@@ -16,18 +16,33 @@
package com.android.settings.voice;
+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.pm.ServiceInfo;
import android.preference.Preference;
import android.provider.Settings;
+import android.service.voice.VoiceInteractionService;
+import android.service.voice.VoiceInteractionServiceInfo;
+import android.speech.RecognitionService;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+import com.android.settings.search.SearchIndexableRaw;
import com.android.settings.voice.VoiceInputPreference.RadioButtonGroupState;
import android.os.Bundle;
import android.preference.PreferenceCategory;
import android.widget.Checkable;
+import java.util.ArrayList;
+import java.util.List;
+
public class VoiceInputSettings extends SettingsPreferenceFragment implements
- Preference.OnPreferenceClickListener, RadioButtonGroupState {
+ Preference.OnPreferenceClickListener, RadioButtonGroupState, Indexable {
private static final String TAG = "VoiceInputSettings";
private static final boolean DBG = false;
@@ -160,4 +175,68 @@
}
return true;
}
+
+ // For Search
+ public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+
+ @Override
+ public List<SearchIndexableRaw> getRawDataToIndex(Context context,
+ boolean enabled) {
+
+ List<SearchIndexableRaw> indexables = new ArrayList<>();
+
+ final String screenTitle = context.getString(R.string.voice_input_settings_title);
+
+ SearchIndexableRaw indexable = new SearchIndexableRaw(context);
+ indexable.key = "voice_service_preference_section_title";
+ indexable.title = context.getString(R.string.voice_service_preference_section_title);
+ indexable.screenTitle = screenTitle;
+ indexables.add(indexable);
+
+ final List<ResolveInfo> voiceInteractions =
+ context.getPackageManager().queryIntentServices(
+ new Intent(VoiceInteractionService.SERVICE_INTERFACE),
+ PackageManager.GET_META_DATA);
+
+ final int countInteractions = voiceInteractions.size();
+ for (int i = 0; i < countInteractions; i++) {
+ ResolveInfo info = voiceInteractions.get(i);
+ VoiceInteractionServiceInfo visInfo = new VoiceInteractionServiceInfo(
+ context.getPackageManager(), info.serviceInfo);
+ if (visInfo.getParseError() != null) {
+ continue;
+ }
+ indexables.add(getSearchIndexableRaw(context, info, screenTitle));
+ }
+
+ final List<ResolveInfo> recognitions =
+ context.getPackageManager().queryIntentServices(
+ new Intent(RecognitionService.SERVICE_INTERFACE),
+ PackageManager.GET_META_DATA);
+
+ final int countRecognitions = recognitions.size();
+ for (int i = 0; i < countRecognitions; i++) {
+ ResolveInfo info = recognitions.get(i);
+ indexables.add(getSearchIndexableRaw(context, info, screenTitle));
+ }
+
+ return indexables;
+ }
+
+ private SearchIndexableRaw getSearchIndexableRaw(Context context,
+ ResolveInfo info, String screenTitle) {
+
+ ServiceInfo serviceInfo = info.serviceInfo;
+ ComponentName componentName = new ComponentName(serviceInfo.packageName,
+ serviceInfo.name);
+
+ SearchIndexableRaw indexable = new SearchIndexableRaw(context);
+ indexable.key = componentName.flattenToString();
+ indexable.title = info.loadLabel(context.getPackageManager()).toString();
+ indexable.screenTitle = screenTitle;
+
+ return indexable;
+ }
+ };
}
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index 5be9046..d409764 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -16,13 +16,11 @@
package com.android.settings.vpn2;
-import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.Intent;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.IConnectivityManager;
@@ -31,13 +29,10 @@
import android.os.Message;
import android.os.ServiceManager;
import android.os.SystemProperties;
-import android.os.UserHandle;
import android.os.UserManager;
-import android.os.Process;
import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
-import android.provider.Settings;
import android.security.Credentials;
import android.security.KeyStore;
import android.text.TextUtils;
@@ -49,14 +44,11 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
-import android.widget.AdapterView.OnItemSelectedListener;
-import android.widget.Spinner;
import com.android.internal.net.LegacyVpnInfo;
import com.android.internal.net.VpnConfig;
@@ -64,9 +56,6 @@
import com.android.internal.util.ArrayUtils;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.UserSpinnerAdapter;
-import com.android.settings.UserSpinnerAdapter.UserDetails;
-import com.android.settings.Utils;
import com.google.android.collect.Lists;
@@ -76,12 +65,11 @@
public class VpnSettings extends SettingsPreferenceFragment implements
Handler.Callback, Preference.OnPreferenceClickListener,
- DialogInterface.OnClickListener, DialogInterface.OnDismissListener, OnItemSelectedListener {
+ DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
private static final String TAG = "VpnSettings";
private static final String TAG_LOCKDOWN = "lockdown";
- private static final String ACTION_VPN_SETTINGS = "android.net.vpn.SETTINGS";
private static final String EXTRA_PICK_LOCKDOWN = "android.net.vpn.PICK_LOCKDOWN";
// TODO: migrate to using DialogFragment when editing
@@ -102,7 +90,6 @@
private String mSelectedKey;
private boolean mUnavailable;
- private UserSpinnerAdapter mProfileSpinnerAdapter;
@Override
public void onCreate(Bundle savedState) {
@@ -130,39 +117,6 @@
}
@Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
-
- Context context = getActivity();
- mProfileSpinnerAdapter = Utils.createUserSpinnerAdapter(mUm, getActivity());
- if (mProfileSpinnerAdapter != null) {
- Spinner spinner = (Spinner) getActivity().getLayoutInflater().inflate(
- R.layout.spinner_view, null);
-
- spinner.setAdapter(mProfileSpinnerAdapter);
- spinner.setOnItemSelectedListener(this);
- setPinnedHeaderView(spinner);
- }
- }
-
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- UserHandle selectedUser = mProfileSpinnerAdapter.getUserHandle(position);
- if (selectedUser.getIdentifier() != UserHandle.myUserId()) {
- Intent intent = new Intent(ACTION_VPN_SETTINGS);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- Activity activity = getActivity();
- activity.startActivityAsUser(intent, selectedUser);
- activity.finish();
- }
- }
-
- @Override
- public void onNothingSelected(AdapterView<?> parent) {
- // Nothing to do
- }
-
- @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.vpn, menu);
@@ -537,7 +491,7 @@
private static class TitleAdapter extends ArrayAdapter<CharSequence> {
public TitleAdapter(Context context, List<CharSequence> objects) {
- super(context, com.android.internal.R.layout.select_dialog_singlechoice_holo,
+ super(context, com.android.internal.R.layout.select_dialog_singlechoice_material,
android.R.id.text1, objects);
}
}
diff --git a/src/com/android/settings/widget/SetupWizardIllustration.java b/src/com/android/settings/widget/SetupWizardIllustration.java
index dcc4c65..8a9d507 100644
--- a/src/com/android/settings/widget/SetupWizardIllustration.java
+++ b/src/com/android/settings/widget/SetupWizardIllustration.java
@@ -22,6 +22,7 @@
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
+import android.util.LayoutDirection;
import android.util.Log;
import android.widget.FrameLayout;
@@ -45,6 +46,7 @@
private int mForegroundHeight = 0;
private float mScale = 1.0f;
private float mAspectRatio = 0.0f;
+ private boolean mAutoMirrored;
public SetupWizardIllustration(Context context) {
this(context, null);
@@ -65,6 +67,8 @@
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.SetupWizardIllustration, 0, 0);
mAspectRatio = a.getFloat(R.styleable.SetupWizardIllustration_aspectRatio, 0.0f);
+ // TODO: Use framework autoMirrored supported in drawables instead b/17047609
+ mAutoMirrored = a.getBoolean(R.styleable.SetupWizardIllustration_autoMirrored, false);
a.recycle();
}
// Number of pixels of the 8dp baseline grid as defined in material design specs
@@ -131,6 +135,11 @@
@Override
public void onDraw(Canvas canvas) {
+ canvas.save();
+ if (mAutoMirrored && getLayoutDirection() == LayoutDirection.RTL) {
+ canvas.scale(-1, 1);
+ canvas.translate(-canvas.getWidth(), 0);
+ }
if (mBackground != null) {
canvas.save();
// Draw the background filling parts not covered by the illustration
@@ -146,6 +155,7 @@
mForeground.draw(canvas);
canvas.restore();
}
+ canvas.restore();
super.onDraw(canvas);
}
}
diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java
index 0ec1f13..3df4ece 100644
--- a/src/com/android/settings/wifi/AccessPoint.java
+++ b/src/com/android/settings/wifi/AccessPoint.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.StateListDrawable;
import android.net.NetworkInfo.DetailedState;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
@@ -266,14 +267,17 @@
Drawable drawable = getIcon();
if (drawable == null) {
- drawable = context.getTheme().obtainStyledAttributes(
- wifi_signal_attributes).getDrawable(0);
+ // To avoid a drawing race condition, we first set the state (SECURE/NONE) and then
+ // set the icon (drawable) to that state's drawable.
+ StateListDrawable sld = (StateListDrawable) context.getTheme()
+ .obtainStyledAttributes(wifi_signal_attributes).getDrawable(0);
+ sld.setState((security != SECURITY_NONE) ? STATE_SECURED : STATE_NONE);
+ drawable = sld.getCurrent();
setIcon(drawable);
}
if (drawable != null) {
drawable.setLevel(level);
- drawable.setState((security != SECURITY_NONE) ? STATE_SECURED : STATE_NONE);
}
}
}
@@ -554,17 +558,6 @@
if (mConfig != null) { // Is saved network
summary.append(context.getString(R.string.wifi_remembered));
}
-
-// TODO: Wi-Fi team needs to decide what to do with this code.
-// if (security != SECURITY_NONE) {
-// String securityStrFormat;
-// if (summary.length() == 0) {
-// securityStrFormat = context.getString(R.string.wifi_secured_first_item);
-// } else {
-// securityStrFormat = context.getString(R.string.wifi_secured_second_item);
-// }
-// }
-
}
if (WifiSettings.mVerboseLogging > 0) {
diff --git a/src/com/android/settings/wifi/AdvancedWifiSettings.java b/src/com/android/settings/wifi/AdvancedWifiSettings.java
index b7316d0..236aecd 100644
--- a/src/com/android/settings/wifi/AdvancedWifiSettings.java
+++ b/src/com/android/settings/wifi/AdvancedWifiSettings.java
@@ -20,6 +20,9 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.net.NetworkScoreManager;
+import android.net.NetworkScorerAppManager;
+import android.net.NetworkScorerAppManager.NetworkScorerAppData;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.net.wifi.WpsInfo;
@@ -29,6 +32,7 @@
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceScreen;
+import android.preference.SwitchPreference;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.security.Credentials;
@@ -40,6 +44,8 @@
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
+import java.util.Collection;
+
public class AdvancedWifiSettings extends SettingsPreferenceFragment
implements Preference.OnPreferenceChangeListener {
@@ -49,13 +55,12 @@
private static final String KEY_FREQUENCY_BAND = "frequency_band";
private static final String KEY_NOTIFY_OPEN_NETWORKS = "notify_open_networks";
private static final String KEY_SLEEP_POLICY = "sleep_policy";
- private static final String KEY_POOR_NETWORK_DETECTION = "wifi_poor_network_detection";
private static final String KEY_SCAN_ALWAYS_AVAILABLE = "wifi_scan_always_available";
private static final String KEY_INSTALL_CREDENTIALS = "install_credentials";
+ private static final String KEY_WIFI_ASSISTANT = "wifi_assistant";
private static final String KEY_WIFI_DIRECT = "wifi_direct";
private static final String KEY_WPS_PUSH = "wps_push_button";
private static final String KEY_WPS_PIN = "wps_pin_entry";
- private static final String KEY_SUSPEND_OPTIMIZATIONS = "suspend_optimizations";
private WifiManager mWifiManager;
@@ -102,27 +107,14 @@
}
private void initPreferences() {
- CheckBoxPreference notifyOpenNetworks =
- (CheckBoxPreference) findPreference(KEY_NOTIFY_OPEN_NETWORKS);
+ SwitchPreference notifyOpenNetworks =
+ (SwitchPreference) findPreference(KEY_NOTIFY_OPEN_NETWORKS);
notifyOpenNetworks.setChecked(Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
notifyOpenNetworks.setEnabled(mWifiManager.isWifiEnabled());
- CheckBoxPreference poorNetworkDetection =
- (CheckBoxPreference) findPreference(KEY_POOR_NETWORK_DETECTION);
- if (poorNetworkDetection != null) {
- if (Utils.isWifiOnly(getActivity())) {
- getPreferenceScreen().removePreference(poorNetworkDetection);
- } else {
- poorNetworkDetection.setChecked(Global.getInt(getContentResolver(),
- Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
- WifiManager.DEFAULT_POOR_NETWORK_AVOIDANCE_ENABLED ?
- 1 : 0) == 1);
- }
- }
-
- CheckBoxPreference scanAlwaysAvailable =
- (CheckBoxPreference) findPreference(KEY_SCAN_ALWAYS_AVAILABLE);
+ SwitchPreference scanAlwaysAvailable =
+ (SwitchPreference) findPreference(KEY_SCAN_ALWAYS_AVAILABLE);
scanAlwaysAvailable.setChecked(Global.getInt(getContentResolver(),
Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1);
@@ -133,7 +125,20 @@
Preference pref = findPreference(KEY_INSTALL_CREDENTIALS);
pref.setIntent(intent);
- Intent wifiDirectIntent = new Intent(getActivity(),
+ final Context context = getActivity();
+ NetworkScorerAppData scorer = WifiSettings.getWifiAssistantApp(context);
+ SwitchPreference wifiAssistant = (SwitchPreference)findPreference(KEY_WIFI_ASSISTANT);
+ if (scorer != null) {
+ final boolean checked = NetworkScorerAppManager.getActiveScorer(context) != null;
+ wifiAssistant.setSummary(getResources().getString(
+ R.string.wifi_automatically_manage_summary, scorer.mScorerName));
+ wifiAssistant.setOnPreferenceChangeListener(this);
+ wifiAssistant.setChecked(checked);
+ } else {
+ getPreferenceScreen().removePreference(wifiAssistant);
+ }
+
+ Intent wifiDirectIntent = new Intent(context,
com.android.settings.Settings.WifiP2pSettingsActivity.class);
Preference wifiDirectPref = findPreference(KEY_WIFI_DIRECT);
wifiDirectPref.setIntent(wifiDirectIntent);
@@ -142,7 +147,7 @@
Preference wpsPushPref = findPreference(KEY_WPS_PUSH);
wpsPushPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference arg0) {
- WpsDialog wpsDialog = new WpsDialog(getActivity(), WpsInfo.PBC);
+ WpsDialog wpsDialog = new WpsDialog(context, WpsInfo.PBC);
wpsDialog.show();
return true;
}
@@ -152,17 +157,12 @@
Preference wpsPinPref = findPreference(KEY_WPS_PIN);
wpsPinPref.setOnPreferenceClickListener(new OnPreferenceClickListener(){
public boolean onPreferenceClick(Preference arg0) {
- WpsDialog wpsDialog = new WpsDialog(getActivity(), WpsInfo.DISPLAY);
+ WpsDialog wpsDialog = new WpsDialog(context, WpsInfo.DISPLAY);
wpsDialog.show();
return true;
}
});
- CheckBoxPreference suspendOptimizations =
- (CheckBoxPreference) findPreference(KEY_SUSPEND_OPTIMIZATIONS);
- suspendOptimizations.setChecked(Global.getInt(getContentResolver(),
- Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
-
ListPreference frequencyPref = (ListPreference) findPreference(KEY_FREQUENCY_BAND);
if (mWifiManager.isDualBandSupported()) {
@@ -183,7 +183,7 @@
ListPreference sleepPolicyPref = (ListPreference) findPreference(KEY_SLEEP_POLICY);
if (sleepPolicyPref != null) {
- if (Utils.isWifiOnly(getActivity())) {
+ if (Utils.isWifiOnly(context)) {
sleepPolicyPref.setEntries(R.array.wifi_sleep_policy_entries_wifi_only);
}
sleepPolicyPref.setOnPreferenceChangeListener(this);
@@ -228,19 +228,11 @@
if (KEY_NOTIFY_OPEN_NETWORKS.equals(key)) {
Global.putInt(getContentResolver(),
Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
- ((CheckBoxPreference) preference).isChecked() ? 1 : 0);
- } else if (KEY_POOR_NETWORK_DETECTION.equals(key)) {
- Global.putInt(getContentResolver(),
- Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
- ((CheckBoxPreference) preference).isChecked() ? 1 : 0);
- } else if (KEY_SUSPEND_OPTIMIZATIONS.equals(key)) {
- Global.putInt(getContentResolver(),
- Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED,
- ((CheckBoxPreference) preference).isChecked() ? 1 : 0);
+ ((SwitchPreference) preference).isChecked() ? 1 : 0);
} else if (KEY_SCAN_ALWAYS_AVAILABLE.equals(key)) {
Global.putInt(getContentResolver(),
Global.WIFI_SCAN_ALWAYS_AVAILABLE,
- ((CheckBoxPreference) preference).isChecked() ? 1 : 0);
+ ((SwitchPreference) preference).isChecked() ? 1 : 0);
} else {
return super.onPreferenceTreeClick(screen, preference);
}
@@ -249,6 +241,7 @@
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
+ final Context context = getActivity();
String key = preference.getKey();
if (KEY_FREQUENCY_BAND.equals(key)) {
@@ -257,10 +250,32 @@
mWifiManager.setFrequencyBand(value, true);
updateFrequencyBandSummary(preference, value);
} catch (NumberFormatException e) {
- Toast.makeText(getActivity(), R.string.wifi_setting_frequency_band_error,
+ Toast.makeText(context, R.string.wifi_setting_frequency_band_error,
Toast.LENGTH_SHORT).show();
return false;
}
+ } else if (KEY_WIFI_ASSISTANT.equals(key)) {
+ if (((Boolean)newValue).booleanValue() == false) {
+ NetworkScorerAppManager.setActiveScorer(context, null);
+ return true;
+ }
+
+ NetworkScorerAppData wifiAssistant = WifiSettings.getWifiAssistantApp(context);
+ Intent intent = new Intent();
+ if (wifiAssistant.mConfigurationActivityClassName != null) {
+ // App has a custom configuration activity; launch that.
+ // This custom activity will be responsible for launching the system
+ // dialog.
+ intent.setClassName(wifiAssistant.mPackageName,
+ wifiAssistant.mConfigurationActivityClassName);
+ } else {
+ // Fall back on the system dialog.
+ intent.setAction(NetworkScoreManager.ACTION_CHANGE_ACTIVE);
+ intent.putExtra(NetworkScoreManager.EXTRA_PACKAGE_NAME,
+ wifiAssistant.mPackageName);
+ }
+
+ startActivity(intent);
}
if (KEY_SLEEP_POLICY.equals(key)) {
@@ -270,7 +285,7 @@
Integer.parseInt(stringValue));
updateSleepPolicySummary(preference, stringValue);
} catch (NumberFormatException e) {
- Toast.makeText(getActivity(), R.string.wifi_setting_sleep_policy_error,
+ Toast.makeText(context, R.string.wifi_setting_sleep_policy_error,
Toast.LENGTH_SHORT).show();
return false;
}
@@ -280,18 +295,19 @@
}
private void refreshWifiInfo() {
+ final Context context = getActivity();
WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
Preference wifiMacAddressPref = findPreference(KEY_MAC_ADDRESS);
String macAddress = wifiInfo == null ? null : wifiInfo.getMacAddress();
wifiMacAddressPref.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress
- : getActivity().getString(R.string.status_unavailable));
+ : context.getString(R.string.status_unavailable));
wifiMacAddressPref.setSelectable(false);
Preference wifiIpAddressPref = findPreference(KEY_CURRENT_IP_ADDRESS);
- String ipAddress = Utils.getWifiIpAddresses(getActivity());
+ String ipAddress = Utils.getWifiIpAddresses(context);
wifiIpAddressPref.setSummary(ipAddress == null ?
- getActivity().getString(R.string.status_unavailable) : ipAddress);
+ context.getString(R.string.status_unavailable) : ipAddress);
wifiIpAddressPref.setSelectable(false);
}
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index e83cb06..5366d66 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -27,7 +27,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.location.LocationManager;
@@ -45,11 +44,13 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.os.Parcelable;
import android.preference.Preference;
import android.preference.PreferenceScreen;
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;
@@ -129,7 +130,6 @@
private WifiManager.ActionListener mConnectListener;
private WifiManager.ActionListener mSaveListener;
private WifiManager.ActionListener mForgetListener;
- private boolean mP2pSupported;
private WifiEnabler mWifiEnabler;
// An access point being editted is stored here.
@@ -156,7 +156,7 @@
private boolean mDlgEdit;
private AccessPoint mDlgAccessPoint;
private Bundle mAccessPointSavedState;
- private Preference mWifiAssistantPreference;
+ private View mWifiAssistantCard;
private NetworkScorerAppData mWifiAssistantApp;
/** verbose logging flag. this flag is set thru developer debugging options
@@ -165,52 +165,6 @@
/* End of "used in Wifi Setup context" */
- /** Holds the Wifi Assistant Card. */
- private class WifiAssistantPreference extends Preference {
- public WifiAssistantPreference() {
- super(getActivity());
- setLayoutResource(R.layout.wifi_assistant_card);
- }
-
- @Override
- public void onBindView(View view) {
- super.onBindView(view);
- Button setup = (Button)view.findViewById(R.id.setup);
- Button noThanks = (Button)view.findViewById(R.id.no_thanks_button);
-
- if (setup != null && noThanks != null) {
- setup.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent = new Intent();
- if (mWifiAssistantApp.mConfigurationActivityClassName != null) {
- // App has a custom configuration activity; launch that.
- // This custom activity will be responsible for launching the system
- // dialog.
- intent.setClassName(mWifiAssistantApp.mPackageName,
- mWifiAssistantApp.mConfigurationActivityClassName);
- } else {
- // Fall back on the system dialog.
- intent.setAction(NetworkScoreManager.ACTION_CHANGE_ACTIVE);
- intent.putExtra(NetworkScoreManager.EXTRA_PACKAGE_NAME,
- mWifiAssistantApp.mPackageName);
- }
- startActivityForResult(intent, REQUEST_ENABLE_WIFI_ASSISTANT);
- }
- });
-
- noThanks.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- setWifiAssistantTimeout();
- getPreferenceScreen().removePreference(WifiAssistantPreference.this);
- mWifiAssistantApp = null;
- }
- });
- }
- }
- }
-
/** A restricted multimap for use in constructAccessPoints */
private static class Multimap<K,V> {
private final HashMap<K,List<V>> store = new HashMap<K,List<V>>();
@@ -285,7 +239,7 @@
mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- handleEvent(context, intent);
+ handleEvent(intent);
}
};
@@ -296,7 +250,6 @@
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- mP2pSupported = getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_DIRECT);
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
mConnectListener = new WifiManager.ActionListener() {
@@ -347,7 +300,7 @@
if (savedInstanceState != null) {
mDlgEdit = savedInstanceState.getBoolean(SAVE_DIALOG_EDIT_MODE);
if (savedInstanceState.containsKey(SAVE_DIALOG_ACCESS_POINT_STATE)) {
- mAccessPointSavedState =
+ mAccessPointSavedState =
savedInstanceState.getBundle(SAVE_DIALOG_ACCESS_POINT_STATE);
}
}
@@ -384,7 +337,7 @@
if (requestCode == REQUEST_ENABLE_WIFI_ASSISTANT) {
if (resultCode == Activity.RESULT_OK) {
setWifiAssistantTimeout();
- getPreferenceScreen().removePreference(mWifiAssistantPreference);
+ getListView().removeHeaderView(mWifiAssistantCard);
mWifiAssistantApp = null;
}
} else {
@@ -706,8 +659,9 @@
addMessagePreference(R.string.wifi_empty_list_wifi_on);
}
+ getListView().removeHeaderView(mWifiAssistantCard);
if (mWifiAssistantApp != null) {
- getPreferenceScreen().addPreference(mWifiAssistantPreference);
+ getListView().addHeaderView(mWifiAssistantCard);
}
for (AccessPoint accessPoint : accessPoints) {
@@ -732,38 +686,88 @@
}
}
- private boolean prepareWifiAssistantCard() {
- if (mWifiAssistantPreference == null) {
- mWifiAssistantPreference = new WifiAssistantPreference();
+ /**
+ * Returns the Network Scorer for the Wifi Assistant App.
+ */
+ public static NetworkScorerAppData getWifiAssistantApp(Context context) {
+ Collection<NetworkScorerAppData> scorers =
+ NetworkScorerAppManager.getAllValidScorers(context);
+
+ if (scorers.isEmpty()) {
+ return null;
}
+ // TODO: b/13780935 - Implement proper scorer selection. Rather than pick the first
+ // scorer on the system, we should allow the user to select one.
+ return scorers.iterator().next();
+ }
+
+ private void prepareWifiAssistantCard() {
if (getActivity() instanceof WifiPickerActivity) {
- return false;
+ return;
}
if (NetworkScorerAppManager.getActiveScorer(getActivity()) != null) {
// A scorer is already enabled; don't show the card.
- return false;
+ return;
}
Collection<NetworkScorerAppData> scorers =
NetworkScorerAppManager.getAllValidScorers(getActivity());
if (scorers.isEmpty()) {
// No scorers are available to enable; don't show the card.
- return false;
+ return;
}
SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences();
long lastTimeoutEndTime = sharedPreferences.getLong(KEY_ASSISTANT_START_TIME, 0);
long dismissTime = sharedPreferences.getLong(KEY_ASSISTANT_DISMISS_TIME, 0);
- boolean shouldShow = ((System.currentTimeMillis() - lastTimeoutEndTime) > dismissTime);
- if (shouldShow) {
- // TODO: b/13780935 - Implement proper scorer selection. Rather than pick the first
- // scorer on the system, we should allow the user to select one.
- mWifiAssistantApp = scorers.iterator().next();
+ if ((System.currentTimeMillis() - lastTimeoutEndTime) <= dismissTime) {
+ return;
}
- return shouldShow;
+
+ // TODO: b/13780935 - Implement proper scorer selection. Rather than pick the first
+ // scorer on the system, we should allow the user to select one.
+ mWifiAssistantApp = scorers.iterator().next();
+
+ if (mWifiAssistantCard == null) {
+ mWifiAssistantCard = LayoutInflater.from(getActivity())
+ .inflate(R.layout.wifi_assistant_card, getListView(), false);
+ Button setup = (Button) mWifiAssistantCard.findViewById(R.id.setup);
+ Button noThanks = (Button) mWifiAssistantCard.findViewById(R.id.no_thanks_button);
+
+ if (setup != null && noThanks != null) {
+ setup.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent();
+ if (mWifiAssistantApp.mConfigurationActivityClassName != null) {
+ // App has a custom configuration activity; launch that.
+ // This custom activity will be responsible for launching the system
+ // dialog.
+ intent.setClassName(mWifiAssistantApp.mPackageName,
+ mWifiAssistantApp.mConfigurationActivityClassName);
+ } else {
+ // Fall back on the system dialog.
+ intent.setAction(NetworkScoreManager.ACTION_CHANGE_ACTIVE);
+ intent.putExtra(NetworkScoreManager.EXTRA_PACKAGE_NAME,
+ mWifiAssistantApp.mPackageName);
+ }
+ startActivityForResult(intent, REQUEST_ENABLE_WIFI_ASSISTANT);
+ }
+ });
+
+ noThanks.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setWifiAssistantTimeout();
+ getListView().removeHeaderView(mWifiAssistantCard);
+ mWifiAssistantApp = null;
+ }
+ });
+ }
+ }
}
private void setWifiAssistantTimeout() {
@@ -861,7 +865,7 @@
return accessPoints;
}
- private void handleEvent(Context context, Intent intent) {
+ private void handleEvent(Intent intent) {
String action = intent.getAction();
if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) {
updateWifiState(intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
diff --git a/src/com/android/settings/wifi/WifiSetupActivity.java b/src/com/android/settings/wifi/WifiSetupActivity.java
index 3dd7a03..5452a03 100644
--- a/src/com/android/settings/wifi/WifiSetupActivity.java
+++ b/src/com/android/settings/wifi/WifiSetupActivity.java
@@ -218,6 +218,7 @@
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_THEME, intent.getStringExtra(EXTRA_THEME));
nextIntent.putExtra(EXTRA_RESULT_CODE, resultCode);
startActivityForResult(nextIntent, NEXT_REQUEST);
}