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

Commit d2f1511f authored by Todd Kennedy's avatar Todd Kennedy
Browse files

Don't get extras from the Intent

When handling Intents in the system process, we need to be careful
to not cause the extras bundle to be unparcelled. If the extra is
unparcelled, any custom class added to the extras will throw a
ClassCastException during the unparcel. For legacy reasons, we
would get the "seq" extra from the Intent for broadcast debugging.
This violates our requirement to not unparcel extras in the system
server process.

Bug: 19068243
Change-Id: I6cac426a0ef8648a05ded69ee4ac244017d9b5d1
parent e1f183d0
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -7051,7 +7051,6 @@ public final class ActivityManagerService extends ActivityManagerNative
                return;
            }
            final IPackageManager pm = AppGlobals.getPackageManager();
            final String authority = uri.getAuthority();
            final ProviderInfo pi = getProviderInfoLocked(authority, userId);
            if (pi == null) {
@@ -15733,13 +15732,13 @@ public final class ActivityManagerService extends ActivityManagerNative
                    callerPackage, callingPid, callingUid, resolvedType,
                    requiredPermission, appOp, receivers, resultTo, resultCode,
                    resultData, map, ordered, sticky, false, userId);
            if (DEBUG_BROADCAST) Slog.v(
                    TAG, "Enqueueing ordered broadcast " + r
                    + ": prev had " + queue.mOrderedBroadcasts.size());
            if (DEBUG_BROADCAST) {
                int seq = r.intent.getIntExtra("seq", -1);
                Slog.i(TAG, "Enqueueing broadcast " + r.intent.getAction() + " seq=" + seq);
            }
            if (DEBUG_BROADCAST) Slog.i(
                    TAG, "Enqueueing broadcast " + r.intent.getAction());
            boolean replaced = replacePending && queue.replaceOrderedBroadcastLocked(r);
            if (!replaced) {
                queue.enqueueOrderedBroadcastLocked(r);
@@ -18289,8 +18288,8 @@ public final class ActivityManagerService extends ActivityManagerNative
        }
    }
    private Set getProfileIdsLocked(int userId) {
        Set userIds = new HashSet<Integer>();
    private Set<Integer> getProfileIdsLocked(int userId) {
        Set<Integer> userIds = new HashSet<Integer>();
        final List<UserInfo> profiles = getUserManagerLocked().getProfiles(
                userId, false /* enabledOnly */);
        for (UserInfo user : profiles) {
+4 −11
Original line number Diff line number Diff line
@@ -513,11 +513,7 @@ public final class BroadcastQueue {
                }
            }
            try {
                if (DEBUG_BROADCAST_LIGHT) {
                    int seq = r.intent.getIntExtra("seq", -1);
                    Slog.i(TAG, "Delivering to " + filter
                            + " (seq=" + seq + "): " + r);
                }
                if (DEBUG_BROADCAST_LIGHT) Slog.i(TAG, "Delivering to " + filter + " : " + r);
                performReceiveLocked(filter.receiverList.app, filter.receiverList.receiver,
                    new Intent(r.intent), r.resultCode, r.resultData,
                    r.resultExtras, r.ordered, r.initialSticky, r.userId);
@@ -662,12 +658,9 @@ public final class BroadcastQueue {
                    // result if requested...
                    if (r.resultTo != null) {
                        try {
                            if (DEBUG_BROADCAST) {
                                int seq = r.intent.getIntExtra("seq", -1);
                                Slog.i(TAG, "Finishing broadcast ["
                                        + mQueueName + "] " + r.intent.getAction()
                                        + " seq=" + seq + " app=" + r.callerApp);
                            }
                            if (DEBUG_BROADCAST) Slog.i(TAG,
                                    "Finishing broadcast [" + mQueueName + "] "
                                    + r.intent.getAction() + " app=" + r.callerApp);
                            performReceiveLocked(r.callerApp, r.resultTo,
                                new Intent(r.intent), r.resultCode,
                                r.resultData, r.resultExtras, false, false, r.userId);