2222import android .annotation .SdkConstant .SdkConstantType ;
2323import android .app .Service ;
2424import android .content .Intent ;
25+ import android .graphics .PixelFormat ;
2526import android .graphics .drawable .ColorDrawable ;
2627import android .os .Handler ;
2728import 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