Skip to content

Commit b528661

Browse files
committed
Create new job id for each file executed
See #11
1 parent 712b2c0 commit b528661

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/src/main/java/com/termux/boot/BootJobService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class BootJobService extends JobService {
1313

1414
public static final String SCRIPT_FILE_PATH = "com.termux.boot.script_path";
1515

16-
private static final String TAG = "termux:boot JobService";
16+
private static final String TAG = "termux";
1717

1818
// Constants from TermuxService.
1919
private static final String TERMUX_SERVICE = "com.termux.app.TermuxService";

app/src/main/java/com/termux/boot/BootReceiver.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
public class BootReceiver extends BroadcastReceiver {
1717

18+
public static final int TERMUX_BOOT_JOB_ID_BASE = 1000;
19+
static int jobId = TERMUX_BOOT_JOB_ID_BASE;
20+
1821
@Override
1922
public void onReceive(Context context, Intent intent) {
2023
if (!Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) return;
@@ -40,7 +43,7 @@ public void onReceive(Context context, Intent intent) {
4043
extras.putString(BootJobService.SCRIPT_FILE_PATH, file.getAbsolutePath());
4144

4245
ComponentName serviceComponent = new ComponentName(context, BootJobService.class);
43-
JobInfo job = new JobInfo.Builder(0, serviceComponent)
46+
JobInfo job = new JobInfo.Builder(jobId++, serviceComponent)
4447
.setExtras(extras)
4548
.setOverrideDeadline(3 * 1000)
4649
.build();

0 commit comments

Comments
 (0)