diff --git a/api/current.txt b/api/current.txt index 3d8c5a64f913c..7d99a35e3804f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -6474,6 +6474,7 @@ package android.app.admin { method public boolean isMasterVolumeMuted(android.content.ComponentName); method public boolean isNetworkLoggingEnabled(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); @@ -6543,6 +6544,7 @@ package android.app.admin { method public boolean setPermittedAccessibilityServices(android.content.ComponentName, java.util.List); method public boolean setPermittedCrossProfileNotificationListeners(android.content.ComponentName, java.util.List); method public boolean setPermittedInputMethods(android.content.ComponentName, java.util.List); + 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); diff --git a/api/system-current.txt b/api/system-current.txt index 66b6d990ec0cd..dcea0044272fb 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -380,6 +380,7 @@ package android.app.admin { method public java.lang.CharSequence getDeviceOwnerOrganizationName(); method public java.util.List getPermittedAccessibilityServices(int); method public java.util.List getPermittedInputMethodsForCurrentUser(); + method public java.lang.CharSequence getPrintingDisabledReason(); method public android.content.ComponentName getProfileOwner() throws java.lang.IllegalArgumentException; method public java.lang.String getProfileOwnerNameAsUser(int) throws java.lang.IllegalArgumentException; method public int getUserProvisioningState(); diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index d465e0df64061..7fccda8c04e3e 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -9210,10 +9210,13 @@ 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. - * @hide */ public void setPrintingEnabled(@NonNull ComponentName admin, boolean enabled) { try { @@ -9224,10 +9227,12 @@ public class DevicePolicyManager { } /** - * Returns whether printing is enabled for current user. + * 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. - * @hide */ public boolean isPrintingEnabled() { try { @@ -9242,9 +9247,9 @@ public class DevicePolicyManager { * * Used only by PrintService. * @return Localized error message. - * @throws SecurityException if caller is not system. * @hide */ + @SystemApi public CharSequence getPrintingDisabledReason() { try { return mService.getPrintingDisabledReason();