Provide camera context and fault-controlled orientation sensor boundaries

This commit is contained in:
evgeny committed 2026-10-29 13:34:24 +01:00
1 parent 5a6bfd49d6
commit fe5c2b8cb8
2 files changed
+20

No files matched your search

@@ -0,0 +1,5 @@
package android.content
class Context {
fun <T> getSystemService(type: Class<T>): T = type.cast(android.hardware.camera2.CameraManager.shared)
}
@@ -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<OrientationEventListener>(); var failures = emptySet<String>() }
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) }
}