Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22ff6f9d authored by Charles He's avatar Charles He
Browse files

Add user restriction to suppress error dialogs.

Bug: 66125576
Test: cts-tradefed run cts-dev --module DevicePolicyManager -t com.android.cts.devicepolicy.UserRestrictionsTest
Test: bit FrameworksServicesTests:com.android.server.pm.UserRestrictionsUtilsTest
Change-Id: I1c4cf4a107f47e9b5543607e57b76dd2e5acfba5
parent 93d703a4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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";
+1 −0
Original line number Diff line number Diff line
@@ -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";
+1 −0
Original line number Diff line number Diff line
@@ -32099,6 +32099,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";
+19 −0
Original line number Diff line number Diff line
@@ -573,6 +573,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
+2 −1
Original line number Diff line number Diff line
@@ -198,7 +198,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;
@@ -752,6 +751,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());
    }
Loading