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

Commit 6b326caf authored by Jigar Thakkar's avatar Jigar Thakkar
Browse files

Expose Userproperties builder methods for tests

This change exposes builder setters, particularly for
setShowInQuietMode and setShowInSharingSurfaces for unit tests
in mainline modules. These correspond to the properties that were
recently added to support different profile behaviours on sharing
surfaces.

Bug: 307515481
Test: atest UserManagerServiceUserPropertiesTest
Test: atest UserManagerServiceUserTypeTest
Change-Id: I3fcc4e7a997a8446e39b6447a6b45ca0a6251d38
parent 7d7d81a1
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -1143,6 +1143,13 @@ package android.content.pm {
    field public static final int SHOW_IN_LAUNCHER_WITH_PARENT = 0; // 0x0
    field public static final int SHOW_IN_LAUNCHER_WITH_PARENT = 0; // 0x0
  }
  }


  public static final class UserProperties.Builder {
    ctor public UserProperties.Builder();
    method @NonNull public android.content.pm.UserProperties build();
    method @NonNull public android.content.pm.UserProperties.Builder setShowInQuietMode(int);
    method @NonNull public android.content.pm.UserProperties.Builder setShowInSharingSurfaces(int);
  }

}
}


package android.content.res {
package android.content.res {
+56 −11
Original line number Original line Diff line number Diff line
@@ -1076,6 +1076,8 @@ public final class UserProperties implements Parcelable {
     * Intended for building default values (and so all properties are present in the built object).
     * Intended for building default values (and so all properties are present in the built object).
     * @hide
     * @hide
     */
     */
    @TestApi
    @SuppressLint("UnflaggedApi") // b/306636213
    public static final class Builder {
    public static final class Builder {
        // UserProperties fields and their default values.
        // UserProperties fields and their default values.
        private @ShowInLauncher int mShowInLauncher = SHOW_IN_LAUNCHER_WITH_PARENT;
        private @ShowInLauncher int mShowInLauncher = SHOW_IN_LAUNCHER_WITH_PARENT;
@@ -1099,54 +1101,82 @@ public final class UserProperties implements Parcelable {
        private boolean mDeleteAppWithParent = false;
        private boolean mDeleteAppWithParent = false;
        private boolean mAlwaysVisible = false;
        private boolean mAlwaysVisible = false;


        /**
         * @hide
         */
        @SuppressLint("UnflaggedApi") // b/306636213
        @TestApi
        public Builder() {}

        /** @hide */
        public Builder setShowInLauncher(@ShowInLauncher int showInLauncher) {
        public Builder setShowInLauncher(@ShowInLauncher int showInLauncher) {
            mShowInLauncher = showInLauncher;
            mShowInLauncher = showInLauncher;
            return this;
            return this;
        }
        }


        /** @hide */
        public Builder setStartWithParent(boolean startWithParent) {
        public Builder setStartWithParent(boolean startWithParent) {
            mStartWithParent = startWithParent;
            mStartWithParent = startWithParent;
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mShowInSettings} */
        /** Sets the value for {@link #mShowInSettings}
         * @hide
         */
        public Builder setShowInSettings(@ShowInSettings int showInSettings) {
        public Builder setShowInSettings(@ShowInSettings int showInSettings) {
            mShowInSettings = showInSettings;
            mShowInSettings = showInSettings;
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mShowInQuietMode} */
        /** Sets the value for {@link #mShowInQuietMode}
         * @hide
         */
        @TestApi
        @SuppressLint("UnflaggedApi") // b/306636213
        @NonNull
        public Builder setShowInQuietMode(@ShowInQuietMode int showInQuietMode) {
        public Builder setShowInQuietMode(@ShowInQuietMode int showInQuietMode) {
            mShowInQuietMode = showInQuietMode;
            mShowInQuietMode = showInQuietMode;
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mShowInSharingSurfaces}. */
        /** Sets the value for {@link #mShowInSharingSurfaces}.
         * @hide
         */
        @TestApi
        @SuppressLint("UnflaggedApi") // b/306636213
        @NonNull
        public Builder setShowInSharingSurfaces(@ShowInSharingSurfaces int showInSharingSurfaces) {
        public Builder setShowInSharingSurfaces(@ShowInSharingSurfaces int showInSharingSurfaces) {
            mShowInSharingSurfaces = showInSharingSurfaces;
            mShowInSharingSurfaces = showInSharingSurfaces;
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mInheritDevicePolicy}*/
        /** Sets the value for {@link #mInheritDevicePolicy}
         * @hide
         */
        public Builder setInheritDevicePolicy(
        public Builder setInheritDevicePolicy(
                @InheritDevicePolicy int inheritRestrictionsDevicePolicy) {
                @InheritDevicePolicy int inheritRestrictionsDevicePolicy) {
            mInheritDevicePolicy = inheritRestrictionsDevicePolicy;
            mInheritDevicePolicy = inheritRestrictionsDevicePolicy;
            return this;
            return this;
        }
        }


        /** @hide */
        public Builder setUseParentsContacts(boolean useParentsContacts) {
        public Builder setUseParentsContacts(boolean useParentsContacts) {
            mUseParentsContacts = useParentsContacts;
            mUseParentsContacts = useParentsContacts;
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mUpdateCrossProfileIntentFiltersOnOTA} */
        /** Sets the value for {@link #mUpdateCrossProfileIntentFiltersOnOTA}
         * @hide
         */
        public Builder setUpdateCrossProfileIntentFiltersOnOTA(boolean
        public Builder setUpdateCrossProfileIntentFiltersOnOTA(boolean
                updateCrossProfileIntentFiltersOnOTA) {
                updateCrossProfileIntentFiltersOnOTA) {
            mUpdateCrossProfileIntentFiltersOnOTA = updateCrossProfileIntentFiltersOnOTA;
            mUpdateCrossProfileIntentFiltersOnOTA = updateCrossProfileIntentFiltersOnOTA;
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mCrossProfileIntentFilterAccessControl} */
        /** Sets the value for {@link #mCrossProfileIntentFilterAccessControl}
         * @hide
         */
        public Builder setCrossProfileIntentFilterAccessControl(
        public Builder setCrossProfileIntentFilterAccessControl(
                @CrossProfileIntentFilterAccessControlLevel int
                @CrossProfileIntentFilterAccessControlLevel int
                        crossProfileIntentFilterAccessControl) {
                        crossProfileIntentFilterAccessControl) {
@@ -1154,24 +1184,30 @@ public final class UserProperties implements Parcelable {
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mCrossProfileIntentResolutionStrategy} */
        /** Sets the value for {@link #mCrossProfileIntentResolutionStrategy}
         * @hide
         */
        public Builder setCrossProfileIntentResolutionStrategy(@CrossProfileIntentResolutionStrategy
        public Builder setCrossProfileIntentResolutionStrategy(@CrossProfileIntentResolutionStrategy
                int crossProfileIntentResolutionStrategy) {
                int crossProfileIntentResolutionStrategy) {
            mCrossProfileIntentResolutionStrategy = crossProfileIntentResolutionStrategy;
            mCrossProfileIntentResolutionStrategy = crossProfileIntentResolutionStrategy;
            return this;
            return this;
        }
        }


        /** @hide */
        public Builder setMediaSharedWithParent(boolean mediaSharedWithParent) {
        public Builder setMediaSharedWithParent(boolean mediaSharedWithParent) {
            mMediaSharedWithParent = mediaSharedWithParent;
            mMediaSharedWithParent = mediaSharedWithParent;
            return this;
            return this;
        }
        }


        /** @hide */
        public Builder setCredentialShareableWithParent(boolean credentialShareableWithParent) {
        public Builder setCredentialShareableWithParent(boolean credentialShareableWithParent) {
            mCredentialShareableWithParent = credentialShareableWithParent;
            mCredentialShareableWithParent = credentialShareableWithParent;
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mAuthAlwaysRequiredToDisableQuietMode} */
        /** Sets the value for {@link #mAuthAlwaysRequiredToDisableQuietMode}
         * @hide
         */
        public Builder setAuthAlwaysRequiredToDisableQuietMode(
        public Builder setAuthAlwaysRequiredToDisableQuietMode(
                boolean authAlwaysRequiredToDisableQuietMode) {
                boolean authAlwaysRequiredToDisableQuietMode) {
            mAuthAlwaysRequiredToDisableQuietMode =
            mAuthAlwaysRequiredToDisableQuietMode =
@@ -1179,19 +1215,28 @@ public final class UserProperties implements Parcelable {
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mDeleteAppWithParent}*/
        /** Sets the value for {@link #mDeleteAppWithParent}
         * @hide
         */
        public Builder setDeleteAppWithParent(boolean deleteAppWithParent) {
        public Builder setDeleteAppWithParent(boolean deleteAppWithParent) {
            mDeleteAppWithParent = deleteAppWithParent;
            mDeleteAppWithParent = deleteAppWithParent;
            return this;
            return this;
        }
        }


        /** Sets the value for {@link #mAlwaysVisible}*/
        /** Sets the value for {@link #mAlwaysVisible}
         * @hide
         */
        public Builder setAlwaysVisible(boolean alwaysVisible) {
        public Builder setAlwaysVisible(boolean alwaysVisible) {
            mAlwaysVisible = alwaysVisible;
            mAlwaysVisible = alwaysVisible;
            return this;
            return this;
        }
        }


        /** Builds a UserProperties object with *all* values populated. */
        /** Builds a UserProperties object with *all* values populated.
         * @hide
         */
        @TestApi
        @SuppressLint("UnflaggedApi") // b/306636213
        @NonNull
        public UserProperties build() {
        public UserProperties build() {
            return new UserProperties(
            return new UserProperties(
                    mShowInLauncher,
                    mShowInLauncher,