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

Skip to content
Commit b98529ea authored by riddle_hsu's avatar riddle_hsu Committed by Steve Kondik
Browse files

[ActivityManager] Reduce report wrong anr activity

Symptom:
Report ANR on wrong activity.

Reproduce steps:
 (All launchMode, taskAffinity are default and
  without additional intent flag)
 Case 1:
  1.Launch activity A from launcher.
  2.Activity A starts B activity.
  3.Press home key.
  4.Launch activity A from launcher (B is top).
  5.Press back key twice to finish B and A,
    A sleep 10s in onResume.
  6.ANR will report on launcher.

 Case 2:
  1.Launch activity A from launcher.
  2.Press home key.
  3.Kill process of A.
  4.Launch activity A from launcher.
  5.A sleep 10s in onResume, press back key immediately.
  6.ANR will report on launcher.

Possible root cause:
Focused activity will not be updated every time when activity
resumed. (the condition to call setFocusedActivityLocked)

Case 1:
Launcher was stopped and not waitingVisible due to launcher
is not the previous one, then getWaitingHistoryRecordLocked
has no chance to correct the real ANR activity.

Case 2:
Due to process of next activity is died, bring existed
task will not set mResumedActivity (it will be set when its
process is started), so when assigning waitingVisible from
processStoppingActivitiesLocked, the return value of
allResumedActivitiesVisible will be true even there is no
mResumedActivity. That results set waitingVisible to false
to previous activity (e.g. launcher), then also cannot
correct ANR target as case 1.

Change-Id: I0b24f46a8fab266382ebc6e2ed84ebeca9358768
parent b135f00d
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