net.twisterrob.inventory
net.twisterrob.inventory copied to clipboard
Crash: App.startServices -> DatabaseService.enqueueWork -> JobSchedulerService.enforceValidJobRequest
samsung starqltesq (Galaxy S9) Android 10 (SDK 29) Version: 12001279 (1.2.0#1279-8eca619) Occurred: 4 days ago once for 1 user.
Exception java.lang.RuntimeException:
at android.app.ActivityThread.handleMakeApplication (ActivityThread.java:7189)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:7134)
at android.app.ActivityThread.access$1600 (ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2102)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:8167)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)
Caused by java.lang.IllegalArgumentException:
at android.os.Parcel.createException (Parcel.java:2092)
at android.os.Parcel.readException (Parcel.java:2056)
at android.os.Parcel.readException (Parcel.java:2004)
at android.app.job.IJobScheduler$Stub$Proxy.enqueue (IJobScheduler.java:358)
at android.app.JobSchedulerImpl.enqueue (JobSchedulerImpl.java:52)
at androidx.core.app.JobIntentService$JobWorkEnqueuer.enqueueWork (JobIntentService.java:347)
at androidx.core.app.JobIntentService.enqueueWork (JobIntentService.java:527)
at androidx.core.app.JobIntentService.enqueueWork (JobIntentService.java:505)
at net.twisterrob.inventory.android.content.db.DatabaseService.enqueueWork (DatabaseService.java:43)
at net.twisterrob.inventory.android.App.startServices (App.java:72)
at net.twisterrob.inventory.android.App.onStart (App.java:67)
at net.twisterrob.android.app.BaseApp.onCreate (BaseApp.java:99)
at net.twisterrob.inventory.android.Hilt_App.onCreate (Hilt_App.java:41)
at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1190)
at android.app.ActivityThread.handleMakeApplication (ActivityThread.java:7184)
Caused by android.os.RemoteException: Remote stack trace:
at com.android.server.job.JobSchedulerService$JobSchedulerStub.enforceValidJobRequest (JobSchedulerService.java:2724)
at com.android.server.job.JobSchedulerService$JobSchedulerStub.enqueue (JobSchedulerService.java:2814)
at android.app.job.IJobScheduler$Stub.onTransact (IJobScheduler.java:183)
at android.os.Binder.execTransactInternal (Binder.java:1056)
at android.os.Binder.execTransact (Binder.java:1029)
https://play.google.com/console/u/0/developers/7995455198986011414/app/4974852622245161228/vitals/crashes/465e458ebc751ae239ce9b9b4f1908fb/details?days=28#cluster-insights-section
Note: JobIntentService is not maintained so my best bet is #256
GitHub: https://github.com/search?q=enforceValidJobRequest+&type=issues
- Most of the mentions seems to contain
java.lang.IllegalArgumentException: Tried to schedule job for non-existent component: ComponentInfo{app.package/com.example.ClassExtendingJobIntentService} - https://github.com/firebase/quickstart-unity/issues/1070 has a potential fix because my service is not exported, even SDK 29 is matching: https://github.com/TWiStErRob/net.twisterrob.inventory/blob/c663ba18d753f0ba9d8f8d77492dd929f326c830/android/src/main/AndroidManifest.xml#L159
- Note: backup service is not exported either, but that's only activated when the user is actively doing it
StackOverflow also concurs: https://stackoverflow.com/a/52203436/253468
Doing some math on JobSchedulerService.java in API 29 sources:
- enqueue calls enforceValidJobRequest on 2814 in stack and 2756 in source, that's a -56 difference
- enforceValidJobRequest:2724 is then located at 2724-56=2666, i.e.
"No such service " + service
ServiceInfo si = pm.getServiceInfo(service, PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, UserHandle.getUserId(uid));
if (si == null) {
throw new IllegalArgumentException("No such service " + service);
}
so the question is when getServiceInfo returns null? ... eeer it's @NonNull...
like literally
@NonNull
public abstract ServiceInfo getServiceInfo(@NonNull ComponentName component,
@ComponentInfoFlags int flags) throws NameNotFoundException;
@Override
public ServiceInfo getServiceInfo(ComponentName className, int flags) throws NameNotFoundException {
final int userId = getUserId();
try {
ServiceInfo si = mPM.getServiceInfo(className, updateFlagsForComponent(flags, userId, null), userId);
if (si != null) {
return si;
}
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
throw new NameNotFoundException(className.toString());
}
Let's say that the math was wrong for the offset...