diff --git a/res/drawable/ic_adaptive_font_download.xml b/res/drawable/ic_adaptive_font_download.xml
new file mode 100644
index 00000000000..1993015b01d
--- /dev/null
+++ b/res/drawable/ic_adaptive_font_download.xml
@@ -0,0 +1,36 @@
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/captioning_preview.xml b/res/layout/captioning_preview.xml
index d8d2e4fbc5d..19e63602c71 100644
--- a/res/layout/captioning_preview.xml
+++ b/res/layout/captioning_preview.xml
@@ -21,13 +21,17 @@
android:clipToPadding="true"
android:clipChildren="true"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
Magnify with shortcut & triple-tap
About %1$s
+
+ Text and reading options
Options
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 8113a9fd1d0..65e481a64c1 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">
+
+
+
resolveInfos = AppRestrictionsFragment.this.mPackageManager
- .queryIntentActivities(intent, 0 /* no flags */);
- if (resolveInfos.size() != 1) {
- return;
+ ResolveInfo resolveInfo = mPackageManager.resolveActivity(
+ intent, PackageManager.MATCH_DEFAULT_ONLY);
+
+ if (resolveInfo == null) {
+ throw new ActivityNotFoundException("No result for resolving " + intent);
}
// Prevent potential privilege escalation
- ActivityInfo activityInfo = resolveInfos.get(0).activityInfo;
+ ActivityInfo activityInfo = resolveInfo.activityInfo;
if (!packageName.equals(activityInfo.packageName)) {
throw new SecurityException("Application " + packageName
+ " is not allowed to start activity " + intent);
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 767a328ec0b..255b85fe0bf 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -1251,7 +1251,10 @@ public class UserSettings extends SettingsPreferenceFragment
}
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/network/NetworkProviderSettingsTest.java b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
index f3e3674bda7..999487659cb 100644
--- a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
@@ -328,6 +328,55 @@ public class NetworkProviderSettingsTest {
anyInt());
}
+ @Test
+ public void onCreateContextMenu_canShare_shouldHaveShareMenuForConnectedWifiEntry() {
+ final FragmentActivity activity = mock(FragmentActivity.class);
+ when(activity.getApplicationContext()).thenReturn(mContext);
+ when(mNetworkProviderSettings.getActivity()).thenReturn(activity);
+
+ final WifiEntry wifiEntry = mock(WifiEntry.class);
+ when(wifiEntry.canDisconnect()).thenReturn(true);
+ when(wifiEntry.canShare()).thenReturn(true);
+ when(wifiEntry.canForget()).thenReturn(true);
+ when(wifiEntry.isSaved()).thenReturn(true);
+ when(wifiEntry.getConnectedState()).thenReturn(WifiEntry.CONNECTED_STATE_CONNECTED);
+
+ final LongPressWifiEntryPreference connectedWifiEntryPreference =
+ mNetworkProviderSettings.createLongPressWifiEntryPreference(wifiEntry);
+ final View view = mock(View.class);
+ when(view.getTag()).thenReturn(connectedWifiEntryPreference);
+
+ final ContextMenu menu = mock(ContextMenu.class);
+ mNetworkProviderSettings.onCreateContextMenu(menu, view, null /* info */);
+
+ verify(menu).add(anyInt(), eq(NetworkProviderSettings.MENU_ID_SHARE), anyInt(), anyInt());
+ }
+
+ @Test
+ public void onCreateContextMenu_canNotShare_shouldDisappearShareMenuForConnectedWifiEntry() {
+ final FragmentActivity activity = mock(FragmentActivity.class);
+ when(activity.getApplicationContext()).thenReturn(mContext);
+ when(mNetworkProviderSettings.getActivity()).thenReturn(activity);
+
+ final WifiEntry wifiEntry = mock(WifiEntry.class);
+ when(wifiEntry.canDisconnect()).thenReturn(true);
+ when(wifiEntry.canShare()).thenReturn(false);
+ when(wifiEntry.canForget()).thenReturn(true);
+ when(wifiEntry.isSaved()).thenReturn(true);
+ when(wifiEntry.getConnectedState()).thenReturn(WifiEntry.CONNECTED_STATE_CONNECTED);
+
+ final LongPressWifiEntryPreference connectedWifiEntryPreference =
+ mNetworkProviderSettings.createLongPressWifiEntryPreference(wifiEntry);
+ final View view = mock(View.class);
+ when(view.getTag()).thenReturn(connectedWifiEntryPreference);
+
+ final ContextMenu menu = mock(ContextMenu.class);
+ mNetworkProviderSettings.onCreateContextMenu(menu, view, null /* info */);
+
+ verify(menu, never())
+ .add(anyInt(), eq(NetworkProviderSettings.MENU_ID_SHARE), anyInt(), anyInt());
+ }
+
@Test
public void onWifiEntriesChanged_shouldChangeNextButtonState() {
mNetworkProviderSettings.onWifiEntriesChanged();
diff --git a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
index d8f3959c6d7..5c13e2f8de6 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.anyInt;
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.ComponentName;
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 @@ public class UserSettingsTest {
@Mock
private UserManager mUserManager;
@Mock
+ private PackageManager mPackageManager;
+ @Mock
private MetricsFeatureProvider mMetricsFeatureProvider;
private FragmentActivity mActivity;
@@ -149,11 +154,13 @@ public class UserSettingsTest {
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);
@@ -653,6 +660,29 @@ public class UserSettingsTest {
verify(mMetricsFeatureProvider).action(any(), eq(SettingsEnums.ACTION_USER_GUEST_ADD));
}
+ @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 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 7ef7ae1d2ba..b22f26a94ed 100644
--- a/tests/unit/AndroidManifest.xml
+++ b/tests/unit/AndroidManifest.xml
@@ -15,6 +15,7 @@
-->
@@ -69,6 +70,13 @@
android:resource="@xml/authenticator" />
+
+
+