Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf0c106c authored by Galia Peycheva's avatar Galia Peycheva
Browse files

Fix dream letterboxed when there is a cutout

Fix: 170167239
Test: m && flash && verify the dream is fullscreen

Change-Id: Id26d3bde207da4168db32dc81a3ad8e001174495
parent 56df9323
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -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);
    }
+7 −0
Original line number Diff line number Diff line
@@ -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