universal7885: CameraLightSensor: Use correct code to start service

* W ActivityManager: Unable to start service Intent { cmp=com.eurekateam.cameralightsensor/.CameraLightSensorService } U=0: not found

* Ref: https://stackoverflow.com/questions/19105587/unable-to-start-service-intent-not-found

* Makes BootReceiver unable to start service
This commit is contained in:
roynatech2544 2021-11-13 19:19:44 +09:00
commit e4569f7c82
No known key found for this signature in database
GPG key ID: 9675C32163D88D30
5 changed files with 6 additions and 23 deletions

View file

@ -7,7 +7,4 @@ android_app {
privileged: true,
certificate: "platform",
static_libs: [ "androidx.core_core" ],
optimize: {
proguard_flags_files: ["proguard.flags"],
},
}

View file

@ -30,13 +30,14 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity
<service
android:name=".CameraLightSensorService"
android:exported="true">
android:exported="true"
android:foregroundServiceType="camera">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.SCREEN_OFF" />
<action android:name="android.intent.action.SCREEN_ON" />
</intent-filter>
</activity>
</service>
</application>
</manifest>

View file

@ -1,7 +0,0 @@
# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
-renamesourcefileattribute SourceFile

View file

@ -3,15 +3,14 @@ package com.eurekateam.cameralightsensor;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.eurekateam.cameralightsensor.CameraLightSensorService;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equalsIgnoreCase(Intent.ACTION_BOOT_COMPLETED)) {
if (context != null) {
final Intent i = new Intent();
i.setClassName("com.eurekateam.cameralightsensor",
"com.eurekateam.cameralightsensor.CameraLightSensorService");
final Intent i = new Intent(context, CameraLightSensorService.class);
context.startForegroundService(i);
}
}

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string-array translatable="false" name="config_tether_wifi_regexs">
<item>"wlan\\d"</item>
<item>"swlan\\d"</item>
</string-array>
</resources>