summaryrefslogtreecommitdiff
path: root/services/print
diff options
context:
space:
mode:
authorVladislav Kuzkokov <vkuzkokov@google.com>2018-01-25 16:33:05 +0100
committerVladislav Kuzkokov <vkuzkokov@google.com>2018-02-05 22:30:05 +0100
commit622b9f921278b308e9497675e63159f926764c91 (patch)
tree9af89f10e49cdccf643fc5c2c549f157b62e2c29 /services/print
parent367358ec364d9aca36b305879672f7c26db27469 (diff)
Make printing policy a restriction.
Use existing API instead of creating new method. Bug: 64140119 Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testPrintingPolicy Change-Id: I9ff94f4d73824e7bf9aedbb64811ad60fccf9779
Diffstat (limited to 'services/print')
-rw-r--r--services/print/java/com/android/server/print/PrintManagerService.java6
1 files changed, 1 insertions, 5 deletions
diff --git a/services/print/java/com/android/server/print/PrintManagerService.java b/services/print/java/com/android/server/print/PrintManagerService.java
index e1c1eb298e31..e8620edc9d5e 100644
--- a/services/print/java/com/android/server/print/PrintManagerService.java
+++ b/services/print/java/com/android/server/print/PrintManagerService.java
@@ -21,7 +21,6 @@ import static android.content.pm.PackageManager.MATCH_DEBUG_TRIAGED_MISSING;
import android.annotation.NonNull;
import android.app.ActivityManager;
-import android.app.admin.DevicePolicyManager;
import android.app.admin.DevicePolicyManagerInternal;
import android.content.ComponentName;
import android.content.Context;
@@ -115,12 +114,9 @@ public final class PrintManagerService extends SystemService {
private final SparseArray<UserState> mUserStates = new SparseArray<>();
- private final DevicePolicyManager mDpm;
-
PrintManagerImpl(Context context) {
mContext = context;
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
- mDpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
registerContentObservers();
registerBroadcastReceivers();
}
@@ -722,7 +718,7 @@ public final class PrintManagerService extends SystemService {
}
private boolean isPrintingEnabled() {
- return mDpm == null || mDpm.isPrintingEnabled();
+ return !mUserManager.hasUserRestriction(UserManager.DISALLOW_PRINTING);
}
private void dump(@NonNull DualDumpOutputStream dumpStream,