Merge "Skip indexing dynamic and injected raw data when page search is disabled" into sc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5abe890..a21c4bb 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -473,6 +473,7 @@
<activity android:name="Settings$FaceSettingsActivity"
android:label="@string/security_settings_face_preference_title"
+ android:theme="@style/Theme.SubSettings"
android:exported="true"
android:icon="@drawable/ic_face_header">
<intent-filter>
@@ -677,7 +678,8 @@
<activity android:name=".localepicker.LocalePickerWithRegionActivity"
android:excludeFromRecents="true"
android:configChanges="orientation|keyboardHidden|screenSize"
- android:exported="false">
+ android:exported="false"
+ android:theme="@style/Theme.LocalePickerWithRegionActivity">
</activity>
<activity
diff --git a/res/drawable/ic_suggested_notifications.xml b/res/drawable/ic_suggested_notifications.xml
index 5bce000..a696f47 100644
--- a/res/drawable/ic_suggested_notifications.xml
+++ b/res/drawable/ic_suggested_notifications.xml
@@ -19,9 +19,9 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
- android:fillColor="@color/sud_color_accent_light"
+ android:fillColor="?android:attr/colorPrimary"
android:pathData="M18,17v-6c0,-3.07 -1.63,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C7.64,5.36 6,7.92 6,11v6H4v2h10h0.38H20v-2H18zM16,17H8v-6c0,-2.48 1.51,-4.5 4,-4.5s4,2.02 4,4.5V17z"/>
<path
- android:fillColor="@color/sud_color_accent_light"
+ android:fillColor="?android:attr/colorPrimary"
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z"/>
</vector>
diff --git a/res/layout-land/choose_lock_pattern.xml b/res/layout-land/choose_lock_pattern.xml
deleted file mode 100644
index 29c3350..0000000
--- a/res/layout-land/choose_lock_pattern.xml
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License")
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<com.google.android.setupdesign.GlifLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:icon="@drawable/ic_lock"
- android:layout="@layout/sud_glif_blank_template"
- settings:sucHeaderText="@string/lock_settings_picker_title">
-
- <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- android:id="@+id/topLayout"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <!-- left side: instructions and messages -->
- <LinearLayout
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1.0"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginBottom="@dimen/sud_content_frame_padding_bottom"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="vertical">
-
- <ScrollView
- android:id="@+id/scroll_layout_title_header"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="?attr/sudGlifHeaderGravity"
- android:layout_marginStart="0dp"
- android:layout_marginEnd="0dp"
- android:src="@drawable/ic_lock"/>
-
- <TextView
- android:id="@+id/suc_layout_title"
- style="@style/SudGlifHeaderTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="0dp"
- android:layout_marginEnd="0dp"/>
-
- <TextView
- android:id="@+id/sud_layout_description"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minLines="2" />
-
- <!-- header message -->
- <TextView
- android:id="@+id/headerText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:gravity="?attr/sudGlifHeaderGravity"
- android:textSize="18sp"/>
-
- <TextView android:id="@+id/footerText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_marginTop="10dp"
- android:textSize="14sp"
- android:visibility="gone" />
-
- <Button
- android:id="@+id/screen_lock_options"
- style="@style/SudGlifButton.Tertiary"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:gravity="?attr/sudGlifHeaderGravity"
- android:text="@string/setup_lock_settings_options_button_label"
- android:visibility="gone" />
-
- </LinearLayout>
-
- </ScrollView>
-
- </LinearLayout>
-
- <!-- right side: lock pattern -->
- <com.google.android.setupdesign.view.FillContentLayout
- style="@style/LockPatternContainerStyle"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1.0"
- android:paddingStart="0dp">
-
- <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:background="@color/lock_pattern_background" />
-
- </com.google.android.setupdesign.view.FillContentLayout>
-
- </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-
-</com.google.android.setupdesign.GlifLayout>
diff --git a/res/layout-land/confirm_lock_password.xml b/res/layout-land/confirm_lock_password.xml
deleted file mode 100644
index 775f9ad..0000000
--- a/res/layout-land/confirm_lock_password.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<com.google.android.setupdesign.GlifLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/setup_wizard_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:icon="@drawable/ic_enterprise">
-
- <!--common_typos_disable-->
- <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- android:id="@+id/topLayout"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1">
-
- <TextView
- android:id="@+id/sud_layout_description"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd" />
-
- <Button
- android:id="@+id/forgotButton"
- style="@style/SudGlifButton.Secondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:layout_gravity="center"
- android:visibility="gone" />
-
- <com.android.settings.widget.ScrollToParentEditText
- android:id="@+id/password_entry"
- android:layout_width="208dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:inputType="textPassword"
- android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
- android:gravity="center"
- style="@style/TextAppearance.PasswordEntry"/>
-
- <TextView
- style="@style/TextAppearance.ErrorText"
- android:accessibilityLiveRegion="polite"
- android:id="@+id/errorText"
- android:layout_gravity="center"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"/>
-
- <Space
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <Button
- android:id="@+id/cancelButton"
- style="@style/SudGlifButton.Secondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:layout_marginBottom="80dp"
- android:layout_gravity="center_horizontal"
- android:text="@string/cancel" />
-
- <!--common_typos_disable-->
- </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-</com.google.android.setupdesign.GlifLayout>
\ No newline at end of file
diff --git a/res/layout-land/confirm_lock_pattern.xml b/res/layout-land/confirm_lock_pattern.xml
deleted file mode 100644
index 1126052..0000000
--- a/res/layout-land/confirm_lock_pattern.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<com.google.android.setupdesign.GlifLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/setup_wizard_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:icon="@drawable/ic_enterprise"
- android:layout="@layout/sud_glif_blank_template">
-
- <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- android:id="@+id/topLayout"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <ScrollView
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:fillViewport="true">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingBottom="24dp">
-
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="?attr/sudGlifHeaderGravity"
- android:src="@drawable/ic_enterprise" />
-
- <TextView
- android:id="@+id/suc_layout_title"
- style="@style/SudGlifHeaderTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <TextView
- android:id="@+id/sud_layout_subtitle"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd" />
-
- <Button
- android:id="@+id/cancelButton"
- style="@style/SetupWizardButton.Negative"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:text="@string/cancel" />
-
- <Button
- android:id="@+id/forgotButton"
- style="@style/SudGlifButton.Secondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:layout_gravity="center"
- android:visibility="gone" />
-
- <Space
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <TextView
- style="@style/TextAppearance.ErrorText"
- android:accessibilityLiveRegion="polite"
- android:id="@+id/errorText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:layout_marginBottom="24dp"
- android:gravity="center_vertical"/>
-
- </LinearLayout>
-
- </ScrollView>
-
- <com.google.android.setupdesign.view.FillContentLayout
- style="@style/LockPatternContainerStyle"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:paddingStart="0dp">
-
- <com.android.internal.widget.LockPatternView
- android:id="@+id/lockPattern"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center" />
-
- </com.google.android.setupdesign.view.FillContentLayout>
-
- </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-</com.google.android.setupdesign.GlifLayout>
-
diff --git a/res/layout-land/confirm_lock_pattern_normal.xml b/res/layout-land/confirm_lock_pattern_normal.xml
deleted file mode 100644
index 2a9103f..0000000
--- a/res/layout-land/confirm_lock_pattern_normal.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<com.google.android.setupdesign.GlifLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/setup_wizard_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:icon="@drawable/ic_lock"
- android:layout="@layout/sud_glif_blank_template">
-
- <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- android:id="@+id/topLayout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
-
- <ScrollView
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:fillViewport="true">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingBottom="24dp">
-
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="?attr/sudGlifHeaderGravity"
- android:src="@drawable/ic_lock" />
-
- <TextView
- android:id="@+id/suc_layout_title"
- style="@style/SudGlifHeaderTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <TextView
- style="@style/SudDescription.Glif"
- android:id="@+id/sud_layout_subtitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd" />
-
- <Button
- android:id="@+id/cancelButton"
- style="@style/SetupWizardButton.Negative"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:text="@string/cancel" />
-
- <Space
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <TextView
- style="@style/TextAppearance.ErrorText"
- android:accessibilityLiveRegion="polite"
- android:id="@+id/errorText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:layout_marginBottom="24dp"
- android:gravity="center_vertical"/>
- </LinearLayout>
-
- </ScrollView>
-
- <com.google.android.setupdesign.view.FillContentLayout
- style="@style/LockPatternContainerStyle"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:paddingStart="0dp">
-
- <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:background="@color/lock_pattern_background" />
-
- </com.google.android.setupdesign.view.FillContentLayout>
-
- </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-</com.google.android.setupdesign.GlifLayout>
diff --git a/res/layout/choose_lock_pattern_common.xml b/res/layout/choose_lock_pattern_common.xml
index 46e857b..b238d93 100644
--- a/res/layout/choose_lock_pattern_common.xml
+++ b/res/layout/choose_lock_pattern_common.xml
@@ -18,97 +18,55 @@
<!-- Used in phone portrait and tablet, as referenced in alias.xml. -->
<com.google.android.setupdesign.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:icon="@drawable/ic_lock"
- android:layout="@layout/sud_glif_blank_template">
+ android:icon="@drawable/ic_lock">
+ <!-- takes up all space above button bar at bottom -->
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
android:id="@+id/topLayout"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:gravity="center"
android:clipChildren="false"
android:clipToPadding="false"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp">
- <LinearLayout
- style="@style/SudGlifHeaderContainer"
+ <TextView
+ android:id="@+id/headerText"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/ic_lock" />
-
- <TextView
- android:id="@+id/suc_layout_title"
- style="@style/SudGlifHeaderTitle"
- android:accessibilityLiveRegion="polite"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- </LinearLayout>
-
- <!-- takes up all space above button bar at bottom -->
- <LinearLayout
- style="@style/SudContentFrame"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
+ android:minLines="2"
android:gravity="center"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="vertical"
- android:paddingLeft="0dp"
- android:paddingRight="0dp">
+ android:paddingStart="?attr/sudMarginStart"
+ android:paddingEnd="?attr/sudMarginEnd"/>
- <TextView
- android:id="@+id/sud_layout_description"
- style="@style/SudDescription.Glif"
+ <com.google.android.setupdesign.view.FillContentLayout
+ style="@style/LockPatternContainerStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1">
+
+ <com.android.internal.widget.LockPatternView
+ android:id="@+id/lockPattern"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:minLines="2" />
+ android:layout_height="match_parent"
+ android:layout_gravity="center"/>
- <TextView android:id="@+id/headerText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minLines="2"
- android:gravity="center"
- android:paddingStart="?attr/sudMarginStart"
- android:paddingEnd="?attr/sudMarginEnd"
- android:textSize="12sp" />
-
- <com.google.android.setupdesign.view.FillContentLayout
- style="@style/LockPatternContainerStyle"
- android:layout_width="wrap_content"
- android:layout_height="0dp"
- android:layout_weight="1">
-
- <com.android.internal.widget.LockPatternView
- android:id="@+id/lockPattern"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center" />
-
- </com.google.android.setupdesign.view.FillContentLayout>
-
- </LinearLayout>
+ </com.google.android.setupdesign.view.FillContentLayout>
<TextView android:id="@+id/footerText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:minHeight="50dip"
- android:textSize="14sp"
- android:visibility="gone"/>
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:minHeight="50dip"
+ android:textSize="14sp"
+ android:visibility="gone"/>
<Button
android:id="@+id/screen_lock_options"
@@ -116,8 +74,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setup_lock_settings_options_button_label"
- android:visibility="gone" />
-
+ android:visibility="gone"/>
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
</com.google.android.setupdesign.GlifLayout>
diff --git a/res/layout/confirm_lock_password_base.xml b/res/layout/confirm_lock_password_base.xml
index a1525b7..7c2fc5b 100644
--- a/res/layout/confirm_lock_password_base.xml
+++ b/res/layout/confirm_lock_password_base.xml
@@ -18,8 +18,7 @@
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:icon="@drawable/ic_enterprise"
- android:layout="@layout/sud_glif_blank_template">
+ android:icon="@drawable/ic_enterprise">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
android:id="@+id/topLayout"
@@ -32,28 +31,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="?attr/sudGlifHeaderGravity"
- android:src="@drawable/ic_enterprise" />
-
- <TextView
- android:id="@+id/headerText"
- style="@style/SudGlifHeaderTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <TextView
- android:id="@+id/sud_layout_description"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd" />
-
<Button
android:id="@+id/forgotButton"
style="@style/SudGlifButton.Secondary"
@@ -82,7 +59,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:inputType="textPassword"
- android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
+ android:imeOptions="actionNext|flagForceAscii"
android:gravity="center"
style="@style/TextAppearance.PasswordEntry"/>
diff --git a/res/layout/confirm_lock_password_normal.xml b/res/layout/confirm_lock_password_normal.xml
index 089ecdc..f2b8d1f 100644
--- a/res/layout/confirm_lock_password_normal.xml
+++ b/res/layout/confirm_lock_password_normal.xml
@@ -52,7 +52,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:inputType="textPassword"
- android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
+ android:imeOptions="actionNext|flagForceAscii"
android:gravity="center"
style="@style/TextAppearance.PasswordEntry"/>
diff --git a/res/layout/confirm_lock_pattern_base.xml b/res/layout/confirm_lock_pattern_base.xml
index bac2689..f79fc72 100644
--- a/res/layout/confirm_lock_pattern_base.xml
+++ b/res/layout/confirm_lock_pattern_base.xml
@@ -18,8 +18,7 @@
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:icon="@drawable/ic_enterprise"
- android:layout="@layout/sud_glif_blank_template">
+ android:icon="@drawable/ic_enterprise">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
android:id="@+id/topLayout"
@@ -33,28 +32,6 @@
android:orientation="vertical"
android:paddingBottom="24dp">
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="?attr/sudGlifHeaderGravity"
- android:src="@drawable/ic_enterprise" />
-
- <TextView
- android:id="@+id/suc_layout_title"
- style="@style/SudGlifHeaderTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <TextView
- android:id="@+id/sud_layout_subtitle"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd" />
-
<Button
android:id="@+id/cancelButton"
style="@style/SudGlifButton.Secondary"
diff --git a/res/layout/confirm_lock_pattern_normal_base.xml b/res/layout/confirm_lock_pattern_normal_base.xml
index 29783dd..62a1160 100644
--- a/res/layout/confirm_lock_pattern_normal_base.xml
+++ b/res/layout/confirm_lock_pattern_normal_base.xml
@@ -18,8 +18,7 @@
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:icon="@drawable/ic_lock"
- android:layout="@layout/sud_glif_blank_template">
+ android:icon="@drawable/ic_lock">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
android:id="@+id/topLayout"
@@ -28,35 +27,6 @@
android:orientation="vertical">
<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="?attr/sudGlifHeaderGravity"
- android:src="@drawable/ic_lock" />
-
- <TextView
- android:id="@+id/suc_layout_title"
- style="@style/SudGlifHeaderTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <TextView
- style="@style/SudDescription.Glif"
- android:id="@+id/sud_layout_subtitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd" />
-
- </LinearLayout>
-
- <LinearLayout
style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/res/layout/face_enroll_button.xml b/res/layout/face_enroll_button.xml
index f40c42c..2e7ba8d 100644
--- a/res/layout/face_enroll_button.xml
+++ b/res/layout/face_enroll_button.xml
@@ -22,7 +22,7 @@
<Button
android:id="@+id/security_settings_face_settings_enroll_button"
- android:layout_marginStart="@dimen/screen_margin_sides"
+ android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
diff --git a/res/layout/face_remove_button.xml b/res/layout/face_remove_button.xml
index a05fb85..2bbaca9 100644
--- a/res/layout/face_remove_button.xml
+++ b/res/layout/face_remove_button.xml
@@ -22,7 +22,7 @@
<Button
android:id="@+id/security_settings_face_settings_remove_button"
- android:layout_marginStart="@dimen/screen_margin_sides"
+ android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
diff --git a/res/layout/preference_balance_slider.xml b/res/layout/preference_balance_slider.xml
index 43cd86f..93e192a 100644
--- a/res/layout/preference_balance_slider.xml
+++ b/res/layout/preference_balance_slider.xml
@@ -91,6 +91,8 @@
<TextView
android:id="@+id/left_text"
android:text="@string/accessibility_toggle_primary_balance_left_label"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
@@ -99,6 +101,8 @@
<TextView
android:id="@+id/right_text"
android:text="@string/accessibility_toggle_primary_balance_right_label"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index bf56cc4..8a6ff0d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7756,6 +7756,8 @@
<string name="help_url_battery_missing" translatable="false"></string>
<!-- url for vpn page if connected vpn is not a secure type -->
<string name="help_url_insecure_vpn" translatable="false"></string>
+ <!-- url for learning more about IT admin policy disabling -->
+ <string name="help_url_action_disabled_by_it_admin" translatable="false"></string>
<!-- User account title [CHAR LIMIT=30] -->
<string name="user_account_title">Account for content</string>
@@ -10823,22 +10825,24 @@
<!-- Summary of Android version info (when there is a pending upgrade available) [CHAR LIMIT=NONE] -->
<string name="android_version_pending_update_summary">Update available</string>
- <!-- Title for dialog displayed when user selects on a setting locked by an admin [CHAR LIMIT=30 BACKUP_MESSAGE_ID:4867639270211833535] -->
- <string name="disabled_by_policy_title">Action not allowed</string>
- <!-- Title for dialog displayed to tell user that changing volume was disallowed by an admin [CHAR LIMIT=50] -->
+ <!-- Title for dialog displayed when user taps a setting on their phone that's blocked by their IT admin [CHAR LIMIT=30 BACKUP_MESSAGE_ID:4867639270211833535] -->
+ <string name="disabled_by_policy_title">Blocked by your IT admin</string>
+ <!-- Title for dialog displayed to tell user that changing volume on their phone is blocked by their IT admin [CHAR LIMIT=50] -->
<string name="disabled_by_policy_title_adjust_volume">Can’t change volume</string>
- <!-- Title for dialog displayed to tell user that outgoing calls were disabled by an admin [CHAR LIMIT=50] -->
- <string name="disabled_by_policy_title_outgoing_calls">Calling not allowed</string>
- <!-- Title for dialog displayed to tell user that sending SMS were disabled by an admin [CHAR LIMIT=50] -->
- <string name="disabled_by_policy_title_sms">SMS not allowed</string>
- <!-- Title for dialog displayed to tell user that the camera was disabled by an admin [CHAR LIMIT=50] -->
- <string name="disabled_by_policy_title_camera">Camera not allowed</string>
- <!-- Title for dialog displayed to tell user that screenshots are disabled by an admin [CHAR LIMIT=50] -->
- <string name="disabled_by_policy_title_screen_capture">Screenshot not allowed</string>
+ <!-- Title for dialog displayed to tell user that outgoing calls are blocked by their IT admin [CHAR LIMIT=50] -->
+ <string name="disabled_by_policy_title_outgoing_calls">Can’t make calls</string>
+ <!-- Title for dialog displayed to tell user that sending SMS messages is blocked by their IT admin [CHAR LIMIT=50] -->
+ <string name="disabled_by_policy_title_sms">Can’t send SMS messages</string>
+ <!-- Title for dialog displayed to tell user that the camera on their phone is blocked by their IT admin [CHAR LIMIT=50] -->
+ <string name="disabled_by_policy_title_camera">Can’t use camera</string>
+ <!-- Title for dialog displayed to tell user that taking screenshots on their phone is blocked by their IT admin [CHAR LIMIT=50] -->
+ <string name="disabled_by_policy_title_screen_capture">Can’t take screenshots</string>
<!-- Title for dialog displayed to tell user that the app was suspended by an admin [CHAR LIMIT=50] -->
<string name="disabled_by_policy_title_suspend_packages">Can’t open this app</string>
<!-- Dialog title. This dialog lets a user know that a specific setting is blocked by their credit provider. Since the user purchased the device from the credit provider, the credit provider controls what they can access. [CHAR LIMIT=50] -->
<string name="disabled_by_policy_title_financed_device">Blocked by your credit provider</string>
+ <!-- Shown when the user tries to change phone settings that are blocked by their IT admin [CHAR LIMIT=200] -->
+ <string name="default_admin_support_msg">If you have questions, contact your IT admin</string>
<!-- Shown in dialog to allow user to see more information about the device admin [CHAR LIMIT=30] -->
<string name="admin_support_more_info">More details</string>
<!-- Shown in admin details page to warn user about policies the admin can set in a work profile. [CHAR LIMIT=NONE] -->
@@ -13128,6 +13132,8 @@
<string name="to_switch_networks_disconnect_ethernet">To switch networks, disconnect ethernet</string>
<!-- Panel subtitle for Wi-Fi turned on. [CHAR LIMIT=60] -->
<string name="wifi_is_turned_on_subtitle">Wi\u2011Fi is turned on</string>
+ <!-- Panel subtitle for select the network you want to use for data. [CHAR LIMIT=60] -->
+ <string name="select_network_to_connect_internet">Select the network you want to use for data</string>
<!-- Title for merged carrier Wi-Fi offload toggle. [CHAR LIMIT=NONE] -->
<string name="carrier_wifi_offload_title">W+ connections</string>
<!-- Summary for merged carrier Wi-Fi offload toggle. [CHAR LIMIT=NONE] -->
@@ -13295,4 +13301,9 @@
<string name="mic_toggle_title">Microphone access</string>
<!-- Describes what is affected by the camera or mic toggle [CHAR LIMIT=NONE] -->
<string name="sensor_toggle_description">For all apps and services</string>
+
+ <!-- Title for Game settings entry. [CHAR_LIMIT=NONE] -->
+ <string name="game_settings_title">Game settings</string>
+ <!-- Summary for Game settings entry. [CHAR_LIMIT=NONE] -->
+ <string name="game_settings_summary">Turn on Game Dashboard shortcut, etc</string>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index d9a55e6..c72b3a5 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -145,6 +145,7 @@
<item name="android:layout_marginStart">4dip</item>
<item name="android:textAlignment">viewStart</item>
<item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Medium</item>
+ <item name="android:textColorHint">?android:attr/textColorSecondary</item>
<item name="android:minHeight">@dimen/min_tap_target_size</item>
</style>
@@ -391,7 +392,6 @@
<style name="BiometricHeaderStyle" parent="@*android:style/TextAppearance.DeviceDefault.Subhead">
<item name="android:paddingTop">16dp</item>
- <item name="android:textColor">@color/primary_dark_material_light</item>
<item name="android:lineSpacingMultiplier">1.2</item>
</style>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 555a045..9681b03 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -32,7 +32,6 @@
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:datePickerDialogTheme">@style/PickerDialogTheme.Settings</item>
<item name="android:progressBarStyleHorizontal">@style/HorizontalProgressBarStyle</item>
- <item name="android:textColorHint">?android:attr/textColorSecondary</item>
<item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
<item name="face_layout_theme">@style/FaceLayoutTheme</item>
@@ -93,6 +92,10 @@
<item name="android:backgroundDimEnabled">false</item>
</style>
+ <style name="Theme.LocalePickerWithRegionActivity" parent="Theme.Settings">
+ <item name="android:textColorHint">?android:attr/textColorSecondary</item>
+ </style>
+
<style name="ThemeOverlay.SwitchBar.Settings.Base" parent="@*android:style/ThemeOverlay.DeviceDefault.ActionBar">
<item name="android:elevation">1dp</item>
<item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
diff --git a/res/xml/apps.xml b/res/xml/apps.xml
index 68b5c9a..a7d823b 100644
--- a/res/xml/apps.xml
+++ b/res/xml/apps.xml
@@ -62,6 +62,14 @@
<intent android:action="android.settings.MANAGE_DEFAULT_APPS_SETTINGS"/>
</Preference>
+ <Preference
+ android:key="game_settings"
+ android:title="@string/game_settings_title"
+ android:summary="@string/game_settings_summary"
+ android:order="-995"
+ settings:controller="com.android.settings.applications.GameSettingsPreferenceController">
+ </Preference>
+
<PreferenceCategory
android:key="dashboard_tile_placeholder"
android:order="10"/>
diff --git a/res/xml/security_settings_face.xml b/res/xml/security_settings_face.xml
index e1ac9b3..147c4ca 100644
--- a/res/xml/security_settings_face.xml
+++ b/res/xml/security_settings_face.xml
@@ -19,12 +19,6 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/security_settings_face_preference_title">
- <com.android.settings.widget.VideoPreference
- android:key="security_settings_face_video"
- android:title="@string/summary_placeholder"
- settings:animation="@raw/face_settings"
- settings:controller="com.android.settings.widget.VideoPreferenceController"/>
-
<com.android.settingslib.widget.TopIntroPreference
android:title="@string/security_settings_face_settings_top_intro"
settings:searchable="false"/>
@@ -83,19 +77,16 @@
android:key="security_settings_face_delete_faces_container"
android:title="@string/security_settings_face_settings_remove_face_model"
android:selectable="false"
- android:layout="@layout/face_remove_button"
- settings:allowDividerBelow="true"/>
+ android:layout="@layout/face_remove_button"/>
<com.android.settingslib.widget.LayoutPreference
android:key="security_settings_face_enroll_faces_container"
android:title="@string/security_settings_face_settings_enroll"
android:selectable="false"
- android:layout="@layout/face_enroll_button"
- settings:allowDividerBelow="true"/>
+ android:layout="@layout/face_enroll_button"/>
</PreferenceCategory>
<com.android.settingslib.widget.FooterPreference
android:key="security_face_footer"
- settings:allowDividerAbove="true"
settings:controller="com.android.settings.biometrics.face.FaceSettingsFooterPreferenceController" />
</PreferenceScreen>
diff --git a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java
index b5496a8..4e8be42 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java
@@ -28,13 +28,11 @@
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
+import android.widget.LinearLayout;
import androidx.preference.Preference;
import androidx.recyclerview.widget.RecyclerView;
@@ -44,6 +42,7 @@
import com.android.settingslib.RestrictedPreference;
import com.google.android.setupdesign.GlifPreferenceLayout;
+import com.google.android.setupdesign.util.ThemeHelper;
import java.util.List;
@@ -85,14 +84,13 @@
layout.setDividerInsets(Integer.MAX_VALUE, 0);
layout.setDescriptionText(R.string.vision_settings_description);
layout.setHeaderText(R.string.vision_settings_title);
- layout.setIcon(getResources().getDrawable(R.drawable.ic_accessibility_visibility));
+ layout.setIcon(getPrefContext().getDrawable(R.drawable.ic_accessibility_visibility));
- final ImageView iconView = layout.findManagedViewById(R.id.sud_layout_icon);
- final FrameLayout.LayoutParams params =
- (FrameLayout.LayoutParams) iconView.getLayoutParams();
- params.gravity = Gravity.START;
- layout.getHeaderTextView().setGravity(Gravity.START);
- layout.getDescriptionTextView().setGravity(Gravity.START);
+ if (ThemeHelper.shouldApplyExtendedPartnerConfig(getActivity())) {
+ final LinearLayout headerLayout = layout.findManagedViewById(R.id.sud_layout_header);
+ headerLayout.setPadding(0, headerLayout.getPaddingTop(), 0,
+ headerLayout.getPaddingBottom());
+ }
}
@Override
diff --git a/src/com/android/settings/applications/GameSettingsFeatureProvider.java b/src/com/android/settings/applications/GameSettingsFeatureProvider.java
new file mode 100644
index 0000000..ac2d6bd
--- /dev/null
+++ b/src/com/android/settings/applications/GameSettingsFeatureProvider.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2021 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.applications;
+
+import android.content.Context;
+
+/**
+ * Provider for Game Settings related feature.
+ */
+public interface GameSettingsFeatureProvider {
+ /**
+ * Returns true if the feature is supported.
+ */
+ boolean isSupported(Context context);
+
+ /**
+ * Launch GameSettings
+ */
+ void launchGameSettings(Context context);
+}
diff --git a/src/com/android/settings/applications/GameSettingsFeatureProviderImpl.java b/src/com/android/settings/applications/GameSettingsFeatureProviderImpl.java
new file mode 100644
index 0000000..67212e7
--- /dev/null
+++ b/src/com/android/settings/applications/GameSettingsFeatureProviderImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2021 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.applications;
+
+import android.content.Context;
+
+/**
+ * Provider implementation for Game Settings related features.
+ */
+public class GameSettingsFeatureProviderImpl implements
+ GameSettingsFeatureProvider {
+ @Override
+ public boolean isSupported(Context context) {
+ return false;
+ }
+
+ @Override
+ public void launchGameSettings(Context context) {
+ return;
+ }
+}
diff --git a/src/com/android/settings/applications/GameSettingsPreferenceController.java b/src/com/android/settings/applications/GameSettingsPreferenceController.java
new file mode 100644
index 0000000..67c1bb1
--- /dev/null
+++ b/src/com/android/settings/applications/GameSettingsPreferenceController.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2021 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.applications;
+
+import android.content.Context;
+import android.text.TextUtils;
+
+import androidx.preference.Preference;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.overlay.FeatureFactory;
+
+/** Contains logic that deals with showing Game Settings in app settings. */
+public class GameSettingsPreferenceController extends BasePreferenceController {
+
+ @VisibleForTesting
+ final GameSettingsFeatureProvider mGameSettingsFeatureProvider;
+
+ public GameSettingsPreferenceController(Context context, String key) {
+ super(context, key);
+ mGameSettingsFeatureProvider =
+ FeatureFactory.getFactory(context).getGameSettingsFeatureProvider();
+ }
+
+ GameSettingsPreferenceController(Context context, String key,
+ GameSettingsFeatureProvider gameSettingsFeatureProvider) {
+ super(context, key);
+ mGameSettingsFeatureProvider = gameSettingsFeatureProvider;
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return mGameSettingsFeatureProvider.isSupported(mContext)
+ ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ }
+
+ @Override
+ public boolean handlePreferenceTreeClick(Preference preference) {
+ if (TextUtils.equals(getPreferenceKey(), preference.getKey())) {
+ mGameSettingsFeatureProvider.launchGameSettings(mContext);
+ return true;
+ }
+ return super.handlePreferenceTreeClick(preference);
+ }
+}
diff --git a/src/com/android/settings/applications/appinfo/AlarmsAndRemindersDetails.java b/src/com/android/settings/applications/appinfo/AlarmsAndRemindersDetails.java
index 25d7332..3765dd9 100644
--- a/src/com/android/settings/applications/appinfo/AlarmsAndRemindersDetails.java
+++ b/src/com/android/settings/applications/appinfo/AlarmsAndRemindersDetails.java
@@ -81,6 +81,9 @@
if (savedInstanceState != null) {
mUncommittedState = (Boolean) savedInstanceState.get(UNCOMMITTED_STATE_KEY);
+ if (mUncommittedState != null && isAppSpecific()) {
+ setResult(mUncommittedState ? RESULT_OK : RESULT_CANCELED);
+ }
}
addPreferencesFromResource(R.xml.alarms_and_reminders);
mSwitchPref = findPreference(KEY_SWITCH);
@@ -97,9 +100,11 @@
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
- final boolean checked = (Boolean) newValue;
if (preference == mSwitchPref) {
- mUncommittedState = checked;
+ mUncommittedState = (Boolean) newValue;
+ if (isAppSpecific()) {
+ setResult(mUncommittedState ? RESULT_OK : RESULT_CANCELED);
+ }
refreshUi();
return true;
}
@@ -125,6 +130,11 @@
newState ? 1 : 0);
}
+ private boolean isAppSpecific() {
+ return Settings.AlarmsAndRemindersAppActivity.class.getName().equals(
+ getIntent().getComponent().getClassName());
+ }
+
@Override
public void onPause() {
super.onPause();
@@ -133,10 +143,6 @@
}
if (mPermissionState != null && mUncommittedState != null
&& mUncommittedState != mPermissionState.isAllowed()) {
- if (Settings.AlarmsAndRemindersAppActivity.class.getName().equals(
- getIntent().getComponent().getClassName())) {
- setResult(mUncommittedState ? RESULT_OK : RESULT_CANCELED);
- }
setCanScheduleAlarms(mUncommittedState);
logPermissionChange(mUncommittedState, mPackageName);
mUncommittedState = null;
diff --git a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
index c3031ef..ea34faf 100644
--- a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
@@ -269,6 +269,8 @@
@Override
public void onClick(View v) {
+ mMetricsFeatureProvider.action(
+ mActivity, SettingsEnums.ACTION_APP_INFO_FORCE_STOP);
// force stop
if (mAppsControlDisallowedAdmin != null && !mAppsControlDisallowedBySystem) {
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(
@@ -724,6 +726,8 @@
mPackageName, AUTO_REVOKED_APP_INTERACTION__ACTION__OPEN_IN_SETTINGS);
}
mContext.startActivityAsUser(mAppLaunchIntent, new UserHandle(mUserId));
+ mMetricsFeatureProvider.action(mActivity,
+ SettingsEnums.ACTION_APP_INFO_OPEN, mPackageName);
}
}
diff --git a/src/com/android/settings/biometrics/BiometricEnrollBase.java b/src/com/android/settings/biometrics/BiometricEnrollBase.java
index 67148d1..22420d0 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollBase.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollBase.java
@@ -20,7 +20,6 @@
import android.annotation.Nullable;
import android.content.Intent;
-import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
import android.os.UserHandle;
@@ -38,6 +37,7 @@
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
import com.google.android.setupdesign.GlifLayout;
+import com.google.android.setupdesign.util.ThemeHelper;
/**
* Base activity for all biometric enrollment steps.
@@ -100,6 +100,8 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ setTheme(SetupWizardUtils.getTheme(this, getIntent()));
+ ThemeHelper.trySetDynamicColor(this);
mChallenge = getIntent().getLongExtra(EXTRA_KEY_CHALLENGE, -1L);
mSensorId = getIntent().getIntExtra(EXTRA_KEY_SENSOR_ID, -1);
// Don't need to retrieve the HAT if it already exists. In some cases, the extras do not
@@ -123,13 +125,6 @@
}
@Override
- protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
- final int new_resid = SetupWizardUtils.getTheme(this, getIntent());
- theme.applyStyle(R.style.SetupWizardPartnerResource, true);
- super.onApplyThemeResource(theme, new_resid, first);
- }
-
- @Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(EXTRA_KEY_LAUNCHED_CONFIRM, mLaunchedConfirmLock);
diff --git a/src/com/android/settings/display/BatteryPercentagePreferenceController.java b/src/com/android/settings/display/BatteryPercentagePreferenceController.java
index 945ce47..448fb2b 100644
--- a/src/com/android/settings/display/BatteryPercentagePreferenceController.java
+++ b/src/com/android/settings/display/BatteryPercentagePreferenceController.java
@@ -17,6 +17,7 @@
import static android.provider.Settings.System.SHOW_BATTERY_PERCENT;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.provider.Settings;
@@ -28,6 +29,7 @@
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.overlay.FeatureFactory;
/**
* A controller to manage the switch for showing battery percentage in the status bar.
@@ -75,6 +77,8 @@
boolean showPercentage = (Boolean) newValue;
Settings.System.putInt(mContext.getContentResolver(), SHOW_BATTERY_PERCENT,
showPercentage ? 1 : 0);
+ FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
+ .action(mContext, SettingsEnums.OPEN_BATTERY_PERCENTAGE, showPercentage);
return true;
}
}
diff --git a/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java b/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java
index 1140291..86ffa47 100644
--- a/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java
+++ b/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java
@@ -16,21 +16,17 @@
package com.android.settings.enterprise;
-import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED;
-
import android.annotation.NonNull;
import android.annotation.UserIdInt;
import android.app.Activity;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
-import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Process;
import android.os.UserHandle;
-import android.os.UserManager;
import android.util.IconDrawableFactory;
import android.view.LayoutInflater;
import android.view.View;
@@ -42,12 +38,12 @@
import androidx.appcompat.app.AlertDialog;
import com.android.settings.R;
-import com.android.settings.Settings;
import com.android.settings.Utils;
-import com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminAdd;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedLockUtilsInternal;
+import com.android.settingslib.enterprise.ActionDisabledByAdminController;
+import com.android.settingslib.enterprise.ActionDisabledByAdminControllerFactory;
import java.util.Objects;
@@ -60,10 +56,16 @@
@VisibleForTesting EnforcedAdmin mEnforcedAdmin;
private ViewGroup mDialogView;
private String mRestriction = null;
- private Activity mActivity;
+ private final Activity mActivity;
+ private final ActionDisabledByAdminController mActionDisabledByAdminController;
public ActionDisabledByAdminDialogHelper(Activity activity) {
mActivity = activity;
+ mActionDisabledByAdminController =
+ ActionDisabledByAdminControllerFactory.createInstance(
+ mActivity.getSystemService(DevicePolicyManager.class),
+ new ActionDisabledLearnMoreButtonLauncherImpl(),
+ new DeviceAdminStringProviderImpl(mActivity));
}
private @UserIdInt int getEnforcementAdminUserId(@NonNull EnforcedAdmin admin) {
@@ -83,10 +85,10 @@
mEnforcedAdmin = enforcedAdmin;
mRestriction = restriction;
final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
- mDialogView = (ViewGroup) LayoutInflater.from(builder.getContext()).inflate(
+ mDialogView = (ViewGroup) LayoutInflater.from(mActivity).inflate(
R.layout.admin_support_details_dialog, null);
- initializeDialogViews(mDialogView, mEnforcedAdmin.component, getEnforcementAdminUserId(),
- mRestriction);
+ initializeDialogViews(mDialogView, mEnforcedAdmin, getEnforcementAdminUserId(),
+ mRestriction, mActionDisabledByAdminController);
builder.setPositiveButton(R.string.okay, null).setView(mDialogView);
maybeSetLearnMoreButton(builder);
return builder;
@@ -94,16 +96,7 @@
@VisibleForTesting
void maybeSetLearnMoreButton(AlertDialog.Builder builder) {
- // The "Learn more" button appears only if the restriction is enforced by an admin in the
- // same profile group. Otherwise the admin package and its policies are not accessible to
- // the current user.
- final UserManager um = UserManager.get(mActivity.getApplicationContext());
- if (um.isSameProfileGroup(getEnforcementAdminUserId(mEnforcedAdmin), um.getUserHandle())) {
- builder.setNeutralButton(R.string.learn_more, (dialog, which) -> {
- showAdminPolicies(mEnforcedAdmin, mActivity);
- mActivity.finish();
- });
- }
+ mActionDisabledByAdminController.setupLearnMoreButton(mActivity, builder);
}
public void updateDialog(String restriction, EnforcedAdmin admin) {
@@ -112,16 +105,18 @@
}
mEnforcedAdmin = admin;
mRestriction = restriction;
- initializeDialogViews(mDialogView, mEnforcedAdmin.component, getEnforcementAdminUserId(),
- mRestriction);
+ initializeDialogViews(mDialogView, mEnforcedAdmin, getEnforcementAdminUserId(),
+ mRestriction, mActionDisabledByAdminController);
}
- private void initializeDialogViews(View root, ComponentName admin, int userId,
- String restriction) {
+ private void initializeDialogViews(View root, EnforcedAdmin enforcedAdmin, int userId,
+ String restriction, ActionDisabledByAdminController controller) {
+ ComponentName admin = enforcedAdmin.component;
if (admin == null) {
return;
}
+ controller.updateEnforcedAdmin(enforcedAdmin, userId);
setAdminSupportIcon(root, admin, userId);
if (isNotCurrentUserOrProfile(admin, userId)) {
@@ -171,37 +166,8 @@
if (titleView == null) {
return;
}
- if (isFinancedDevice()) {
- titleView.setText(R.string.disabled_by_policy_title_financed_device);
- return;
- }
- if (restriction == null) {
- titleView.setText(R.string.disabled_by_policy_title);
- return;
- }
- switch (restriction) {
- case UserManager.DISALLOW_ADJUST_VOLUME:
- titleView.setText(R.string.disabled_by_policy_title_adjust_volume);
- break;
- case UserManager.DISALLOW_OUTGOING_CALLS:
- titleView.setText(R.string.disabled_by_policy_title_outgoing_calls);
- break;
- case UserManager.DISALLOW_SMS:
- titleView.setText(R.string.disabled_by_policy_title_sms);
- break;
- case DevicePolicyManager.POLICY_DISABLE_CAMERA:
- titleView.setText(R.string.disabled_by_policy_title_camera);
- break;
- case DevicePolicyManager.POLICY_DISABLE_SCREEN_CAPTURE:
- titleView.setText(R.string.disabled_by_policy_title_screen_capture);
- break;
- case DevicePolicyManager.POLICY_SUSPEND_PACKAGES:
- titleView.setText(R.string.disabled_by_policy_title_suspend_packages);
- break;
- default:
- // Use general text if no specialized title applies
- titleView.setText(R.string.disabled_by_policy_title);
- }
+ titleView.setText(
+ mActionDisabledByAdminController.getAdminSupportTitle(restriction));
}
@VisibleForTesting
@@ -227,34 +193,12 @@
getEnforcementAdminUserId(enforcedAdmin));
}
}
+ final CharSequence supportContentString =
+ mActionDisabledByAdminController.getAdminSupportContentString(
+ mActivity, supportMessage);
final TextView textView = root.findViewById(R.id.admin_support_msg);
- if (supportMessage != null) {
- textView.setText(supportMessage);
+ if (supportContentString != null) {
+ textView.setText(supportContentString);
}
}
-
- @VisibleForTesting
- void showAdminPolicies(final EnforcedAdmin enforcedAdmin, final Activity activity) {
- final Intent intent = new Intent();
- if (enforcedAdmin.component != null) {
- intent.setClass(activity, DeviceAdminAdd.class);
- intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
- enforcedAdmin.component);
- intent.putExtra(DeviceAdminAdd.EXTRA_CALLED_FROM_SUPPORT_DIALOG, true);
- // DeviceAdminAdd class may need to run as managed profile.
- activity.startActivityAsUser(intent, enforcedAdmin.user);
- } else {
- intent.setClass(activity, Settings.DeviceAdminSettingsActivity.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- // Activity merges both managed profile and parent users
- // admins so show as same user as this activity.
- activity.startActivity(intent);
- }
- }
-
- private boolean isFinancedDevice() {
- final DevicePolicyManager dpm = mActivity.getSystemService(DevicePolicyManager.class);
- return dpm.isDeviceManaged() && dpm.getDeviceOwnerType(
- dpm.getDeviceOwnerComponentOnAnyUser()) == DEVICE_OWNER_TYPE_FINANCED;
- }
}
diff --git a/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImpl.java b/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImpl.java
new file mode 100644
index 0000000..b4d97e4
--- /dev/null
+++ b/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImpl.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2021 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.enterprise;
+
+import static java.util.Objects.requireNonNull;
+
+import android.app.Activity;
+import android.app.admin.DevicePolicyManager;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.UserHandle;
+import android.os.UserManager;
+
+import androidx.appcompat.app.AlertDialog;
+
+import com.android.settings.R;
+import com.android.settings.Settings;
+import com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminAdd;
+import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
+import com.android.settingslib.enterprise.ActionDisabledLearnMoreButtonLauncher;
+
+import java.util.function.BiConsumer;
+
+/**
+ * Helper class to set up the "Learn more" button in the action disabled dialog.
+ */
+public class ActionDisabledLearnMoreButtonLauncherImpl
+ implements ActionDisabledLearnMoreButtonLauncher {
+
+ static final BiConsumer<Activity, EnforcedAdmin> SHOW_ADMIN_POLICIES =
+ (activity, enforcedAdmin) -> {
+ showAdminPolicies(enforcedAdmin, activity);
+ activity.finish();
+ };
+
+ static final BiConsumer<Activity, String> LAUNCH_HELP_PAGE = (activity, url) -> {
+ launchLearnMoreHelpPage(activity, url);
+ activity.finish();
+ };
+
+ @Override
+ public void setupLearnMoreButtonToShowAdminPolicies(
+ Activity activity,
+ AlertDialog.Builder builder,
+ int enforcementAdminUserId,
+ EnforcedAdmin enforcedAdmin) {
+ requireNonNull(activity);
+ requireNonNull(builder);
+ requireNonNull(enforcedAdmin);
+ // The "Learn more" button appears only if the restriction is enforced by an admin in the
+ // same profile group. Otherwise the admin package and its policies are not accessible to
+ // the current user.
+ final UserManager um = UserManager.get(activity);
+ if (um.isSameProfileGroup(enforcementAdminUserId, um.getUserHandle())) {
+ setupLearnMoreButton(builder, () ->
+ SHOW_ADMIN_POLICIES.accept(activity, enforcedAdmin));
+ }
+ }
+
+ @Override
+ public void setupLearnMoreButtonToLaunchHelpPage(
+ Activity activity,
+ AlertDialog.Builder builder,
+ String url) {
+ requireNonNull(activity);
+ requireNonNull(builder);
+ requireNonNull(url);
+ setupLearnMoreButton(builder, () -> LAUNCH_HELP_PAGE.accept(activity, url));
+ }
+
+ private void setupLearnMoreButton(AlertDialog.Builder builder, Runnable runnable) {
+ builder.setNeutralButton(R.string.learn_more, (dialog, which) -> {
+ runnable.run();
+ });
+ }
+
+ private static void launchLearnMoreHelpPage(Activity activity, String url) {
+ activity.startActivityAsUser(createLearnMoreIntent(url), UserHandle.SYSTEM);
+ }
+
+ private static Intent createLearnMoreIntent(String url) {
+ final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ return intent;
+ }
+
+ private static void showAdminPolicies(
+ EnforcedAdmin enforcedAdmin,
+ Activity activity) {
+ final Intent intent = new Intent();
+ if (enforcedAdmin.component != null) {
+ intent.setClass(activity, DeviceAdminAdd.class);
+ intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
+ enforcedAdmin.component);
+ intent.putExtra(DeviceAdminAdd.EXTRA_CALLED_FROM_SUPPORT_DIALOG, true);
+ // DeviceAdminAdd class may need to run as managed profile.
+ activity.startActivityAsUser(intent, enforcedAdmin.user);
+ } else {
+ intent.setClass(activity, Settings.DeviceAdminSettingsActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ // Activity merges both managed profile and parent users
+ // admins so show as same user as this activity.
+ activity.startActivity(intent);
+ }
+ }
+}
diff --git a/src/com/android/settings/enterprise/DeviceAdminStringProviderImpl.java b/src/com/android/settings/enterprise/DeviceAdminStringProviderImpl.java
new file mode 100644
index 0000000..68b2021
--- /dev/null
+++ b/src/com/android/settings/enterprise/DeviceAdminStringProviderImpl.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2021 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.enterprise;
+
+import static java.util.Objects.requireNonNull;
+
+import android.content.Context;
+
+import com.android.settings.R;
+import com.android.settingslib.enterprise.DeviceAdminStringProvider;
+
+class DeviceAdminStringProviderImpl implements DeviceAdminStringProvider {
+ private final Context mContext;
+
+ DeviceAdminStringProviderImpl(Context context) {
+ mContext = requireNonNull(context);
+ }
+
+ @Override
+ public String getDefaultDisabledByPolicyTitle() {
+ return mContext.getString(R.string.disabled_by_policy_title);
+ }
+
+ @Override
+ public String getDisallowAdjustVolumeTitle() {
+ return mContext.getString(R.string.disabled_by_policy_title_adjust_volume);
+ }
+
+ @Override
+ public String getDisallowOutgoingCallsTitle() {
+ return mContext.getString(R.string.disabled_by_policy_title_outgoing_calls);
+ }
+
+ @Override
+ public String getDisallowSmsTitle() {
+ return mContext.getString(R.string.disabled_by_policy_title_sms);
+ }
+
+ @Override
+ public String getDisableCameraTitle() {
+ return mContext.getString(R.string.disabled_by_policy_title_camera);
+ }
+
+ @Override
+ public String getDisableScreenCaptureTitle() {
+ return mContext.getString(R.string.disabled_by_policy_title_screen_capture);
+ }
+
+ @Override
+ public String getSuspendPackagesTitle() {
+ return mContext.getString(R.string.disabled_by_policy_title_suspend_packages);
+ }
+
+ @Override
+ public String getDefaultDisabledByPolicyContent() {
+ return mContext.getString(R.string.default_admin_support_msg);
+ }
+
+ @Override
+ public String getLearnMoreHelpPageUrl() {
+ return mContext.getString(R.string.help_url_action_disabled_by_it_admin);
+ }
+
+ @Override
+ public String getDisabledByPolicyTitleForFinancedDevice() {
+ return mContext.getString(R.string.disabled_by_policy_title_financed_device);
+ }
+}
diff --git a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
index 2b83288..965994d 100644
--- a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
@@ -49,6 +49,7 @@
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.utils.StringUtil;
import com.android.settingslib.widget.LayoutPreference;
import com.android.settingslib.widget.RadioButtonPreference;
@@ -113,6 +114,7 @@
@VisibleForTesting
boolean enableTriState = true;
+ private MetricsFeatureProvider mMetricsFeatureProvider;
private AppButtonsPreferenceController mAppButtonsPreferenceController;
private BackgroundActivityPreferenceController mBackgroundActivityPreferenceController;
@@ -240,6 +242,8 @@
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
+ mMetricsFeatureProvider = FeatureFactory.getFactory(getContext())
+ .getMetricsFeatureProvider();
final String packageName = getArguments().getString(EXTRA_PACKAGE_NAME);
if (enableTriState) {
@@ -262,6 +266,9 @@
initHeader();
if (enableTriState) {
initPreferenceForTriState(getContext());
+ final String packageName = mBatteryOptimizeUtils.getPackageName();
+ mMetricsFeatureProvider.action(getContext(),
+ SettingsEnums.OPEN_APP_BATTERY_USAGE, packageName);
} else {
initPreference(getContext());
}
@@ -411,9 +418,24 @@
@Override
public void onRadioButtonClicked(RadioButtonPreference selected) {
- updatePreferenceState(mUnrestrictedPreference, selected.getKey());
- updatePreferenceState(mOptimizePreference, selected.getKey());
- updatePreferenceState(mRestrictedPreference, selected.getKey());
+ final String selectedKey = selected.getKey();
+ updatePreferenceState(mUnrestrictedPreference, selectedKey);
+ updatePreferenceState(mOptimizePreference, selectedKey);
+ updatePreferenceState(mRestrictedPreference, selectedKey);
+
+ // Logs metric.
+ int metricCategory = 0;
+ if (selectedKey.equals(mUnrestrictedPreference.getKey())) {
+ metricCategory = SettingsEnums.ACTION_APP_BATTERY_USAGE_UNRESTRICTED;
+ } else if (selectedKey.equals(mOptimizePreference.getKey())) {
+ metricCategory = SettingsEnums.ACTION_APP_BATTERY_USAGE_OPTIMIZED;
+ } else if (selectedKey.equals(mRestrictedPreference.getKey())) {
+ metricCategory = SettingsEnums.ACTION_APP_BATTERY_USAGE_RESTRICTED;
+ }
+ if (metricCategory != 0) {
+ mMetricsFeatureProvider.action(getContext(),
+ metricCategory, mBatteryOptimizeUtils.getPackageName());
+ }
}
private void updatePreferenceState(RadioButtonPreference preference, String selectedKey) {
diff --git a/src/com/android/settings/fuelgauge/BatteryOptimizeUtils.java b/src/com/android/settings/fuelgauge/BatteryOptimizeUtils.java
index 1184a77..4a56040 100644
--- a/src/com/android/settings/fuelgauge/BatteryOptimizeUtils.java
+++ b/src/com/android/settings/fuelgauge/BatteryOptimizeUtils.java
@@ -27,6 +27,7 @@
/** A utility class for application usage operation. */
public class BatteryOptimizeUtils {
private static final String TAG = "BatteryOptimizeUtils";
+ private static final String UNKNOWN_PACKAGE = "unknown";
@VisibleForTesting AppOpsManager mAppOpsManager;
@VisibleForTesting BatteryUtils mBatteryUtils;
@@ -108,6 +109,10 @@
|| mPowerAllowListBackend.isDefaultActiveApp(mPackageName);
}
+ String getPackageName() {
+ return mPackageName == null ? UNKNOWN_PACKAGE : mPackageName;
+ }
+
private void refreshState() {
mPowerAllowListBackend.refreshList();
mAllowListed = mPowerAllowListBackend.isAllowlisted(mPackageName);
diff --git a/src/com/android/settings/fuelgauge/RestrictAppPreferenceController.java b/src/com/android/settings/fuelgauge/RestrictAppPreferenceController.java
index 1460d75..b960d4c 100644
--- a/src/com/android/settings/fuelgauge/RestrictAppPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/RestrictAppPreferenceController.java
@@ -18,6 +18,7 @@
package com.android.settings.fuelgauge;
import android.app.AppOpsManager;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.UserManager;
@@ -29,6 +30,7 @@
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.fuelgauge.batterytip.AppInfo;
import com.android.settings.fuelgauge.batterytip.BatteryTipUtils;
+import com.android.settings.overlay.FeatureFactory;
import java.util.List;
@@ -80,6 +82,8 @@
// start fragment
RestrictedAppDetails.startRestrictedAppDetails(mPreferenceFragment,
mAppInfos);
+ FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
+ .action(mContext, SettingsEnums.OPEN_APP_RESTRICTED_LIST);
return true;
}
diff --git a/src/com/android/settings/fuelgauge/RestrictedAppDetails.java b/src/com/android/settings/fuelgauge/RestrictedAppDetails.java
index db83140..77eaa23 100644
--- a/src/com/android/settings/fuelgauge/RestrictedAppDetails.java
+++ b/src/com/android/settings/fuelgauge/RestrictedAppDetails.java
@@ -44,8 +44,10 @@
import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
import com.android.settings.fuelgauge.batterytip.tips.RestrictAppTip;
import com.android.settings.fuelgauge.batterytip.tips.UnrestrictAppTip;
+import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.AppCheckBoxPreference;
import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.utils.StringUtil;
import java.util.List;
@@ -76,6 +78,8 @@
@VisibleForTesting
BatteryDatabaseManager mBatteryDatabaseManager;
+ private MetricsFeatureProvider mMetricsFeatureProvider;
+
public static void startRestrictedAppDetails(InstrumentedPreferenceFragment fragment,
List<AppInfo> appInfos) {
final Bundle args = new Bundle();
@@ -100,7 +104,8 @@
mIconDrawableFactory = IconDrawableFactory.newInstance(context);
mBatteryUtils = BatteryUtils.getInstance(context);
mBatteryDatabaseManager = BatteryDatabaseManager.getInstance(context);
-
+ mMetricsFeatureProvider =
+ FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
refreshUi();
}
@@ -162,7 +167,9 @@
(Boolean) value);
fragment.setTargetFragment(this, 0 /* requestCode */);
fragment.show(getFragmentManager(), TAG);
-
+ mMetricsFeatureProvider.action(getContext(),
+ SettingsEnums.ACTION_APP_RESTRICTED_LIST_UNCHECKED,
+ appInfo.packageName);
return false;
});
diff --git a/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java b/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java
index 7501897..1e9c240 100644
--- a/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java
+++ b/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java
@@ -19,7 +19,6 @@
import android.content.Context;
import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
import com.android.settings.widget.SettingsMainSwitchPreferenceController;
/**
@@ -33,9 +32,8 @@
@Override
public int getAvailabilityStatus() {
- return OneHandedSettingsUtils.isSupportOneHandedMode()
- ? BasePreferenceController.AVAILABLE
- : BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+ return OneHandedSettingsUtils.isFeatureAvailable(mContext)
+ ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/gestures/OneHandedSettingsUtils.java b/src/com/android/settings/gestures/OneHandedSettingsUtils.java
index 5de02db..21998a6 100644
--- a/src/com/android/settings/gestures/OneHandedSettingsUtils.java
+++ b/src/com/android/settings/gestures/OneHandedSettingsUtils.java
@@ -177,6 +177,28 @@
}
/**
+ * Get NavigationBar mode flag from Settings provider.
+ * @param context App context
+ * @return Navigation bar mode:
+ * 0 = 3 button
+ * 1 = 2 button
+ * 2 = fully gestural
+ */
+ public static int getNavigationBarMode(Context context) {
+ return Settings.Secure.getIntForUser(context.getContentResolver(),
+ Settings.Secure.NAVIGATION_MODE, 2 /* fully gestural */, sCurrentUserId);
+ }
+
+ /**
+ *
+ * @param context App context
+ * @return Support One-Handed mode feature or not.
+ */
+ public static boolean isFeatureAvailable(Context context) {
+ return isSupportOneHandedMode() && getNavigationBarMode(context) != 0;
+ }
+
+ /**
* Registers callback for observing Settings.Secure.ONE_HANDED_MODE_ENABLED state.
* @param callback for state changes
*/
diff --git a/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java b/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java
index 320d006..ec81482 100644
--- a/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java
+++ b/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java
@@ -33,7 +33,8 @@
@Override
public int getAvailabilityStatus() {
- return OneHandedSettingsUtils.isSupportOneHandedMode() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ return OneHandedSettingsUtils.isFeatureAvailable(mContext)
+ ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/network/ProviderModelSlice.java b/src/com/android/settings/network/ProviderModelSlice.java
index 84581d7..6b6180b 100644
--- a/src/com/android/settings/network/ProviderModelSlice.java
+++ b/src/com/android/settings/network/ProviderModelSlice.java
@@ -34,6 +34,7 @@
import androidx.core.graphics.drawable.IconCompat;
import androidx.slice.Slice;
import androidx.slice.builders.ListBuilder;
+import androidx.slice.builders.SliceAction;
import com.android.settings.R;
import com.android.settings.SubSettings;
@@ -59,6 +60,8 @@
public class ProviderModelSlice extends WifiSlice {
private static final String TAG = "ProviderModelSlice";
+ protected static final String ACTION_TITLE_CONNECT_TO_CARRIER = "Connect_To_Carrier";
+
private final ProviderModelSliceHelper mHelper;
public ProviderModelSlice(Context context) {
@@ -250,6 +253,31 @@
}
@Override
+ protected ListBuilder.RowBuilder getWifiSliceItemRow(WifiSliceItem wifiSliceItem) {
+ final CharSequence title = wifiSliceItem.getTitle();
+ final IconCompat levelIcon = getWifiSliceItemLevelIcon(wifiSliceItem);
+ final ListBuilder.RowBuilder rowBuilder = new ListBuilder.RowBuilder()
+ .setTitleItem(levelIcon, ListBuilder.ICON_IMAGE)
+ .setTitle(title)
+ .setSubtitle(wifiSliceItem.getSummary())
+ .setContentDescription(wifiSliceItem.getContentDescription());
+
+ final IconCompat endIcon;
+ if (wifiSliceItem.hasInternetAccess()) {
+ rowBuilder.setPrimaryAction(SliceAction.create(getBroadcastIntent(mContext),
+ levelIcon, ListBuilder.ICON_IMAGE, ACTION_TITLE_CONNECT_TO_CARRIER));
+ endIcon = IconCompat.createWithResource(mContext, R.drawable.ic_settings_close);
+ } else {
+ rowBuilder.setPrimaryAction(getWifiEntryAction(wifiSliceItem, levelIcon, title));
+ endIcon = getEndIcon(wifiSliceItem);
+ }
+ if (endIcon != null) {
+ rowBuilder.addEndItem(endIcon, ListBuilder.ICON_IMAGE);
+ }
+ return rowBuilder;
+ }
+
+ @Override
protected IconCompat getWifiSliceItemLevelIcon(WifiSliceItem wifiSliceItem) {
if (wifiSliceItem.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED
&& getInternetType() != InternetUpdater.INTERNET_WIFI) {
diff --git a/src/com/android/settings/network/telephony/Enable2gPreferenceController.java b/src/com/android/settings/network/telephony/Enable2gPreferenceController.java
index 5c7d224..5ae04ed 100644
--- a/src/com/android/settings/network/telephony/Enable2gPreferenceController.java
+++ b/src/com/android/settings/network/telephony/Enable2gPreferenceController.java
@@ -80,7 +80,7 @@
&& carrierConfig != null
&& !carrierConfig.getBoolean(CarrierConfigManager.KEY_HIDE_ENABLE_2G)
&& mTelephonyManager.isRadioInterfaceCapabilitySupported(
- mTelephonyManager.CAPABILITY_ALLOWED_NETWORK_TYPES_USED);
+ mTelephonyManager.CAPABILITY_USES_ALLOWED_NETWORK_TYPES_BITMASK);
return visible ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}
diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java
index 27e2b72..c8d5ffd 100644
--- a/src/com/android/settings/notification/RedactionInterstitial.java
+++ b/src/com/android/settings/notification/RedactionInterstitial.java
@@ -26,7 +26,6 @@
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
-import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserManager;
import android.provider.Settings;
@@ -50,6 +49,7 @@
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
import com.google.android.setupdesign.GlifLayout;
+import com.google.android.setupdesign.util.ThemeHelper;
public class RedactionInterstitial extends SettingsActivity {
@@ -61,18 +61,14 @@
}
@Override
- protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
- final int new_resid = SetupWizardUtils.getTheme(this, getIntent());
- super.onApplyThemeResource(theme, new_resid, first);
- }
-
- @Override
protected boolean isValidFragment(String fragmentName) {
return RedactionInterstitialFragment.class.getName().equals(fragmentName);
}
@Override
protected void onCreate(Bundle savedInstance) {
+ setTheme(SetupWizardUtils.getTheme(this, getIntent()));
+ ThemeHelper.trySetDynamicColor(this);
super.onCreate(savedInstance);
findViewById(R.id.content_parent).setFitsSystemWindows(false);
}
diff --git a/src/com/android/settings/overlay/FeatureFactory.java b/src/com/android/settings/overlay/FeatureFactory.java
index e7b23b9..58f80fc 100644
--- a/src/com/android/settings/overlay/FeatureFactory.java
+++ b/src/com/android/settings/overlay/FeatureFactory.java
@@ -25,6 +25,7 @@
import com.android.settings.R;
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
+import com.android.settings.applications.GameSettingsFeatureProvider;
import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.biometrics.face.FaceFeatureProvider;
@@ -168,6 +169,11 @@
*/
public abstract SecuritySettingsFeatureProvider getSecuritySettingsFeatureProvider();
+ /**
+ * Retrieve implementation for Game Settings feature.
+ */
+ public abstract GameSettingsFeatureProvider getGameSettingsFeatureProvider();
+
public static final class FactoryNotFoundException extends RuntimeException {
public FactoryNotFoundException(Throwable throwable) {
super("Unable to create factory. Did you misconfigure Proguard?", throwable);
diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java
index 00f9a0e..13b7b60 100644
--- a/src/com/android/settings/overlay/FeatureFactoryImpl.java
+++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java
@@ -29,6 +29,8 @@
import com.android.settings.accounts.AccountFeatureProviderImpl;
import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProviderImpl;
+import com.android.settings.applications.GameSettingsFeatureProvider;
+import com.android.settings.applications.GameSettingsFeatureProviderImpl;
import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProviderImpl;
import com.android.settings.aware.AwareFeatureProvider;
@@ -103,6 +105,7 @@
private WifiTrackerLibProvider mWifiTrackerLibProvider;
private ExtraAppInfoFeatureProvider mExtraAppInfoFeatureProvider;
private SecuritySettingsFeatureProvider mSecuritySettingsFeatureProvider;
+ private GameSettingsFeatureProvider mGameSettingsFeatureProvider;
@Override
public SupportFeatureProvider getSupportFeatureProvider(Context context) {
@@ -324,4 +327,12 @@
}
return mSecuritySettingsFeatureProvider;
}
+
+ @Override
+ public GameSettingsFeatureProvider getGameSettingsFeatureProvider() {
+ if (mGameSettingsFeatureProvider == null) {
+ mGameSettingsFeatureProvider = new GameSettingsFeatureProviderImpl();
+ }
+ return mGameSettingsFeatureProvider;
+ }
}
diff --git a/src/com/android/settings/panel/InternetConnectivityPanel.java b/src/com/android/settings/panel/InternetConnectivityPanel.java
index 163afa1..50371ae 100644
--- a/src/com/android/settings/panel/InternetConnectivityPanel.java
+++ b/src/com/android/settings/panel/InternetConnectivityPanel.java
@@ -65,6 +65,8 @@
private static final String TAG = "InternetConnectivityPanel";
private static final int SUBTITLE_TEXT_NONE = -1;
private static final int SUBTITLE_TEXT_WIFI_IS_TURNED_ON = R.string.wifi_is_turned_on_subtitle;
+ private static final int SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET =
+ R.string.select_network_to_connect_internet;
private static final int SUBTITLE_TEXT_SEARCHING_FOR_NETWORKS =
R.string.wifi_empty_list_wifi_on;
private static final int SUBTITLE_TEXT_NON_CARRIER_NETWORK_UNAVAILABLE =
@@ -322,6 +324,9 @@
final List<ScanResult> wifiList = mWifiManager.getScanResults();
if (wifiList != null && wifiList.size() != 0) {
+ // When the Wi-Fi scan result is not empty
+ // Sub-Title: Select the network you want to use for data
+ mSubtitle = SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET;
return;
}
diff --git a/src/com/android/settings/password/ChooseLockPassword.java b/src/com/android/settings/password/ChooseLockPassword.java
index 6382abf..06b17cd 100644
--- a/src/com/android/settings/password/ChooseLockPassword.java
+++ b/src/com/android/settings/password/ChooseLockPassword.java
@@ -42,7 +42,6 @@
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
-import android.content.res.Resources.Theme;
import android.graphics.Insets;
import android.graphics.Typeface;
import android.os.Bundle;
@@ -89,6 +88,7 @@
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupdesign.GlifLayout;
+import com.google.android.setupdesign.util.ThemeHelper;
import java.util.ArrayList;
import java.util.Collections;
@@ -107,12 +107,6 @@
return modIntent;
}
- @Override
- protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
- final int new_resid = SetupWizardUtils.getTheme(this, getIntent());
- super.onApplyThemeResource(theme, new_resid, first);
- }
-
public static class IntentBuilder {
private final Intent mIntent;
@@ -207,6 +201,8 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SetupWizardUtils.getTheme(this, getIntent()));
+ ThemeHelper.trySetDynamicColor(this);
super.onCreate(savedInstanceState);
findViewById(R.id.content_parent).setFitsSystemWindows(false);
}
diff --git a/src/com/android/settings/password/ChooseLockPattern.java b/src/com/android/settings/password/ChooseLockPattern.java
index 6e5368d..53898a6 100644
--- a/src/com/android/settings/password/ChooseLockPattern.java
+++ b/src/com/android/settings/password/ChooseLockPattern.java
@@ -33,10 +33,8 @@
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
-import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.ScrollView;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
@@ -61,6 +59,8 @@
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupdesign.GlifLayout;
+import com.google.android.setupdesign.template.IconMixin;
+import com.google.android.setupdesign.util.ThemeHelper;
import java.util.Collections;
import java.util.List;
@@ -94,12 +94,6 @@
return modIntent;
}
- @Override
- protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
- final int new_resid = SetupWizardUtils.getTheme(this, getIntent());
- super.onApplyThemeResource(theme, new_resid, first);
- }
-
public static class IntentBuilder {
private final Intent mIntent;
@@ -171,7 +165,8 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
- // requestWindowFeature(Window.FEATURE_NO_TITLE);
+ setTheme(SetupWizardUtils.getTheme(this, getIntent()));
+ ThemeHelper.trySetDynamicColor(this);
super.onCreate(savedInstanceState);
findViewById(R.id.content_parent).setFitsSystemWindows(false);
}
@@ -205,9 +200,7 @@
private LockscreenCredential mCurrentCredential;
private boolean mRequestGatekeeperPassword;
- protected TextView mTitleText;
protected TextView mHeaderText;
- protected TextView mMessageText;
protected LockPatternView mLockPatternView;
protected TextView mFooterText;
protected FooterButton mSkipOrClearButton;
@@ -215,9 +208,6 @@
@VisibleForTesting protected LockscreenCredential mChosenPattern;
private ColorStateList mDefaultHeaderColorList;
- // ScrollView that contains title and header, only exist in land mode
- private ScrollView mTitleHeaderScrollView;
-
/**
* The patten used during the help screen to show how to draw a pattern.
*/
@@ -308,15 +298,6 @@
}
mFooterText.setText("");
mNextButton.setEnabled(false);
-
- if (mTitleHeaderScrollView != null) {
- mTitleHeaderScrollView.post(new Runnable() {
- @Override
- public void run() {
- mTitleHeaderScrollView.fullScroll(ScrollView.FOCUS_DOWN);
- }
- });
- }
}
};
@@ -513,17 +494,12 @@
Bundle savedInstanceState) {
final GlifLayout layout = (GlifLayout) inflater.inflate(
R.layout.choose_lock_pattern, container, false);
- switch(getContext().getDisplay().getRotation()) {
- case Surface.ROTATION_90:
- case Surface.ROTATION_270:
- layout.setLandscapeHeaderAreaVisible(false /* visible */);
- break;
- }
updateActivityTitle();
+ layout.setHeaderText(getActivity().getTitle());
if (getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)) {
View iconView = layout.findViewById(R.id.sud_layout_icon);
if (iconView != null) {
- iconView.setVisibility(View.GONE);
+ layout.getMixin(IconMixin.class).setVisibility(View.GONE);
}
} else {
if (mForFingerprint) {
@@ -561,10 +537,8 @@
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- mTitleText = view.findViewById(R.id.suc_layout_title);
mHeaderText = (TextView) view.findViewById(R.id.headerText);
mDefaultHeaderColorList = mHeaderText.getTextColors();
- mMessageText = view.findViewById(R.id.sud_layout_description);
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
mLockPatternView.setTactileFeedbackEnabled(
@@ -573,9 +547,6 @@
mFooterText = (TextView) view.findViewById(R.id.footerText);
- mTitleHeaderScrollView = (ScrollView) view.findViewById(R.id
- .scroll_layout_title_header);
-
// make it so unhandled touch events within the unlock screen go to the
// lock pattern view.
final LinearLayoutWithDefaultTouchRecepient topLayout
@@ -756,12 +727,13 @@
} else {
mHeaderText.setText(stage.headerMessage);
}
+ final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
final boolean forAnyBiometric = mForFingerprint || mForFace || mForBiometrics;
int message = forAnyBiometric ? stage.messageForBiometrics : stage.message;
if (message == ID_EMPTY_MESSAGE) {
- mMessageText.setText("");
+ layout.setDescriptionText("");
} else {
- mMessageText.setText(message);
+ layout.setDescriptionText(message);
}
if (stage.footerMessage == ID_EMPTY_MESSAGE) {
mFooterText.setText("");
@@ -782,7 +754,7 @@
if (stage == Stage.NeedToConfirm && forAnyBiometric) {
mHeaderText.setText("");
- mTitleText.setText(R.string.lockpassword_draw_your_pattern_again_header);
+ layout.setHeaderText(R.string.lockpassword_draw_your_pattern_again_header);
}
}
diff --git a/src/com/android/settings/password/ConfirmLockPassword.java b/src/com/android/settings/password/ConfirmLockPassword.java
index 6092d9f..0278941 100644
--- a/src/com/android/settings/password/ConfirmLockPassword.java
+++ b/src/com/android/settings/password/ConfirmLockPassword.java
@@ -53,6 +53,8 @@
import com.android.settingslib.animation.AppearAnimationUtils;
import com.android.settingslib.animation.DisappearAnimationUtils;
+import com.google.android.setupdesign.GlifLayout;
+
import java.util.ArrayList;
public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
@@ -103,14 +105,13 @@
private AsyncTask<?, ?, ?> mPendingLockCheck;
private CredentialCheckResultTracker mCredentialCheckResultTracker;
private boolean mDisappearing = false;
- private TextView mHeaderTextView;
- private TextView mDetailsTextView;
private CountDownTimer mCountdownTimer;
private boolean mIsAlpha;
private InputMethodManager mImm;
private AppearAnimationUtils mAppearAnimationUtils;
private DisappearAnimationUtils mDisappearAnimationUtils;
private boolean mIsManagedProfile;
+ private GlifLayout mGlifLayout;
// required constructor for fragments
public ConfirmLockPasswordFragment() {
@@ -130,18 +131,12 @@
: R.layout.confirm_lock_password,
container,
false);
-
+ mGlifLayout = view.findViewById(R.id.setup_wizard_layout);
mPasswordEntry = (ImeAwareEditText) view.findViewById(R.id.password_entry);
mPasswordEntry.setOnEditorActionListener(this);
// EditText inside ScrollView doesn't automatically get focus.
mPasswordEntry.requestFocus();
mPasswordEntryInputDisabler = new TextViewInputDisabler(mPasswordEntry);
-
- mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
- if (mHeaderTextView == null) {
- mHeaderTextView = view.findViewById(R.id.suc_layout_title);
- }
- mDetailsTextView = (TextView) view.findViewById(R.id.sud_layout_description);
mErrorTextView = (TextView) view.findViewById(R.id.errorText);
mIsAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == storedQuality
|| DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == storedQuality
@@ -168,8 +163,8 @@
if (TextUtils.isEmpty(detailsMessage)) {
detailsMessage = getString(getDefaultDetails());
}
- mHeaderTextView.setText(headerMessage);
- mDetailsTextView.setText(detailsMessage);
+ mGlifLayout.setHeaderText(headerMessage);
+ mGlifLayout.setDescriptionText(detailsMessage);
}
int currentType = mPasswordEntry.getInputType();
if (mIsAlpha) {
@@ -194,7 +189,7 @@
110, 1f /* translationScale */,
0.5f /* delayScale */, AnimationUtils.loadInterpolator(
getContext(), android.R.interpolator.fast_out_linear_in));
- setAccessibilityTitle(mHeaderTextView.getText());
+ setAccessibilityTitle(mGlifLayout.getHeaderText());
mCredentialCheckResultTracker = (CredentialCheckResultTracker) getFragmentManager()
.findFragmentByTag(FRAGMENT_TAG_CHECK_LOCK_RESULT);
@@ -278,8 +273,8 @@
@Override
public void prepareEnterAnimation() {
super.prepareEnterAnimation();
- mHeaderTextView.setAlpha(0f);
- mDetailsTextView.setAlpha(0f);
+ mGlifLayout.getHeaderTextView().setAlpha(0f);
+ mGlifLayout.getDescriptionTextView().setAlpha(0f);
mCancelButton.setAlpha(0f);
if (mForgotButton != null) {
mForgotButton.setAlpha(0f);
@@ -290,8 +285,8 @@
private View[] getActiveViews() {
ArrayList<View> result = new ArrayList<>();
- result.add(mHeaderTextView);
- result.add(mDetailsTextView);
+ result.add(mGlifLayout.getHeaderTextView());
+ result.add(mGlifLayout.getDescriptionTextView());
if (mCancelButton.getVisibility() == View.VISIBLE) {
result.add(mCancelButton);
}
diff --git a/src/com/android/settings/password/ConfirmLockPattern.java b/src/com/android/settings/password/ConfirmLockPattern.java
index 0e18436..a1a7ea7f 100644
--- a/src/com/android/settings/password/ConfirmLockPattern.java
+++ b/src/com/android/settings/password/ConfirmLockPattern.java
@@ -28,7 +28,6 @@
import android.os.storage.StorageManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
-import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
@@ -120,12 +119,6 @@
container,
false);
mGlifLayout = view.findViewById(R.id.setup_wizard_layout);
- switch(getContext().getDisplay().getRotation()) {
- case Surface.ROTATION_90:
- case Surface.ROTATION_270:
- mGlifLayout.setLandscapeHeaderAreaVisible(false /* visible */);
- break;
- }
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
mErrorTextView = (TextView) view.findViewById(R.id.errorText);
diff --git a/src/com/android/settings/password/SetupChooseLockPattern.java b/src/com/android/settings/password/SetupChooseLockPattern.java
index b34863d..70cd6f2 100644
--- a/src/com/android/settings/password/SetupChooseLockPattern.java
+++ b/src/com/android/settings/password/SetupChooseLockPattern.java
@@ -30,6 +30,8 @@
import com.android.settings.R;
import com.android.settings.SetupRedactionInterstitial;
+import com.google.android.setupdesign.GlifLayout;
+
/**
* Setup Wizard's version of ChooseLockPattern screen. It inherits the logic and basic structure
* from ChooseLockPattern class, and should remain similar to that behaviorally. This class should
@@ -142,10 +144,11 @@
// Show generic pattern message when pattern lock screen launch in Setup wizard flow
// before fingerprint and face setup.
+ final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
if (stage.message == ID_EMPTY_MESSAGE) {
- mMessageText.setText("");
+ layout.setDescriptionText("");
} else {
- mMessageText.setText(stage.message);
+ layout.setDescriptionText(stage.message);
}
}
diff --git a/src/com/android/settings/slices/VolumeSliceHelper.java b/src/com/android/settings/slices/VolumeSliceHelper.java
index bcf02e5..5e43b86 100644
--- a/src/com/android/settings/slices/VolumeSliceHelper.java
+++ b/src/com/android/settings/slices/VolumeSliceHelper.java
@@ -111,17 +111,21 @@
private static void handleStreamChanged(Context context, Intent intent) {
final int inputType = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1);
- for (Map.Entry<Uri, Integer> entry : sRegisteredUri.entrySet()) {
- if (entry.getValue() == inputType) {
- context.getContentResolver().notifyChange(entry.getKey(), null /* observer */);
- break;
+ synchronized (sRegisteredUri) {
+ for (Map.Entry<Uri, Integer> entry : sRegisteredUri.entrySet()) {
+ if (entry.getValue() == inputType) {
+ context.getContentResolver().notifyChange(entry.getKey(), null /* observer */);
+ break;
+ }
}
}
}
private static void notifyAllStreamsChanged(Context context) {
- sRegisteredUri.forEach((uri, audioStream) -> {
- context.getContentResolver().notifyChange(uri, null /* observer */);
- });
+ synchronized (sRegisteredUri) {
+ sRegisteredUri.forEach((uri, audioStream) -> {
+ context.getContentResolver().notifyChange(uri, null /* observer */);
+ });
+ }
}
}
diff --git a/src/com/android/settings/wifi/slice/WifiSlice.java b/src/com/android/settings/wifi/slice/WifiSlice.java
index 1374e76..75d2c66 100644
--- a/src/com/android/settings/wifi/slice/WifiSlice.java
+++ b/src/com/android/settings/wifi/slice/WifiSlice.java
@@ -183,7 +183,7 @@
return Utils.createIconWithDrawable(drawable);
}
- private IconCompat getEndIcon(WifiSliceItem wifiSliceItem) {
+ protected IconCompat getEndIcon(WifiSliceItem wifiSliceItem) {
if (wifiSliceItem.getConnectedState() != WifiEntry.CONNECTED_STATE_DISCONNECTED) {
return IconCompat.createWithResource(mContext, R.drawable.ic_settings_24dp);
}
@@ -194,7 +194,7 @@
return null;
}
- private SliceAction getWifiEntryAction(WifiSliceItem wifiSliceItem, IconCompat icon,
+ protected SliceAction getWifiEntryAction(WifiSliceItem wifiSliceItem, IconCompat icon,
CharSequence title) {
final int requestCode = wifiSliceItem.getKey().hashCode();
diff --git a/src/com/android/settings/wifi/slice/WifiSliceItem.java b/src/com/android/settings/wifi/slice/WifiSliceItem.java
index 9fe54d3..5028a06 100644
--- a/src/com/android/settings/wifi/slice/WifiSliceItem.java
+++ b/src/com/android/settings/wifi/slice/WifiSliceItem.java
@@ -36,6 +36,7 @@
private final int mLevel;
private final boolean mShouldShowXLevelIcon;
private final boolean mShouldEditBeforeConnect;
+ private final boolean mHasInternetAccess;
private final String mSummary;
// These values must be kept within [WifiEntry.WIFI_LEVEL_MIN, WifiEntry.WIFI_LEVEL_MAX]
@@ -56,6 +57,7 @@
mLevel = wifiEntry.getLevel();
mShouldShowXLevelIcon = wifiEntry.shouldShowXLevelIcon();
mShouldEditBeforeConnect = wifiEntry.shouldEditBeforeConnect();
+ mHasInternetAccess = wifiEntry.hasInternetAccess();
mSummary = wifiEntry.getSummary(false /* concise */);
}
@@ -112,6 +114,13 @@
}
/**
+ * Returns true when the Wi-Fi network has Internet access.
+ */
+ public boolean hasInternetAccess() {
+ return mHasInternetAccess;
+ }
+
+ /**
* In Wi-Fi picker, when users click a saved network, it will connect to the Wi-Fi network.
* However, for some special cases, Wi-Fi picker should show Wi-Fi editor UI for users to edit
* security or password before connecting. Or users will always get connection fail results.
diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
index 337bad7..9b2e97f 100644
--- a/tests/robotests/Android.bp
+++ b/tests/robotests/Android.bp
@@ -72,10 +72,11 @@
static_libs: [
"SettingsLib-robo-testutils",
- "android-support-annotations",
+ "android-support-annotations",
"androidx.test.core",
"androidx.test.runner",
"androidx.test.ext.junit",
+ "androidx.test.espresso.core",
],
libs: [
diff --git a/tests/robotests/src/com/android/settings/applications/GameSettingsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/GameSettingsPreferenceControllerTest.java
new file mode 100644
index 0000000..fa4fce8
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/applications/GameSettingsPreferenceControllerTest.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2021 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.applications;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+
+import com.android.settings.testutils.FakeFeatureFactory;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class GameSettingsPreferenceControllerTest {
+
+ private GameSettingsPreferenceController mController;
+ private GameSettingsFeatureProvider mProvider;
+ private Context mContext;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mContext = spy(RuntimeEnvironment.application);
+
+ mProvider = FakeFeatureFactory.setupForTest().getGameSettingsFeatureProvider();
+ mController = new GameSettingsPreferenceController(mContext, "test_key", mProvider);
+ }
+
+ @Test
+ public void getAvailabilityStatus_GameSettingsFeatureEnabled_shouldReturnAVAILABLE() {
+ when(mProvider.isSupported(mContext)).thenReturn(true);
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_GameSettingsFeatureDisabled_shouldReturnUNSUPPORTED_ON_DEVICE() {
+ when(mProvider.isSupported(mContext)).thenReturn(false);
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
index 24bcde8..abb616a 100644
--- a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
@@ -75,6 +75,9 @@
AdaptiveSleepCameraStatePreferenceController mAdaptiveSleepCameraStatePreferenceController;
@Mock
+ AdaptiveSleepBatterySaverPreferenceController mAdaptiveSleepBatterySaverPreferenceController;
+
+ @Mock
Preference mDisableOptionsPreference;
@Before
@@ -103,6 +106,8 @@
mSettings.mAdaptiveSleepPermissionController = mPermissionPreferenceController;
mSettings.mAdaptiveSleepCameraStatePreferenceController =
mAdaptiveSleepCameraStatePreferenceController;
+ mSettings.mAdaptiveSleepBatterySaverPreferenceController =
+ mAdaptiveSleepBatterySaverPreferenceController;
}
@Test
diff --git a/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java b/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java
index 5c3dacd..6acc72f 100644
--- a/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java
@@ -21,7 +21,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
@@ -31,7 +30,6 @@
import android.app.Activity;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
-import android.content.Intent;
import android.content.pm.UserInfo;
import android.os.Process;
import android.os.UserHandle;
@@ -43,8 +41,6 @@
import androidx.appcompat.app.AlertDialog;
import com.android.settings.R;
-import com.android.settings.Settings;
-import com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminAdd;
import com.android.settings.testutils.CustomActivity;
import com.android.settings.testutils.shadow.ShadowActivity;
import com.android.settings.testutils.shadow.ShadowDevicePolicyManager;
@@ -69,6 +65,11 @@
ShadowActivity.class
})
public class ActionDisabledByAdminDialogHelperTest {
+ private static final ComponentName ADMIN_COMPONENT =
+ new ComponentName("some.package.name", "some.package.name.SomeClass");
+ private static final int USER_ID = 123;
+ private static final EnforcedAdmin ENFORCED_ADMIN =
+ new EnforcedAdmin(ADMIN_COMPONENT, UserHandle.of(USER_ID));
private ActionDisabledByAdminDialogHelper mHelper;
private Activity mActivity;
private org.robolectric.shadows.ShadowActivity mActivityShadow;
@@ -81,32 +82,6 @@
}
@Test
- public void testShowAdminPoliciesWithComponent() {
- final int userId = 123;
- final ComponentName component = new ComponentName("some.package.name",
- "some.package.name.SomeClass");
- final EnforcedAdmin admin = new EnforcedAdmin(component, UserHandle.of(userId));
-
- mHelper.showAdminPolicies(admin, mActivity);
-
- final Intent intent = mActivityShadow.getNextStartedActivity();
- assertTrue(
- intent.getBooleanExtra(DeviceAdminAdd.EXTRA_CALLED_FROM_SUPPORT_DIALOG, false));
- assertEquals(component,
- intent.getParcelableExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN));
- }
-
- @Test
- public void testShowAdminPoliciesWithoutComponent() {
- final int userId = 123;
- final EnforcedAdmin admin = new EnforcedAdmin(null, UserHandle.of(userId));
- mHelper.showAdminPolicies(admin, mActivity);
- final Intent intent = mActivityShadow.getNextStartedActivity();
- assertEquals(intent.getComponent(), new ComponentName(mActivity,
- Settings.DeviceAdminSettingsActivity.class.getName()));
- }
-
- @Test
public void testSetAdminSupportTitle() {
final ViewGroup view = new FrameLayout(mActivity);
final TextView textView = createAdminSupportDialogTitleTextView(view, mActivity);
@@ -150,6 +125,7 @@
final ViewGroup view = new FrameLayout(mActivity);
final TextView textView = createAdminSupportDialogTitleTextView(view, mActivity);
setupFinancedDevice(dpmShadow);
+ mHelper = new ActionDisabledByAdminDialogHelper(mActivity);
mHelper.setAdminSupportTitle(view, null);
@@ -196,7 +172,8 @@
mHelper.setAdminSupportDetails(mActivity, view, admin);
assertNotNull(admin.component);
- assertEquals("", Shadows.shadowOf(textView).innerText());
+ assertEquals(mActivity.getString(R.string.default_admin_support_msg),
+ Shadows.shadowOf(textView).innerText());
}
@Test
@@ -217,7 +194,8 @@
mHelper.setAdminSupportDetails(mActivity, textView, admin);
assertNull(admin.component);
- assertEquals("", Shadows.shadowOf(textView).innerText());
+ assertEquals(mActivity.getString(R.string.default_admin_support_msg),
+ Shadows.shadowOf(textView).innerText());
}
@Test
@@ -225,12 +203,11 @@
final UserManager userManager = RuntimeEnvironment.application.getSystemService(
UserManager.class);
final ShadowUserManager userManagerShadow = Shadow.extract(userManager);
- final ComponentName component = new ComponentName("some.package.name",
- "some.package.name.SomeClass");
- mHelper.mEnforcedAdmin = new EnforcedAdmin(component, UserHandle.of(123));
+ mHelper.prepareDialogBuilder(
+ /* restriction= */ null, ENFORCED_ADMIN);
// Set up for shadow call.
- userManagerShadow.getSameProfileGroupIds().put(123, 0);
+ userManagerShadow.getSameProfileGroupIds().put(USER_ID, 0);
// Test that the button is shown when user IDs are in the same profile group
AlertDialog.Builder builder = mock(AlertDialog.Builder.class);
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedEnablePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedEnablePreferenceControllerTest.java
index ac2beb3..e5b8688 100644
--- a/tests/robotests/src/com/android/settings/gestures/OneHandedEnablePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedEnablePreferenceControllerTest.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.os.SystemProperties;
import android.os.UserHandle;
+import android.provider.Settings;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
@@ -60,6 +61,7 @@
@Test
public void getAvailabilityStatus_setSupportOneHandedModeProperty_shouldAvailable() {
SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+ setNavigationBarMode(mContext, "2" /* fully gestural */);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.AVAILABLE);
@@ -68,6 +70,16 @@
@Test
public void getAvailabilityStatus_unsetSupportOneHandedModeProperty_shouldUnsupported() {
SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "false");
+ setNavigationBarMode(mContext, "2" /* fully gestural */);
+
+ assertThat(mController.getAvailabilityStatus())
+ .isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_set3ButtonModeProperty_shouldUnsupported() {
+ SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+ setNavigationBarMode(mContext, "0" /* 3-button */);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE);
@@ -88,4 +100,18 @@
assertThat(mController.getSummary())
.isEqualTo(mContext.getText(R.string.switch_off_text));
}
+
+ /**
+ * Set NavigationBar mode flag to Settings provider.
+ * @param context App context
+ * @param value Navigation bar mode:
+ * 0 = 3 button
+ * 1 = 2 button
+ * 2 = fully gestural
+ * @return true if the value was set, false on database errors.
+ */
+ private boolean setNavigationBarMode(Context context, String value) {
+ return Settings.Secure.putStringForUser(context.getContentResolver(),
+ Settings.Secure.NAVIGATION_MODE, value, UserHandle.myUserId());
+ }
}
diff --git a/tests/robotests/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceControllerTest.java
index 9f76800..8f50006 100644
--- a/tests/robotests/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceControllerTest.java
@@ -22,6 +22,7 @@
import android.content.Context;
import android.os.SystemProperties;
+import android.os.UserHandle;
import android.provider.Settings;
import com.android.settings.R;
@@ -69,6 +70,7 @@
@Test
public void getAvailabilityStatus_oneHandedUnsupported_returnsUnsupport() {
SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "false");
+ setNavigationBarMode(mContext, "2" /* fully gestural */);
assertThat(mController.getAvailabilityStatus()).isEqualTo(
BasePreferenceController.UNSUPPORTED_ON_DEVICE);
@@ -77,11 +79,21 @@
@Test
public void getAvailabilityStatus_oneHandedSupported_returnsAvailable() {
SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+ setNavigationBarMode(mContext, "2" /* fully gestural */);
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
@Test
+ public void getAvailabilityStatus_set3ButtonModeProperty_returnsUnsupport() {
+ SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+ setNavigationBarMode(mContext, "0" /* 3-button */);
+
+ assertThat(mController.getAvailabilityStatus())
+ .isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE);
+ }
+
+ @Test
public void getSummary_gestureEnabled_returnsOnSummary() {
mController.setChecked(true);
@@ -105,4 +117,18 @@
assertThat(mController.isChecked()).isFalse();
}
+
+ /**
+ * Set NavigationBar mode flag to Settings provider.
+ * @param context App context
+ * @param value Navigation bar mode:
+ * 0 = 3 button
+ * 1 = 2 button
+ * 2 = fully gestural
+ * @return true if the value was set, false on database errors.
+ */
+ private boolean setNavigationBarMode(Context context, String value) {
+ return Settings.Secure.putStringForUser(context.getContentResolver(),
+ Settings.Secure.NAVIGATION_MODE, value, UserHandle.myUserId());
+ }
}
diff --git a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
index b7e6ffd..4c4b922 100644
--- a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
@@ -23,6 +23,7 @@
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
+import com.android.settings.applications.GameSettingsFeatureProvider;
import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.biometrics.face.FaceFeatureProvider;
@@ -85,6 +86,7 @@
public WifiTrackerLibProvider wifiTrackerLibProvider;
public ExtraAppInfoFeatureProvider extraAppInfoFeatureProvider;
public SecuritySettingsFeatureProvider securitySettingsFeatureProvider;
+ public GameSettingsFeatureProvider gameSettingsFeatureProvider;
/**
* Call this in {@code @Before} method of the test class to use fake factory.
@@ -133,6 +135,7 @@
wifiTrackerLibProvider = mock(WifiTrackerLibProvider.class);
extraAppInfoFeatureProvider = mock(ExtraAppInfoFeatureProvider.class);
securitySettingsFeatureProvider = mock(SecuritySettingsFeatureProvider.class);
+ gameSettingsFeatureProvider = mock(GameSettingsFeatureProvider.class);
}
@Override
@@ -264,4 +267,9 @@
public SecuritySettingsFeatureProvider getSecuritySettingsFeatureProvider() {
return securitySettingsFeatureProvider;
}
+
+ @Override
+ public GameSettingsFeatureProvider getGameSettingsFeatureProvider() {
+ return gameSettingsFeatureProvider;
+ }
}
diff --git a/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java b/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java
new file mode 100644
index 0000000..68468ed
--- /dev/null
+++ b/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2021 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.enterprise;
+
+import static android.app.admin.DevicePolicyManager.EXTRA_DEVICE_ADMIN;
+
+import static com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminAdd.EXTRA_CALLED_FROM_SUPPORT_DIALOG;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.UserHandle;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.settings.Settings;
+import com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminAdd;
+import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+
+@RunWith(AndroidJUnit4.class)
+public class ActionDisabledLearnMoreButtonLauncherImplTest {
+
+ private static final int ENFORCED_ADMIN_USER_ID = 123;
+ private static final ComponentName ADMIN_COMPONENT =
+ new ComponentName("some.package.name", "some.package.name.SomeClass");
+ private static final String URL = "https://testexample.com";
+ private static final Uri URI = Uri.parse(URL);
+
+ @Mock
+ private Activity mActivity;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void showAdminPolicies_noComponent_works() {
+ final EnforcedAdmin enforcedAdmin = createEnforcedAdmin(/* component= */ null);
+
+ ActionDisabledLearnMoreButtonLauncherImpl.SHOW_ADMIN_POLICIES
+ .accept(mActivity, enforcedAdmin);
+
+ final ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
+ verify(mActivity).startActivity(captor.capture());
+ assertThat(captor.getValue().getComponent().getClassName())
+ .isEqualTo(Settings.DeviceAdminSettingsActivity.class.getName());
+ }
+
+ @Test
+ public void showAdminPolicies_withComponent_works() {
+ final EnforcedAdmin enforcedAdmin = createEnforcedAdmin(ADMIN_COMPONENT);
+
+ ActionDisabledLearnMoreButtonLauncherImpl.SHOW_ADMIN_POLICIES
+ .accept(mActivity, enforcedAdmin);
+
+ final ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
+ verify(mActivity).startActivityAsUser(
+ captor.capture(),
+ eq(UserHandle.of(ENFORCED_ADMIN_USER_ID)));
+ assertDeviceAdminAddIntent(captor.getValue());
+ }
+
+ @Test
+ public void launchHelpPage_works() {
+ ActionDisabledLearnMoreButtonLauncherImpl.LAUNCH_HELP_PAGE.accept(mActivity, URL);
+
+ final ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
+ verify(mActivity).startActivityAsUser(captor.capture(), eq(UserHandle.SYSTEM));
+ assertActionViewIntent(captor.getValue());
+ }
+
+ private EnforcedAdmin createEnforcedAdmin(ComponentName component) {
+ return new RestrictedLockUtils.EnforcedAdmin(
+ component, UserHandle.of(ENFORCED_ADMIN_USER_ID));
+ }
+
+ private void assertDeviceAdminAddIntent(Intent intent) {
+ assertThat(intent.getComponent().getClassName())
+ .isEqualTo(DeviceAdminAdd.class.getName());
+ assertThat((ComponentName) intent.getParcelableExtra(EXTRA_DEVICE_ADMIN))
+ .isEqualTo(ADMIN_COMPONENT);
+ assertThat(intent.getBooleanExtra(
+ EXTRA_CALLED_FROM_SUPPORT_DIALOG,
+ /* defaultValue= */ false))
+ .isTrue();
+ }
+
+ private void assertActionViewIntent(Intent intent) {
+ assertThat(intent.getAction())
+ .isEqualTo(Intent.ACTION_VIEW);
+ assertThat(intent.getData())
+ .isEqualTo(URI);
+ }
+}
diff --git a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
index c516f0c..4b06acf 100644
--- a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
+++ b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
@@ -16,6 +16,8 @@
package com.android.settings.network;
+import static com.android.settings.network.ProviderModelSlice.ACTION_TITLE_CONNECT_TO_CARRIER;
+
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
@@ -96,10 +98,12 @@
private WifiSliceItem mMockWifiSliceItem3;
@Mock
ListBuilder.RowBuilder mMockCarrierRowBuild;
+ @Mock
+ WifiPickerTracker mWifiPickerTracker;
+ @Mock
+ WifiSliceItem mWifiSliceItem;
private FakeFeatureFactory mFeatureFactory;
- @Mock
- private WifiPickerTracker mWifiPickerTracker;
@Before
@UiThreadTest
@@ -388,4 +392,29 @@
verify(mMockNetworkProviderWorker, never()).connectCarrierNetwork();
}
+
+ @Test
+ public void getWifiSliceItemRow_wifiNoInternetAccess_actionConnectToWifiSsid() {
+ when(mWifiSliceItem.getKey()).thenReturn("wifi_key");
+ when(mWifiSliceItem.getTitle()).thenReturn("wifi_ssid");
+ when(mWifiSliceItem.hasInternetAccess()).thenReturn(false);
+
+ ListBuilder.RowBuilder rowBuilder =
+ mMockProviderModelSlice.getWifiSliceItemRow(mWifiSliceItem);
+
+ assertThat(rowBuilder.getPrimaryAction().getTitle())
+ .isEqualTo("wifi_ssid");
+ }
+
+ @Test
+ public void getWifiSliceItemRow_wifiHasInternetAccess_actionConnectToCarrier() {
+ when(mWifiSliceItem.getTitle()).thenReturn("wifi_ssid");
+ when(mWifiSliceItem.hasInternetAccess()).thenReturn(true);
+
+ ListBuilder.RowBuilder rowBuilder =
+ mMockProviderModelSlice.getWifiSliceItemRow(mWifiSliceItem);
+
+ assertThat(rowBuilder.getPrimaryAction().getTitle())
+ .isEqualTo(ACTION_TITLE_CONNECT_TO_CARRIER);
+ }
}
diff --git a/tests/unit/src/com/android/settings/network/telephony/Enable2gPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/Enable2gPreferenceControllerTest.java
index 5ade979..9fb8a31 100644
--- a/tests/unit/src/com/android/settings/network/telephony/Enable2gPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/Enable2gPreferenceControllerTest.java
@@ -96,7 +96,7 @@
@Test
public void getAvailabilityStatus_nullCarrierConfig_returnUnavailable() {
doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported(
- mTelephonyManager.CAPABILITY_ALLOWED_NETWORK_TYPES_USED);
+ mTelephonyManager.CAPABILITY_USES_ALLOWED_NETWORK_TYPES_BITMASK);
mPersistableBundle.putBoolean(CarrierConfigManager.KEY_HIDE_ENABLE_2G,
false);
doReturn(null).when(mCarrierConfigManager);
@@ -107,7 +107,7 @@
@Test
public void getAvailabilityStatus_capabilityNotSupported_returnUnavailable() {
doReturn(false).when(mTelephonyManager).isRadioInterfaceCapabilitySupported(
- mTelephonyManager.CAPABILITY_ALLOWED_NETWORK_TYPES_USED);
+ mTelephonyManager.CAPABILITY_USES_ALLOWED_NETWORK_TYPES_BITMASK);
mPersistableBundle.putBoolean(CarrierConfigManager.KEY_HIDE_ENABLE_2G,
false);
@@ -117,7 +117,7 @@
@Test
public void getAvailabilityStatus_returnAvailable() {
doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported(
- mTelephonyManager.CAPABILITY_ALLOWED_NETWORK_TYPES_USED);
+ mTelephonyManager.CAPABILITY_USES_ALLOWED_NETWORK_TYPES_BITMASK);
mPersistableBundle.putBoolean(CarrierConfigManager.KEY_HIDE_ENABLE_2G,
false);
@@ -146,7 +146,7 @@
// Setup state to allow disabling
doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported(
- mTelephonyManager.CAPABILITY_ALLOWED_NETWORK_TYPES_USED);
+ mTelephonyManager.CAPABILITY_USES_ALLOWED_NETWORK_TYPES_BITMASK);
mPersistableBundle.putBoolean(CarrierConfigManager.KEY_HIDE_ENABLE_2G,
false);
diff --git a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
index 5ee2cc9..651eb04 100644
--- a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
+++ b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
@@ -63,6 +63,10 @@
ApplicationProvider.getApplicationContext(), "airplane_mode");
public static final String SUBTITLE_WIFI_IS_TURNED_ON = ResourcesUtils.getResourcesString(
ApplicationProvider.getApplicationContext(), "wifi_is_turned_on_subtitle");
+ public static final String SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET =
+ ResourcesUtils.getResourcesString(
+ ApplicationProvider.getApplicationContext(),
+ "select_network_to_connect_internet");
public static final String BUTTON_SETTINGS = ResourcesUtils.getResourcesString(
ApplicationProvider.getApplicationContext(), "settings_button");
public static final String SUBTITLE_NON_CARRIER_NETWORK_UNAVAILABLE =
@@ -175,7 +179,7 @@
}
@Test
- public void getSubTitle_apmOffWifiOnTwoWifiItemsNoCarrierData_shouldBeNull() {
+ public void getSubTitle_apmOffWifiOnTwoWifiItemsNoCarrierData_selectNetworkToConnectInternet() {
List wifiList = new ArrayList<ScanResult>();
wifiList.add(new ScanResult());
wifiList.add(new ScanResult());
@@ -183,7 +187,8 @@
mPanel.updatePanelTitle();
- assertThat(mPanel.getSubTitle()).isNull();
+ assertThat(mPanel.getSubTitle())
+ .isEqualTo(SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET);
}
@Test
diff --git a/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
index b6f330b..1e74d92 100644
--- a/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
@@ -21,6 +21,7 @@
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
+import com.android.settings.applications.GameSettingsFeatureProvider;
import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.biometrics.face.FaceFeatureProvider;
@@ -80,6 +81,7 @@
public WifiTrackerLibProvider wifiTrackerLibProvider;
public ExtraAppInfoFeatureProvider extraAppInfoFeatureProvider;
public SecuritySettingsFeatureProvider securitySettingsFeatureProvider;
+ public GameSettingsFeatureProvider gameSettingsFeatureProvider;
/**
* Call this in {@code @Before} method of the test class to use fake factory.
@@ -119,6 +121,7 @@
wifiTrackerLibProvider = mock(WifiTrackerLibProvider.class);
extraAppInfoFeatureProvider = mock(ExtraAppInfoFeatureProvider.class);
securitySettingsFeatureProvider = mock(SecuritySettingsFeatureProvider.class);
+ gameSettingsFeatureProvider = mock(GameSettingsFeatureProvider.class);
}
@Override
@@ -250,4 +253,9 @@
public SecuritySettingsFeatureProvider getSecuritySettingsFeatureProvider() {
return securitySettingsFeatureProvider;
}
+
+ @Override
+ public GameSettingsFeatureProvider getGameSettingsFeatureProvider() {
+ return gameSettingsFeatureProvider;
+ }
}