OSDN Git Service

[ActivityManager]: Fix the activity visibility state not sync between ActivityManager...
authorlouis_chang <louis_chang@htc.com>
Tue, 28 Jan 2014 10:38:06 +0000 (18:38 +0800)
committerlouis_chang <louis_chang@htc.com>
Tue, 28 Jan 2014 10:38:06 +0000 (18:38 +0800)
commitd5c91ece7bfea74ee7ab2bc86f3cb3f5c531f866
treee25bab302ca193c2e594958f9c7e278f1b332be9
parent1ff4293e33f98e6dc19e4f154cb497af9bd88c9d
[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager

Symptom:
When press Home key to home screen, user is able to see the activity's window shown on top of wallpaper and below launcher(widgets).

Root Cause:
The ensureActivitiesVisibleLocked() is called pretty often (for example when a new process bound).
If the top activity "B" was finishing, then the previous activity "A" should be visible.
Therefore, the activity "A" window will be set to visible and then launched activity "A", but it does not updates the visible state in ActivityRecord for "A".
There has a timing issue that if a new activity "C" is started, "C" becomes the new top activity and be resumed.
In that case, Activity "A" window will remain visible even if it is behind a full screen activity "C" because the ActivityRecord.visble of "A" is still false, so the window visibility won't be update.
So when user press home key and back to launcher, the surface of activity "A" will be composed on top of wallpaper.

Solution:
Updates ActivityRecord.visible to true for "A". After "C" is started, the "A" will be called WindowManagerService.setAppVisibility() to set invisible, then called onStop() when execute ensureActivitiesVisibleLocked() again.

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