diff options
| author | 2017-10-10 19:45:12 +0000 | |
|---|---|---|
| committer | 2017-10-10 19:45:12 +0000 | |
| commit | af60534c97fd91d283a8171aa82e5cef78f757d8 (patch) | |
| tree | 13b1a27430a20cbc1ca1b28815e8de6219388785 | |
| parent | f3e2f6309bc1ee715467e16b9417b9ea23d42ce4 (diff) | |
| parent | 22ff6f9df0b1e195f4d9daee0c7f4ba8f7ad6c9a (diff) | |
Merge "Add user restriction to suppress error dialogs."
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | api/test-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/os/UserManager.java | 19 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 3 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/UserRestrictionsUtils.java | 2 |
6 files changed, 26 insertions, 1 deletions
diff --git a/api/current.txt b/api/current.txt index ecb6e420bec3..9bbdee155872 100644 --- a/api/current.txt +++ b/api/current.txt @@ -31834,6 +31834,7 @@ package android.os { field public static final java.lang.String DISALLOW_SET_WALLPAPER = "no_set_wallpaper"; field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location"; field public static final java.lang.String DISALLOW_SMS = "no_sms"; + field public static final java.lang.String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs"; field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps"; field public static final java.lang.String DISALLOW_UNMUTE_MICROPHONE = "no_unmute_microphone"; field public static final java.lang.String DISALLOW_USB_FILE_TRANSFER = "no_usb_file_transfer"; diff --git a/api/system-current.txt b/api/system-current.txt index 183fb4bfdad7..ea077fe62aee 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -34678,6 +34678,7 @@ package android.os { field public static final java.lang.String DISALLOW_SET_WALLPAPER = "no_set_wallpaper"; field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location"; field public static final java.lang.String DISALLOW_SMS = "no_sms"; + field public static final java.lang.String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs"; field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps"; field public static final java.lang.String DISALLOW_UNMUTE_MICROPHONE = "no_unmute_microphone"; field public static final java.lang.String DISALLOW_USB_FILE_TRANSFER = "no_usb_file_transfer"; diff --git a/api/test-current.txt b/api/test-current.txt index fd3729ff1caa..fe861e1078bd 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -32097,6 +32097,7 @@ package android.os { field public static final java.lang.String DISALLOW_SET_WALLPAPER = "no_set_wallpaper"; field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location"; field public static final java.lang.String DISALLOW_SMS = "no_sms"; + field public static final java.lang.String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs"; field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps"; field public static final java.lang.String DISALLOW_UNMUTE_MICROPHONE = "no_unmute_microphone"; field public static final java.lang.String DISALLOW_USB_FILE_TRANSFER = "no_usb_file_transfer"; diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 430a5e3e7281..8c688713c9aa 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -574,6 +574,25 @@ public class UserManager { public static final String DISALLOW_CREATE_WINDOWS = "no_create_windows"; /** + * Specifies that system error dialogs for crashed or unresponsive apps should not be shown. + * In this case, the system will force-stop the app as if the user chooses the "close app" + * option on the UI. No feedback report will be collected as there is no way for the user to + * provide explicit consent. + * + * When this user restriction is set by device owners, it's applied to all users; when it's set + * by profile owners, it's only applied to the relevant profiles. + * The default value is <code>false</code>. + * + * <p>This user restriction has no effect on managed profiles. + * <p>Key for user restrictions. + * <p>Type: Boolean + * @see DevicePolicyManager#addUserRestriction(ComponentName, String) + * @see DevicePolicyManager#clearUserRestriction(ComponentName, String) + * @see #getUserRestrictions() + */ + public static final String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs"; + + /** * Specifies if what is copied in the clipboard of this profile can * be pasted in related profiles. Does not restrict if the clipboard of related profiles can be * pasted in this profile. diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index e6fe620485da..0b2dd9b8d5e3 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -199,7 +199,6 @@ import android.annotation.UserIdInt; import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; -import android.app.ActivityManager.StackId; import android.app.ActivityManager.StackInfo; import android.app.ActivityManager.TaskSnapshot; import android.app.ActivityManagerInternal; @@ -753,6 +752,8 @@ public class ActivityManagerService extends IActivityManager.Stub public boolean canShowErrorDialogs() { return mShowDialogs && !mSleeping && !mShuttingDown && !mKeyguardController.isKeyguardShowing(DEFAULT_DISPLAY) + && !mUserController.hasUserRestriction(UserManager.DISALLOW_SYSTEM_ERROR_DIALOGS, + mUserController.getCurrentUserId()) && !(UserManager.isDeviceInDemoMode(mContext) && mUserController.getCurrentUser().isDemo()); } diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java index a6b05d71c9f0..c18a71d380e9 100644 --- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java +++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java @@ -96,6 +96,7 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_SMS, UserManager.DISALLOW_FUN, UserManager.DISALLOW_CREATE_WINDOWS, + UserManager.DISALLOW_SYSTEM_ERROR_DIALOGS, UserManager.DISALLOW_CROSS_PROFILE_COPY_PASTE, UserManager.DISALLOW_OUTGOING_BEAM, UserManager.DISALLOW_WALLPAPER, @@ -156,6 +157,7 @@ public class UserRestrictionsUtils { private static final Set<String> GLOBAL_RESTRICTIONS = Sets.newArraySet( UserManager.DISALLOW_ADJUST_VOLUME, UserManager.DISALLOW_BLUETOOTH_SHARING, + UserManager.DISALLOW_SYSTEM_ERROR_DIALOGS, UserManager.DISALLOW_RUN_IN_BACKGROUND, UserManager.DISALLOW_UNMUTE_MICROPHONE, UserManager.DISALLOW_UNMUTE_DEVICE |