@@ -128,13 +128,15 @@ public int onStartCommand(Intent intent, int flags, int startId) {
128128 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .HONEYCOMB ) {
129129 windowManager .getDefaultDisplay ().getSize (szWindow );
130130 } else {
131- int w = windowManager .getDefaultDisplay ().getWidth ();
132- int h = windowManager .getDefaultDisplay ().getHeight ();
131+ DisplayMetrics displaymetrics = new DisplayMetrics ();
132+ windowManager .getDefaultDisplay ().getMetrics (displaymetrics );
133+ int w = displaymetrics .widthPixels ;
134+ int h = displaymetrics .heightPixels ;
133135 szWindow .set (w , h );
134136 }
135137 WindowManager .LayoutParams params = new WindowManager .LayoutParams (
136138 WindowSetup .width == -1999 ? -1 : WindowSetup .width ,
137- WindowSetup .height != -1999 ? WindowSetup .height : screenHeight (),
139+ WindowSetup .height != -1999 ? WindowSetup .width : screenHeight (),
138140 0 ,
139141 -statusBarHeightPx (),
140142 Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ? WindowManager .LayoutParams .TYPE_APPLICATION_OVERLAY : WindowManager .LayoutParams .TYPE_PHONE ,
@@ -204,6 +206,8 @@ private void updateOverlayFlag(MethodChannel.Result result, String flag) {
204206 WindowManager .LayoutParams .FLAG_LAYOUT_INSET_DECOR | WindowManager .LayoutParams .FLAG_HARDWARE_ACCELERATED ;
205207 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .S && WindowSetup .flag == clickableFlag ) {
206208 params .alpha = MAXIMUM_OPACITY_ALLOWED_FOR_S_AND_HIGHER ;
209+ } else {
210+ params .alpha = 0 ;
207211 }
208212 windowManager .updateViewLayout (flutterView , params );
209213 result .success (true );
@@ -215,15 +219,16 @@ private void updateOverlayFlag(MethodChannel.Result result, String flag) {
215219 private void resizeOverlay (int width , int height , MethodChannel .Result result ) {
216220 if (windowManager != null ) {
217221 WindowManager .LayoutParams params = (WindowManager .LayoutParams ) flutterView .getLayoutParams ();
218- params .width = width ;
219- params .height = height ;
222+ params .width = ( width == - 1999 || width == - 1 ) ? - 1 : dpToPx ( width ) ;
223+ params .height = height != 1999 || height != - 1 ? dpToPx ( height ) : height ;
220224 windowManager .updateViewLayout (flutterView , params );
221225 result .success (true );
222226 } else {
223227 result .success (false );
224228 }
225229 }
226230
231+
227232 @ Override
228233 public void onCreate () {
229234 createNotificationChannel ();
0 commit comments