Skip to content

Commit 5217773

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Fix issue #7296314, issue #7296314." into jb-mr1-dev
2 parents d9c9912 + 4c1e318 commit 5217773

File tree

6 files changed

+156
-125
lines changed

6 files changed

+156
-125
lines changed

api/17.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20347,7 +20347,6 @@ package android.service.dreams {
2034720347
method public android.view.WindowManager getWindowManager();
2034820348
method public boolean isFullscreen();
2034920349
method public boolean isInteractive();
20350-
method public boolean isLowProfile();
2035120350
method public boolean isScreenBright();
2035220351
method public void onActionModeFinished(android.view.ActionMode);
2035320352
method public void onActionModeStarted(android.view.ActionMode);
@@ -20372,7 +20371,6 @@ package android.service.dreams {
2037220371
method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
2037320372
method public void setFullscreen(boolean);
2037420373
method public void setInteractive(boolean);
20375-
method public void setLowProfile(boolean);
2037620374
method public void setScreenBright(boolean);
2037720375
field public static final java.lang.String DREAM_META_DATA = "android.service.dream";
2037820376
field public static final java.lang.String SERVICE_INTERFACE = "android.service.dreams.DreamService";

api/current.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20347,7 +20347,6 @@ package android.service.dreams {
2034720347
method public android.view.WindowManager getWindowManager();
2034820348
method public boolean isFullscreen();
2034920349
method public boolean isInteractive();
20350-
method public boolean isLowProfile();
2035120350
method public boolean isScreenBright();
2035220351
method public void onActionModeFinished(android.view.ActionMode);
2035320352
method public void onActionModeStarted(android.view.ActionMode);
@@ -20372,7 +20371,6 @@ package android.service.dreams {
2037220371
method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
2037320372
method public void setFullscreen(boolean);
2037420373
method public void setInteractive(boolean);
20375-
method public void setLowProfile(boolean);
2037620374
method public void setScreenBright(boolean);
2037720375
field public static final java.lang.String DREAM_META_DATA = "android.service.dream";
2037820376
field public static final java.lang.String SERVICE_INTERFACE = "android.service.dreams.DreamService";

core/java/android/service/dreams/DreamService.java

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import android.annotation.SdkConstant.SdkConstantType;
2323
import android.app.Service;
2424
import android.content.Intent;
25+
import android.graphics.PixelFormat;
2526
import android.graphics.drawable.ColorDrawable;
2627
import android.os.Handler;
2728
import android.os.IBinder;
@@ -401,6 +402,9 @@ public boolean isInteractive() {
401402
* Sets View.SYSTEM_UI_FLAG_LOW_PROFILE on the content view.
402403
*
403404
* @param lowProfile True to set View.SYSTEM_UI_FLAG_LOW_PROFILE
405+
* @hide There is no reason to have this -- dreams can set this flag
406+
* on their own content view, and from there can actually do the
407+
* correct interactions with it (seeing when it is cleared etc).
404408
*/
405409
public void setLowProfile(boolean lowProfile) {
406410
mLowProfile = lowProfile;
@@ -412,20 +416,23 @@ public void setLowProfile(boolean lowProfile) {
412416
* Returns whether or not this dream is in low profile mode. Defaults to true.
413417
*
414418
* @see #setLowProfile(boolean)
419+
* @hide
415420
*/
416421
public boolean isLowProfile() {
417422
return getSystemUiVisibilityFlagValue(View.SYSTEM_UI_FLAG_LOW_PROFILE, mLowProfile);
418423
}
419424

420425
/**
421-
* Sets View.SYSTEM_UI_FLAG_FULLSCREEN on the content view.
426+
* Controls {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN}
427+
* on the dream's window.
422428
*
423-
* @param fullscreen True to set View.SYSTEM_UI_FLAG_FULLSCREEN
429+
* @param fullscreen If true, the fullscreen flag will be set; else it
430+
* will be cleared.
424431
*/
425432
public void setFullscreen(boolean fullscreen) {
426433
mFullscreen = fullscreen;
427-
int flag = View.SYSTEM_UI_FLAG_FULLSCREEN;
428-
applySystemUiVisibilityFlags(mFullscreen ? flag : 0, flag);
434+
int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
435+
applyWindowFlags(mFullscreen ? flag : 0, flag);
429436
}
430437

431438
/**
@@ -434,7 +441,7 @@ public void setFullscreen(boolean fullscreen) {
434441
* @see #setFullscreen(boolean)
435442
*/
436443
public boolean isFullscreen() {
437-
return getSystemUiVisibilityFlagValue(View.SYSTEM_UI_FLAG_FULLSCREEN, mFullscreen);
444+
return mFullscreen;
438445
}
439446

440447
/**
@@ -565,6 +572,7 @@ private final void attach(IBinder windowToken) {
565572
mWindow.setCallback(this);
566573
mWindow.requestFeature(Window.FEATURE_NO_TITLE);
567574
mWindow.setBackgroundDrawable(new ColorDrawable(0xFF000000));
575+
mWindow.setFormat(PixelFormat.OPAQUE);
568576

569577
if (mDebug) Slog.v(TAG, String.format("Attaching window token: %s to window of type %s",
570578
windowToken, WindowManager.LayoutParams.TYPE_DREAM));
@@ -573,9 +581,12 @@ private final void attach(IBinder windowToken) {
573581
lp.type = WindowManager.LayoutParams.TYPE_DREAM;
574582
lp.token = windowToken;
575583
lp.windowAnimations = com.android.internal.R.style.Animation_Dream;
576-
lp.flags |= ( WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
584+
lp.flags |= ( WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
585+
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
586+
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
577587
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
578588
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
589+
| (mFullscreen ? WindowManager.LayoutParams.FLAG_FULLSCREEN : 0)
579590
| (mScreenBright ? WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON : 0)
580591
);
581592
mWindow.setAttributes(lp);
@@ -588,9 +599,8 @@ private final void attach(IBinder windowToken) {
588599
if (mDebug) Slog.v(TAG, "Window added on thread " + Thread.currentThread().getId());
589600
try {
590601
applySystemUiVisibilityFlags(
591-
(mLowProfile ? View.SYSTEM_UI_FLAG_LOW_PROFILE : 0)
592-
| (mFullscreen ? View.SYSTEM_UI_FLAG_FULLSCREEN : 0),
593-
View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN);
602+
(mLowProfile ? View.SYSTEM_UI_FLAG_LOW_PROFILE : 0),
603+
View.SYSTEM_UI_FLAG_LOW_PROFILE);
594604
getWindowManager().addView(mWindow.getDecorView(), mWindow.getAttributes());
595605
} catch (Throwable t) {
596606
Slog.w("Crashed adding window view", t);

0 commit comments

Comments
 (0)