Merge "Fix usage hint of ringtone vibration preview" into qt-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ee93b5e..cb63df9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1547,7 +1547,6 @@
<activity android:name=".password.ConfirmDeviceCredentialActivity$InternalActivity"
android:exported="false"
android:permission="android.permission.MANAGE_USERS"
- android:resizeableActivity="false"
android:taskAffinity="com.android.settings.workmode"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter android:priority="1">
diff --git a/res/layout/captioning_preview.xml b/res/layout/captioning_preview.xml
index b90c3a5..d8d2e4f 100644
--- a/res/layout/captioning_preview.xml
+++ b/res/layout/captioning_preview.xml
@@ -15,41 +15,32 @@
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/preview_viewport"
+ android:clipToPadding="true"
+ android:clipChildren="true"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
+ android:layout_height="wrap_content">
+
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/captioning_preview_height"
+ android:contentDescription="@null"
+ android:scaleType="centerCrop"
+ android:src="@drawable/caption_background"/>
<FrameLayout
- android:id="@+id/preview_viewport"
+ android:id="@+id/preview_window"
android:layout_width="match_parent"
- android:layout_height="@dimen/captioning_preview_height" >
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|start"
+ android:padding="16dp">
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:contentDescription="@null"
- android:scaleType="centerCrop"
- android:src="@drawable/caption_background" />
-
- <FrameLayout
- android:id="@+id/preview_window"
- android:layout_width="match_parent"
+ <com.android.internal.widget.SubtitleView
+ android:id="@+id/preview_text"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom|start"
- android:padding="16dp" >
-
- <com.android.internal.widget.SubtitleView
- android:id="@+id/preview_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/captioning_preview_text" />
- </FrameLayout>
+ android:text="@string/captioning_preview_text"/>
</FrameLayout>
-
- <FrameLayout
- android:id="@+id/properties_fragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
-</LinearLayout>
+</FrameLayout>
diff --git a/res/layout/magnification_video_preference.xml b/res/layout/magnification_video_preference.xml
index fe7f26f..ff7089c 100644
--- a/res/layout/magnification_video_preference.xml
+++ b/res/layout/magnification_video_preference.xml
@@ -16,7 +16,9 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:clipChildren="true"
+ android:clipToPadding="true">
<ImageView
android:id="@+id/video_background"
diff --git a/res/raw/system_nav_3_button.mp4 b/res/raw/system_nav_3_button.mp4
index 1287f28..86fb236 100644
--- a/res/raw/system_nav_3_button.mp4
+++ b/res/raw/system_nav_3_button.mp4
Binary files differ
diff --git a/res/raw/system_nav_fully_gestural.mp4 b/res/raw/system_nav_fully_gestural.mp4
index 165ce33..ae9c6d7 100644
--- a/res/raw/system_nav_fully_gestural.mp4
+++ b/res/raw/system_nav_fully_gestural.mp4
Binary files differ
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index ffe0aa5..9ac9110 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -675,15 +675,6 @@
</string-array>
<!-- Keys for the list of accessibility timeouts xml. -->
- <string-array name="accessibility_timeout_content_selector_keys" translatable="false">
- <item>accessibility_content_timeout_default</item>
- <item>accessibility_content_timeout_10secs</item>
- <item>accessibility_content_timeout_30secs</item>
- <item>accessibility_content_timeout_1min</item>
- <item>accessibility_content_timeout_2mins</item>
- </string-array>
-
- <!-- Keys for the list of accessibility timeouts xml. -->
<string-array name="accessibility_timeout_control_selector_keys" translatable="false">
<item>accessibility_control_timeout_default</item>
<item>accessibility_control_timeout_10secs</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a8e90b4..54a39e4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -890,6 +890,8 @@
<string name="security_settings_face_preference_title">Face authentication</string>
<!-- Introduction title shown in face enrollment education screen [CHAR LIMIT=40] -->
<string name="security_settings_face_enroll_education_title">How to set up Face unlock</string>
+ <!-- Introduction title shown in face enrollment education screen for accessibility [CHAR LIMI=40]-->
+ <string name="security_settings_face_enroll_education_title_accessibility">Set up Face unlock</string>
<!-- Introduction title shown in face enrollment education screen to show the face authentication feature, when face unlock is disabled by device admin [CHAR LIMIT=60] -->
<string name="security_settings_face_enroll_education_title_unlock_disabled">Use your face to authenticate</string>
<!-- Introduction detail message shown in face education [CHAR LIMIT=NONE] -->
@@ -925,7 +927,7 @@
<!-- Title shown in face enrollment dialog [CHAR LIMIT=40] -->
<string name="security_settings_face_enroll_repeat_title">Center your face in the circle</string>
<!-- Button text to skip enrollment of face [CHAR LIMIT=40] -->
- <string name="security_settings_face_enroll_enrolling_skip">Do it later</string>
+ <string name="security_settings_face_enroll_enrolling_skip">Skip</string>
<!-- Text shown when "Add face" button is disabled -->
<string name="face_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> faces</string>
<!-- Text shown when users has enrolled a maximum number of faces [CHAR LIMIT=NONE] -->
@@ -4891,12 +4893,10 @@
<string name="accessibility_timeout_1min">1 minute</string>
<!-- Option heading to leave the timeout requirement for accessibility users at 2 mins. [CHAR LIMIT=35] -->
<string name="accessibility_timeout_2mins">2 minutes</string>
- <!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
- <string name="accessibility_content_timeout_preference_title">Time to read</string>
+ <!-- Title for accessibility settings timeout item. [CHAR LIMIT=43] -->
+ <string name="accessibility_setting_item_control_timeout_title">Time to take action (Accessibility timeout)</string>
<!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
<string name="accessibility_control_timeout_preference_title">Time to take action</string>
- <!-- Descriptive text for accessibility preference to accessibility content timeout. [CHAR LIMIT=NONE] -->
- <string name="accessibility_content_timeout_preference_summary">Choose how long to show messages that you need to read, but are visible only temporarily.\n\nNot all apps support this setting.</string>
<!-- Descriptive text for accessibility preference to accessibility control timeout. [CHAR LIMIT=NONE] -->
<string name="accessibility_control_timeout_preference_summary">Choose how long to show messages that ask you to take action, but are visible only temporarily.\n\nNot all apps support this setting.</string>
diff --git a/res/xml/accessibility_content_timeout_settings.xml b/res/xml/accessibility_content_timeout_settings.xml
deleted file mode 100644
index ea8d88a..0000000
--- a/res/xml/accessibility_content_timeout_settings.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2018 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<PreferenceScreen
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="accessibility_content_timeout_preference"
- android:title="@string/accessibility_content_timeout_preference_title"
- android:persistent="false" >
-
- <com.android.settings.widget.VideoPreference
- android:key="accessibility_content_timeout_video"
- android:title="@string/summary_placeholder"
- settings:animation="@raw/accessibility_timeout"
- settings:preview="@drawable/accessibility_timeout"
- settings:controller="com.android.settings.widget.VideoPreferenceController"
- android:persistent="false" />
-
- <com.android.settings.widget.RadioButtonPreference
- android:key="accessibility_content_timeout_default"
- android:title="@string/accessibility_timeout_default"
- settings:allowDividerAbove="true"
- android:persistent="false" />
-
- <com.android.settings.widget.RadioButtonPreference
- android:key="accessibility_content_timeout_10secs"
- android:title="@string/accessibility_timeout_10secs"
- android:persistent="false" />
-
- <com.android.settings.widget.RadioButtonPreference
- android:key="accessibility_content_timeout_30secs"
- android:title="@string/accessibility_timeout_30secs"
- android:persistent="false" />
-
- <com.android.settings.widget.RadioButtonPreference
- android:key="accessibility_content_timeout_1min"
- android:title="@string/accessibility_timeout_1min"
- android:persistent="false" />
-
- <com.android.settings.widget.RadioButtonPreference
- android:key="accessibility_content_timeout_2mins"
- android:title="@string/accessibility_timeout_2mins"
- android:persistent="false" />
-
- <com.android.settingslib.widget.FooterPreference
- android:title="@string/accessibility_content_timeout_preference_summary"
- android:selectable="false" />
-
-</PreferenceScreen>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index b4968f8..d9c61b5 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -77,12 +77,6 @@
android:key="toggle_disable_animations"
android:title="@string/accessibility_disable_animations" />
- <Preference
- android:fragment="com.android.settings.accessibility.AccessibilityContentTimeoutPreferenceFragment"
- android:key="accessibility_content_timeout_preference_fragment"
- android:title="@string/accessibility_content_timeout_preference_title"
- android:persistent="false" />
-
</PreferenceCategory>
<PreferenceCategory
@@ -115,7 +109,7 @@
<Preference
android:fragment="com.android.settings.accessibility.AccessibilityControlTimeoutPreferenceFragment"
android:key="accessibility_control_timeout_preference_fragment"
- android:title="@string/accessibility_control_timeout_preference_title"
+ android:title="@string/accessibility_setting_item_control_timeout_title"
android:persistent="false" />
<Preference
diff --git a/res/xml/captioning_settings.xml b/res/xml/captioning_settings.xml
index 3129738..56e0e2d 100644
--- a/res/xml/captioning_settings.xml
+++ b/res/xml/captioning_settings.xml
@@ -21,6 +21,12 @@
android:key="captioning_preference_screen"
android:title="@string/accessibility_captioning_title" >
+ <com.android.settingslib.widget.LayoutPreference
+ android:key="caption_preview"
+ android:title="@string/summary_placeholder"
+ android:layout="@layout/captioning_preview"
+ settings:searchable="false"/>
+
<PreferenceCategory
android:key="standard"
android:title="@string/captioning_standard_options_title" >
diff --git a/src/com/android/settings/accessibility/AccessibilityContentTimeoutPreferenceFragment.java b/src/com/android/settings/accessibility/AccessibilityContentTimeoutPreferenceFragment.java
deleted file mode 100644
index 8a41bd4..0000000
--- a/src/com/android/settings/accessibility/AccessibilityContentTimeoutPreferenceFragment.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2018 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.accessibility;
-
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.res.Resources;
-import android.provider.SearchIndexableResource;
-
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.search.SearchIndexable;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-@SearchIndexable
-public final class AccessibilityContentTimeoutPreferenceFragment extends DashboardFragment
- implements AccessibilityTimeoutController.OnChangeListener {
-
- static final String TAG = "AccessibilityContentTimeoutPreferenceFragment";
- private static final List<AbstractPreferenceController> sControllers = new ArrayList<>();
-
- @Override
- public void onCheckedChanged(Preference preference) {
- for (AbstractPreferenceController controller : sControllers) {
- controller.updateState(preference);
- }
- }
-
- @Override
- public void onResume() {
- super.onResume();
-
- for (AbstractPreferenceController controller :
- buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
- ((AccessibilityTimeoutController)controller).setOnChangeListener(this);
- }
- }
-
- @Override
- public void onPause() {
- super.onPause();
-
- for (AbstractPreferenceController controller :
- buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
- ((AccessibilityTimeoutController)controller).setOnChangeListener(null);
- }
- }
-
- @Override
- public int getMetricsCategory() {
- return SettingsEnums.ACCESSIBILITY;
- }
-
- @Override
- protected String getLogTag() {
- return TAG;
- }
-
- @Override
- protected int getPreferenceScreenResId() {
- return R.xml.accessibility_content_timeout_settings;
- }
-
- @Override
- protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
- return buildPreferenceControllers(context, getSettingsLifecycle());
- }
-
- private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
- Lifecycle lifecycle) {
- if (sControllers.size() == 0) {
- Resources resources = context.getResources();
-
- String[] timeoutKeys = resources.getStringArray(
- R.array.accessibility_timeout_content_selector_keys);
-
- for (int i=0; i < timeoutKeys.length; i++) {
- sControllers.add(new AccessibilityTimeoutController(
- context, lifecycle, timeoutKeys[i], TAG));
- }
- }
- return sControllers;
- }
-
- public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider() {
- @Override
- public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
- boolean enabled) {
- final SearchIndexableResource sir = new SearchIndexableResource(context);
- sir.xmlResId = R.xml.accessibility_content_timeout_settings;
- return Arrays.asList(sir);
- }
-
- @Override
- public List<String> getNonIndexableKeys(Context context) {
- final List<String> keys = super.getNonIndexableKeys(context);
- return keys;
- }
-
- @Override
- public List<AbstractPreferenceController> createPreferenceControllers(
- Context context) {
- return buildPreferenceControllers(context, null);
- }
- };
-}
\ No newline at end of file
diff --git a/src/com/android/settings/accessibility/AccessibilityControlTimeoutPreferenceFragment.java b/src/com/android/settings/accessibility/AccessibilityControlTimeoutPreferenceFragment.java
index a6426bf..df950e8 100644
--- a/src/com/android/settings/accessibility/AccessibilityControlTimeoutPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/AccessibilityControlTimeoutPreferenceFragment.java
@@ -98,7 +98,7 @@
for (int i=0; i < timeoutKeys.length; i++) {
sControllers.add(new AccessibilityTimeoutController(
- context, lifecycle, timeoutKeys[i], TAG));
+ context, lifecycle, timeoutKeys[i]));
}
}
return sControllers;
@@ -126,4 +126,4 @@
return buildPreferenceControllers(context, null);
}
};
-}
\ No newline at end of file
+}
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 148e901..1dbae00 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -132,8 +132,6 @@
"vibration_preference_screen";
private static final String DISPLAY_DALTONIZER_PREFERENCE_SCREEN =
"daltonizer_preference";
- private static final String ACCESSIBILITY_CONTENT_TIMEOUT_PREFERENCE =
- "accessibility_content_timeout_preference_fragment";
private static final String ACCESSIBILITY_CONTROL_TIMEOUT_PREFERENCE =
"accessibility_control_timeout_preference_fragment";
private static final String DARK_UI_MODE_PREFERENCE =
@@ -727,8 +725,6 @@
mToggleInversionPreference.getOrder() + 1);
mToggleDisableAnimationsPreference.setOrder(
mToggleLargePointerIconPreference.getOrder() + 1);
- findPreference(ACCESSIBILITY_CONTENT_TIMEOUT_PREFERENCE).setOrder(
- mToggleDisableAnimationsPreference.getOrder() + 1);
mToggleInversionPreference.setSummary(R.string.summary_empty);
displayCategory.addPreference(mToggleInversionPreference);
displayCategory.addPreference(mDisplayDaltonizerPreferenceScreen);
@@ -795,8 +791,6 @@
updateAccessibilityShortcut(mAccessibilityShortcutPreferenceScreen);
updateAccessibilityTimeoutSummary(getContentResolver(),
- findPreference(ACCESSIBILITY_CONTENT_TIMEOUT_PREFERENCE));
- updateAccessibilityTimeoutSummary(getContentResolver(),
findPreference(ACCESSIBILITY_CONTROL_TIMEOUT_PREFERENCE));
}
@@ -806,14 +800,8 @@
int[] timeoutValues = getResources().getIntArray(
R.array.accessibility_timeout_selector_values);
- int timeoutValue = 0;
- if (pref.getKey().equals(ACCESSIBILITY_CONTENT_TIMEOUT_PREFERENCE)) {
- timeoutValue = AccessibilityTimeoutController.getSecureAccessibilityTimeoutValue(
- resolver, AccessibilityTimeoutController.CONTENT_TIMEOUT_SETTINGS_SECURE);
- } else if (pref.getKey().equals(ACCESSIBILITY_CONTROL_TIMEOUT_PREFERENCE)) {
- timeoutValue = AccessibilityTimeoutController.getSecureAccessibilityTimeoutValue(
+ int timeoutValue = AccessibilityTimeoutController.getSecureAccessibilityTimeoutValue(
resolver, AccessibilityTimeoutController.CONTROL_TIMEOUT_SETTINGS_SECURE);
- }
int idx = Ints.indexOf(timeoutValues, timeoutValue);
pref.setSummary(timeoutSummarys[idx == -1 ? 0 : idx]);
diff --git a/src/com/android/settings/accessibility/AccessibilityTimeoutController.java b/src/com/android/settings/accessibility/AccessibilityTimeoutController.java
index a6c5f6f..057013c 100644
--- a/src/com/android/settings/accessibility/AccessibilityTimeoutController.java
+++ b/src/com/android/settings/accessibility/AccessibilityTimeoutController.java
@@ -36,6 +36,9 @@
import java.util.HashMap;
import java.util.Map;
+/**
+ * Controller class that control accessibility time out settings.
+ */
public class AccessibilityTimeoutController extends AbstractPreferenceController implements
LifecycleObserver, RadioButtonPreference.OnClickListener, PreferenceControllerMixin {
static final String CONTENT_TIMEOUT_SETTINGS_SECURE =
@@ -43,11 +46,11 @@
static final String CONTROL_TIMEOUT_SETTINGS_SECURE =
Settings.Secure.ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS;
- // pair the preference key and timeout value
+ // pair the preference key and timeout value.
private final Map<String, Integer> mAccessibilityTimeoutKeyToValueMap = new HashMap<>();
+ // RadioButtonPreference key, each preference represent a timeout value.
private final String mPreferenceKey;
- private final String mfragmentTag;
private final ContentResolver mContentResolver;
private final Resources mResources;
private OnChangeListener mOnChangeListener;
@@ -55,7 +58,7 @@
private int mAccessibilityUiTimeoutValue;
public AccessibilityTimeoutController(Context context, Lifecycle lifecycle,
- String preferenceKey, String fragmentTag) {
+ String preferenceKey) {
super(context);
mContentResolver = context.getContentResolver();
@@ -65,7 +68,6 @@
lifecycle.addObserver(this);
}
mPreferenceKey = preferenceKey;
- mfragmentTag = fragmentTag;
}
protected static int getSecureAccessibilityTimeoutValue(ContentResolver resolver, String name) {
@@ -84,14 +86,8 @@
private Map<String, Integer> getTimeoutValueToKeyMap() {
if (mAccessibilityTimeoutKeyToValueMap.size() == 0) {
- String[] timeoutKeys = null;
- if (mfragmentTag.equals(AccessibilityContentTimeoutPreferenceFragment.TAG)) {
- timeoutKeys = mResources.getStringArray(
- R.array.accessibility_timeout_content_selector_keys);
- } else if (mfragmentTag.equals(AccessibilityControlTimeoutPreferenceFragment.TAG)) {
- timeoutKeys = mResources.getStringArray(
+ String[] timeoutKeys = mResources.getStringArray(
R.array.accessibility_timeout_control_selector_keys);
- }
int[] timeoutValues = mResources.getIntArray(
R.array.accessibility_timeout_selector_values);
@@ -109,11 +105,9 @@
}
private void handlePreferenceChange(String value) {
- if (mfragmentTag.equals(AccessibilityContentTimeoutPreferenceFragment.TAG)) {
- putSecureString(Settings.Secure.ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS, value);
- } else if (mfragmentTag.equals(AccessibilityControlTimeoutPreferenceFragment.TAG)) {
- putSecureString(Settings.Secure.ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS, value);
- }
+ // save value to both content and control timeout setting.
+ putSecureString(Settings.Secure.ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS, value);
+ putSecureString(Settings.Secure.ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS, value);
}
@Override
@@ -144,16 +138,10 @@
}
}
- private int getAccessibilityTimeoutValue(String fragmentTag) {
- int timeoutValue = 0;
- // two kinds of Secure value, one is content timeout, the other is control timeout.
- if (AccessibilityContentTimeoutPreferenceFragment.TAG.equals(fragmentTag)) {
- timeoutValue = getSecureAccessibilityTimeoutValue(mContentResolver,
- CONTENT_TIMEOUT_SETTINGS_SECURE);
- } else if (AccessibilityControlTimeoutPreferenceFragment.TAG.equals(fragmentTag)) {
- timeoutValue = getSecureAccessibilityTimeoutValue(mContentResolver,
+ private int getAccessibilityTimeoutValue() {
+ // get accessibility control timeout value
+ int timeoutValue = getSecureAccessibilityTimeoutValue(mContentResolver,
CONTROL_TIMEOUT_SETTINGS_SECURE);
- }
return timeoutValue;
}
@@ -167,7 +155,7 @@
public void updateState(Preference preference) {
super.updateState(preference);
- mAccessibilityUiTimeoutValue = getAccessibilityTimeoutValue(mfragmentTag);
+ mAccessibilityUiTimeoutValue = getAccessibilityTimeoutValue();
// reset RadioButton
mPreference.setChecked(false);
@@ -175,7 +163,13 @@
updatePreferenceCheckedState(preferenceValue);
}
- public static interface OnChangeListener {
+ /**
+ * Listener interface handles checked event.
+ */
+ public interface OnChangeListener {
+ /**
+ * A hook that is called when preference checked.
+ */
void onCheckedChanged(Preference preference);
}
-}
\ No newline at end of file
+}
diff --git a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
index ae7e3fd..bddca9c 100644
--- a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
+++ b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
@@ -22,13 +22,8 @@
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
-import android.preference.PreferenceFrameLayout;
import android.provider.Settings;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.OnLayoutChangeListener;
-import android.view.ViewGroup;
-import android.view.ViewGroup.LayoutParams;
import android.view.accessibility.CaptioningManager;
import android.view.accessibility.CaptioningManager.CaptionStyle;
@@ -46,6 +41,7 @@
import com.android.settings.widget.ToggleSwitch;
import com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener;
import com.android.settingslib.accessibility.AccessibilityUtils;
+import com.android.settingslib.widget.LayoutPreference;
import java.util.Locale;
@@ -54,6 +50,7 @@
*/
public class CaptionPropertiesFragment extends SettingsPreferenceFragment
implements OnPreferenceChangeListener, OnValueChangedListener {
+ private static final String PREF_CAPTION_PREVIEW = "caption_preview";
private static final String PREF_BACKGROUND_COLOR = "captioning_background_color";
private static final String PREF_BACKGROUND_OPACITY = "captioning_background_opacity";
private static final String PREF_FOREGROUND_COLOR = "captioning_foreground_color";
@@ -116,43 +113,6 @@
}
@Override
- public View onCreateView(
- LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- final View rootView = inflater.inflate(R.layout.captioning_preview, container, false);
-
- // We have to do this now because PreferenceFrameLayout looks at it
- // only when the view is added.
- if (container instanceof PreferenceFrameLayout) {
- ((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
- }
-
- final View content = super.onCreateView(inflater, container, savedInstanceState);
- ((ViewGroup) rootView.findViewById(R.id.properties_fragment)).addView(
- content, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
-
- return rootView;
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
-
- final boolean enabled = mCaptioningManager.isEnabled();
- mPreviewText = (SubtitleView) view.findViewById(R.id.preview_text);
- mPreviewText.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
-
- mPreviewWindow = view.findViewById(R.id.preview_window);
- mPreviewViewport = view.findViewById(R.id.preview_viewport);
- mPreviewViewport.addOnLayoutChangeListener(new OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
- refreshPreviewText();
- }
- });
- }
-
- @Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
@@ -263,6 +223,19 @@
}
private void initializeAllPreferences() {
+ final LayoutPreference captionPreview = findPreference(PREF_CAPTION_PREVIEW);
+
+ final boolean enabled = mCaptioningManager.isEnabled();
+ mPreviewText = captionPreview.findViewById(R.id.preview_text);
+ mPreviewText.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
+
+ mPreviewWindow = captionPreview.findViewById(R.id.preview_window);
+
+ mPreviewViewport = captionPreview.findViewById(R.id.preview_viewport);
+ mPreviewViewport.addOnLayoutChangeListener(
+ (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom)
+ -> refreshPreviewText());
+
mLocale = (LocalePreference) findPreference(PREF_LOCALE);
mFontSize = (ListPreference) findPreference(PREF_FONT_SIZE);
@@ -370,9 +343,9 @@
/**
* Unpack the specified color value and update the preferences.
*
- * @param color color preference
+ * @param color color preference
* @param opacity opacity preference
- * @param value packed value
+ * @param value packed value
*/
private void parseColorOpacity(ColorPreference color, ColorPreference opacity, int value) {
final int colorValue;
diff --git a/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java b/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java
index bb26283..dcf1f1c 100644
--- a/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java
+++ b/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java
@@ -15,8 +15,6 @@
*/
package com.android.settings.accessibility;
-import static android.content.DialogInterface.BUTTON_POSITIVE;
-
import static com.android.internal.accessibility.AccessibilityShortcutController.COLOR_INVERSION_COMPONENT_NAME;
import static com.android.internal.accessibility.AccessibilityShortcutController.DALTONIZER_COMPONENT_NAME;
@@ -25,7 +23,6 @@
import android.app.settings.SettingsEnums;
import android.content.ComponentName;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -191,6 +188,7 @@
((ShortcutServicePickerFragment) fragment).onServiceConfirmed(
bundle.getString(EXTRA_KEY));
}
+ dismiss();
}
}
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
index fae1785..956ba49 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
@@ -33,6 +33,7 @@
import android.view.accessibility.AccessibilityManager;
import android.widget.Button;
import android.widget.CompoundButton;
+import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.Utils;
@@ -59,19 +60,28 @@
private View mIllustrationAccessibility;
private Handler mHandler;
private Intent mResultIntent;
+ private TextView mDescriptionText;
private CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ int titleRes = isChecked ?
+ R.string.security_settings_face_enroll_education_title_accessibility
+ : R.string.security_settings_face_enroll_education_title;
+ getLayout().setHeaderText(titleRes);
+ setTitle(titleRes);
+
if (isChecked) {
mIllustrationNormal.stop();
mIllustrationNormal.setVisibility(View.INVISIBLE);
mIllustrationAccessibility.setVisibility(View.VISIBLE);
+ mDescriptionText.setVisibility(View.INVISIBLE);
} else {
mIllustrationNormal.setVisibility(View.VISIBLE);
mIllustrationNormal.start();
mIllustrationAccessibility.setVisibility(View.INVISIBLE);
+ mDescriptionText.setVisibility(View.VISIBLE);
}
}
};
@@ -88,6 +98,7 @@
mIllustrationNormal = findViewById(R.id.illustration_normal);
mIllustrationAccessibility = findViewById(R.id.illustration_accessibility);
+ mDescriptionText = findViewById(R.id.sud_layout_description);
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
mFooterBarMixin.setSecondaryButton(
diff --git a/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java
index 990e68d..d532a76 100644
--- a/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java
+++ b/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java
@@ -94,6 +94,7 @@
Log.e(TAG, "Unable to remove face: " + face.getBiometricId()
+ " error: " + errMsgId + " " + errString);
Toast.makeText(mContext, errString, Toast.LENGTH_SHORT).show();
+ mRemoving = false;
}
@Override
@@ -131,6 +132,7 @@
mFaceManager.remove(faces.get(0), mUserId, mRemovalCallback);
} else {
mButton.setEnabled(true);
+ mRemoving = false;
}
}
};
diff --git a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
index 1fe7e7d..d5e1723 100644
--- a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
+++ b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
@@ -79,7 +79,6 @@
private final PackageManager mPm;
private final NotificationBackend mNotificationBackend;
private IUsageStatsManager mUsageStatsManager;
- private final int mUserId;
private final IconDrawableFactory mIconDrawableFactory;
private Calendar mCal;
@@ -104,7 +103,6 @@
ApplicationsState appState, Fragment host) {
super(context);
mIconDrawableFactory = IconDrawableFactory.newInstance(context);
- mUserId = UserHandle.myUserId();
mPm = context.getPackageManager();
mHost = host;
mApplicationsState = appState;
@@ -177,7 +175,6 @@
e.printStackTrace();
}
if (events != null) {
-
ArrayMap<String, NotifyingApp> aggregatedStats = new ArrayMap<>();
UsageEvents.Event event = new UsageEvents.Event();
@@ -205,7 +202,8 @@
}
}
- private static String getKey(int userId, String pkg) {
+ @VisibleForTesting
+ static String getKey(int userId, String pkg) {
return userId + "|" + pkg;
}
@@ -252,12 +250,13 @@
}
boolean rebindPref = true;
- NotificationAppPreference pref = appPreferences.remove(pkgName);
+ NotificationAppPreference pref = appPreferences.remove(getKey(app.getUserId(),
+ pkgName));
if (pref == null) {
pref = new NotificationAppPreference(prefContext);
rebindPref = false;
}
- pref.setKey(pkgName);
+ pref.setKey(getKey(app.getUserId(), pkgName));
pref.setTitle(appEntry.label);
pref.setIcon(mIconDrawableFactory.getBadgedIcon(appEntry.info));
pref.setIconSize(TwoTargetPreference.ICON_SIZE_SMALL);
@@ -267,11 +266,11 @@
Bundle args = new Bundle();
args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkgName);
args.putInt(AppInfoBase.ARG_PACKAGE_UID, appEntry.info.uid);
-
pref.setIntent(new SubSettingLauncher(mHost.getActivity())
.setDestination(AppNotificationSettings.class.getName())
.setTitleRes(R.string.notifications_title)
.setArguments(args)
+ .setUserHandle(new UserHandle(UserHandle.getUserId(appEntry.info.uid)))
.setSourceMetricsCategory(
SettingsEnums.MANAGE_APPLICATIONS_NOTIFICATIONS)
.toIntent());
@@ -301,11 +300,11 @@
int count = 0;
for (NotifyingApp app : mApps) {
final ApplicationsState.AppEntry appEntry = mApplicationsState.getEntry(
- app.getPackage(), mUserId);
+ app.getPackage(), app.getUserId());
if (appEntry == null) {
continue;
}
- if (!shouldIncludePkgInRecents(app.getPackage())) {
+ if (!shouldIncludePkgInRecents(app.getPackage(), app.getUserId())) {
continue;
}
displayableApps.add(app);
@@ -321,14 +320,14 @@
/**
* Whether or not the app should be included in recent list.
*/
- private boolean shouldIncludePkgInRecents(String pkgName) {
+ private boolean shouldIncludePkgInRecents(String pkgName, int userId) {
final Intent launchIntent = new Intent().addCategory(Intent.CATEGORY_LAUNCHER)
.setPackage(pkgName);
if (mPm.resolveActivity(launchIntent, 0) == null) {
// Not visible on launcher -> likely not a user visible app, skip if non-instant.
final ApplicationsState.AppEntry appEntry =
- mApplicationsState.getEntry(pkgName, mUserId);
+ mApplicationsState.getEntry(pkgName, userId);
if (appEntry == null || appEntry.info == null || !AppUtils.isInstant(appEntry.info)) {
Log.d(TAG, "Not a user visible or instant app, skipping " + pkgName);
return false;
diff --git a/src/com/android/settings/widget/UsageGraph.java b/src/com/android/settings/widget/UsageGraph.java
index 7cef66f..505dc58 100644
--- a/src/com/android/settings/widget/UsageGraph.java
+++ b/src/com/android/settings/widget/UsageGraph.java
@@ -288,7 +288,11 @@
canvas.drawPath(mPath, paint);
}
- private void drawFilledPath(Canvas canvas, SparseIntArray localPaths, Paint paint) {
+ @VisibleForTesting
+ void drawFilledPath(Canvas canvas, SparseIntArray localPaths, Paint paint) {
+ if (localPaths.size() == 0) {
+ return;
+ }
mPath.reset();
float lastStartX = localPaths.keyAt(0);
mPath.moveTo(localPaths.keyAt(0), localPaths.valueAt(0));
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
index a07ffb9..43bdc30 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
@@ -27,11 +27,9 @@
import android.os.Vibrator;
import android.provider.Settings;
-import androidx.preference.ListPreference;
import androidx.preference.Preference;
import com.android.settings.R;
-import com.android.settings.display.DarkUIPreferenceController;
import com.android.settings.testutils.XmlTestUtils;
import org.junit.Before;
@@ -46,8 +44,6 @@
@RunWith(RobolectricTestRunner.class)
public class AccessibilitySettingsTest {
private static final String VIBRATION_PREFERENCE_SCREEN = "vibration_preference_screen";
- private static final String ACCESSIBILITY_CONTENT_TIMEOUT_PREFERENCE =
- "accessibility_content_timeout_preference_fragment";
private static final String ACCESSIBILITY_CONTROL_TIMEOUT_PREFERENCE =
"accessibility_control_timeout_preference_fragment";
private static final String DARK_UI_MODE_PREFERENCE =
@@ -71,9 +67,9 @@
@Test
public void testNonIndexableKeys_existInXmlLayout() {
final List<String> niks = AccessibilitySettings.SEARCH_INDEX_DATA_PROVIDER
- .getNonIndexableKeys(mContext);
+ .getNonIndexableKeys(mContext);
final List<String> keys =
- XmlTestUtils.getKeysFromPreferenceXml(mContext, R.xml.accessibility_settings);
+ XmlTestUtils.getKeysFromPreferenceXml(mContext, R.xml.accessibility_settings);
assertThat(keys).containsAllIn(niks);
}
@@ -113,12 +109,6 @@
for (int i = 0; i < testingValues.length; i++) {
Settings.Secure.putString(mContentResolver,
- Settings.Secure.ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS, testingValues[i]);
-
- verifyAccessibilityTimeoutSummary(ACCESSIBILITY_CONTENT_TIMEOUT_PREFERENCE,
- exceptedResIds[i]);
-
- Settings.Secure.putString(mContentResolver,
Settings.Secure.ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS, testingValues[i]);
verifyAccessibilityTimeoutSummary(ACCESSIBILITY_CONTROL_TIMEOUT_PREFERENCE,
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityTimeoutControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityTimeoutControllerTest.java
index 531282b..7891664 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityTimeoutControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityTimeoutControllerTest.java
@@ -45,8 +45,7 @@
@RunWith(RobolectricTestRunner.class)
public class AccessibilityTimeoutControllerTest
implements AccessibilityTimeoutController.OnChangeListener {
- private static final String PREF_KEY = "accessibility_content_timeout_30secs";
- private static String PREF_TITLE;
+ private static final String PREF_KEY = "accessibility_control_timeout_30secs";
private AccessibilityTimeoutController mController;
@@ -62,15 +61,14 @@
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
- mController = new AccessibilityTimeoutController(mContext, mock(Lifecycle.class),
- PREF_KEY, AccessibilityContentTimeoutPreferenceFragment.TAG);
+ mController = new AccessibilityTimeoutController(mContext, mock(Lifecycle.class), PREF_KEY);
mController.setOnChangeListener(this);
mContentResolver = mContext.getContentResolver();
- PREF_TITLE = mContext.getResources().getString(R.string.accessibility_timeout_30secs);
+ String prefTitle = mContext.getResources().getString(R.string.accessibility_timeout_30secs);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mMockPref);
when(mMockPref.getKey()).thenReturn(PREF_KEY);
- when(mMockPref.getTitle()).thenReturn(PREF_TITLE);
+ when(mMockPref.getTitle()).thenReturn(prefTitle);
mController.displayPreference(mScreen);
}
@@ -87,7 +85,7 @@
@Test
public void updateState_notChecked() {
Settings.Secure.putString(mContentResolver,
- Settings.Secure.ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS, "0");
+ Settings.Secure.ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS, "0");
mController.updateState(mMockPref);
@@ -99,7 +97,7 @@
@Test
public void updateState_checked() {
Settings.Secure.putString(mContentResolver,
- Settings.Secure.ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS, "30000");
+ Settings.Secure.ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS, "30000");
mController.updateState(mMockPref);
@@ -113,8 +111,8 @@
mController.onRadioButtonClicked(mMockPref);
String accessibilityUiTimeoutValue = Settings.Secure.getString(mContentResolver,
- Settings.Secure.ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS);
+ Settings.Secure.ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS);
assertThat(accessibilityUiTimeoutValue).isEqualTo("30000");
}
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java
index d47d125..93bd8dc 100644
--- a/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java
@@ -168,7 +168,6 @@
@Test
public void display_showRecents() throws Exception {
-
List<Event> events = new ArrayList<>();
Event app = new Event();
app.mEventType = Event.NOTIFICATION_INTERRUPTION;
@@ -262,8 +261,12 @@
ArgumentCaptor<Preference> prefCaptor = ArgumentCaptor.forClass(Preference.class);
verify(mCategory, times(2)).addPreference(prefCaptor.capture());
List<Preference> prefs = prefCaptor.getAllValues();
- assertThat(prefs.get(1).getKey()).isEqualTo(app.getPackageName());
- assertThat(prefs.get(0).getKey()).isEqualTo(app1.getPackageName());
+ assertThat(prefs.get(1).getKey()).isEqualTo(
+ RecentNotifyingAppsPreferenceController.getKey(UserHandle.myUserId(),
+ app.getPackageName()));
+ assertThat(prefs.get(0).getKey()).isEqualTo(
+ RecentNotifyingAppsPreferenceController.getKey(UserHandle.myUserId(),
+ app1.getPackageName()));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/widget/UsageGraphTest.java b/tests/robotests/src/com/android/settings/widget/UsageGraphTest.java
index 7f09c3b..ebb496c 100644
--- a/tests/robotests/src/com/android/settings/widget/UsageGraphTest.java
+++ b/tests/robotests/src/com/android/settings/widget/UsageGraphTest.java
@@ -24,6 +24,8 @@
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.Paint;
import android.util.SparseIntArray;
import com.android.settingslib.R;
@@ -177,4 +179,14 @@
assertThat(localPaths.keyAt(5)).isEqualTo(1001);
assertThat(localPaths.valueAt(5)).isEqualTo(-1);
}
+
+ @Test
+ public void drawFilledPath_emptyPath_shouldNotCrash() {
+ final Canvas canvas = new Canvas();
+ final SparseIntArray localPaths = new SparseIntArray();
+ final Paint paint = new Paint();
+
+ // Should not crash
+ mGraph.drawFilledPath(canvas, localPaths, paint);
+ }
}