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

Commit 1032d6c1 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Fix missing source info of hot launch"

parents 853a7f4a b5e37eec
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -700,11 +700,15 @@ class ActivityStarter {
                    mService.updateConfigurationLocked(mRequest.globalConfig, null, false);
                    mService.updateConfigurationLocked(mRequest.globalConfig, null, false);
                }
                }


                // The original options may have additional info about metrics. The mOptions is not
                // used here because it may be cleared in setTargetStackIfNeeded.
                final ActivityOptions originalOptions = mRequest.activityOptions != null
                        ? mRequest.activityOptions.getOriginalOptions() : null;
                // Notify ActivityMetricsLogger that the activity has launched.
                // Notify ActivityMetricsLogger that the activity has launched.
                // ActivityMetricsLogger will then wait for the windows to be drawn and populate
                // ActivityMetricsLogger will then wait for the windows to be drawn and populate
                // WaitResult.
                // WaitResult.
                mSupervisor.getActivityMetricsLogger().notifyActivityLaunched(launchingState, res,
                mSupervisor.getActivityMetricsLogger().notifyActivityLaunched(launchingState, res,
                        mLastStartActivityRecord, mOptions);
                        mLastStartActivityRecord, originalOptions);
                return getExternalResult(mRequest.waitResult == null ? res
                return getExternalResult(mRequest.waitResult == null ? res
                        : waitForResult(res, mLastStartActivityRecord));
                        : waitForResult(res, mLastStartActivityRecord));
            }
            }
+8 −0
Original line number Original line Diff line number Diff line
@@ -149,6 +149,14 @@ public class SafeActivityOptions {
        adapter.setCallingPidUid(callingPid, callingUid);
        adapter.setCallingPidUid(callingPid, callingUid);
    }
    }


    /**
     * Gets the original options passed in. It should only be used for logging. DO NOT use it as a
     * condition in the logic of activity launch.
     */
    ActivityOptions getOriginalOptions() {
        return mOriginalOptions;
    }

    /**
    /**
     * @see ActivityOptions#popAppVerificationBundle
     * @see ActivityOptions#popAppVerificationBundle
     */
     */
+5 −0
Original line number Original line Diff line number Diff line
@@ -63,6 +63,7 @@ import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.notNull;


import android.app.ActivityOptions;
import android.app.ActivityOptions;
import android.app.IApplicationThread;
import android.app.IApplicationThread;
@@ -800,6 +801,7 @@ public class ActivityStarterTests extends WindowTestsBase {
        final Task topTask = new TaskBuilder(mSupervisor).setParentTask(topStack).build();
        final Task topTask = new TaskBuilder(mSupervisor).setParentTask(topStack).build();
        new ActivityBuilder(mAtm).setTask(topTask).build();
        new ActivityBuilder(mAtm).setTask(topTask).build();


        doReturn(mActivityMetricsLogger).when(mSupervisor).getActivityMetricsLogger();
        // Start activity with the same intent as {@code singleTaskActivity} on secondary display.
        // Start activity with the same intent as {@code singleTaskActivity} on secondary display.
        final ActivityOptions options = ActivityOptions.makeBasic()
        final ActivityOptions options = ActivityOptions.makeBasic()
                .setLaunchDisplayId(secondaryDisplay.mDisplayId);
                .setLaunchDisplayId(secondaryDisplay.mDisplayId);
@@ -813,6 +815,9 @@ public class ActivityStarterTests extends WindowTestsBase {


        // Ensure secondary display only creates two stacks.
        // Ensure secondary display only creates two stacks.
        verify(secondaryTaskContainer, times(2)).createStack(anyInt(), anyInt(), anyBoolean());
        verify(secondaryTaskContainer, times(2)).createStack(anyInt(), anyInt(), anyBoolean());
        // The metrics logger should receive the same result and non-null options.
        verify(mActivityMetricsLogger).notifyActivityLaunched(any() /* launchingState */,
                eq(result), eq(singleTaskActivity), notNull() /* options */);
    }
    }


    @Test
    @Test