Reset relaunching count is app dies during re-launch

WindowManager keeps a count of how many relaunches an app is told
to do so that it can defer app transtions until the relaunches are
done. If the app porcess is killed during one of the relaunches
the app will never report back that it is done relaunching, so
app transtions into the app will not happen until will timeout
from waiting for the app.
We now notify WM of this situation so it can clear the relaunching
count for the app.

Bug: 29551109
Change-Id: Ibadba9f73e6e1bde141385aa8a0e066fbc0c5764
This commit is contained in:
Wale Ogunwale
2016-06-24 14:20:37 -07:00
parent 90b2c781ff
commit 8fd75428b4
3 changed files with 20 additions and 0 deletions

View File

@@ -3759,6 +3759,10 @@ final class ActivityStack {
if (getVisibleBehindActivity() == r) {
mStackSupervisor.requestVisibleBehindLocked(r, false);
}
// Clean-up activities are no longer relaunching (e.g. app process died). Notify window
// manager so it can update its bookkeeping.
mWindowManager.notifyAppRelaunchesCleared(r.appToken);
}
private void removeTimeoutsForActivityLocked(ActivityRecord r) {

View File

@@ -625,6 +625,13 @@ class AppWindowToken extends WindowToken {
}
}
void clearRelaunching() {
if (canFreezeBounds()) {
unfreezeBounds();
}
mPendingRelaunchCount = 0;
}
void addWindow(WindowState w) {
for (int i = allAppWindows.size() - 1; i >= 0; i--) {
WindowState candidate = allAppWindows.get(i);

View File

@@ -10206,6 +10206,15 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
public void notifyAppRelaunchesCleared(IBinder token) {
synchronized (mWindowMap) {
final AppWindowToken appWindow = findAppWindowToken(token);
if (appWindow != null) {
appWindow.clearRelaunching();
}
}
}
@Override
public int getDockedDividerInsetsLw() {
return getDefaultDisplayContentLocked().getDockedDividerController().getContentInsets();