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

Commit 999ea9fb authored by Vladislav Kuzkokov's avatar Vladislav Kuzkokov Committed by Android (Google) Code Review
Browse files

Merge "Make printing policy a restriction."

parents 2dd7bde9 622b9f92
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -6493,7 +6493,6 @@ package android.app.admin {
    method public boolean isNetworkLoggingEnabled(android.content.ComponentName);
    method public boolean isOverrideApnEnabled(android.content.ComponentName);
    method public boolean isPackageSuspended(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public boolean isPrintingEnabled();
    method public boolean isProfileOwnerApp(java.lang.String);
    method public boolean isProvisioningAllowed(java.lang.String);
    method public boolean isResetPasswordTokenActive(android.content.ComponentName);
@@ -6566,7 +6565,6 @@ package android.app.admin {
    method public boolean setPermittedAccessibilityServices(android.content.ComponentName, java.util.List<java.lang.String>);
    method public boolean setPermittedCrossProfileNotificationListeners(android.content.ComponentName, java.util.List<java.lang.String>);
    method public boolean setPermittedInputMethods(android.content.ComponentName, java.util.List<java.lang.String>);
    method public void setPrintingEnabled(android.content.ComponentName, boolean);
    method public void setProfileEnabled(android.content.ComponentName);
    method public void setProfileName(android.content.ComponentName, java.lang.String);
    method public void setRecommendedGlobalProxy(android.content.ComponentName, android.net.ProxyInfo);
@@ -33140,6 +33138,7 @@ package android.os {
    field public static final java.lang.String DISALLOW_NETWORK_RESET = "no_network_reset";
    field public static final java.lang.String DISALLOW_OUTGOING_BEAM = "no_outgoing_beam";
    field public static final java.lang.String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls";
    field public static final java.lang.String DISALLOW_PRINTING = "no_printing";
    field public static final java.lang.String DISALLOW_REMOVE_MANAGED_PROFILE = "no_remove_managed_profile";
    field public static final java.lang.String DISALLOW_REMOVE_USER = "no_remove_user";
    field public static final java.lang.String DISALLOW_SAFE_BOOT = "no_safe_boot";
+0 −35
Original line number Diff line number Diff line
@@ -9403,41 +9403,6 @@ public class DevicePolicyManager {
        }
    }

    /**
     * Allows/disallows printing.
     *
     * Called by a device owner or a profile owner.
     * Device owner changes policy for all users. Profile owner can override it if present.
     * Printing is enabled by default. If {@code FEATURE_PRINTING} is absent, the call is ignored.
     *
     * @param admin which {@link DeviceAdminReceiver} this request is associated with.
     * @param enabled whether printing should be allowed or not.
     * @throws SecurityException if {@code admin} is neither device, nor profile owner.
     */
    public void setPrintingEnabled(@NonNull ComponentName admin, boolean enabled) {
        try {
            mService.setPrintingEnabled(admin, enabled);
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /**
     * Returns whether printing is enabled for this user.
     *
     * Always {@code false} if {@code FEATURE_PRINTING} is absent.
     * Otherwise, {@code true} by default.
     *
     * @return {@code true} iff printing is enabled.
     */
    public boolean isPrintingEnabled() {
        try {
            return mService.isPrintingEnabled();
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /**
     * Called by device owner to add an override APN.
     *
+0 −3
Original line number Diff line number Diff line
@@ -402,9 +402,6 @@ interface IDevicePolicyManager {
    CharSequence getStartUserSessionMessage(in ComponentName admin);
    CharSequence getEndUserSessionMessage(in ComponentName admin);

    void setPrintingEnabled(in ComponentName admin, boolean enabled);
    boolean isPrintingEnabled();

    List<String> setMeteredDataDisabled(in ComponentName admin, in List<String> packageNames);
    List<String> getMeteredDataDisabled(in ComponentName admin);

+14 −0
Original line number Diff line number Diff line
@@ -943,6 +943,20 @@ public class UserManager {
     * @see #getUserRestrictions()
     */
    public static final String DISALLOW_SHARE_INTO_MANAGED_PROFILE = "no_sharing_into_profile";

    /**
     * Specifies whether the user is allowed to print.
     *
     * This restriction can be set by device or profile owner.
     *
     * The default value is {@code false}.
     *
     * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
     * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
     * @see #getUserRestrictions()
     */
    public static final String DISALLOW_PRINTING = "no_printing";

    /**
     * Application restriction key that is used to indicate the pending arrival
     * of real restrictions for the app.
+2 −1
Original line number Diff line number Diff line
@@ -122,7 +122,8 @@ public class UserRestrictionsUtils {
            UserManager.DISALLOW_CONFIG_BRIGHTNESS,
            UserManager.DISALLOW_SHARE_INTO_MANAGED_PROFILE,
            UserManager.DISALLOW_AMBIENT_DISPLAY,
            UserManager.DISALLOW_CONFIG_SCREEN_TIMEOUT
            UserManager.DISALLOW_CONFIG_SCREEN_TIMEOUT,
            UserManager.DISALLOW_PRINTING
    });

    /**
Loading