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

Commit c2bbff6f authored by Oleg Kibirev's avatar Oleg Kibirev Committed by Android (Google) Code Review
Browse files

Merge "Make Restricted preferences configurable at runtime" into main

parents da7c3af6 0cf1e260
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -151,6 +151,18 @@ public class RestrictedPreferenceHelper {
                        UserHandle.myUserId());
    }

    /**
     * Configures the user restriction that this preference will track. This is equivalent to
     * specifying {@link R.styleable#RestrictedPreference_userRestriction} in XML and allows
     * configuring user restriction at runtime.
     */
    public void setUserRestriction(@Nullable String userRestriction) {
        mAttrUserRestriction = userRestriction == null ||
            RestrictedLockUtilsInternal.hasBaseUserRestriction(mContext, userRestriction,
                UserHandle.myUserId()) ? null : userRestriction;
        setDisabledByAdmin(checkRestrictionEnforced());
    }

    public void useAdminDisabledSummary(boolean useSummary) {
        mDisabledSummary = useSummary;
    }