Merge "Import translations. DO NOT MERGE ANYWHERE"
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 2907416..38e3e20 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -3221,6 +3221,22 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" android:color="@color/accessibility_feature_background"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_adaptive_font_download.xml"
+ line="23"
+ column="13"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color="@color/homepage_about_background" />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
diff --git a/res/drawable/ic_adaptive_font_download.xml b/res/drawable/ic_adaptive_font_download.xml
new file mode 100644
index 0000000..1993015
--- /dev/null
+++ b/res/drawable/ic_adaptive_font_download.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <com.android.settingslib.widget.AdaptiveIconShapeDrawable
+ android:width="@dimen/accessibility_icon_size"
+ android:height="@dimen/accessibility_icon_size"
+ android:color="@color/accessibility_feature_background"/>
+ </item>
+ <item android:gravity="center">
+ <vector
+ android:width="@dimen/accessibility_icon_foreground_size"
+ android:height="@dimen/accessibility_icon_foreground_size"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M6.4,18h2.1l1.1,-3.05h4.8L15.5,18h2.1L13.05,6h-2.1zM10.2,13.2l1.75,-4.95h0.1l1.75,4.95zM4,22q-0.825,0 -1.413,-0.587Q2,20.825 2,20L2,4q0,-0.825 0.587,-1.413Q3.175,2 4,2h16q0.825,0 1.413,0.587Q22,3.175 22,4v16q0,0.825 -0.587,1.413Q20.825,22 20,22zM4,20h16L20,4L4,4v16zM4,4v16L4,4z"/>
+ </vector>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index db7c751..6240175 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5326,6 +5326,8 @@
<string name="accessibility_screen_magnification_state_navbar_gesture">Magnify with shortcut & triple-tap</string>
<!-- Title for the footer text to explain what accessibility service does. [CHAR LIMIT=35] -->
<string name="accessibility_introduction_title">About <xliff:g id="service" example="Select to Speak">%1$s</xliff:g></string>
+ <!-- Title for the accessibility preference to adjust the display size, font size, bold text, and high contrast text features. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_text_reading_options_title">Text and reading options</string>
<!-- Title for the footer text to explain what option accessibility service does. [CHAR LIMIT=35] -->
<string name="accessibility_screen_option">Options</string>
<!-- Summary for the accessibility preference to enable screen magnification. [CHAR LIMIT=25] -->
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 8113a9f..65e481a 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -36,6 +36,14 @@
android:persistent="false"
android:title="@string/display_category_title">
+ <!-- After completely finishing the Text and reading options feature, it will be visible. -->
+ <Preference
+ android:icon="@drawable/ic_adaptive_font_download"
+ android:key="text_reading_options"
+ android:persistent="false"
+ android:title="@strings/accessibility_text_reading_options_title"
+ settings:isPreferenceVisible="false"/>
+
<Preference
android:fragment="com.android.settings.accessibility.TextAndDisplayFragment"
android:key="text_and_display_preference_screen"
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 767a328..255b85f 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -1251,7 +1251,10 @@
}
return true;
} else if (pref == mAddSupervisedUser) {
+ mMetricsFeatureProvider.action(getActivity(), SettingsEnums.ACTION_USER_SUPERVISED_ADD);
+ Trace.beginSection("UserSettings.addSupervisedUser");
onAddSupervisedUserClicked();
+ Trace.endSection();
return true;
} else if (pref == mAddGuest) {
mAddGuest.setEnabled(false); // prevent multiple tap issue
diff --git a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
index d8f3959..5c13e2f 100644
--- a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
@@ -27,6 +27,7 @@
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.notNull;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
@@ -40,6 +41,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
@@ -122,6 +125,8 @@
@Mock
private UserManager mUserManager;
@Mock
+ private PackageManager mPackageManager;
+ @Mock
private MetricsFeatureProvider mMetricsFeatureProvider;
private FragmentActivity mActivity;
@@ -149,11 +154,13 @@
ReflectionHelpers.setField(mFragment, "mMetricsFeatureProvider", mMetricsFeatureProvider);
doReturn(mUserManager).when(mActivity).getSystemService(UserManager.class);
+ doReturn(mPackageManager).when(mActivity).getPackageManager();
doReturn(mActivity).when(mFragment).getActivity();
doReturn(mContext).when(mFragment).getContext();
doReturn(mMockPreferenceManager).when(mFragment).getPreferenceManager();
doReturn(mUserManager).when(mContext).getSystemService(UserManager.class);
+ doReturn(mPackageManager).when(mContext).getPackageManager();
mProvisionedBackupValue = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0);
@@ -654,6 +661,29 @@
}
@Test
+ public void onPreferenceClick_addSupervisedUserClicked_startIntentWithAction() {
+ final String intentPackage = "testPackage";
+ final String intentAction = UserManager.ACTION_CREATE_SUPERVISED_USER;
+ final int metricsAction = SettingsEnums.ACTION_USER_SUPERVISED_ADD;
+ try {
+ setConfigSupervisedUserCreationPackage(intentPackage);
+ doReturn(new ResolveInfo()).when(mPackageManager).resolveActivity(any(), anyInt());
+ doNothing().when(mFragment).startActivity(any());
+
+ mFragment.onPreferenceClick(mAddSupervisedUserPreference);
+
+ final ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
+ verify(mFragment).startActivity(captor.capture());
+ assertThat(captor.getValue().getPackage()).isEqualTo(intentPackage);
+ assertThat(captor.getValue().getAction()).isEqualTo(intentAction);
+
+ verify(mMetricsFeatureProvider).action(any(), eq(metricsAction));
+ } finally {
+ SettingsShadowResources.reset();
+ }
+ }
+
+ @Test
public void getRealUsersCount_onlyAdmin_shouldCount() {
givenUsers(getAdminUser(true));
diff --git a/tests/unit/AndroidManifest.xml b/tests/unit/AndroidManifest.xml
index 7ef7ae1..b22f26a 100644
--- a/tests/unit/AndroidManifest.xml
+++ b/tests/unit/AndroidManifest.xml
@@ -15,6 +15,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
package="com.android.settings.tests.unit">
<uses-permission android:name="android.permission.BLUETOOTH" />
@@ -69,6 +70,13 @@
android:resource="@xml/authenticator" />
</service>
+ <!-- Disable startup provider due to resource loading issue. -->
+ <provider
+ android:name="androidx.startup.InitializationProvider"
+ android:authorities="${applicationId}.androidx-startup"
+ tools:node="remove"
+ tools:replace="android:authorities"/>
+
</application>
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"