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

Commit 0193e955 authored by Ng Zhi An's avatar Ng Zhi An
Browse files

Enable offload queue based on flag value

This flag was added in ag/6102001, and defaults to false.

This experiment flag is backed by a persistent system property:
"persist.device_config.activity_manager_native_boot.offload_queue_enabled",

It defaults to false, which will perform as if the offload queue was
never created, since no broadcasts will be placed on that queue.

For simplicity in implementation, we create the offload queue anyway,
but nothing will be placed on it, and every operation on that queue will
be no-op.

When the flag is true, the offload queue is used for long broadcasts,
which for now is BOOT_COMPLETED.

Bug: 120794810
Test: dumpsys activity broadcasts # does not have offload queue
Test: device_config put activity_manager_native_boot
offload_queue_enabled true, then reboot and check dumpsys
Change-Id: Iccd6c18b688a2c04eb5ec61d4a020df308dd14cd
parent 69789f95
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -548,6 +548,11 @@ public class ActivityManagerService extends IActivityManager.Stub
    // Whether we should use SCHED_FIFO for UI and RenderThreads.
    boolean mUseFifoUiScheduling = false;
    // Use an offload queue for long broadcasts, e.g. BOOT_COMPLETED.
    // For simplicity, since we statically declare the size of the array of BroadcastQueues,
    // we still create this new offload queue, but never ever put anything on it.
    boolean mEnableOffloadQueue;
    BroadcastQueue mFgBroadcastQueue;
    BroadcastQueue mBgBroadcastQueue;
    BroadcastQueue mOffloadBroadcastQueue;
@@ -2282,6 +2287,9 @@ public class ActivityManagerService extends IActivityManager.Stub
        // by default, no "slow" policy in this queue
        offloadConstants.SLOW_TIME = Integer.MAX_VALUE;
        mEnableOffloadQueue = SystemProperties.getBoolean(
                "persist.device_config.activity_manager_native_boot.offload_queue_enabled", false);
        mFgBroadcastQueue = new BroadcastQueue(this, mHandler,
                "foreground", foreConstants, false);
        mBgBroadcastQueue = new BroadcastQueue(this, mHandler,
@@ -18383,6 +18391,6 @@ public class ActivityManagerService extends IActivityManager.Stub
    }
    private boolean isOnOffloadQueue(int flags) {
        return ((flags & Intent.FLAG_RECEIVER_OFFLOAD) != 0);
        return (mEnableOffloadQueue && ((flags & Intent.FLAG_RECEIVER_OFFLOAD) != 0));
    }
}