From 4d3aaf6980b00ad7e9b53674cdf452c4b5cf6357 Mon Sep 17 00:00:00 2001 From: Galia Peycheva Date: Fri, 3 Apr 2020 17:57:33 +0200 Subject: [PATCH] Remove usage of low profile in DreamService The low profile in DreamService was used to hide the status bar and navigation bar. Now this is done by WindowInsetController.hide(systemBars()) in DreamActivity. Bug: 151749301 Test: m && flash && verify that system bars don't show up Change-Id: I8fc9ca67262e92422afb472ccd76ec561c90f66d --- .../android/service/dreams/DreamService.java | 44 ------------------- .../dreams/dozetest/DozeTestDream.java | 1 - 2 files changed, 45 deletions(-) diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java index 3f0787350075d..337027ef5bc99 100644 --- a/core/java/android/service/dreams/DreamService.java +++ b/core/java/android/service/dreams/DreamService.java @@ -182,7 +182,6 @@ public class DreamService extends Service implements Window.Callback { private Window mWindow; private Activity mActivity; private boolean mInteractive; - private boolean mLowProfile = true; private boolean mFullscreen; private boolean mScreenBright = true; private boolean mStarted; @@ -529,32 +528,6 @@ public class DreamService extends Service implements Window.Callback { return mInteractive; } - /** - * Sets View.SYSTEM_UI_FLAG_LOW_PROFILE on the content view. - * - * @param lowProfile True to set View.SYSTEM_UI_FLAG_LOW_PROFILE - * @hide There is no reason to have this -- dreams can set this flag - * on their own content view, and from there can actually do the - * correct interactions with it (seeing when it is cleared etc). - */ - public void setLowProfile(boolean lowProfile) { - if (mLowProfile != lowProfile) { - mLowProfile = lowProfile; - int flag = View.SYSTEM_UI_FLAG_LOW_PROFILE; - applySystemUiVisibilityFlags(mLowProfile ? flag : 0, flag); - } - } - - /** - * Returns whether or not this dream is in low profile mode. Defaults to true. - * - * @see #setLowProfile(boolean) - * @hide - */ - public boolean isLowProfile() { - return getSystemUiVisibilityFlagValue(View.SYSTEM_UI_FLAG_LOW_PROFILE, mLowProfile); - } - /** * Controls {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} * on the dream's window. @@ -1094,10 +1067,6 @@ public class DreamService extends Service implements Window.Callback { // along well. Dreams usually don't need such bars anyways, so disable them by default. mWindow.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - applySystemUiVisibilityFlags( - (mLowProfile ? View.SYSTEM_UI_FLAG_LOW_PROFILE : 0), - View.SYSTEM_UI_FLAG_LOW_PROFILE); - mWindow.getDecorView().addOnAttachStateChangeListener( new View.OnAttachStateChangeListener() { @Override @@ -1126,18 +1095,6 @@ public class DreamService extends Service implements Window.Callback { } } - private boolean getSystemUiVisibilityFlagValue(int flag, boolean defaultValue) { - View v = mWindow == null ? null : mWindow.getDecorView(); - return v == null ? defaultValue : (v.getSystemUiVisibility() & flag) != 0; - } - - private void applySystemUiVisibilityFlags(int flags, int mask) { - View v = mWindow == null ? null : mWindow.getDecorView(); - if (v != null) { - v.setSystemUiVisibility(applyFlags(v.getSystemUiVisibility(), flags, mask)); - } - } - private int applyFlags(int oldFlags, int flags, int mask) { return (oldFlags&~mask) | (flags&mask); } @@ -1163,7 +1120,6 @@ public class DreamService extends Service implements Window.Callback { pw.println(" window: " + mWindow); pw.print(" flags:"); if (isInteractive()) pw.print(" interactive"); - if (isLowProfile()) pw.print(" lowprofile"); if (isFullscreen()) pw.print(" fullscreen"); if (isScreenBright()) pw.print(" bright"); if (isWindowless()) pw.print(" windowless"); diff --git a/tests/DozeTest/src/com/android/dreams/dozetest/DozeTestDream.java b/tests/DozeTest/src/com/android/dreams/dozetest/DozeTestDream.java index f4f610b1b2807..fa292bd0d57a6 100644 --- a/tests/DozeTest/src/com/android/dreams/dozetest/DozeTestDream.java +++ b/tests/DozeTest/src/com/android/dreams/dozetest/DozeTestDream.java @@ -100,7 +100,6 @@ public class DozeTestDream extends DreamService { public void onAttachedToWindow() { super.onAttachedToWindow(); setInteractive(false); - setLowProfile(true); setFullscreen(true); setContentView(R.layout.dream); setScreenBright(false);