mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-21 19:55:33 -04:00
universal7885: CamLightSensor: use ACTION_USER_PRESENT
...instead of ACTION_SCREEN_ON Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
parent
897280850b
commit
cab7cfd593
2 changed files with 3 additions and 3 deletions
|
|
@ -34,7 +34,7 @@
|
|||
android:foregroundServiceType="camera">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.SCREEN_OFF" />
|
||||
<action android:name="android.intent.action.SCREEN_ON" />
|
||||
<action android:name="android.intent.action.ACTION_USER_PRESENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ open class CameraLightSensorService : Service() {
|
|||
|
||||
private val mScreenStateReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action == Intent.ACTION_SCREEN_ON) {
|
||||
if (intent.action == Intent.ACTION_USER_PRESENT) {
|
||||
onDisplayOn()
|
||||
mServiceStarted = true
|
||||
} else if (intent.action == Intent.ACTION_SCREEN_OFF) {
|
||||
|
|
@ -249,7 +249,7 @@ open class CameraLightSensorService : Service() {
|
|||
startForeground(50, pushNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA)
|
||||
batteryOptimization(mContext)
|
||||
mRegistered = false
|
||||
screenStateFilter = IntentFilter(Intent.ACTION_SCREEN_ON)
|
||||
screenStateFilter = IntentFilter(Intent.ACTION_USER_PRESENT)
|
||||
screenStateFilter!!.addAction(Intent.ACTION_SCREEN_OFF)
|
||||
try {
|
||||
if (Settings.System.getInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS_MODE)
|
||||
|
|
|
|||
Loading…
Reference in a new issue