From fe5c2b8cb83d65c6cb1c0eed691b237a53eca5f3 Mon Sep 17 00:00:00 2001 From: evgeny Date: Thu, 29 Oct 2026 00:52:55 +0100 Subject: [PATCH] Provide camera context and fault-controlled orientation sensor boundaries --- .../src/main/kotlin/android/content/Context.kt | 5 +++++ .../android/view/OrientationEventListener.kt | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tools/chatgui-android/video-tests/src/main/kotlin/android/content/Context.kt create mode 100644 tools/chatgui-android/video-tests/src/main/kotlin/android/view/OrientationEventListener.kt diff --git a/tools/chatgui-android/video-tests/src/main/kotlin/android/content/Context.kt b/tools/chatgui-android/video-tests/src/main/kotlin/android/content/Context.kt new file mode 100644 index 000000000..2cb1e2384 --- /dev/null +++ b/tools/chatgui-android/video-tests/src/main/kotlin/android/content/Context.kt @@ -0,0 +1,5 @@ +package android.content + +class Context { + fun getSystemService(type: Class): T = type.cast(android.hardware.camera2.CameraManager.shared) +} diff --git a/tools/chatgui-android/video-tests/src/main/kotlin/android/view/OrientationEventListener.kt b/tools/chatgui-android/video-tests/src/main/kotlin/android/view/OrientationEventListener.kt new file mode 100644 index 000000000..8563ca856 --- /dev/null +++ b/tools/chatgui-android/video-tests/src/main/kotlin/android/view/OrientationEventListener.kt @@ -0,0 +1,15 @@ +package android.view + +import android.content.Context +import java.util.concurrent.CopyOnWriteArrayList + +abstract class OrientationEventListener(context: Context) { + companion object { val created = CopyOnWriteArrayList(); var failures = emptySet() } + var enabled = false + private set + init { created.add(this) } + abstract fun onOrientationChanged(angle: Int) + fun canDetectOrientation(): Boolean { check("query" !in failures); return true } + fun enable() { check("enable" !in failures); enabled = true; check("enable after" !in failures) } + fun disable() { check("disable" !in failures); enabled = false; check("disable after" !in failures) } +}