@@ -55,7 +55,6 @@ public class StatusBarWindowView extends FrameLayout {
5555 public StatusBarWindowView (Context context , AttributeSet attrs ) {
5656 super (context , attrs );
5757 setMotionEventSplittingEnabled (false );
58- setWillNotDraw (false );
5958 mTransparentSrcPaint .setColor (0 );
6059 mTransparentSrcPaint .setXfermode (new PorterDuffXfermode (PorterDuff .Mode .SRC ));
6160 }
@@ -105,11 +104,16 @@ protected void onAttachedToWindow () {
105104 // We need to ensure that our window doesn't suffer from overdraw which would normally
106105 // occur if our window is translucent. Since we are drawing the whole window anyway with
107106 // the scrim, we don't need the window to be cleared in the beginning.
108- IBinder windowToken = getWindowToken ();
109- WindowManager .LayoutParams lp = (WindowManager .LayoutParams ) getLayoutParams ();
110- lp .token = windowToken ;
111- setLayoutParams (lp );
112- WindowManagerGlobal .getInstance ().changeCanvasOpacity (windowToken , true );
107+ if (mService .isScrimSrcModeEnabled ()) {
108+ IBinder windowToken = getWindowToken ();
109+ WindowManager .LayoutParams lp = (WindowManager .LayoutParams ) getLayoutParams ();
110+ lp .token = windowToken ;
111+ setLayoutParams (lp );
112+ WindowManagerGlobal .getInstance ().changeCanvasOpacity (windowToken , true );
113+ setWillNotDraw (false );
114+ } else {
115+ setWillNotDraw (!DEBUG );
116+ }
113117 }
114118
115119 @ Override
@@ -199,23 +203,25 @@ public boolean onTouchEvent(MotionEvent ev) {
199203 @ Override
200204 public void onDraw (Canvas canvas ) {
201205 super .onDraw (canvas );
202- // We need to ensure that our window is always drawn fully even when we have paddings,
203- // since we simulate it to be opaque.
204- int paddedBottom = getHeight () - getPaddingBottom ();
205- int paddedRight = getWidth () - getPaddingRight ();
206- if (getPaddingTop () != 0 ) {
207- canvas .drawRect (0 , 0 , getWidth (), getPaddingTop (), mTransparentSrcPaint );
208- }
209- if (getPaddingBottom () != 0 ) {
210- canvas .drawRect (0 , paddedBottom , getWidth (), getHeight (), mTransparentSrcPaint );
211- }
212- if (getPaddingLeft () != 0 ) {
213- canvas .drawRect (0 , getPaddingTop (), getPaddingLeft (), paddedBottom ,
214- mTransparentSrcPaint );
215- }
216- if (getPaddingRight () != 0 ) {
217- canvas .drawRect (paddedRight , getPaddingTop (), getWidth (), paddedBottom ,
218- mTransparentSrcPaint );
206+ if (mService .isScrimSrcModeEnabled ()) {
207+ // We need to ensure that our window is always drawn fully even when we have paddings,
208+ // since we simulate it to be opaque.
209+ int paddedBottom = getHeight () - getPaddingBottom ();
210+ int paddedRight = getWidth () - getPaddingRight ();
211+ if (getPaddingTop () != 0 ) {
212+ canvas .drawRect (0 , 0 , getWidth (), getPaddingTop (), mTransparentSrcPaint );
213+ }
214+ if (getPaddingBottom () != 0 ) {
215+ canvas .drawRect (0 , paddedBottom , getWidth (), getHeight (), mTransparentSrcPaint );
216+ }
217+ if (getPaddingLeft () != 0 ) {
218+ canvas .drawRect (0 , getPaddingTop (), getPaddingLeft (), paddedBottom ,
219+ mTransparentSrcPaint );
220+ }
221+ if (getPaddingRight () != 0 ) {
222+ canvas .drawRect (paddedRight , getPaddingTop (), getWidth (), paddedBottom ,
223+ mTransparentSrcPaint );
224+ }
219225 }
220226 if (DEBUG ) {
221227 Paint pt = new Paint ();
0 commit comments