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

Commit 12d38a83 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix another issue with constructing SafeActivityOptions

Also log the wtf earlier as well so we know where potential
issues are coming from

Test: Launch notififcation
Bug: 78591617
Change-Id: I99557670fd3805dbeac9042f7db13e28fa00fc21
parent 7bb2e938
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -283,6 +283,14 @@ final class PendingIntentRecord extends IIntentSender.Stub {
                final int callingUid = Binder.getCallingUid();
                final int callingPid = Binder.getCallingPid();

                // Extract options before clearing calling identity
                SafeActivityOptions mergedOptions = key.options;
                if (mergedOptions == null) {
                    mergedOptions = SafeActivityOptions.fromBundle(options);
                } else {
                    mergedOptions.setCallerOptions(ActivityOptions.fromBundle(options));
                }

                final long origId = Binder.clearCallingIdentity();

                if (whitelistDuration != null) {
@@ -319,13 +327,6 @@ final class PendingIntentRecord extends IIntentSender.Stub {
                switch (key.type) {
                    case ActivityManager.INTENT_SENDER_ACTIVITY:
                        try {
                            SafeActivityOptions mergedOptions = key.options;
                            if (mergedOptions == null) {
                                mergedOptions = SafeActivityOptions.fromBundle(options);
                            } else {
                                mergedOptions.setCallerOptions(ActivityOptions.fromBundle(options));
                            }

                            // Note when someone has a pending intent, even from different
                            // users, then there's no need to ensure the calling user matches
                            // the target user, so validateIncomingUser is always false below.
+7 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Binder;
import android.os.Bundle;
import android.os.Process;
import android.os.UserHandle;
import android.util.Slog;
import android.view.RemoteAnimationAdapter;
@@ -78,6 +79,9 @@ class SafeActivityOptions {
        mOriginalCallingPid = Binder.getCallingPid();
        mOriginalCallingUid = Binder.getCallingUid();
        mOriginalOptions = options;
        if (mOriginalCallingPid == Process.myPid()) {
            Slog.wtf(TAG, "Safe activity options constructed after clearing calling id");
        }
    }

    /**
@@ -89,6 +93,9 @@ class SafeActivityOptions {
        mRealCallingPid = Binder.getCallingPid();
        mRealCallingUid = Binder.getCallingUid();
        mCallerOptions = options;
        if (mRealCallingPid == Process.myPid()) {
            Slog.wtf(TAG, "setCallerOptions called after clearing calling id");
        }
    }

    /**