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

Commit b4d80752 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Remove modern_queue_enabled flag." into main

parents 24be2e1f 2cd75ddf
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -6053,20 +6053,6 @@ public class ActivityManager {
        }
    }

    /**
     * Checks if the "modern" broadcast queue is enabled.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.DUMP)
    public boolean isModernBroadcastQueueEnabled() {
        try {
            return getService().isModernBroadcastQueueEnabled();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Checks if the process represented by the given {@code pid} is frozen.
     *
+0 −6
Original line number Diff line number Diff line
@@ -225,12 +225,6 @@ public abstract class ActivityManagerInternal {
     */
    public abstract boolean isSystemReady();

    /**
     * @return {@code true} if system is using the "modern" broadcast queue,
     *         {@code false} otherwise.
     */
    public abstract boolean isModernQueueEnabled();

    /**
     * Enforce capability restrictions on use of the given BroadcastOptions
     */
+0 −4
Original line number Diff line number Diff line
@@ -898,10 +898,6 @@ interface IActivityManager {
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.DUMP)")
    void forceDelayBroadcastDelivery(in String targetPackage, long delayedDurationMs);

    /** Checks if the modern broadcast queue is enabled. */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.DUMP)")
    boolean isModernBroadcastQueueEnabled();

    /** Checks if the process represented by the given pid is frozen. */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.DUMP)")
    boolean isProcessFrozen(int pid);
+2 −58
Original line number Diff line number Diff line
@@ -725,12 +725,6 @@ public class ActivityManagerService extends IActivityManager.Stub
    // Whether we should use SCHED_FIFO for UI and RenderThreads.
    final boolean mUseFifoUiScheduling;
    /**
     * Flag indicating if we should use {@link BroadcastQueueModernImpl} instead
     * of the default {@link BroadcastQueueImpl}.
     */
    final boolean mEnableModernQueue;
    @GuardedBy("this")
    private final SparseArray<IUnsafeIntentStrictModeCallback>
            mStrictModeCallbacks = new SparseArray<>();
@@ -2508,7 +2502,6 @@ public class ActivityManagerService extends IActivityManager.Stub
        mInternal = new LocalService();
        mPendingStartActivityUids = new PendingStartActivityUids();
        mUseFifoUiScheduling = false;
        mEnableModernQueue = false;
        mBroadcastQueue = injector.getBroadcastQueue(this);
        mComponentAliasResolver = new ComponentAliasResolver(this);
    }
@@ -2550,9 +2543,6 @@ public class ActivityManagerService extends IActivityManager.Stub
                ? new OomAdjusterModernImpl(this, mProcessList, activeUids)
                : new OomAdjuster(this, mProcessList, activeUids);
        mEnableModernQueue = new BroadcastConstants(
                Settings.Global.BROADCAST_FG_CONSTANTS).MODERN_QUEUE_ENABLED;
        mBroadcastQueue = mInjector.getBroadcastQueue(this);
        mServices = new ActiveServices(this);
@@ -15025,9 +15015,6 @@ public class ActivityManagerService extends IActivityManager.Stub
                        + " ordered=" + ordered + " userid=" + userId
                        + " options=" + (brOptions == null ? "null" : brOptions.toBundle()));
        if ((resultTo != null) && !ordered) {
            if (!mEnableModernQueue) {
                Slog.w(TAG, "Broadcast " + intent + " not ordered but result callback requested!");
            }
            if (!UserHandle.isCore(callingUid)) {
                String msg = "Unauthorized unordered resultTo broadcast "
                             + intent + " sent from uid " + callingUid;
@@ -15628,29 +15615,6 @@ public class ActivityManagerService extends IActivityManager.Stub
        filterNonExportedComponents(intent, callingUid, callingPid, registeredReceivers,
                mPlatformCompat, callerPackage, resolvedType);
        int NR = registeredReceivers != null ? registeredReceivers.size() : 0;
        if (!ordered && NR > 0 && !mEnableModernQueue) {
            // If we are not serializing this broadcast, then send the
            // registered receivers separately so they don't wait for the
            // components to be launched. We don't do this split for the modern
            // queue because delivery to registered receivers isn't blocked
            // behind manifest receivers.
            if (isCallerSystem) {
                checkBroadcastFromSystem(intent, callerApp, callerPackage, callingUid,
                        isProtectedBroadcast, registeredReceivers);
            }
            final BroadcastQueue queue = mBroadcastQueue;
            BroadcastRecord r = new BroadcastRecord(queue, intent, callerApp, callerPackage,
                    callerFeatureId, callingPid, callingUid, callerInstantApp, resolvedType,
                    requiredPermissions, excludedPermissions, excludedPackages, appOp, brOptions,
                    registeredReceivers, resultToApp, resultTo, resultCode, resultData,
                    resultExtras, ordered, sticky, false, userId,
                    backgroundStartPrivileges, timeoutExempt, filterExtrasForReceiver,
                    callerAppProcessState);
            if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "Enqueueing parallel broadcast " + r);
            queue.enqueueBroadcastLocked(r);
            registeredReceivers = null;
            NR = 0;
        }
        // Merge into one list.
        int ir = 0;
@@ -18301,11 +18265,6 @@ public class ActivityManagerService extends IActivityManager.Stub
            return mSystemReady;
        }
        @Override
        public boolean isModernQueueEnabled() {
            return mEnableModernQueue;
        }
        @Override
        public void enforceBroadcastOptionsPermissions(Bundle options, int callingUid) {
            enforceBroadcastOptionPermissionsInternal(options, callingUid);
@@ -18735,7 +18694,6 @@ public class ActivityManagerService extends IActivityManager.Stub
                    Binder.restoreCallingIdentity(origId);
                }
            }
        }
        @Override
@@ -18745,12 +18703,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                int userId, int[] appIdAllowList,
                @Nullable BiFunction<Integer, Bundle, Bundle> filterExtrasForReceiver,
                @Nullable Bundle bOptions) {
            // Sending broadcasts with a finish callback without the need for the broadcasts
            // delivery to be serialized is only supported by modern queue. So, when modern
            // queue is disabled, we continue to send broadcasts in a serialized fashion.
            final boolean serialized = !isModernQueueEnabled();
            return broadcastIntent(intent, resultTo, requiredPermissions, serialized, userId,
                    appIdAllowList, filterExtrasForReceiver, bOptions);
            return broadcastIntent(intent, resultTo, requiredPermissions, false /* serialized */,
                    userId, appIdAllowList, filterExtrasForReceiver, bOptions);
        }
        @Override
@@ -19789,20 +19743,10 @@ public class ActivityManagerService extends IActivityManager.Stub
        Objects.requireNonNull(targetPackage);
        Preconditions.checkArgumentNonnegative(delayedDurationMs);
        enforceCallingPermission(permission.DUMP, "forceDelayBroadcastDelivery()");
        // Ignore request if modern queue is not enabled
        if (!mEnableModernQueue) {
            return;
        }
        mBroadcastQueue.forceDelayBroadcastDelivery(targetPackage, delayedDurationMs);
    }
    @Override
    public boolean isModernBroadcastQueueEnabled() {
        enforceCallingPermission(permission.DUMP, "isModernBroadcastQueueEnabled()");
        return mEnableModernQueue;
    }
    @Override
    public boolean isProcessFrozen(int pid) {
        enforceCallingPermission(permission.DUMP, "isProcessFrozen()");
+0 −11
Original line number Diff line number Diff line
@@ -127,14 +127,6 @@ public class BroadcastConstants {
    // started its process can start a background activity.
    public long ALLOW_BG_ACTIVITY_START_TIMEOUT = DEFAULT_ALLOW_BG_ACTIVITY_START_TIMEOUT;

    /**
     * Flag indicating if we should use {@link BroadcastQueueModernImpl} instead
     * of the default {@link BroadcastQueueImpl}.
     */
    public boolean MODERN_QUEUE_ENABLED = DEFAULT_MODERN_QUEUE_ENABLED;
    private static final String KEY_MODERN_QUEUE_ENABLED = "modern_queue_enabled";
    private static final boolean DEFAULT_MODERN_QUEUE_ENABLED = true;

    /**
     * For {@link BroadcastQueueModernImpl}: Maximum dispatch parallelism
     * that we'll tolerate for ordinary broadcast dispatch.
@@ -421,8 +413,6 @@ public class BroadcastConstants {
     */
    private void updateDeviceConfigConstants() {
        synchronized (this) {
            MODERN_QUEUE_ENABLED = getDeviceConfigBoolean(KEY_MODERN_QUEUE_ENABLED,
                    DEFAULT_MODERN_QUEUE_ENABLED);
            MAX_RUNNING_PROCESS_QUEUES = getDeviceConfigInt(KEY_MAX_RUNNING_PROCESS_QUEUES,
                    DEFAULT_MAX_RUNNING_PROCESS_QUEUES);
            EXTRA_RUNNING_URGENT_PROCESS_QUEUES = getDeviceConfigInt(
@@ -498,7 +488,6 @@ public class BroadcastConstants {
            pw.print(NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT);
            pw.println("):");
            pw.increaseIndent();
            pw.print(KEY_MODERN_QUEUE_ENABLED, MODERN_QUEUE_ENABLED).println();
            pw.print(KEY_MAX_RUNNING_PROCESS_QUEUES, MAX_RUNNING_PROCESS_QUEUES).println();
            pw.print(KEY_MAX_RUNNING_ACTIVE_BROADCASTS, MAX_RUNNING_ACTIVE_BROADCASTS).println();
            pw.print(KEY_CORE_MAX_RUNNING_BLOCKING_BROADCASTS,
Loading