summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZak Cohen <zakcohen@google.com>2019-03-05 16:50:39 -0800
committerZak Cohen <zakcohen@google.com>2019-03-11 21:36:19 +0000
commit3e12ac7434914cb131f54f4030a2e8ab04fe6f5c (patch)
treea68b4ebd675c9c9b112e47b991501834c13c1909
parent79f2408ef759dd0faecad549a8feb154c76a70f9 (diff)
ContentSuggestionsService - allow user manager to disable content suggestions.
Bug: 126227834 Test: compile Change-Id: I2e8f4a87b1d4adf0d3dd591380d50ee28ae20379
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/os/UserManager.java15
-rw-r--r--services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsManagerService.java4
-rw-r--r--services/core/java/com/android/server/pm/UserRestrictionsUtils.java1
4 files changed, 20 insertions, 1 deletions
diff --git a/api/current.txt b/api/current.txt
index 9a4be3ed1a16..55cf4492e8ad 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -35493,6 +35493,7 @@ package android.os {
field public static final String DISALLOW_CONFIG_VPN = "no_config_vpn";
field public static final String DISALLOW_CONFIG_WIFI = "no_config_wifi";
field public static final String DISALLOW_CONTENT_CAPTURE = "no_content_capture";
+ field public static final String DISALLOW_CONTENT_SUGGESTIONS = "no_content_suggestions";
field public static final String DISALLOW_CREATE_WINDOWS = "no_create_windows";
field public static final String DISALLOW_CROSS_PROFILE_COPY_PASTE = "no_cross_profile_copy_paste";
field public static final String DISALLOW_DATA_ROAMING = "no_data_roaming";
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 42633778a321..5e3568588b7a 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -954,6 +954,21 @@ public class UserManager {
public static final String DISALLOW_CONTENT_CAPTURE = "no_content_capture";
/**
+ * Specifies if the current user is able to receive content suggestions for selections based on
+ * the contents of their screen.
+ *
+ * <p>Device owner and profile owner can set this restriction. When it is set by device owner,
+ * only the target user will be affected.
+ *
+ * <p>The default value is <code>false</code>.
+ *
+ * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
+ * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
+ * @see #getUserRestrictions()
+ */
+ public static final String DISALLOW_CONTENT_SUGGESTIONS = "no_content_suggestions";
+
+ /**
* Specifies if user switching is blocked on the current user.
*
* <p> This restriction can only be set by the device owner, it will be applied to all users.
diff --git a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsManagerService.java b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsManagerService.java
index 58dbea469b9c..69b4672213c4 100644
--- a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsManagerService.java
+++ b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsManagerService.java
@@ -32,6 +32,7 @@ import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ShellCallback;
import android.os.UserHandle;
+import android.os.UserManager;
import android.util.Slog;
import com.android.server.LocalServices;
@@ -63,7 +64,8 @@ public class ContentSuggestionsManagerService extends
public ContentSuggestionsManagerService(Context context) {
super(context, new FrameworkResourcesServiceNameResolver(context,
- com.android.internal.R.string.config_defaultContentSuggestionsService), null);
+ com.android.internal.R.string.config_defaultContentSuggestionsService),
+ UserManager.DISALLOW_CONTENT_SUGGESTIONS);
mActivityTaskManagerInternal = LocalServices.getService(ActivityTaskManagerInternal.class);
}
diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
index 7e4365dafbe4..ae4ff03a5d8c 100644
--- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
+++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
@@ -120,6 +120,7 @@ public class UserRestrictionsUtils {
UserManager.DISALLOW_UNMUTE_DEVICE,
UserManager.DISALLOW_AUTOFILL,
UserManager.DISALLOW_CONTENT_CAPTURE,
+ UserManager.DISALLOW_CONTENT_SUGGESTIONS,
UserManager.DISALLOW_USER_SWITCH,
UserManager.DISALLOW_UNIFIED_PASSWORD,
UserManager.DISALLOW_CONFIG_LOCATION,