OSDN Git Service

[ActivityManager] Fix activity always visible.
authorriddle_hsu <riddle_hsu@htc.com>
Mon, 16 Feb 2015 10:43:49 +0000 (18:43 +0800)
committerRiddle Hsu <riddle_hsu@htc.com>
Mon, 13 Apr 2015 04:25:05 +0000 (04:25 +0000)
commit7dfe4d7d8562351243eb81c4fcefdae07fc2fecb
tree4abf0a7accc4855d05e5bb2961062720a91d7ff7
parentefd9abb7dfd8d5015e73ab52b4f9b7854df4b02c
[ActivityManager] Fix activity always visible.

Sample code, symptom video and detail:
http://code.google.com/p/android/issues/detail?id=87909

If device is sleeping, activity will be paused immediately
after resume, it is unnecessary to force complete it.
Otherwise the state may get worse because mPausingActivity
is cleared, the real pausing from activityPausedLocked won't
be able to complete pause flow (PAUSING to PAUSED).

If the fail-to-pause activity called finish, it will also
cannot complete finish flow because only !PAUSING can do it.
This results in an activity that has visible=true, finishing=true,
state=PAUSING and always show on wallpaper.

Issue flow:
Case 1
1.At home stack and screen off.
2.A task T contains one activity Z and its process was died.
3.Launch new activity X on T.
4.Before activity Z complete resume, any process
  bound and died trigger update visibility and resume top.
5.X calls finish.
6.Turn on screen, X will be always visible.

Case 2
1.Launch Settings (or any), press home key.
2.Launch an activity X in Task T, press home key.
3.Kill process of activity X, turn off screen.
4.Launch activity X with NEW_TASK | CLEAR_TASK.
5.Activity X calls finish.
6.Turn on screen, X will be always visible.

Change-Id: I8ca1845fd100e13ec58382c8c0105bf0a9f8137d
services/core/java/com/android/server/am/ActivityStack.java