Merge "Entries in the Deletion Helper should be default unchecked." into nyc-mr1-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8a82702..1d72424 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -154,7 +154,7 @@
</intent-filter>
</activity>
- <receiver android:name="ManagedProfileSetup">
+ <receiver android:name="SettingsInitialize">
<intent-filter>
<action android:name="android.intent.action.USER_INITIALIZE"/>
<action android:name="android.intent.action.PRE_BOOT_COMPLETED"/>
@@ -2889,6 +2889,18 @@
android:value="true" />
</activity>
+ <activity android:name=".WebViewImplementation"
+ android:exported="true"
+ android:excludeFromRecents="true"
+ android:theme="@*android:style/Theme.Material.Light.Dialog.Alert">
+ <intent-filter>
+ <action android:name="android.settings.WEBVIEW_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+ android:value="true" />
+ </activity>
+
<service
android:name=".SettingsDumpService"
android:exported="true"
diff --git a/res/color/sliding_tab_title_text_color.xml b/res/color/sliding_tab_title_text_color.xml
new file mode 100644
index 0000000..925ab97
--- /dev/null
+++ b/res/color/sliding_tab_title_text_color.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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">
+ <item android:state_selected="false"
+ android:color="#b3ffffff"/>
+ <item android:color="@android:color/white"/>
+</selector>
diff --git a/res/drawable/ic_lightbulb_outline_24.xml b/res/drawable/ic_lightbulb_outline_24.xml
new file mode 100644
index 0000000..89cf8fa
--- /dev/null
+++ b/res/drawable/ic_lightbulb_outline_24.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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.
+-->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorAccent">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M9,21c0,0.55 0.45,1 1,1h4c0.55,0 1,-0.45 1,-1v-1L9,20v1zM12,2C8.14,2
+ 5,5.14 5,9c0,2.38 1.19,4.47 3,5.74L8,17c0,0.55 0.45,1 1,1h6c0.55,0 1,-0.45
+ 1,-1v-2.26c1.81,-1.27 3,-3.36 3,-5.74 0,-3.86 -3.14,-7
+ -7,-7zM14.85,13.1l-0.85,0.6L14,16h-4v-2.3l-0.85,-0.6C7.8,12.16 7,10.63 7,9c0,-2.76
+ 2.24,-5 5,-5s5,2.24 5,5c0,1.63 -0.8,3.16 -2.15,4.1z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/selectable_card_grey.xml b/res/drawable/selectable_card_grey.xml
new file mode 100644
index 0000000..e4c73ba
--- /dev/null
+++ b/res/drawable/selectable_card_grey.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<ripple
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="?android:attr/colorControlHighlight">
+ <item android:drawable="@color/card_background_grey"/>
+</ripple>
diff --git a/res/layout/dashboard_spacer.xml b/res/layout/dashboard_spacer.xml
index 19ef8ff..b26f1e5 100644
--- a/res/layout/dashboard_spacer.xml
+++ b/res/layout/dashboard_spacer.xml
@@ -14,6 +14,8 @@
limitations under the License.
-->
-<View xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="6dp" />
+<View
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="6dp"
+ android:background="@color/card_background_grey"/>
diff --git a/res/layout/lockscreen_remote_input.xml b/res/layout/lockscreen_remote_input.xml
index af4bee0..1c565a3 100644
--- a/res/layout/lockscreen_remote_input.xml
+++ b/res/layout/lockscreen_remote_input.xml
@@ -15,14 +15,15 @@
~ limitations under the License
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/lockscreen_remote_input"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
+ android:layout_weight="1"
android:layout_marginStart="20dp"
android:paddingStart="20dp"
android:paddingEnd="?android:attr/dialogPreferredPadding"
@@ -32,4 +33,13 @@
android:gravity="center_vertical"
android:text="@string/lockscreen_remote_input"
/>
-</FrameLayout>
\ No newline at end of file
+
+ <ImageView
+ android:id="@+id/restricted_lock_icon_remote_input"
+ android:layout_width="@dimen/restricted_icon_size"
+ android:layout_height="@dimen/restricted_icon_size"
+ android:src="@drawable/ic_info"
+ android:layout_marginEnd="?android:attr/dialogPreferredPadding"
+ android:layout_gravity="center_vertical"
+ android:scaleType="centerInside" />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/redaction_interstitial.xml b/res/layout/redaction_interstitial.xml
index f48b917..0c4273f 100644
--- a/res/layout/redaction_interstitial.xml
+++ b/res/layout/redaction_interstitial.xml
@@ -65,7 +65,7 @@
</RadioGroup>
- <CheckBox
+ <com.android.settings.RestrictedCheckBox
android:id="@+id/lockscreen_remote_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/res/layout/restricted_preference_dropdown.xml b/res/layout/restricted_preference_dropdown.xml
new file mode 100644
index 0000000..1a1e191
--- /dev/null
+++ b/res/layout/restricted_preference_dropdown.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 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="wrap_content">
+
+ <view android:id="@+id/spinner"
+ class="com.android.settings.notification.RestrictedDropDownPreference$ReselectionSpinner"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:visibility="invisible" />
+
+ <include layout="@layout/preference_material" />
+
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/setup_choose_lock_pattern_common.xml b/res/layout/setup_choose_lock_pattern_common.xml
index 7e59bbf..20e46f3 100644
--- a/res/layout/setup_choose_lock_pattern_common.xml
+++ b/res/layout/setup_choose_lock_pattern_common.xml
@@ -41,17 +41,16 @@
<TextView android:id="@+id/headerText"
android:layout_width="match_parent"
- android:layout_height="0dip"
+ android:layout_height="wrap_content"
android:layout_weight="1"
+ android:minLines="2"
android:gravity="center"
- android:minHeight="50dip"
- android:textSize="18sp"/>
+ android:textSize="18sp" />
<com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
android:layout_width="match_parent"
android:layout_height="0dip"
- android:layout_weight="4"
- android:background="@color/lock_pattern_background"/>
+ android:layout_weight="4" />
<!-- Buttons are hidden during setup, and use the buttons in setup navigation bar instead -->
<LinearLayout
diff --git a/res/layout/setup_redaction_interstitial.xml b/res/layout/setup_redaction_interstitial.xml
index 965d77f..026578f 100644
--- a/res/layout/setup_redaction_interstitial.xml
+++ b/res/layout/setup_redaction_interstitial.xml
@@ -66,7 +66,7 @@
<!-- Place the checkbox inside RadioGroup and use SuwRadioButton style instead of
SuwCheckBox style so that the checkbox and text is aligned with radio buttons. -->
- <CheckBox
+ <com.android.settings.RestrictedRadioButton
android:id="@+id/lockscreen_remote_input"
style="@style/SuwRadioButton"
android:layout_width="wrap_content"
diff --git a/res/layout/sliding_tab_title_view.xml b/res/layout/sliding_tab_title_view.xml
index 0386345..1a4328f 100644
--- a/res/layout/sliding_tab_title_view.xml
+++ b/res/layout/sliding_tab_title_view.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 Android Open Source Project
+<!--
+ Copyright (C) 2016 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.
@@ -19,10 +20,10 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
- android:ellipsize="end"
- android:maxLines="1"
- android:textColor="@android:color/white"
- android:gravity="center"
android:background="?android:attr/selectableItemBackground"
- android:textAllCaps="true"
- android:padding="@dimen/pager_tabs_title_padding"/>
\ No newline at end of file
+ android:ellipsize="end"
+ android:gravity="center"
+ android:maxLines="1"
+ android:padding="@dimen/pager_tabs_title_padding"
+ android:textColor="@color/sliding_tab_title_text_color"
+ android:textAllCaps="true"/>
diff --git a/res/layout/spinner_dropdown_restricted_item.xml b/res/layout/spinner_dropdown_restricted_item.xml
new file mode 100644
index 0000000..823b430
--- /dev/null
+++ b/res/layout/spinner_dropdown_restricted_item.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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:orientation="horizontal"
+ android:gravity="center_vertical">
+ <TextView android:id="@android:id/text1"
+ style="?android:attr/spinnerDropDownItemStyle"
+ android:singleLine="true"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:ellipsize="marquee" />
+ <ImageView android:id="@+id/restricted_icon"
+ android:layout_width="@dimen/restricted_icon_size"
+ android:layout_height="@dimen/restricted_icon_size"
+ android:src="@drawable/ic_info"
+ android:baselineAlignBottom="true"
+ android:layout_marginEnd="@dimen/restricted_icon_padding"
+ android:gravity="end|center_vertical"
+ android:visibility="gone" />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/suggestion_header.xml b/res/layout/suggestion_header.xml
index c48553e..b30df60 100644
--- a/res/layout/suggestion_header.xml
+++ b/res/layout/suggestion_header.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
+<!--
+ Copyright (C) 2016 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.
@@ -20,27 +21,31 @@
android:layout_height="@dimen/dashboard_category_height"
android:clickable="true"
android:focusable="true"
- android:background="@drawable/selectable_card"
- android:elevation="@dimen/dashboard_category_elevation"
+ android:background="@drawable/selectable_card_grey"
android:gravity="center_vertical" >
-
- <TextView android:id="@android:id/title"
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="@dimen/dashboard_tile_image_size"
+ android:layout_height="@dimen/dashboard_tile_image_size"
+ android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
+ android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end"
+ android:src="@drawable/ic_expand_more"/>
+ <TextView
+ android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingStart="16dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.TileTitle"
android:textColor="?android:attr/colorAccent"
- android:alpha=".87"
android:ellipsize="marquee"
- android:fadingEdge="horizontal" />
-
- <ImageView android:id="@android:id/icon"
- android:layout_width="@dimen/dashboard_tile_image_size"
- android:layout_height="@dimen/dashboard_tile_image_size"
- android:layout_marginStart="@dimen/suggestion_arrow_margin"
- android:layout_marginEnd="@dimen/suggestion_arrow_margin"
- android:src="@drawable/ic_expand_more" />
-
+ android:fadingEdge="horizontal"/>
+ <TextView
+ android:id="@android:id/summary"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="end"
+ android:paddingEnd="16dp"
+ android:textAppearance="@style/TextAppearance.TileTitle"
+ android:textColor="?android:attr/colorAccent"/>
</LinearLayout>
diff --git a/res/layout/suggestion_tile.xml b/res/layout/suggestion_tile.xml
index 10c9558..9ffd455 100644
--- a/res/layout/suggestion_tile.xml
+++ b/res/layout/suggestion_tile.xml
@@ -18,70 +18,58 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:background="@drawable/selectable_card_grey"
android:clickable="true"
android:focusable="true"
- android:background="@drawable/selectable_card"
- android:elevation="@dimen/dashboard_category_elevation"
- android:orientation="vertical" >
+ android:gravity="center_vertical"
+ android:minHeight="@dimen/dashboard_tile_minimum_height">
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="?android:attr/listDivider" />
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="@dimen/dashboard_tile_image_size"
+ android:layout_height="@dimen/dashboard_tile_image_size"
+ android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
+ android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end"
+ android:scaleType="centerInside"/>
- <LinearLayout
- android:layout_width="match_parent"
+ <RelativeLayout
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:minHeight="@dimen/dashboard_tile_minimum_height">
+ android:layout_weight="1">
+
+ <TextView android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="@style/TextAppearance.TileTitle"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"/>
+
+ <TextView android:id="@android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/title"
+ android:layout_alignStart="@android:id/title"
+ android:textAppearance="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
+
+ </RelativeLayout>
+
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
<ImageView
- android:id="@android:id/icon"
- android:layout_width="@dimen/dashboard_tile_image_size"
- android:layout_height="@dimen/dashboard_tile_image_size"
- android:scaleType="centerInside"
- android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
- android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
-
- <RelativeLayout
+ android:id="@+id/overflow"
+ style="?android:attr/actionOverflowButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_weight="1">
+ android:paddingStart="16dp"
+ android:paddingTop="16dp"
+ android:paddingEnd="18dp"
+ android:paddingBottom="16dp"
+ android:gravity="top"/>
- <TextView android:id="@android:id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:textAppearance="@style/TextAppearance.TileTitle"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal" />
+ </FrameLayout>
- <TextView android:id="@android:id/summary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@android:id/title"
- android:layout_alignStart="@android:id/title"
- android:textAppearance="@style/TextAppearance.Small"
- android:textColor="?android:attr/textColorSecondary" />
-
- </RelativeLayout>
-
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent">
-
- <ImageView android:id="@+id/overflow"
- android:layout_width="44dp"
- android:layout_height="44dp"
- android:paddingStart="16dp"
- android:paddingBottom="16dp"
- android:paddingTop="12dp"
- android:paddingEnd="12dp"
- android:gravity="top"
- style="?android:attr/actionOverflowButtonStyle" />
-
- </FrameLayout>
-
- </LinearLayout>
-
-</LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/support_escalation_options.xml b/res/layout/support_escalation_options.xml
index 6944edb..6b88908 100644
--- a/res/layout/support_escalation_options.xml
+++ b/res/layout/support_escalation_options.xml
@@ -19,9 +19,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/support_escalation_background"
+ android:background="@color/card_background_grey"
android:gravity="center_horizontal"
- android:paddingBottom="8dp">
+ android:paddingBottom="40dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -39,6 +39,7 @@
android:id="@+id/summary1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
android:textAppearance="@style/TextAppearance.Small"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
@@ -59,6 +60,7 @@
android:id="@+id/summary2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
android:textAppearance="@style/TextAppearance.Small"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
diff --git a/res/layout/support_item_title.xml b/res/layout/support_item_title.xml
index b99a552..0110da0 100644
--- a/res/layout/support_item_title.xml
+++ b/res/layout/support_item_title.xml
@@ -19,9 +19,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/support_escalation_background"
- android:paddingTop="32dp"
- android:paddingBottom="32dp"
+ android:background="@color/card_background_grey"
+ android:paddingTop="40dp"
+ android:paddingBottom="42dp"
android:paddingStart="56dp"
android:paddingEnd="56dp"
android:orientation="vertical">
@@ -29,11 +29,13 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
android:textAppearance="@style/TextAppearance.SupportTitle"/>
<TextView
android:id="@android:id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
android:paddingTop="8dp"
android:textAppearance="@style/TextAppearance.Small"
android:textColor="?android:attr/textColorSecondary"/>
diff --git a/res/layout/support_sign_in_button.xml b/res/layout/support_sign_in_button.xml
index 4a14ac3..fb789e8 100644
--- a/res/layout/support_sign_in_button.xml
+++ b/res/layout/support_sign_in_button.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/support_escalation_background"
+ android:background="@color/card_background_grey"
android:gravity="center_horizontal"
android:orientation="vertical">
<Button
@@ -32,5 +32,7 @@
android:id="@android:id/text2"
style="@style/SupportSecondaryButton"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:minHeight="48dp"/>
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index 44523f4..ceb7201 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -15,9 +15,10 @@
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:fadeScrollbars="false">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:fadeScrollbars="false"
+ android:scrollIndicators="top|bottom">
<LinearLayout
android:layout_width="match_parent"
@@ -71,7 +72,7 @@
<Spinner android:id="@+id/security"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/wifi_item_content"
+ style="@style/wifi_item_spinner"
android:prompt="@string/wifi_security"
android:entries="@array/wifi_security" />
</LinearLayout>
@@ -103,7 +104,7 @@
<Spinner android:id="@+id/method"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/wifi_item_content"
+ style="@style/wifi_item_spinner"
android:prompt="@string/wifi_eap_method"
android:entries="@array/wifi_eap_method" />
</LinearLayout>
@@ -122,7 +123,7 @@
<Spinner android:id="@+id/phase2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/wifi_item_content"
+ style="@style/wifi_item_spinner"
android:prompt="@string/please_select_phase2"
android:entries="@array/wifi_phase2_entries" />
</LinearLayout>
@@ -141,7 +142,7 @@
<Spinner android:id="@+id/ca_cert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/wifi_item_content"
+ style="@style/wifi_item_spinner"
android:prompt="@string/wifi_eap_ca_cert" />
</LinearLayout>
@@ -201,7 +202,7 @@
<Spinner android:id="@+id/user_cert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/wifi_item_content"
+ style="@style/wifi_item_spinner"
android:prompt="@string/wifi_eap_user_cert" />
</LinearLayout>
@@ -285,6 +286,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/wifi_item"
+ android:paddingBottom="4dp"
android:visibility="gone">
<CheckBox android:id="@+id/wifi_advanced_togglebox"
android:layout_width="match_parent"
@@ -314,7 +316,7 @@
<Spinner android:id="@+id/proxy_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/wifi_item_content"
+ style="@style/wifi_item_spinner"
android:prompt="@string/proxy_settings_title"
android:entries="@array/wifi_proxy_settings" />
@@ -439,7 +441,7 @@
<Spinner android:id="@+id/ip_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/wifi_item_content"
+ style="@style/wifi_item_spinner"
android:prompt="@string/wifi_ip_settings"
android:entries="@array/wifi_ip_settings" />
diff --git a/res/values/colors.xml b/res/values/colors.xml
index b9a4826..81f3d32 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -131,6 +131,6 @@
<color name="usage_graph_dots">#B0BEC5</color>
- <color name="support_escalation_background">#eeeeee</color>
+ <color name="card_background_grey">#eeeeee</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 5c81f12..c50e226 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -119,8 +119,6 @@
<dimen name="dashboard_tile_image_margin_start">16dp</dimen>
<dimen name="dashboard_tile_image_margin_end">32dp</dimen>
- <dimen name="suggestion_arrow_margin">16dp</dimen>
-
<!-- SwitchBar margin start / end -->
<dimen name="switchbar_margin_start">16dp</dimen>
<dimen name="switchbar_margin_end">16dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7750501..00c1130 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7200,7 +7200,10 @@
<string name="condition_work_summary">Apps, background sync, and other features related to your work profile are turned off.</string>
<!-- Title for the suggestions section on the dashboard [CHAR LIMIT=30] -->
- <string name="suggestions_title">Suggestions (<xliff:g name="count" example="3">%1$d</xliff:g>)</string>
+ <string name="suggestions_title">Suggestions</string>
+
+ <!-- Summary for the suggestions section on the dashboard, representing number of suggestions. [CHAR LIMIT=10] -->
+ <string name="suggestions_summary">+<xliff:g name="count" example="3">%1$d</xliff:g></string>
<!-- Name of option to remove a suggestion from the list [CHAR LIMIT=30] -->
<string name="suggestion_remove">Remove</string>
@@ -7491,7 +7494,7 @@
<string name="deletion_helper_free_button">Free up <xliff:g id="freeable" example="1.2GB">%1$s</xliff:g></string>
<!-- Title text for connecting to customer support [CHAR LIMIT=80]-->
- <string name="support_escalation_title">Around-the-clock help</string>
+ <string name="support_escalation_title">Around-the-clock support</string>
<!-- Summary text for connecting to customer support [CHAR LIMIT=NONE]-->
<string name="support_escalation_summary">You can request a support call or chat and we\'ll get back to you with a quickness</string>
@@ -7517,6 +7520,9 @@
<!-- Button label for visiting help forum [CHAR LIMIT=60]-->
<string name="support_forum_title">Help forum</string>
+ <!-- Button label for visiting the tips & tricks site [CHAR LIMIT=60]-->
+ <string name="support_tips_and_tricks_title">Tips & tricks</string>
+
<!-- Title text that indicates user needs to sign in to get customer support. [CHAR LIMIT=80]-->
<string name="support_sign_in_required_title">Sign in for support</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 4835a14..24d7905 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -228,6 +228,10 @@
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
+ <style name="wifi_item_spinner" parent="wifi_item_content">
+ <item name="android:minHeight">48dp</item>
+ </style>
+
<style name="wifi_advanced_toggle" parent="wifi_item_content">
<item name="android:background">@null</item>
<item name="android:button">@null</item>
diff --git a/res/xml/app_notification_settings.xml b/res/xml/app_notification_settings.xml
index 40a8569..ee9237c 100644
--- a/res/xml/app_notification_settings.xml
+++ b/res/xml/app_notification_settings.xml
@@ -17,8 +17,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/app_notifications_title"
- android:key="app_notification_settings"
- settings:keywords="@string/keywords_date_and_time">
+ android:key="app_notification_settings">
<!-- Importance -->
<!-- Block -->
@@ -43,7 +42,7 @@
android:order="4"/>
<!-- Visibility Override -->
- <DropDownPreference
+ <com.android.settings.notification.RestrictedDropDownPreference
android:key="visibility_override"
android:title="@string/app_notification_visibility_override_title"
android:order="5" />
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 594cd38..4214343 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -341,7 +341,6 @@
final private static int sWidgetsToDisable = StatusBarManager.DISABLE_EXPAND
| StatusBarManager.DISABLE_NOTIFICATION_ICONS
| StatusBarManager.DISABLE_NOTIFICATION_ALERTS
- | StatusBarManager.DISABLE_SYSTEM_INFO
| StatusBarManager.DISABLE_HOME
| StatusBarManager.DISABLE_SEARCH
| StatusBarManager.DISABLE_RECENT;
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 2b96dbe..1fd8451 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -749,7 +749,7 @@
ArrayList<String> options = new ArrayList<String>();
ArrayList<String> values = new ArrayList<String>();
for(int n = 0; n < providers.length; n++) {
- if (isPackageEnabled(providers[n].packageName)) {
+ if (Utils.isPackageEnabled(getActivity(), providers[n].packageName)) {
options.add(providers[n].description);
values.add(providers[n].packageName);
}
@@ -1929,15 +1929,6 @@
requestCode, resources.getString(R.string.oem_unlock_enable));
}
- private boolean isPackageEnabled(String packageName) {
- try {
- return getActivity().getPackageManager().getApplicationInfo(packageName, 0).enabled;
- } catch (NameNotFoundException e) {
- // Thrown by PackageManager.getApplicationInfo if the package does not exist
- }
- return false;
- }
-
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (HDCP_CHECKING_KEY.equals(preference.getKey())) {
diff --git a/src/com/android/settings/EncryptionInterstitial.java b/src/com/android/settings/EncryptionInterstitial.java
index 89eba7c..e9e2a7c 100644
--- a/src/com/android/settings/EncryptionInterstitial.java
+++ b/src/com/android/settings/EncryptionInterstitial.java
@@ -24,16 +24,13 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
-import android.os.UserHandle;
import android.support.v7.preference.Preference;
import android.util.Log;
import android.view.LayoutInflater;
-import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.widget.TextView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
-import com.android.internal.widget.LockPatternUtils;
import java.util.List;
@@ -78,6 +75,7 @@
private Preference mDontRequirePasswordToDecrypt;
private boolean mPasswordRequired;
private Intent mUnlockMethodIntent;
+ private int mRequestedPasswordQuality;
@Override
protected int getMetricsCategory() {
@@ -99,12 +97,12 @@
boolean forFingerprint = getActivity().getIntent().getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
Intent intent = getActivity().getIntent();
- final int quality = intent.getIntExtra(EXTRA_PASSWORD_QUALITY, 0);
- mUnlockMethodIntent = (Intent) intent.getParcelableExtra(EXTRA_UNLOCK_METHOD_INTENT);
+ mRequestedPasswordQuality = intent.getIntExtra(EXTRA_PASSWORD_QUALITY, 0);
+ mUnlockMethodIntent = intent.getParcelableExtra(EXTRA_UNLOCK_METHOD_INTENT);
final int msgId;
final int enableId;
final int disableId;
- switch (quality) {
+ switch (mRequestedPasswordQuality) {
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
msgId = forFingerprint ?
R.string.encryption_interstitial_message_pattern_for_fingerprint :
@@ -188,11 +186,9 @@
public Dialog onCreateDialog(int dialogId) {
switch(dialogId) {
case ACCESSIBILITY_WARNING_DIALOG: {
- final int quality = new LockPatternUtils(getActivity())
- .getKeyguardStoredPasswordQuality(UserHandle.myUserId());
final int titleId;
final int messageId;
- switch (quality) {
+ switch (mRequestedPasswordQuality) {
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
titleId = R.string.encrypt_talkback_dialog_require_pattern;
messageId = R.string.encrypt_talkback_dialog_message_pattern;
diff --git a/src/com/android/settings/MonitoringCertInfoActivity.java b/src/com/android/settings/MonitoringCertInfoActivity.java
index 9df3413..2392397 100644
--- a/src/com/android/settings/MonitoringCertInfoActivity.java
+++ b/src/com/android/settings/MonitoringCertInfoActivity.java
@@ -29,15 +29,20 @@
/**
* Activity that shows a dialog explaining that a CA cert is allowing someone to monitor network
- * traffic. This activity should be launched for the user into which the CA cert is installed.
+ * traffic. This activity should be launched for the user into which the CA cert is installed
+ * unless Intent.EXTRA_USER_ID is provided.
*/
public class MonitoringCertInfoActivity extends Activity implements OnClickListener,
OnDismissListener {
+ private int mUserId;
+
@Override
protected void onCreate(Bundle savedStates) {
super.onCreate(savedStates);
+ mUserId = getIntent().getIntExtra(Intent.EXTRA_USER_ID, UserHandle.myUserId());
+
DevicePolicyManager dpm = getSystemService(DevicePolicyManager.class);
final int numberOfCertificates = getIntent().getIntExtra(
Settings.EXTRA_NUMBER_OF_CERTIFICATES, 1);
@@ -53,9 +58,9 @@
builder.setNeutralButton(R.string.cancel, null);
builder.setOnDismissListener(this);
- if (dpm.getProfileOwner() != null) {
+ if (dpm.getProfileOwnerAsUser(mUserId) != null) {
builder.setMessage(getResources().getQuantityString(R.plurals.ssl_ca_cert_info_message,
- numberOfCertificates, dpm.getProfileOwnerName()));
+ numberOfCertificates, dpm.getProfileOwnerNameAsUser(mUserId)));
} else if (dpm.getDeviceOwnerComponentOnCallingUser() != null) {
builder.setMessage(getResources().getQuantityString(
R.plurals.ssl_ca_cert_info_message_device_owner, numberOfCertificates,
@@ -73,7 +78,7 @@
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(android.provider.Settings.ACTION_TRUSTED_CREDENTIALS_USER);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- intent.putExtra(TrustedCredentialsSettings.ARG_SHOW_NEW_FOR_USER, UserHandle.myUserId());
+ intent.putExtra(TrustedCredentialsSettings.ARG_SHOW_NEW_FOR_USER, mUserId);
startActivity(intent);
finish();
}
diff --git a/src/com/android/settings/PointerSpeedPreference.java b/src/com/android/settings/PointerSpeedPreference.java
index c259e26..d06a374 100644
--- a/src/com/android/settings/PointerSpeedPreference.java
+++ b/src/com/android/settings/PointerSpeedPreference.java
@@ -141,7 +141,6 @@
SavedState myState = (SavedState) state;
super.onRestoreInstanceState(myState.getSuperState());
mOldSpeed = myState.oldSpeed;
- mSeekBar.setProgress(myState.progress);
mIm.tryPointerSpeed(myState.progress + InputManager.MIN_POINTER_SPEED);
}
diff --git a/src/com/android/settings/RestrictedCheckBox.java b/src/com/android/settings/RestrictedCheckBox.java
new file mode 100644
index 0000000..476df29
--- /dev/null
+++ b/src/com/android/settings/RestrictedCheckBox.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2016 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 static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
+
+import android.content.Context;
+import android.graphics.PorterDuff;
+import android.util.AttributeSet;
+import android.widget.CheckBox;
+import android.widget.RadioButton;
+import android.widget.TextView;
+
+import com.android.settingslib.RestrictedLockUtils;
+
+/**
+ * A checkbox that can be restricted by device policy, in which case it shows a dialog explaining
+ * what component restricted it.
+ */
+public class RestrictedCheckBox extends CheckBox {
+ private Context mContext;
+ private boolean mDisabledByAdmin;
+ private EnforcedAdmin mEnforcedAdmin;
+
+ public RestrictedCheckBox(Context context) {
+ this(context, null);
+ }
+
+ public RestrictedCheckBox(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mContext = context;
+ }
+
+ @Override
+ public boolean performClick() {
+ if (mDisabledByAdmin) {
+ RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext, mEnforcedAdmin);
+ return true;
+ }
+ return super.performClick();
+ }
+
+ public void setDisabledByAdmin(EnforcedAdmin admin) {
+ final boolean disabled = (admin != null);
+ mEnforcedAdmin = admin;
+ if (mDisabledByAdmin != disabled) {
+ mDisabledByAdmin = disabled;
+ RestrictedLockUtils.setTextViewAsDisabledByAdmin(mContext, this, mDisabledByAdmin);
+ if (mDisabledByAdmin) {
+ getButtonDrawable().setColorFilter(mContext.getColor(R.color.disabled_text_color),
+ PorterDuff.Mode.MULTIPLY);
+ } else {
+ getButtonDrawable().clearColorFilter();
+ }
+ }
+ }
+
+ public boolean isDisabledByAdmin() {
+ return mDisabledByAdmin;
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 72dacd5..d96f459 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -1213,6 +1213,7 @@
} catch (NumberFormatException e) {
Log.e("SecuritySettings", "could not persist lockAfter timeout setting", e);
}
+ setupLockAfterPreference();
updateLockAfterPreferenceSummary();
} else if (KEY_VISIBLE_PATTERN.equals(key)) {
mLockPatternUtils.setVisiblePatternEnabled((Boolean) value, MY_USER_ID);
diff --git a/src/com/android/settings/ManagedProfileSetup.java b/src/com/android/settings/SettingsInitialize.java
similarity index 78%
rename from src/com/android/settings/ManagedProfileSetup.java
rename to src/com/android/settings/SettingsInitialize.java
index ac012b0..07fec07 100644
--- a/src/com/android/settings/ManagedProfileSetup.java
+++ b/src/com/android/settings/SettingsInitialize.java
@@ -36,10 +36,11 @@
/**
* Listens to {@link Intent.ACTION_BOOT_COMPLETED} and {@link Intent.ACTION_PRE_BOOT_COMPLETED}
- * performs setup steps for a managed profile (disables the launcher icon of the Settings app and
- * adds cross-profile intent filters for the appropriate Settings activities).
+ * performs setup steps for a managed profile (disables the launcher icon of the Settings app,
+ * adds cross-profile intent filters for the appropriate Settings activities), and disables the
+ * webview setting for non-admin users.
*/
-public class ManagedProfileSetup extends BroadcastReceiver {
+public class SettingsInitialize extends BroadcastReceiver {
private static final String TAG = "Settings";
private static final String PRIMARY_PROFILE_SETTING =
"com.android.settings.PRIMARY_PROFILE_CONTROLLED";
@@ -48,12 +49,18 @@
public void onReceive(Context context, Intent broadcast) {
final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
UserInfo userInfo = um.getUserInfo(UserHandle.myUserId());
+ final PackageManager pm = context.getPackageManager();
+ managedProfileSetup(context, pm, broadcast, userInfo);
+ webviewSettingSetup(context, pm, userInfo);
+ }
+
+ private void managedProfileSetup(Context context, final PackageManager pm, Intent broadcast,
+ UserInfo userInfo) {
if (userInfo == null || !userInfo.isManagedProfile()) {
return;
}
Log.i(TAG, "Received broadcast: " + broadcast.getAction()
+ ". Setting up intent forwarding for managed profile.");
- final PackageManager pm = context.getPackageManager();
// Clear any previous intent forwarding we set up
pm.clearCrossProfileIntentFilters(userInfo.id);
@@ -86,4 +93,18 @@
pm.setComponentEnabledSetting(settingsComponentName,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
}
+
+ // Disable WebView Setting if the current user is not an admin
+ private void webviewSettingSetup(Context context, PackageManager pm, UserInfo userInfo) {
+ if (userInfo == null) {
+ return;
+ }
+ ComponentName settingsComponentName =
+ new ComponentName(context, WebViewImplementation.class);
+ pm.setComponentEnabledSetting(settingsComponentName,
+ userInfo.isAdmin() ?
+ PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
+ }
}
diff --git a/src/com/android/settings/TrustedCredentialsDialogBuilder.java b/src/com/android/settings/TrustedCredentialsDialogBuilder.java
index ed2ab09..2508d8c 100644
--- a/src/com/android/settings/TrustedCredentialsDialogBuilder.java
+++ b/src/com/android/settings/TrustedCredentialsDialogBuilder.java
@@ -43,6 +43,7 @@
public interface DelegateInterface {
List<X509Certificate> getX509CertsFromCertHolder(CertHolder certHolder);
void removeOrInstallCert(CertHolder certHolder);
+ boolean startConfirmCredentialIfNotConfirmed(int userId);
}
private final DialogEventHandler mDialogEventHandler;
@@ -144,8 +145,10 @@
private void onClickTrust() {
CertHolder certHolder = getCurrentCertInfo();
- mDpm.approveCaCert(certHolder.getAlias(), certHolder.getUserId(), true);
- nextOrDismiss();
+ if (!mDelegate.startConfirmCredentialIfNotConfirmed(certHolder.getUserId())) {
+ mDpm.approveCaCert(certHolder.getAlias(), certHolder.getUserId(), true);
+ nextOrDismiss();
+ }
}
private void onClickRemove() {
diff --git a/src/com/android/settings/TrustedCredentialsSettings.java b/src/com/android/settings/TrustedCredentialsSettings.java
index e7ab406..c630ed6 100644
--- a/src/com/android/settings/TrustedCredentialsSettings.java
+++ b/src/com/android/settings/TrustedCredentialsSettings.java
@@ -17,6 +17,7 @@
package com.android.settings;
import android.annotation.UiThread;
+import android.app.Activity;
import android.app.KeyguardManager;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
@@ -79,8 +80,10 @@
private KeyguardManager mKeyguardManager;
private int mTrustAllCaUserId;
-
+ private static final String SAVED_CONFIRMED_CREDENTIAL_USERS = "ConfirmedCredentialUsers";
+ private static final String SAVED_CONFIRMING_CREDENTIAL_USER = "ConfirmingCredentialUser";
private static final String USER_ACTION = "com.android.settings.TRUSTED_CREDENTIALS_USER";
+ private static final int REQUEST_CONFIRM_CREDENTIALS = 1;
@Override
protected int getMetricsCategory() {
@@ -154,6 +157,8 @@
private TabHost mTabHost;
private ArrayList<GroupAdapter> mGroupAdapters = new ArrayList<>(2);
private AliasOperation mAliasOperation;
+ private ArraySet<Integer> mConfirmedCredentialUsers;
+ private int mConfirmingCredentialUser;
private Set<AdapterData.AliasLoader> mAliasLoaders = new ArraySet<AdapterData.AliasLoader>(2);
private final SparseArray<KeyChainConnection>
mKeyChainConnectionByProfileId = new SparseArray<KeyChainConnection>();
@@ -182,6 +187,17 @@
.getSystemService(Context.KEYGUARD_SERVICE);
mTrustAllCaUserId = getActivity().getIntent().getIntExtra(ARG_SHOW_NEW_FOR_USER,
UserHandle.USER_NULL);
+ mConfirmedCredentialUsers = new ArraySet<>(2);
+ mConfirmingCredentialUser = UserHandle.USER_NULL;
+ if (savedInstanceState != null) {
+ mConfirmingCredentialUser = savedInstanceState.getInt(SAVED_CONFIRMING_CREDENTIAL_USER,
+ UserHandle.USER_NULL);
+ ArrayList<Integer> users = savedInstanceState.getIntegerArrayList(
+ SAVED_CONFIRMED_CREDENTIAL_USERS);
+ if (users != null) {
+ mConfirmedCredentialUsers.addAll(users);
+ }
+ }
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABLE);
@@ -190,6 +206,14 @@
getActivity().registerReceiver(mWorkProfileChangedReceiver, filter);
}
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putIntegerArrayList(SAVED_CONFIRMED_CREDENTIAL_USERS, new ArrayList<>(
+ mConfirmedCredentialUsers));
+ outState.putInt(SAVED_CONFIRMING_CREDENTIAL_USER, mConfirmingCredentialUser);
+ }
+
@Override public View onCreateView(
LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
mTabHost = (TabHost) inflater.inflate(R.layout.trusted_credentials, parent, false);
@@ -219,6 +243,16 @@
super.onDestroy();
}
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == REQUEST_CONFIRM_CREDENTIALS) {
+ if (resultCode == Activity.RESULT_OK) {
+ mConfirmedCredentialUsers.add(mConfirmingCredentialUser);
+ }
+ mConfirmingCredentialUser = UserHandle.USER_NULL;
+ }
+ }
+
private void closeKeyChainConnections() {
final int n = mKeyChainConnectionByProfileId.size();
for (int i = 0; i < n; ++i) {
@@ -262,14 +296,18 @@
}
/**
- * Start work challenge activity. TODO: Move and refactor this method as a util function.
+ * Start work challenge activity.
+ * @return true if screenlock exists
*/
- private void startWorkChallenge(int userId) {
+ private boolean startConfirmCredential(int userId) {
final Intent newIntent = mKeyguardManager.createConfirmDeviceCredentialIntent(null, null,
userId);
- newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_CLEAR_TASK);
- getActivity().startActivity(newIntent);
+ if (newIntent == null) {
+ return false;
+ }
+ mConfirmingCredentialUser = userId;
+ startActivityForResult(newIntent, REQUEST_CONFIRM_CREDENTIALS);
+ return true;
}
/**
@@ -303,7 +341,8 @@
}
@Override
public CertHolder getChild(int groupPosition, int childPosition) {
- return mData.mCertHoldersByUserId.get(getUserIdByGroup(groupPosition)).get(childPosition);
+ return mData.mCertHoldersByUserId.get(getUserIdByGroup(groupPosition)).get(
+ childPosition);
}
@Override
public long getGroupId(int groupPosition) {
@@ -386,18 +425,27 @@
}
public boolean checkGroupExpandableAndStartWarningActivity(int groupPosition) {
+ return checkGroupExpandableAndStartWarningActivity(groupPosition, true);
+ }
+
+ public boolean checkGroupExpandableAndStartWarningActivity(int groupPosition,
+ boolean startActivity) {
final UserHandle groupUser = getGroup(groupPosition);
final int groupUserId = groupUser.getIdentifier();
if (mUserManager.isQuietModeEnabled(groupUser)) {
final Intent intent = UnlaunchableAppActivity.createInQuietModeDialogIntent(
groupUserId);
- getActivity().startActivity(intent);
+ if (startActivity) {
+ getActivity().startActivity(intent);
+ }
return false;
} else if (!mUserManager.isUserUnlocked(groupUser)) {
final LockPatternUtils lockPatternUtils = new LockPatternUtils(
getActivity());
if (lockPatternUtils.isSeparateProfileChallengeEnabled(groupUserId)) {
- startWorkChallenge(groupUserId);
+ if (startActivity) {
+ startConfirmCredential(groupUserId);
+ }
return false;
}
}
@@ -548,7 +596,8 @@
}
public void prepare() {
- mIsListExpanded = checkGroupExpandableAndStartWarningActivity();
+ mIsListExpanded = mParent.checkGroupExpandableAndStartWarningActivity(mGroupPosition,
+ false /* startActivity */);
refreshViews();
}
@@ -890,6 +939,15 @@
new AliasOperation(certHolder).execute();
}
+ @Override
+ public boolean startConfirmCredentialIfNotConfirmed(int userId) {
+ if (mConfirmedCredentialUsers.contains(userId)) {
+ // Credential has been confirmed. Don't start activity.
+ return false;
+ }
+ return startConfirmCredential(userId);
+ }
+
private class AliasOperation extends AsyncTask<Void, Void, Boolean> {
private final CertHolder mCertHolder;
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index d972e07..4eaad7d 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -36,6 +36,7 @@
import android.content.pm.IPackageManager;
import android.content.pm.IntentFilterVerificationInfo;
import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.content.res.Resources;
@@ -87,7 +88,6 @@
import android.view.animation.AnimationUtils;
import android.widget.ListView;
import android.widget.TabWidget;
-
import com.android.internal.app.UnlaunchableAppActivity;
import com.android.internal.util.UserIcons;
@@ -1137,5 +1137,14 @@
}
return null;
}
+
+ public static boolean isPackageEnabled(Context context, String packageName) {
+ try {
+ return context.getPackageManager().getApplicationInfo(packageName, 0).enabled;
+ } catch (NameNotFoundException e) {
+ // Thrown by PackageManager.getApplicationInfo if the package does not exist
+ }
+ return false;
+ }
}
diff --git a/src/com/android/settings/WebViewImplementation.java b/src/com/android/settings/WebViewImplementation.java
new file mode 100644
index 0000000..c949a39
--- /dev/null
+++ b/src/com/android/settings/WebViewImplementation.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.android.settings;
+
+import android.annotation.Nullable;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
+import android.content.DialogInterface.OnClickListener;
+import android.content.DialogInterface.OnDismissListener;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.os.UserManager;
+import android.util.Log;
+import android.webkit.IWebViewUpdateService;
+import android.webkit.WebViewProviderInfo;
+import com.android.internal.logging.MetricsProto.MetricsEvent;
+
+import java.util.ArrayList;
+
+public class WebViewImplementation extends InstrumentedActivity implements
+ OnCancelListener, OnDismissListener {
+
+ private static final String TAG = "WebViewImplementation";
+
+ private IWebViewUpdateService mWebViewUpdateService;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (!UserManager.get(this).isAdminUser()) {
+ finish();
+ return;
+ }
+ mWebViewUpdateService =
+ IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
+ try {
+ WebViewProviderInfo[] providers = mWebViewUpdateService.getValidWebViewPackages();
+ if (providers == null) {
+ Log.e(TAG, "No WebView providers available");
+ finish();
+ return;
+ }
+
+ String currentValue = mWebViewUpdateService.getCurrentWebViewPackageName();
+ if (currentValue == null) {
+ currentValue = "";
+ }
+
+ int currentIndex = -1;
+ ArrayList<String> options = new ArrayList<>();
+ final ArrayList<String> values = new ArrayList<>();
+ for (WebViewProviderInfo provider : providers) {
+ if (Utils.isPackageEnabled(this, provider.packageName)) {
+ options.add(provider.description);
+ values.add(provider.packageName);
+ if (currentValue.contentEquals(provider.packageName)) {
+ currentIndex = values.size() - 1;
+ }
+ }
+ }
+
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.select_webview_provider_dialog_title)
+ .setSingleChoiceItems(options.toArray(new String[0]), currentIndex,
+ new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ try {
+ mWebViewUpdateService.changeProviderAndSetting(values.get(which));
+ } catch (RemoteException e) {
+ Log.w(TAG, "Problem reaching webviewupdate service", e);
+ }
+ finish();
+ }
+ }).setNegativeButton(android.R.string.cancel, null)
+ .setOnCancelListener(this)
+ .setOnDismissListener(this)
+ .show();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Problem reaching webviewupdate service", e);
+ finish();
+ }
+ }
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsEvent.WEBVIEW_IMPLEMENTATION;
+ }
+
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ finish();
+ }
+}
diff --git a/src/com/android/settings/applications/AppStateAppOpsBridge.java b/src/com/android/settings/applications/AppStateAppOpsBridge.java
index 59af46d..cfbb2fc 100644
--- a/src/com/android/settings/applications/AppStateAppOpsBridge.java
+++ b/src/com/android/settings/applications/AppStateAppOpsBridge.java
@@ -92,7 +92,8 @@
.getUserId(uid)));
try {
permissionState.packageInfo = mIPackageManager.getPackageInfo(pkg,
- PackageManager.GET_PERMISSIONS, permissionState.userHandle.getIdentifier());
+ PackageManager.GET_PERMISSIONS | PackageManager.MATCH_UNINSTALLED_PACKAGES,
+ permissionState.userHandle.getIdentifier());
// Check static permission state (whatever that is declared in package manifest)
String[] requestedPermissions = permissionState.packageInfo.requestedPermissions;
int[] permissionFlags = permissionState.packageInfo.requestedPermissionsFlags;
diff --git a/src/com/android/settings/applications/ConfirmConvertToFbe.java b/src/com/android/settings/applications/ConfirmConvertToFbe.java
index 3687c05..76dcabc 100644
--- a/src/com/android/settings/applications/ConfirmConvertToFbe.java
+++ b/src/com/android/settings/applications/ConfirmConvertToFbe.java
@@ -23,9 +23,11 @@
import android.view.ViewGroup;
import android.widget.Button;
+import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
-public class ConfirmConvertToFbe extends Fragment {
+public class ConfirmConvertToFbe extends SettingsPreferenceFragment {
static final String TAG = "ConfirmConvertToFBE";
@Override
@@ -45,4 +47,9 @@
return rootView;
}
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsEvent.CONVERT_FBE_CONFIRM;
+ }
}
diff --git a/src/com/android/settings/applications/ConvertToFbe.java b/src/com/android/settings/applications/ConvertToFbe.java
index f32c52b..c1e6576 100644
--- a/src/com/android/settings/applications/ConvertToFbe.java
+++ b/src/com/android/settings/applications/ConvertToFbe.java
@@ -16,27 +16,24 @@
package com.android.settings.applications;
import android.app.Activity;
-import android.app.Fragment;
-import android.content.res.Resources;
import android.content.Intent;
+import android.content.res.Resources;
import android.os.Bundle;
-import android.os.RecoverySystem;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
-import com.android.settings.applications.ConfirmConvertToFbe;
+import com.android.internal.logging.MetricsProto;
+import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.ChooseLockSettingsHelper;
-import com.android.settings.SettingsActivity;
import com.android.settings.R;
-
-import java.io.IOException;
+import com.android.settings.SettingsActivity;
+import com.android.settings.SettingsPreferenceFragment;
/* Class to prompt for conversion of userdata to file based encryption
*/
-public class ConvertToFbe extends Fragment {
+public class ConvertToFbe extends SettingsPreferenceFragment {
static final String TAG = "ConvertToFBE";
static final String CONVERT_FBE_EXTRA = "ConvertFBE";
private static final int KEYGUARD_REQUEST = 55;
@@ -85,4 +82,9 @@
sa.startPreferencePanel(ConfirmConvertToFbe.class.getName(), null,
R.string.convert_to_file_encryption, null, null, 0);
}
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsEvent.CONVERT_FBE;
+ }
}
diff --git a/src/com/android/settings/applications/ProcStatsData.java b/src/com/android/settings/applications/ProcStatsData.java
index 3c81374..dd85dd2 100644
--- a/src/com/android/settings/applications/ProcStatsData.java
+++ b/src/com/android/settings/applications/ProcStatsData.java
@@ -160,7 +160,7 @@
ProcessStats.ALL_SCREEN_ADJ, mMemStates, ProcessStats.NON_CACHED_PROC_STATES);
createPkgMap(getProcs(bgTotals, runTotals), bgTotals, runTotals);
- if (totalMem.sysMemZRamWeight > 0) {
+ if (totalMem.sysMemZRamWeight > 0 && !totalMem.hasSwappedOutPss) {
distributeZRam(totalMem.sysMemZRamWeight);
}
@@ -418,8 +418,10 @@
memReader.readMemInfo();
realTotalRam = memReader.getTotalSize();
freeWeight = totalMem.sysMemFreeWeight + totalMem.sysMemCachedWeight;
- usedWeight = totalMem.sysMemKernelWeight + totalMem.sysMemNativeWeight
- + totalMem.sysMemZRamWeight;
+ usedWeight = totalMem.sysMemKernelWeight + totalMem.sysMemNativeWeight;
+ if (!totalMem.hasSwappedOutPss) {
+ usedWeight += totalMem.sysMemZRamWeight;
+ }
for (int i = 0; i < ProcessStats.STATE_COUNT; i++) {
if (i == ProcessStats.STATE_SERVICE_RESTARTING) {
// These don't really run.
diff --git a/src/com/android/settings/applications/RunningServices.java b/src/com/android/settings/applications/RunningServices.java
index 1841f13..f50f3ad 100644
--- a/src/com/android/settings/applications/RunningServices.java
+++ b/src/com/android/settings/applications/RunningServices.java
@@ -24,10 +24,12 @@
import android.view.View;
import android.view.ViewGroup;
+import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
-public class RunningServices extends Fragment {
+public class RunningServices extends SettingsPreferenceFragment {
private static final int SHOW_RUNNING_SERVICES = 1;
private static final int SHOW_BACKGROUND_PROCESSES = 2;
@@ -105,6 +107,11 @@
mOptionsMenu.findItem(SHOW_BACKGROUND_PROCESSES).setVisible(!showingBackground);
}
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsEvent.RUNNING_SERVICES;
+ }
+
private final Runnable mRunningProcessesAvail = new Runnable() {
@Override
public void run() {
diff --git a/src/com/android/settings/dashboard/DashboardAdapter.java b/src/com/android/settings/dashboard/DashboardAdapter.java
index fadc023..7c76794 100644
--- a/src/com/android/settings/dashboard/DashboardAdapter.java
+++ b/src/com/android/settings/dashboard/DashboardAdapter.java
@@ -80,9 +80,10 @@
private Condition mExpandedCondition = null;
private SuggestionParser mSuggestionParser;
- public DashboardAdapter(Context context) {
+ public DashboardAdapter(Context context, SuggestionParser parser) {
mContext = context;
mCache = new IconCache(context);
+ mSuggestionParser = parser;
setHasStableIds(true);
setShowingAll(true);
@@ -92,9 +93,8 @@
return mSuggestions;
}
- public void setSuggestions(List<Tile> suggestions, SuggestionParser parser) {
+ public void setSuggestions(List<Tile> suggestions) {
mSuggestions = suggestions;
- mSuggestionParser = parser;
recountItems();
}
@@ -163,10 +163,7 @@
countItem(null, R.layout.suggestion_header, hasSuggestions, NS_SPACER);
resetCount();
if (mSuggestions != null) {
- int maxSuggestions = mSuggestionMode == SUGGESTION_MODE_DEFAULT
- ? Math.min(DEFAULT_SUGGESTION_COUNT, mSuggestions.size())
- : mSuggestionMode == SUGGESTION_MODE_EXPANDED ? mSuggestions.size()
- : 0;
+ int maxSuggestions = getDisplayableSuggestionCount();
for (int i = 0; i < mSuggestions.size(); i++) {
countItem(mSuggestions.get(i), R.layout.suggestion_tile, i < maxSuggestions,
NS_SUGGESTION);
@@ -208,6 +205,14 @@
mId++;
}
+ private int getDisplayableSuggestionCount() {
+ final int suggestionSize = mSuggestions.size();
+ return mSuggestionMode == SUGGESTION_MODE_DEFAULT
+ ? Math.min(DEFAULT_SUGGESTION_COUNT, suggestionSize)
+ : mSuggestionMode == SUGGESTION_MODE_EXPANDED
+ ? suggestionSize : 0;
+ }
+
@Override
public DashboardItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new DashboardItemHolder(LayoutInflater.from(parent.getContext()).inflate(
@@ -283,6 +288,9 @@
}
public void disableSuggestion(Tile suggestion) {
+ if (mSuggestionParser == null) {
+ return;
+ }
if (mSuggestionParser.dismissSuggestion(suggestion)) {
mContext.getPackageManager().setComponentEnabledSetting(
suggestion.intent.getComponent(),
@@ -296,6 +304,14 @@
holder.icon.setImageResource(hasMoreSuggestions() ? R.drawable.ic_expand_more
: R.drawable.ic_expand_less);
holder.title.setText(mContext.getString(R.string.suggestions_title, mSuggestions.size()));
+ final int undisplayedSuggestionCount =
+ mSuggestions.size() - getDisplayableSuggestionCount();
+ if (undisplayedSuggestionCount == 0) {
+ holder.summary.setText(null);
+ } else {
+ holder.summary.setText(
+ mContext.getString(R.string.suggestions_summary, undisplayedSuggestionCount));
+ }
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index de7ba9e..9acc9a5 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -132,6 +132,9 @@
MetricsLogger.hidden(getContext(), c.getMetricsConstant());
}
}
+ if (mAdapter.getSuggestions() == null) {
+ return;
+ }
for (Tile suggestion : mAdapter.getSuggestions()) {
MetricsLogger.action(getContext(), MetricsEvent.ACTION_HIDE_SETTINGS_SUGGESTION,
DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion));
@@ -178,7 +181,7 @@
mDashboard.setHasFixedSize(true);
mDashboard.setListener(this);
mDashboard.addItemDecoration(new DashboardDecorator(getContext()));
- mAdapter = new DashboardAdapter(getContext());
+ mAdapter = new DashboardAdapter(getContext(), mSuggestionParser);
mAdapter.setConditions(mConditionManager.getConditions());
mDashboard.setAdapter(mAdapter);
mSummaryLoader.setAdapter(mAdapter);
@@ -230,7 +233,7 @@
@Override
protected void onPostExecute(List<Tile> tiles) {
- mAdapter.setSuggestions(tiles, mSuggestionParser);
+ mAdapter.setSuggestions(tiles);
}
}
}
diff --git a/src/com/android/settings/dashboard/SupportItemAdapter.java b/src/com/android/settings/dashboard/SupportItemAdapter.java
index 4b1d318..d3862b4 100644
--- a/src/com/android/settings/dashboard/SupportItemAdapter.java
+++ b/src/com/android/settings/dashboard/SupportItemAdapter.java
@@ -189,6 +189,11 @@
.setIntent(mSupportFeatureProvider.getForumIntent())
.build());
mSupportData.add(new SupportData.Builder(TYPE_SUPPORT_TILE)
+ .setIcon(R.drawable.ic_lightbulb_outline_24)
+ .setText1(R.string.support_tips_and_tricks_title)
+ .setIntent(mSupportFeatureProvider.getTipsAndTricksIntent(mActivity))
+ .build());
+ mSupportData.add(new SupportData.Builder(TYPE_SUPPORT_TILE)
.setIcon(R.drawable.ic_help_24dp)
.setText1(R.string.help_feedback_label)
.setIntent(mSupportFeatureProvider.getHelpIntent(mActivity))
diff --git a/src/com/android/settings/datausage/DataSaverBackend.java b/src/com/android/settings/datausage/DataSaverBackend.java
index 0c8c2e2..eb62ad7 100644
--- a/src/com/android/settings/datausage/DataSaverBackend.java
+++ b/src/com/android/settings/datausage/DataSaverBackend.java
@@ -207,10 +207,6 @@
}
@Override
- public void onRestrictPowerChanged(boolean restrictPower) {
- }
-
- @Override
public void onRestrictBackgroundChanged(final boolean isDataSaving) throws RemoteException {
mHandler.post(new Runnable() {
@Override
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index c81ec53..442c8e3 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -118,7 +118,7 @@
private Preference mExplore;
- private boolean mDetached;
+ private boolean mNeedsUpdate;
private boolean isVolumeValid() {
return (mVolume != null) && (mVolume.getType() == VolumeInfo.TYPE_PRIVATE)
@@ -165,18 +165,22 @@
mExplore = buildAction(R.string.storage_menu_explore);
- mDetached = false;
+ mNeedsUpdate = true;
setHasOptionsMenu(true);
}
+ private void setTitle() {
+ getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
+ }
+
private void update() {
if (!isVolumeValid()) {
getActivity().finish();
return;
}
- getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
+ setTitle();
// Valid options may have changed
getFragmentManager().invalidateOptionsMenu();
@@ -239,6 +243,7 @@
mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));
mMeasure.forceMeasure();
+ mNeedsUpdate = false;
}
private void addPreference(PreferenceGroup group, Preference pref) {
@@ -315,8 +320,10 @@
mStorageManager.registerListener(mStorageListener);
- if (!mDetached) {
+ if (mNeedsUpdate) {
update();
+ } else {
+ setTitle();
}
}
@@ -327,24 +334,11 @@
}
@Override
- public void onAttach(Context context) {
- super.onAttach(context);
- mDetached = false;
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- mDetached = true;
- }
-
- @Override
public void onDestroy() {
super.onDestroy();
if (mMeasure != null) {
mMeasure.onDestroy();
}
- mDetached = false;
}
@Override
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeUnmount.java b/src/com/android/settings/deviceinfo/PrivateVolumeUnmount.java
index 5a4c7b1..7032a1d 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeUnmount.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeUnmount.java
@@ -29,11 +29,11 @@
import android.widget.TextView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
-import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.deviceinfo.StorageSettings.UnmountTask;
-public class PrivateVolumeUnmount extends InstrumentedFragment {
+public class PrivateVolumeUnmount extends SettingsPreferenceFragment {
private VolumeInfo mVolume;
private DiskInfo mDisk;
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index bd6f4fe..f718b3c 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -26,7 +26,6 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.service.notification.NotificationListenerService.Ranking;
-import android.support.v7.preference.DropDownPreference;
import android.util.ArrayMap;
import android.util.Log;
@@ -76,7 +75,7 @@
mPriority =
(RestrictedSwitchPreference) getPreferenceScreen().findPreference(KEY_BYPASS_DND);
mVisibilityOverride =
- (DropDownPreference) getPreferenceScreen().findPreference(
+ (RestrictedDropDownPreference) getPreferenceScreen().findPreference(
KEY_VISIBILITY_OVERRIDE);
mBlock = (RestrictedSwitchPreference) getPreferenceScreen().findPreference(KEY_BLOCK);
mSilent = (RestrictedSwitchPreference) getPreferenceScreen().findPreference(KEY_SILENT);
diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java
index 9acac06..89aebf9 100644
--- a/src/com/android/settings/notification/ConfigureNotificationSettings.java
+++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java
@@ -16,6 +16,7 @@
package com.android.settings.notification;
+import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
@@ -177,6 +178,9 @@
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
}
+ mLockscreen.setRemoteInputRestricted(RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
+ mContext, DevicePolicyManager.KEYGUARD_DISABLE_REMOTE_INPUT, UserHandle.myUserId()));
+
mLockscreen.setEntries(entries.toArray(new CharSequence[entries.size()]));
mLockscreen.setEntryValues(values.toArray(new CharSequence[values.size()]));
updateLockscreenNotifications();
@@ -239,6 +243,10 @@
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
}
+ mLockscreen.setRemoteInputRestricted(RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
+ mContext, DevicePolicyManager.KEYGUARD_DISABLE_REMOTE_INPUT,
+ mProfileChallengeUserId));
+
mLockscreenProfile.setEntries(entries.toArray(new CharSequence[entries.size()]));
mLockscreenProfile.setEntryValues(values.toArray(new CharSequence[values.size()]));
// Work profile does not support this settings as we do not have a policy to enforce it yet
diff --git a/src/com/android/settings/notification/NotificationLockscreenPreference.java b/src/com/android/settings/notification/NotificationLockscreenPreference.java
index fc61be3..01eecf5 100644
--- a/src/com/android/settings/notification/NotificationLockscreenPreference.java
+++ b/src/com/android/settings/notification/NotificationLockscreenPreference.java
@@ -19,6 +19,7 @@
import com.android.settings.R;
import com.android.settings.RestrictedListPreference;
import com.android.settings.Utils;
+import com.android.settingslib.RestrictedLockUtils;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -32,6 +33,7 @@
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
+import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
@@ -42,6 +44,7 @@
private boolean mShowRemoteInput;
private boolean mRemoteInputCheckBoxEnabled = true;
private int mUserId = UserHandle.myUserId();
+ private RestrictedLockUtils.EnforcedAdmin mAdminRestrictingRemoteInput;
public NotificationLockscreenPreference(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -51,6 +54,10 @@
mRemoteInputCheckBoxEnabled = enabled;
}
+ public void setRemoteInputRestricted(RestrictedLockUtils.EnforcedAdmin admin) {
+ mAdminRestrictingRemoteInput = admin;
+ }
+
@Override
protected void onClick() {
final Context context = getContext();
@@ -81,9 +88,19 @@
protected void onDialogCreated(Dialog dialog) {
super.onDialogCreated(dialog);
dialog.create();
- CheckBox view = (CheckBox) dialog.findViewById(R.id.lockscreen_remote_input);
- view.setChecked(!mAllowRemoteInput);
- view.setOnCheckedChangeListener(mListener);
+ CheckBox checkbox = (CheckBox) dialog.findViewById(R.id.lockscreen_remote_input);
+ checkbox.setChecked(!mAllowRemoteInput);
+ checkbox.setOnCheckedChangeListener(mListener);
+ checkbox.setEnabled(mAdminRestrictingRemoteInput == null);
+
+ View restricted = dialog.findViewById(R.id.restricted_lock_icon_remote_input);
+ restricted.setVisibility(mAdminRestrictingRemoteInput == null ? View.GONE : View.VISIBLE);
+
+ if (mAdminRestrictingRemoteInput != null) {
+ checkbox.setClickable(false);
+ dialog.findViewById(com.android.internal.R.id.customPanel)
+ .setOnClickListener(mListener);
+ }
}
@Override
@@ -122,7 +139,7 @@
}
private class Listener implements DialogInterface.OnClickListener,
- CompoundButton.OnCheckedChangeListener {
+ CompoundButton.OnCheckedChangeListener, View.OnClickListener {
private final DialogInterface.OnClickListener mInner;
private View mView;
@@ -150,5 +167,13 @@
public void setView(View view) {
mView = view;
}
+
+ @Override
+ public void onClick(View v) {
+ if (v.getId() == com.android.internal.R.id.customPanel) {
+ RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(),
+ mAdminRestrictingRemoteInput);
+ }
+ }
}
}
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index 77a329c..97a36b6 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -23,6 +23,7 @@
import com.android.settingslib.RestrictedSwitchPreference;
import android.app.Notification;
+import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
@@ -33,7 +34,6 @@
import android.os.UserManager;
import android.provider.Settings;
import android.service.notification.NotificationListenerService.Ranking;
-import android.support.v7.preference.DropDownPreference;
import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.util.Log;
@@ -41,6 +41,7 @@
import java.util.ArrayList;
+import static com.android.settings.notification.RestrictedDropDownPreference.RestrictedItem;
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
abstract public class NotificationSettingsBase extends SettingsPreferenceFragment {
@@ -65,7 +66,7 @@
protected PackageInfo mPkgInfo;
protected ImportanceSeekBarPreference mImportance;
protected RestrictedSwitchPreference mPriority;
- protected DropDownPreference mVisibilityOverride;
+ protected RestrictedDropDownPreference mVisibilityOverride;
protected RestrictedSwitchPreference mBlock;
protected RestrictedSwitchPreference mSilent;
protected EnforcedAdmin mSuspendedAppsAdmin;
@@ -148,6 +149,9 @@
if (mSilent != null) {
mSilent.setDisabledByAdmin(mSuspendedAppsAdmin);
}
+ if (mVisibilityOverride != null) {
+ mVisibilityOverride.setDisabledByAdmin(mSuspendedAppsAdmin);
+ }
}
protected void setupImportancePrefs(boolean isSystemApp, int importance, boolean banned) {
@@ -216,13 +220,24 @@
ArrayList<CharSequence> entries = new ArrayList<>();
ArrayList<CharSequence> values = new ArrayList<>();
+ mVisibilityOverride.clearRestrictedItems();
if (getLockscreenNotificationsEnabled() && getLockscreenAllowPrivateNotifications()) {
- entries.add(getString(R.string.lock_screen_notifications_summary_show));
- values.add(Integer.toString(Ranking.VISIBILITY_NO_OVERRIDE));
+ final String summaryShowEntry =
+ getString(R.string.lock_screen_notifications_summary_show);
+ final String summaryShowEntryValue = Integer.toString(Ranking.VISIBILITY_NO_OVERRIDE);
+ entries.add(summaryShowEntry);
+ values.add(summaryShowEntryValue);
+ setRestrictedIfNotificationFeaturesDisabled(summaryShowEntry, summaryShowEntryValue,
+ DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS
+ | DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS);
}
- entries.add(getString(R.string.lock_screen_notifications_summary_hide));
- values.add(Integer.toString(Notification.VISIBILITY_PRIVATE));
+ final String summaryHideEntry = getString(R.string.lock_screen_notifications_summary_hide);
+ final String summaryHideEntryValue = Integer.toString(Notification.VISIBILITY_PRIVATE);
+ entries.add(summaryHideEntry);
+ values.add(summaryHideEntryValue);
+ setRestrictedIfNotificationFeaturesDisabled(summaryHideEntry, summaryHideEntryValue,
+ DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
entries.add(getString(R.string.lock_screen_notifications_summary_disable));
values.add(Integer.toString(Notification.VISIBILITY_SECRET));
mVisibilityOverride.setEntries(entries.toArray(new CharSequence[entries.size()]));
@@ -248,6 +263,16 @@
});
}
+ private void setRestrictedIfNotificationFeaturesDisabled(CharSequence entry,
+ CharSequence entryValue, int keyguardNotificationFeatures) {
+ EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
+ mContext, keyguardNotificationFeatures, mUserId);
+ if (admin != null) {
+ RestrictedItem item = new RestrictedItem(entry, entryValue, admin);
+ mVisibilityOverride.addRestrictedItem(item);
+ }
+ }
+
private int getGlobalVisibility() {
int globalVis = Ranking.VISIBILITY_NO_OVERRIDE;
if (!getLockscreenNotificationsEnabled()) {
diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java
index 35e4036..84ae35d 100644
--- a/src/com/android/settings/notification/RedactionInterstitial.java
+++ b/src/com/android/settings/notification/RedactionInterstitial.java
@@ -16,6 +16,7 @@
package com.android.settings.notification;
+import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -32,6 +33,7 @@
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
+import com.android.settings.RestrictedCheckBox;
import com.android.settings.RestrictedRadioButton;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
@@ -81,7 +83,7 @@
private RadioGroup mRadioGroup;
private RestrictedRadioButton mShowAllButton;
private RestrictedRadioButton mRedactSensitiveButton;
- private CheckBox mRemoteInputCheckbox;
+ private RestrictedCheckBox mRemoteInputCheckbox;
private int mUserId;
@Override
@@ -102,7 +104,8 @@
mShowAllButton = (RestrictedRadioButton) view.findViewById(R.id.show_all);
mRedactSensitiveButton =
(RestrictedRadioButton) view.findViewById(R.id.redact_sensitive);
- mRemoteInputCheckbox = (CheckBox) view.findViewById(R.id.lockscreen_remote_input);
+ mRemoteInputCheckbox =
+ (RestrictedCheckBox) view.findViewById(R.id.lockscreen_remote_input);
mRemoteInputCheckbox.setOnCheckedChangeListener(this);
mRadioGroup.setOnCheckedChangeListener(this);
@@ -129,6 +132,9 @@
KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS);
checkNotificationFeaturesAndSetDisabled(mRedactSensitiveButton,
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
+ mRemoteInputCheckbox.setDisabledByAdmin(
+ RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(getActivity(),
+ DevicePolicyManager.KEYGUARD_DISABLE_REMOTE_INPUT, mUserId));
loadFromSettings();
}
diff --git a/src/com/android/settings/notification/RestrictedDropDownPreference.java b/src/com/android/settings/notification/RestrictedDropDownPreference.java
new file mode 100644
index 0000000..e4a4cb6
--- /dev/null
+++ b/src/com/android/settings/notification/RestrictedDropDownPreference.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.notification;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.support.v7.preference.DropDownPreference;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.android.settings.R;
+import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
+import com.android.settingslib.RestrictedPreferenceHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RestrictedDropDownPreference extends DropDownPreference {
+ private final RestrictedPreferenceHelper mHelper;
+ private ReselectionSpinner mSpinner;
+ private List<RestrictedItem> mRestrictedItems = new ArrayList<>();
+ private boolean mUserClicked = false;
+
+ public RestrictedDropDownPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setLayoutResource(R.layout.restricted_preference_dropdown);
+ setWidgetLayoutResource(R.layout.restricted_icon);
+ mHelper = new RestrictedPreferenceHelper(context, this, attrs);
+ }
+
+ @Override
+ protected ArrayAdapter createAdapter() {
+ return new RestrictedArrayItemAdapter(getContext());
+ }
+
+ @Override
+ public void setValue(String value) {
+ if (getRestrictedItemForEntryValue(value) != null) {
+ return;
+ }
+ super.setValue(value);
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ mSpinner = (ReselectionSpinner) view.itemView.findViewById(R.id.spinner);
+ mSpinner.setPreference(this);
+ super.onBindViewHolder(view);
+ mHelper.onBindViewHolder(view);
+ mSpinner.setOnItemSelectedListener(mItemSelectedListener);
+ final View restrictedIcon = view.findViewById(R.id.restricted_icon);
+ if (restrictedIcon != null) {
+ restrictedIcon.setVisibility(isDisabledByAdmin() ? View.VISIBLE : View.GONE);
+ }
+ }
+
+ private boolean isRestrictedForEntry(CharSequence entry) {
+ if (entry == null) {
+ return false;
+ }
+ for (RestrictedItem item : mRestrictedItems) {
+ if (entry.equals(item.entry)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private RestrictedItem getRestrictedItemForEntryValue(CharSequence entryValue) {
+ if (entryValue == null) {
+ return null;
+ }
+ for (RestrictedItem item : mRestrictedItems) {
+ if (entryValue.equals(item.entryValue)) {
+ return item;
+ }
+ }
+ return null;
+ }
+
+ private RestrictedItem getRestrictedItemForPosition(int position) {
+ if (position < 0 || position >= getEntryValues().length) {
+ return null;
+ }
+ CharSequence entryValue = getEntryValues()[position];
+ return getRestrictedItemForEntryValue(entryValue);
+ }
+
+ public void addRestrictedItem(RestrictedItem item) {
+ mRestrictedItems.add(item);
+ }
+
+ public void clearRestrictedItems() {
+ mRestrictedItems.clear();
+ }
+
+ @Override
+ public void performClick() {
+ if (!mHelper.performClick()) {
+ mUserClicked = true;
+ super.performClick();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (enabled && isDisabledByAdmin()) {
+ mHelper.setDisabledByAdmin(null);
+ return;
+ }
+ super.setEnabled(enabled);
+ }
+
+ public void setDisabledByAdmin(EnforcedAdmin admin) {
+ if (mHelper.setDisabledByAdmin(admin)) {
+ notifyChanged();
+ }
+ }
+
+ public boolean isDisabledByAdmin() {
+ return mHelper.isDisabledByAdmin();
+ }
+
+ private void setUserClicked(boolean userClicked) {
+ mUserClicked = userClicked;
+ }
+
+ private boolean isUserClicked() {
+ return mUserClicked;
+ }
+
+ private final OnItemSelectedListener mItemSelectedListener = new OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
+ if (mUserClicked) {
+ mUserClicked = false;
+ } else {
+ return;
+ }
+ if (position >= 0 && position < getEntryValues().length) {
+ String value = getEntryValues()[position].toString();
+ RestrictedItem item = getRestrictedItemForEntryValue(value);
+ if (item != null) {
+ RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(),
+ item.enforcedAdmin);
+ mSpinner.setSelection(findIndexOfValue(getValue()));
+ } else if (!value.equals(getValue()) && callChangeListener(value)) {
+ setValue(value);
+ }
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+ // noop
+ }
+ };
+
+ /**
+ * Extension of {@link ArrayAdapter} which updates the state of the dropdown item
+ * depending on whether it is restricted by the admin.
+ */
+ private class RestrictedArrayItemAdapter extends ArrayAdapter<String> {
+ private static final int TEXT_RES_ID = android.R.id.text1;
+ public RestrictedArrayItemAdapter(Context context) {
+ super(context, R.layout.spinner_dropdown_restricted_item, TEXT_RES_ID);
+ }
+
+ @Override
+ public View getDropDownView(int position, View convertView, ViewGroup parent) {
+ View rootView = super.getView(position, convertView, parent);
+ CharSequence entry = getItem(position);
+ boolean isEntryRestricted = isRestrictedForEntry(entry);
+ TextView text = (TextView) rootView.findViewById(TEXT_RES_ID);
+ if (text != null) {
+ text.setEnabled(!isEntryRestricted);
+ }
+ View restrictedIcon = rootView.findViewById(R.id.restricted_icon);
+ if (restrictedIcon != null) {
+ restrictedIcon.setVisibility(isEntryRestricted ? View.VISIBLE : View.GONE);
+ }
+ return rootView;
+ }
+ }
+
+ /**
+ * Extension of {@link Spinner} which triggers the admin support dialog on user clicking a
+ * restricted item even if was already selected.
+ */
+ public static class ReselectionSpinner extends Spinner {
+ private RestrictedDropDownPreference pref;
+
+ public ReselectionSpinner(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public void setPreference(RestrictedDropDownPreference pref) {
+ this.pref = pref;
+ }
+
+ @Override
+ public void setSelection(int position) {
+ int previousSelectedPosition = getSelectedItemPosition();
+ super.setSelection(position);
+ if (position == previousSelectedPosition && pref.isUserClicked()) {
+ pref.setUserClicked(false);
+ RestrictedItem item = pref.getRestrictedItemForPosition(position);
+ if (item != null) {
+ RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(),
+ item.enforcedAdmin);
+ }
+ }
+ }
+ }
+
+ public static class RestrictedItem {
+ public final CharSequence entry;
+ public final CharSequence entryValue;
+ public final EnforcedAdmin enforcedAdmin;
+
+ public RestrictedItem(CharSequence entry, CharSequence entryValue,
+ EnforcedAdmin enforcedAdmin) {
+ this.entry = entry;
+ this.entryValue = entryValue;
+ this.enforcedAdmin = enforcedAdmin;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/overlay/SupportFeatureProvider.java b/src/com/android/settings/overlay/SupportFeatureProvider.java
index bf31f7f..e0b7862 100644
--- a/src/com/android/settings/overlay/SupportFeatureProvider.java
+++ b/src/com/android/settings/overlay/SupportFeatureProvider.java
@@ -80,4 +80,9 @@
* Returns an intent that will start the add account UI.
*/
Intent getAccountLoginIntent();
+
+ /**
+ * Returns an intent that will launch the tips and tricks UI.
+ */
+ Intent getTipsAndTricksIntent(Context context);
}
diff --git a/src/com/android/settings/users/UserPreference.java b/src/com/android/settings/users/UserPreference.java
index 47f8ff9..7b13597 100644
--- a/src/com/android/settings/users/UserPreference.java
+++ b/src/com/android/settings/users/UserPreference.java
@@ -104,6 +104,8 @@
if (mDeleteClickListener != null
&& !RestrictedLockUtils.hasBaseUserRestriction(getContext(),
UserManager.DISALLOW_REMOVE_USER, UserHandle.myUserId())) {
+ deleteView.setVisibility(View.VISIBLE);
+ deleteDividerView.setVisibility(View.VISIBLE);
deleteView.setOnClickListener(mDeleteClickListener);
deleteView.setTag(this);
} else {
@@ -114,11 +116,11 @@
ImageView manageView = (ImageView) view.findViewById(R.id.manage_user);
if (manageView != null) {
if (mSettingsClickListener != null) {
+ manageView.setVisibility(View.VISIBLE);
+ manageDividerView.setVisibility(mDeleteClickListener == null
+ ? View.VISIBLE : View.GONE);
manageView.setOnClickListener(mSettingsClickListener);
manageView.setTag(this);
- if (mDeleteClickListener != null) {
- manageDividerView.setVisibility(View.GONE);
- }
} else {
manageView.setVisibility(View.GONE);
manageDividerView.setVisibility(View.GONE);
diff --git a/src/com/android/settings/widget/SlidingTabLayout.java b/src/com/android/settings/widget/SlidingTabLayout.java
index 176bebc..219d37b 100644
--- a/src/com/android/settings/widget/SlidingTabLayout.java
+++ b/src/com/android/settings/widget/SlidingTabLayout.java
@@ -120,9 +120,7 @@
tabTitleView.setOnClickListener(this);
mTitleView.addView(tabTitleView);
- if (i == mViewPager.getCurrentItem()) {
- tabTitleView.setSelected(true);
- }
+ tabTitleView.setSelected(i == mViewPager.getCurrentItem());
}
}
@@ -159,9 +157,9 @@
if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
onViewPagerPageChanged(position, 0f);
}
- final int titleCount = getChildCount();
+ final int titleCount = mTitleView.getChildCount();
for (int i = 0; i < titleCount; i++) {
- getChildAt(i).setSelected(position == i);
+ mTitleView.getChildAt(i).setSelected(position == i);
}
}
}