Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4936217 authored by Himanshu Gupta's avatar Himanshu Gupta
Browse files

Removing permissions for mItemsRestrictedOnHomeScreen UserProperty

Currently, `mItemsRestrictedOnHomeScreen` UserProperty can only be
accessed by system processes. This was causing
[failures](https://android-build.corp.google.com/test_investigate/?invocationId=I87900010248721608&testResultId=TR27929185691423632&tab=trace)
in postsubmit tests after flags were advanced to staging.

To fix this, the property above is changed to be unrestricted, to
allow Launcher process access.

Bug: 326158831
Test: atest UserManagerServiceUserPropertiesTest
Test: atest UserManagerServiceUserTypeTest
Test: atest FrameworksServicesTests:UserManagerTest
Change-Id: I35b71006a0ad10e062f8c543f73b3aac87322d0f
parent aed70fff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -537,7 +537,6 @@ public final class UserProperties implements Parcelable {
            setDeleteAppWithParent(orig.getDeleteAppWithParent());
            setAlwaysVisible(orig.getAlwaysVisible());
            setAllowStoppingUserWithDelayedLocking(orig.getAllowStoppingUserWithDelayedLocking());
            setItemsRestrictedOnHomeScreen(orig.areItemsRestrictedOnHomeScreen());
        }
        if (hasManagePermission) {
            // Add items that require MANAGE_USERS or stronger.
@@ -557,6 +556,7 @@ public final class UserProperties implements Parcelable {
        setShowInSharingSurfaces(orig.getShowInSharingSurfaces());
        setCrossProfileContentSharingStrategy(orig.getCrossProfileContentSharingStrategy());
        setProfileApiVisibility(orig.getProfileApiVisibility());
        setItemsRestrictedOnHomeScreen(orig.areItemsRestrictedOnHomeScreen());
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -197,8 +197,6 @@ public class UserManagerServiceUserPropertiesTest {
        assertEqualGetterOrThrows(orig::getAlwaysVisible, copy::getAlwaysVisible, exposeAll);
        assertEqualGetterOrThrows(orig::getAllowStoppingUserWithDelayedLocking,
                copy::getAllowStoppingUserWithDelayedLocking, exposeAll);
        assertEqualGetterOrThrows(orig::areItemsRestrictedOnHomeScreen,
                copy::areItemsRestrictedOnHomeScreen, exposeAll);

        // Items requiring hasManagePermission - put them here using hasManagePermission.
        assertEqualGetterOrThrows(orig::getShowInSettings, copy::getShowInSettings,
@@ -220,6 +218,8 @@ public class UserManagerServiceUserPropertiesTest {
                copy::getCrossProfileContentSharingStrategy, true);
        assertEqualGetterOrThrows(orig::getProfileApiVisibility, copy::getProfileApiVisibility,
                true);
        assertEqualGetterOrThrows(orig::areItemsRestrictedOnHomeScreen,
                copy::areItemsRestrictedOnHomeScreen, true);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -350,8 +350,8 @@ public final class UserManagerTest {
                privateProfileUserProperties::getAllowStoppingUserWithDelayedLocking);
        assertThat(typeProps.getProfileApiVisibility()).isEqualTo(
                privateProfileUserProperties.getProfileApiVisibility());
        assertThrows(SecurityException.class,
                privateProfileUserProperties::areItemsRestrictedOnHomeScreen);
        assertThat(typeProps.areItemsRestrictedOnHomeScreen())
                .isEqualTo(privateProfileUserProperties.areItemsRestrictedOnHomeScreen());
        compareDrawables(mUserManager.getUserBadge(),
                Resources.getSystem().getDrawable(userTypeDetails.getBadgePlain()));