Merge "Fix dream letterboxed when there is a cutout"

This commit is contained in:
TreeHugger Robot
2020-10-15 19:05:55 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 3 deletions

View File

@@ -19,7 +19,6 @@ package android.service.dreams;
import android.annotation.Nullable;
import android.app.Activity;
import android.os.Bundle;
import android.view.WindowInsets;
import com.android.internal.R;
@@ -63,8 +62,6 @@ public class DreamActivity extends Activity {
@Override
public void onResume() {
super.onResume();
// Hide all insets (nav bar, status bar, etc) when the dream is showing
getWindow().getInsetsController().hide(WindowInsets.Type.systemBars());
overridePendingTransition(R.anim.dream_activity_open_enter,
R.anim.dream_activity_open_exit);
}

View File

@@ -48,6 +48,7 @@ import android.view.SearchEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.view.accessibility.AccessibilityEvent;
@@ -1061,11 +1062,17 @@ public class DreamService extends Service implements Window.Callback {
| (mFullscreen ? WindowManager.LayoutParams.FLAG_FULLSCREEN : 0)
| (mScreenBright ? WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON : 0)
);
lp.layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
mWindow.setAttributes(lp);
// Workaround: Currently low-profile and in-window system bar backgrounds don't go
// along well. Dreams usually don't need such bars anyways, so disable them by default.
mWindow.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// Hide all insets when the dream is showing
mWindow.getDecorView().getWindowInsetsController().hide(WindowInsets.Type.systemBars());
mWindow.setDecorFitsSystemWindows(false);
mWindow.getDecorView().addOnAttachStateChangeListener(
new View.OnAttachStateChangeListener() {
@Override