From 08c920219ef520415f8c63aabf0ff041c20cac55 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Fri, 8 Feb 2019 14:19:55 -0800 Subject: [PATCH] Added DISALLOW_CONTENT_CAPTURE to UserRestrictionsUtils. Also fixed FrameworkResourcesServiceNameResolver.isDefaultServiceEnabled() Test: atest MixedManagedProfileOwnerTest#testDisallowContentCapture_allowed \ MixedManagedProfileOwnerTest#testSetUserRestrictionLogged \ MixedDeviceOwnerTest#testDisallowContentCapture_allowed \ MixedDeviceOwnerTest#testSetUserRestrictionLogged \ MixedProfileOwnerTest#testDisallowContentCapture_allowed \ MixedProfileOwnerTest#testSetUserRestrictionLogged \ Bug: 123406031 Change-Id: If80257a1023229adcb19f41c90deb2de07ab6c7c --- .../ContentCaptureManagerServiceShellCommand.java | 3 --- .../server/infra/FrameworkResourcesServiceNameResolver.java | 2 +- .../core/java/com/android/server/pm/UserRestrictionsUtils.java | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerServiceShellCommand.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerServiceShellCommand.java index 39d5c9d0b777e..86ad52d9a42ba 100644 --- a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerServiceShellCommand.java +++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerServiceShellCommand.java @@ -77,15 +77,12 @@ public final class ContentCaptureManagerServiceShellCommand extends ShellCommand pw.println(" Temporarily (for DURATION ms) changes the service implemtation."); pw.println(" To reset, call with just the USER_ID argument."); pw.println(""); - pw.println(""); pw.println(" set default-service-enabled USER_ID [true|false]"); pw.println(" Enable / disable the default service for the user."); pw.println(""); - pw.println(""); pw.println(" get default-service-enabled USER_ID"); pw.println(" Checks whether the default service is enabled for the user."); pw.println(""); - pw.println(""); pw.println(" list sessions [--user USER_ID]"); pw.println(" Lists all pending sessions."); pw.println(""); diff --git a/services/core/java/com/android/server/infra/FrameworkResourcesServiceNameResolver.java b/services/core/java/com/android/server/infra/FrameworkResourcesServiceNameResolver.java index cf84e22e7dd18..1b237949a5432 100644 --- a/services/core/java/com/android/server/infra/FrameworkResourcesServiceNameResolver.java +++ b/services/core/java/com/android/server/infra/FrameworkResourcesServiceNameResolver.java @@ -187,7 +187,7 @@ public final class FrameworkResourcesServiceNameResolver implements ServiceNameR @Override public boolean isDefaultServiceEnabled(int userId) { synchronized (mLock) { - return mDefaultServicesDisabled.get(userId); + return !mDefaultServicesDisabled.get(userId); } } diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java index 8d64b810b4075..a944a1ba4e80c 100644 --- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java +++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java @@ -119,6 +119,7 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_OEM_UNLOCK, UserManager.DISALLOW_UNMUTE_DEVICE, UserManager.DISALLOW_AUTOFILL, + UserManager.DISALLOW_CONTENT_CAPTURE, UserManager.DISALLOW_USER_SWITCH, UserManager.DISALLOW_UNIFIED_PASSWORD, UserManager.DISALLOW_CONFIG_LOCATION,