mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 12:35: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">
|
android:foregroundServiceType="camera">
|
||||||
<intent-filter android:priority="1000">
|
<intent-filter android:priority="1000">
|
||||||
<action android:name="android.intent.action.SCREEN_OFF" />
|
<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>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
</application>
|
</application>
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ open class CameraLightSensorService : Service() {
|
||||||
|
|
||||||
private val mScreenStateReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
private val mScreenStateReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
if (intent.action == Intent.ACTION_SCREEN_ON) {
|
if (intent.action == Intent.ACTION_USER_PRESENT) {
|
||||||
onDisplayOn()
|
onDisplayOn()
|
||||||
mServiceStarted = true
|
mServiceStarted = true
|
||||||
} else if (intent.action == Intent.ACTION_SCREEN_OFF) {
|
} else if (intent.action == Intent.ACTION_SCREEN_OFF) {
|
||||||
|
|
@ -249,7 +249,7 @@ open class CameraLightSensorService : Service() {
|
||||||
startForeground(50, pushNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA)
|
startForeground(50, pushNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA)
|
||||||
batteryOptimization(mContext)
|
batteryOptimization(mContext)
|
||||||
mRegistered = false
|
mRegistered = false
|
||||||
screenStateFilter = IntentFilter(Intent.ACTION_SCREEN_ON)
|
screenStateFilter = IntentFilter(Intent.ACTION_USER_PRESENT)
|
||||||
screenStateFilter!!.addAction(Intent.ACTION_SCREEN_OFF)
|
screenStateFilter!!.addAction(Intent.ACTION_SCREEN_OFF)
|
||||||
try {
|
try {
|
||||||
if (Settings.System.getInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS_MODE)
|
if (Settings.System.getInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS_MODE)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue