commit 979eecf6b35d71b37f094873f112196bbba7a8f2
parent 6492cf3b483281e7c7da37e26e39791807827d5d
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Sun, 11 Jun 2023 12:40:48 +0200

fix: disable camera

Diffstat:
Mapp/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt | 24++++++++++++------------
Mapp/src/main/kotlin/me/rhunk/snapenhance/features/impl/tweaks/CameraTweaks.kt | 6+++---
2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt b/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt @@ -191,18 +191,6 @@ enum class ConfigProperty( ConfigCategory.UI_TWEAKS, ConfigIntegerValue(1) ), - CAMERA_DISABLE( - "property.disable_camera", - "description.disable_camera", - ConfigCategory.UI_TWEAKS, - ConfigStateValue(false) - ), - IMMERSIVE_CAMERA_PREVIEW( - "property.immersive_camera_preview", - "description.immersive_camera_preview", - ConfigCategory.UI_TWEAKS, - ConfigStateValue(false) - ), HIDE_UI_ELEMENTS( "property.hide_ui_elements", "description.hide_ui_elements", @@ -292,6 +280,18 @@ enum class ConfigProperty( //CAMERA + CAMERA_DISABLE( + "property.disable_camera", + "description.disable_camera", + ConfigCategory.CAMERA, + ConfigStateValue(false) + ), + IMMERSIVE_CAMERA_PREVIEW( + "property.immersive_camera_preview", + "description.immersive_camera_preview", + ConfigCategory.CAMERA, + ConfigStateValue(false) + ), OVERRIDE_PREVIEW_RESOLUTION( "property.preview_resolution", "description.preview_resolution", diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/tweaks/CameraTweaks.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/tweaks/CameraTweaks.kt @@ -2,9 +2,9 @@ package me.rhunk.snapenhance.features.impl.tweaks import android.Manifest import android.annotation.SuppressLint -import android.app.admin.DevicePolicyManager import android.content.ContextWrapper import android.content.pm.PackageManager +import android.hardware.camera2.CameraManager import me.rhunk.snapenhance.config.ConfigProperty import me.rhunk.snapenhance.data.wrapper.impl.ScSize import me.rhunk.snapenhance.features.Feature @@ -33,8 +33,8 @@ class CameraTweaks : Feature("Camera Tweaks", loadParams = FeatureLoadParams.ACT } } - DevicePolicyManager::class.java.hook("getCameraDisabled", HookStage.BEFORE) { param -> - param.setResult(true) + CameraManager::class.java.hook("openCamera", HookStage.BEFORE) { param -> + param.setResult(null) } }