The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/android: hide display cutout to use full screen

authored by

SeungHoon Han and committed by
Ryan Pavlik
a2f5e5f1 b18202e5

+23 -2
+11
src/xrt/auxiliary/android/src/main/java/org/freedesktop/monado/auxiliary/MonadoView.java
··· 11 11 12 12 import android.app.Activity; 13 13 import android.content.Context; 14 + import android.os.Build; 14 15 import android.os.SystemClock; 15 16 import android.util.DisplayMetrics; 16 17 import android.util.Log; ··· 47 48 @Nullable 48 49 private SurfaceHolder currentSurfaceHolder = null; 49 50 51 + private SystemUiController systemUiController = null; 52 + 50 53 public MonadoView(Context context) { 51 54 super(context); 52 55 this.context = context; 53 56 Activity activity; 54 57 if (context instanceof Activity) { 55 58 activity = (Activity) context; 59 + systemUiController = new SystemUiController(activity); 60 + systemUiController.hide(); 56 61 } else { 57 62 activity = null; 58 63 } ··· 63 68 super(activity); 64 69 this.context = activity; 65 70 this.activity = activity; 71 + systemUiController = new SystemUiController(activity); 72 + systemUiController.hide(); 66 73 } 67 74 68 75 private MonadoView(Activity activity, long nativePointer) { ··· 141 148 lp.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN | 142 149 WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | 143 150 WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; 151 + } 152 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { 153 + lp.layoutInDisplayCutoutMode = 154 + WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; 144 155 } 145 156 windowManager.addView(this, lp); 146 157 if (focusable) {
+7 -2
src/xrt/auxiliary/android/src/main/java/org/freedesktop/monado/auxiliary/SystemUiController.kt
··· 75 75 override fun hide() { 76 76 activity.runOnUiThread { 77 77 val controller = activity.window.insetsController 78 - controller!!.hide(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars()) 78 + controller!!.hide(WindowInsets.Type.displayCutout() 79 + or WindowInsets.Type.statusBars() 80 + or WindowInsets.Type.navigationBars()) 79 81 controller.systemBarsBehavior = 80 82 WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE 81 83 } ··· 84 86 init { 85 87 runOnUiThread { 86 88 activity.window.insetsController!!.addOnControllableInsetsChangedListener { _: WindowInsetsController?, typeMask: Int -> 87 - if (typeMask and WindowInsets.Type.statusBars() == 1 || typeMask and WindowInsets.Type.navigationBars() == 1) { 89 + if (typeMask and WindowInsets.Type.displayCutout() == 1 90 + || typeMask and WindowInsets.Type.statusBars() == 1 91 + || typeMask and WindowInsets.Type.navigationBars() == 1 92 + ) { 88 93 hide() 89 94 } 90 95 }
+5
src/xrt/ipc/android/src/main/java/org/freedesktop/monado/ipc/SurfaceManager.kt
··· 10 10 11 11 import android.content.Context 12 12 import android.hardware.display.DisplayManager 13 + import android.os.Build 13 14 import android.os.Handler 14 15 import android.os.Looper 15 16 import android.provider.Settings ··· 183 184 val lp = WindowManager.LayoutParams() 184 185 lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY 185 186 lp.flags = if (focusable) VIEW_FLAG_FOCUSABLE else VIEW_FLAG_NOT_FOCUSABLE 187 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { 188 + lp.layoutInDisplayCutoutMode = 189 + WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; 190 + } 186 191 187 192 val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager 188 193 wm.addView(v, lp)