universal7885: CamLightSensor: use ACTION_USER_PRESENT

...instead of ACTION_SCREEN_ON

Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
roynatech2544 2021-12-14 00:56:49 +09:00
commit cab7cfd593
No known key found for this signature in database
GPG key ID: 9675C32163D88D30
2 changed files with 3 additions and 3 deletions

View file

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

View file

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