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

Commit aa6de85d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add wtf log when starting activities with different uids"

parents 622b228f cf2ef0c0
Loading
Loading
Loading
Loading
+20 −3
Original line number Original line Diff line number Diff line
@@ -43,6 +43,7 @@ import android.os.Message;
import android.os.UserHandle;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings;
import android.util.Slog;
import android.util.Slog;
import android.util.SparseArray;
import android.util.proto.ProtoOutputStream;
import android.util.proto.ProtoOutputStream;
import android.view.RemoteAnimationAdapter;
import android.view.RemoteAnimationAdapter;


@@ -385,6 +386,7 @@ public class ActivityStartController {
        } else {
        } else {
            callingPid = callingUid = -1;
            callingPid = callingUid = -1;
        }
        }
        final SparseArray<String> startingUidPkgs = new SparseArray<>();
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            intents = ArrayUtils.filterNotNull(intents, Intent[]::new);
            intents = ArrayUtils.filterNotNull(intents, Intent[]::new);
@@ -411,9 +413,14 @@ public class ActivityStartController {
                                callingUid, realCallingUid, UserHandle.USER_NULL));
                                callingUid, realCallingUid, UserHandle.USER_NULL));
                aInfo = mService.mAmInternal.getActivityInfoForUser(aInfo, userId);
                aInfo = mService.mAmInternal.getActivityInfoForUser(aInfo, userId);


                if (aInfo != null && (aInfo.applicationInfo.privateFlags
                if (aInfo != null) {
                    if ((aInfo.applicationInfo.privateFlags
                            & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0) {
                            & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0) {
                    throw new IllegalArgumentException("FLAG_CANT_SAVE_STATE not supported here");
                        throw new IllegalArgumentException(
                                "FLAG_CANT_SAVE_STATE not supported here");
                    }
                    startingUidPkgs.put(aInfo.applicationInfo.uid,
                            aInfo.applicationInfo.packageName);
                }
                }


                final boolean top = i == intents.length - 1;
                final boolean top = i == intents.length - 1;
@@ -439,6 +446,16 @@ public class ActivityStartController {
                        .setOriginatingPendingIntent(originatingPendingIntent)
                        .setOriginatingPendingIntent(originatingPendingIntent)
                        .setAllowBackgroundActivityStart(allowBackgroundActivityStart);
                        .setAllowBackgroundActivityStart(allowBackgroundActivityStart);
            }
            }
            // Log if the activities to be started have different uids.
            if (startingUidPkgs.size() > 1) {
                final StringBuilder sb = new StringBuilder("startActivities: different apps [");
                final int size = startingUidPkgs.size();
                for (int i = 0; i < size; i++) {
                    sb.append(startingUidPkgs.valueAt(i)).append(i == size - 1 ? "]" : ", ");
                }
                sb.append(" from ").append(callingPackage);
                Slog.wtf(TAG, sb.toString());
            }


            final ActivityRecord[] outActivity = new ActivityRecord[1];
            final ActivityRecord[] outActivity = new ActivityRecord[1];
            // Lock the loop to ensure the activities launched in a sequence.
            // Lock the loop to ensure the activities launched in a sequence.