DO NOT MERGE: Cherry-pick a bunch fixes to AOSP
Task affinity updates - Remove task affinity for AppDrawOver Settings - Remove task affinity for ConfigNotificationSettings The task affinity is messing with the back stack for this activity when launched externally Fixes: 80281932 Fixes: 80290571 Test: manual Disable uninstall update option for secondary users. Fixes: 110249550 Test: manual Suppress some gesture search when there is no hardware Fixes: 110250839 Test: robotests Check wifi password length by byte, not char. Change-Id: Ic25ef766886507211c3de8764c1cffef2b27a025 Fixes: 79209073 Test: robotest
This commit is contained in:
@@ -2620,7 +2620,6 @@
|
||||
android:name="Settings$ConfigureNotificationSettingsActivity"
|
||||
android:label="@string/configure_notification_settings"
|
||||
android:exported="true"
|
||||
android:taskAffinity="com.android.settings"
|
||||
android:parentActivityName="Settings">
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="android.settings.NOTIFICATION_SETTINGS" />
|
||||
@@ -2951,7 +2950,6 @@
|
||||
<activity
|
||||
android:name="Settings$AppDrawOverlaySettingsActivity"
|
||||
android:label="@string/draw_overlay"
|
||||
android:taskAffinity="com.android.settings"
|
||||
android:parentActivityName="Settings">
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="android.settings.action.MANAGE_OVERLAY_PERMISSION" />
|
||||
|
@@ -67,6 +67,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Dashboard fragment to display application information from Settings. This activity presents
|
||||
* extended information associated with a package like code, data, total size, permissions
|
||||
@@ -350,8 +351,10 @@ public class AppInfoDashboardFragment extends DashboardFragment
|
||||
final MenuItem uninstallUpdatesItem = menu.findItem(UNINSTALL_UPDATES);
|
||||
final boolean uninstallUpdateDisabled = getContext().getResources().getBoolean(
|
||||
R.bool.config_disable_uninstall_update);
|
||||
uninstallUpdatesItem.setVisible(
|
||||
mUpdatedSysApp && !mAppsControlDisallowedBySystem && !uninstallUpdateDisabled);
|
||||
uninstallUpdatesItem.setVisible(mUserManager.isAdminUser()
|
||||
&& mUpdatedSysApp
|
||||
&& !mAppsControlDisallowedBySystem
|
||||
&& !uninstallUpdateDisabled);
|
||||
if (uninstallUpdatesItem.isVisible()) {
|
||||
RestrictedLockUtils.setMenuItemAsDisabledByAdmin(getActivity(),
|
||||
uninstallUpdatesItem, mAppsControlDisallowedAdmin);
|
||||
|
@@ -70,5 +70,10 @@ public class SwipeToNotificationSettings extends DashboardFragment {
|
||||
sir.xmlResId = R.xml.swipe_to_notification_settings;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return SwipeToNotificationPreferenceController.isAvailable(context);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settingslib.wrapper.PackageManagerWrapper;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class WifiUtils {
|
||||
|
||||
@@ -40,7 +41,7 @@ public class WifiUtils {
|
||||
if (TextUtils.isEmpty(ssid)) {
|
||||
return false;
|
||||
}
|
||||
return ssid.length() > SSID_ASCII_MAX_LENGTH;
|
||||
return ssid.getBytes(StandardCharsets.UTF_8).length > SSID_ASCII_MAX_LENGTH;
|
||||
}
|
||||
|
||||
public static boolean isSSIDTooShort(String ssid) {
|
||||
@@ -61,6 +62,7 @@ public class WifiUtils {
|
||||
|
||||
/**
|
||||
* This method is a stripped and negated version of WifiConfigStore.canModifyNetwork.
|
||||
*
|
||||
* @param context Context of caller
|
||||
* @param config The WiFi config.
|
||||
* @return true if Settings cannot modify the config due to lockDown.
|
||||
|
@@ -91,7 +91,9 @@ public final class AppInfoDashboardFragmentTest {
|
||||
doReturn(mActivity).when(mFragment).getActivity();
|
||||
doReturn(mShadowContext).when(mFragment).getContext();
|
||||
doReturn(mPackageManager).when(mActivity).getPackageManager();
|
||||
when(mUserManager.isAdminUser()).thenReturn(true);
|
||||
|
||||
ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
|
||||
// Default to not considering any apps to be instant (individual tests can override this).
|
||||
ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider",
|
||||
(InstantAppDataProvider) (i -> false));
|
||||
@@ -102,7 +104,7 @@ public final class AppInfoDashboardFragmentTest {
|
||||
when(mDevicePolicyManager.packageHasActiveAdmins(nullable(String.class))).thenReturn(false);
|
||||
when(mUserManager.getUsers().size()).thenReturn(2);
|
||||
ReflectionHelpers.setField(mFragment, "mDpm", mDevicePolicyManager);
|
||||
ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
|
||||
|
||||
final ApplicationInfo info = new ApplicationInfo();
|
||||
info.enabled = true;
|
||||
final AppEntry appEntry = mock(AppEntry.class);
|
||||
@@ -118,7 +120,6 @@ public final class AppInfoDashboardFragmentTest {
|
||||
when(mDevicePolicyManager.packageHasActiveAdmins(nullable(String.class))).thenReturn(false);
|
||||
when(mUserManager.getUsers().size()).thenReturn(2);
|
||||
ReflectionHelpers.setField(mFragment, "mDpm", mDevicePolicyManager);
|
||||
ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
|
||||
final ApplicationInfo info = new ApplicationInfo();
|
||||
info.flags = ApplicationInfo.FLAG_INSTALLED;
|
||||
info.enabled = true;
|
||||
@@ -217,7 +218,6 @@ public final class AppInfoDashboardFragmentTest {
|
||||
final PackageInfo packageInfo = mock(PackageInfo.class);
|
||||
|
||||
ReflectionHelpers.setField(mFragment, "mDpm", mDevicePolicyManager);
|
||||
ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
|
||||
ReflectionHelpers.setField(mFragment, "mPackageInfo", packageInfo);
|
||||
|
||||
assertThat(mFragment.shouldShowUninstallForAll(appEntry)).isFalse();
|
||||
@@ -258,7 +258,6 @@ public final class AppInfoDashboardFragmentTest {
|
||||
userInfos.add(new UserInfo(userID1, "User1", UserInfo.FLAG_PRIMARY));
|
||||
userInfos.add(new UserInfo(userID2, "yue", UserInfo.FLAG_GUEST));
|
||||
when(mUserManager.getUsers(true)).thenReturn(userInfos);
|
||||
ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
|
||||
final ApplicationInfo appInfo = new ApplicationInfo();
|
||||
appInfo.flags = ApplicationInfo.FLAG_INSTALLED;
|
||||
when(mPackageManager.getApplicationInfoAsUser(
|
||||
@@ -282,7 +281,6 @@ public final class AppInfoDashboardFragmentTest {
|
||||
userInfos.add(new UserInfo(userID1, "User1", UserInfo.FLAG_PRIMARY));
|
||||
userInfos.add(new UserInfo(userID2, "yue", UserInfo.FLAG_GUEST));
|
||||
when(mUserManager.getUsers(true)).thenReturn(userInfos);
|
||||
ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
|
||||
final ApplicationInfo appInfo = new ApplicationInfo();
|
||||
appInfo.flags = ApplicationInfo.FLAG_INSTALLED;
|
||||
when(mPackageManager.getApplicationInfoAsUser(
|
||||
|
@@ -23,28 +23,33 @@ import android.provider.SearchIndexableResource;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class SwipeToNotificationSettingsTest {
|
||||
|
||||
@Mock
|
||||
private Context mContext;
|
||||
private SwipeToNotificationSettings mFragment;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mFragment = new SwipeToNotificationSettings();
|
||||
ShadowUtils.reset();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
ShadowUtils.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -57,9 +62,21 @@ public class SwipeToNotificationSettingsTest {
|
||||
public void testSearchIndexProvider_shouldIndexResource() {
|
||||
final List<SearchIndexableResource> indexRes =
|
||||
SwipeToNotificationSettings.SEARCH_INDEX_DATA_PROVIDER
|
||||
.getXmlResourcesToIndex(RuntimeEnvironment.application, true /* enabled */);
|
||||
.getXmlResourcesToIndex(mContext, true /* enabled */);
|
||||
|
||||
assertThat(indexRes).isNotNull();
|
||||
assertThat(indexRes.get(0).xmlResId).isEqualTo(mFragment.getPreferenceScreenResId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowUtils.class)
|
||||
public void getNonIndexableKeys_noFingerprintHardware_shouldSuppressPage() {
|
||||
ShadowUtils.setFingerprintManager(null);
|
||||
|
||||
final List<String> niks = SwipeToNotificationSettings.SEARCH_INDEX_DATA_PROVIDER
|
||||
.getNonIndexableKeys(mContext);
|
||||
|
||||
assertThat(niks).isNotEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ public class WifiUtilsTest {
|
||||
@Test
|
||||
public void testSSID() {
|
||||
assertThat(WifiUtils.isSSIDTooLong("123")).isFalse();
|
||||
assertThat(WifiUtils.isSSIDTooLong("☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎")).isTrue();
|
||||
assertThat(WifiUtils.isSSIDTooLong("☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎☎")).isTrue();
|
||||
|
||||
assertThat(WifiUtils.isSSIDTooShort("123")).isFalse();
|
||||
assertThat(WifiUtils.isSSIDTooShort("")).isTrue();
|
||||
|
Reference in New Issue
Block a user