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

Commit b3f37f0a authored by Jigar Thakkar's avatar Jigar Thakkar Committed by Ankita Vyas
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
Merged-In: I3fcc4e7a997a8446e39b6447a6b45ca0a6251d38
Change-Id: I3fcc4e7a997a8446e39b6447a6b45ca0a6251d38
parent c3600fdc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1107,6 +1107,13 @@ package android.content.pm {
    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 {
+51 −10
Original line number Diff line number Diff line
@@ -1003,6 +1003,8 @@ public final class UserProperties implements Parcelable {
     * Intended for building default values (and so all properties are present in the built object).
     * @hide
     */
    @TestApi
    @SuppressLint("UnflaggedApi") // b/306636213
    public static final class Builder {
        // UserProperties fields and their default values.
        private @ShowInLauncher int mShowInLauncher = SHOW_IN_LAUNCHER_WITH_PARENT;
@@ -1024,55 +1026,82 @@ public final class UserProperties implements Parcelable {
        private boolean mCredentialShareableWithParent = false;
        private boolean mDeleteAppWithParent = false;

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

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

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

        /** Sets the value for {@link #mShowInSettings} */
        /** Sets the value for {@link #mShowInSettings}
         * @hide
         */
        public Builder setShowInSettings(@ShowInSettings int showInSettings) {
            mShowInSettings = showInSettings;
            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) {
            mShowInQuietMode = showInQuietMode;
            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) {
            mShowInSharingSurfaces = showInSharingSurfaces;
            return this;
        }


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

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

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

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

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

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

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

        /** Sets the value for {@link #mDeleteAppWithParent}*/

        /** Sets the value for {@link #mDeleteAppWithParent}
         * @hide
         */
        public Builder setDeleteAppWithParent(boolean deleteAppWithParent) {
            mDeleteAppWithParent = deleteAppWithParent;
            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() {
            return new UserProperties(
                    mShowInLauncher,