OSDN Git Service

Only allow AM to update display orientation based on app containers
authorWale Ogunwale <ogunwale@google.com>
Tue, 2 May 2017 21:49:04 +0000 (14:49 -0700)
committerWale Ogunwale <ogunwale@google.com>
Wed, 3 May 2017 14:22:24 +0000 (07:22 -0700)
commit5f1ae6aaca78a14d25e28042df32df642ab3d29e
treeae9a620d0621d6f7303c3bd5f55ee67ca262da8c
parent251894b134a3d1d2bcba5ff9db7e3a4014cd369a
Only allow AM to update display orientation based on app containers

Activity manager choregraphs several app states when starting an
activity including when the display orientation should be updated based
on the app that is now in the foreground. It is possible for a call to
originate within WM after AM adds the starting app token, but before AM
makes the app visible and resumed. E.g. A relayout call due to a
starting window. When this happens WM can prematurely update the display
orientation with incomplete information causing the starting app to be
in an incorrect orientation initially.
To fix this problem we now only factor in app containers (stacks, task,
..) when updating the display orientation if the call to update is
coming from AM. Otherwise we only use the non-app/system containers to
determine the orientation or return the last orientation.

Change-Id: I431ce9260ee31257732311a548c62cbcdb27eae7
Fixes: 37550022
Test: Launch 2 apps that don't fix orientation and use the recent button
to switch between them while holding the device in landscape.
services/core/java/com/android/server/wm/DisplayContent.java
services/core/java/com/android/server/wm/WindowManagerService.java