also looking at this
feat(android): a main-thread trampoline, and the orientation pair to prove it — ratchet 72 → 70
#173
7 files
+568
-3
| @@ -2592,6 +2592,10 @@ class CraftBridge( | ||
| 2592 | 2592 | |
| 2593 | 2593 | @JavascriptInterface |
| 2594 | 2594 | fun lockOrientation(orientation: String): Boolean { |
| 2595 | // Zig queues the same work on the same looper, through a Runnable | |
| 2596 | // this file's holder owns — see CraftNative.runOnMain. | |
| 2597 | if (CraftNative.lockOrientation(activity, orientation)) return true | |
| 2598 | ||
| 2595 | 2599 | activity.runOnUiThread { |
| 2596 | 2600 | activity.requestedOrientation = when (orientation) { |
| 2597 | 2601 | "portrait" -> ActivityInfo.SCREEN_ORIENTATION_PORTRAIT |
| @@ -2606,6 +2610,8 @@ class CraftBridge( | ||
| 2606 | 2610 | |
| 2607 | 2611 | @JavascriptInterface |
| 2608 | 2612 | fun unlockOrientation(): Boolean { |
| 2613 | if (CraftNative.unlockOrientation(activity)) return true | |
| 2614 | ||
| 2609 | 2615 | activity.runOnUiThread { |
| 2610 | 2616 | activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED |
| 2611 | 2617 | } |