Merge "Remove usage of low profile in DreamService" into rvc-dev

This commit is contained in:
Galia Peycheva
2020-04-15 20:35:00 +00:00
committed by Android (Google) Code Review
2 changed files with 0 additions and 45 deletions

View File

@@ -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");

View File

@@ -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);