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

Commit 62e9fc65 authored by Christopher Tate's avatar Christopher Tate
Browse files

Enable background restrictions

Can be disabled by setting the "debug.bgcheck" system property to
"n" or "no" or "0" or "false" or "off".  (Writing that property
requires root.)

Bug 30953212
Test: observed restrictions being enforced

Change-Id: I4cda9b7840ff25240b6bcaab210ea13888d08cad
parent fd4e9e0f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ final class ActivityManagerConstants extends ContentObserver {
    private static final String KEY_MAX_CACHED_PROCESSES = "max_cached_processes";

    private static final boolean DEFAULT_ENFORCE_BG_CHECK = SystemProperties.getBoolean(
            "debug.bgcheck", false);
            "debug.bgcheck", true);
    private static final int DEFAULT_MAX_CACHED_PROCESSES = 32;

    // Enforce background check on apps targeting O?
+8 −8
Original line number Diff line number Diff line
@@ -2611,6 +2611,14 @@ public class ActivityManagerService extends IActivityManager.Stub
        mPermissionReviewRequired = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_permissionReviewRequired);
        mHandlerThread = new ServiceThread(TAG,
                android.os.Process.THREAD_PRIORITY_FOREGROUND, false /*allowIo*/);
        mHandlerThread.start();
        mHandler = new MainHandler(mHandlerThread.getLooper());
        mUiHandler = new UiHandler();
        mConstants = new ActivityManagerConstants(this, mHandler);
        if (DEBUG_BACKGROUND_CHECK) {
            Slog.d(TAG, "Enforcing O+ bg restrictions: " + mConstants.ENFORCE_BG_CHECK);
            StringBuilder sb = new StringBuilder(200);
@@ -2622,14 +2630,6 @@ public class ActivityManagerService extends IActivityManager.Stub
            Slog.d(TAG, sb.toString());
        }
        mHandlerThread = new ServiceThread(TAG,
                android.os.Process.THREAD_PRIORITY_FOREGROUND, false /*allowIo*/);
        mHandlerThread.start();
        mHandler = new MainHandler(mHandlerThread.getLooper());
        mUiHandler = new UiHandler();
        mConstants = new ActivityManagerConstants(this, mHandler);
        /* static; one-time init here */
        if (sKillHandler == null) {
            sKillThread = new ServiceThread(TAG + ":kill",