Merge "Use top fullscreen window to inherit SystemUI flags" into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
626b8c371b
@@ -63,6 +63,7 @@ import android.util.Slog;
|
||||
import android.view.IApplicationToken;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManager.LayoutParams;
|
||||
import android.view.WindowManagerPolicy.StartingSurface;
|
||||
|
||||
import com.android.internal.util.ToBooleanFunction;
|
||||
@@ -471,6 +472,20 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
|
||||
return delayed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The to top most child window for which {@link LayoutParams#isFullscreen()} returns
|
||||
* true.
|
||||
*/
|
||||
WindowState getTopFullscreenWindow() {
|
||||
for (int i = mChildren.size() - 1; i >= 0; i--) {
|
||||
final WindowState win = mChildren.get(i);
|
||||
if (win != null && win.mAttrs.isFullscreen()) {
|
||||
return win;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
WindowState findMainWindow() {
|
||||
WindowState candidate = null;
|
||||
int j = mChildren.size();
|
||||
|
||||
@@ -162,7 +162,7 @@ class TaskSnapshotSurface implements StartingSurface {
|
||||
+ task);
|
||||
return null;
|
||||
}
|
||||
final WindowState topFullscreenWindow = topFullscreenToken.findMainWindow();
|
||||
final WindowState topFullscreenWindow = topFullscreenToken.getTopFullscreenWindow();
|
||||
if (mainWindow == null || topFullscreenWindow == null) {
|
||||
Slog.w(TAG, "TaskSnapshotSurface.create: Failed to find main window for token="
|
||||
+ token);
|
||||
|
||||
@@ -96,6 +96,24 @@ public class AppWindowTokenTests extends WindowTestsBase {
|
||||
token.removeImmediately();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTopFullscreenWindow() throws Exception {
|
||||
final WindowTestUtils.TestAppWindowToken token =
|
||||
new WindowTestUtils.TestAppWindowToken(mDisplayContent);
|
||||
|
||||
assertNull(token.getTopFullscreenWindow());
|
||||
|
||||
final WindowState window1 = createWindow(null, TYPE_BASE_APPLICATION, token, "window1");
|
||||
final WindowState window11 = createWindow(null, TYPE_APPLICATION, token, "window11");
|
||||
final WindowState window12 = createWindow(null, TYPE_APPLICATION, token, "window12");
|
||||
assertEquals(window12, token.getTopFullscreenWindow());
|
||||
window12.mAttrs.width = 500;
|
||||
assertEquals(window11, token.getTopFullscreenWindow());
|
||||
window11.mAttrs.width = 500;
|
||||
assertEquals(window1, token.getTopFullscreenWindow());
|
||||
token.removeImmediately();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLandscapeSeascapeRotationByApp() throws Exception {
|
||||
// Some plumbing to get the service ready for rotation updates.
|
||||
|
||||
Reference in New Issue
Block a user