Merge "Make printing policy a restriction."

This commit is contained in:
Vladislav Kuzkokov
2018-02-06 17:11:07 +00:00
committed by Android (Google) Code Review
8 changed files with 19 additions and 110 deletions

View File

@@ -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.
*

View File

@@ -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);

View File

@@ -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.