fix: disable camera

This commit is contained in:
rhunk
2023-06-11 12:40:48 +02:00
parent 6492cf3b48
commit 979eecf6b3
2 changed files with 15 additions and 15 deletions

View File

@@ -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",

View File

@@ -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)
}
}