Skip to content
Commit 7673f3f8 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Check null before getting task bounds

The task bounds was used to decide whether multiple launches can
be combined into one event for tracking launch time.

With below sample:
startActivities(new Intent[] {
    new Intent(c, Activity1.class),
    new Intent(c, Activity2.class).setFlags(
        Intent.FLAG_ACTIVITY_CLEAR_TASK
        | Intent.FLAG_ACTIVITY_NEW_TASK) });

When launching Activity2, because Activity1 hasn't real started,
Activity1 will be removed from task directly. Then its task will
be null, that causes mLastLaunchedActivity.getTask() to be null.

If the task is not available, check if the launched activity has
the same uid as the caller uid.

Fix: 276513946
Test: atest ActivityMetricsLaunchObserverTests#testConsecutiveLaunch

Change-Id: I731f0446b62b666b22ba1a6b37364d95efd0a32c
parent b4a8a82f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment