Skip to content

Commit

Permalink
Create new job id for each file executed
Browse files Browse the repository at this point in the history
See #11
  • Loading branch information
fornwall committed Aug 5, 2019
1 parent 712b2c0 commit b528661
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/termux/boot/BootJobService.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class BootJobService extends JobService {

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

private static final String TAG = "termux:boot JobService";
private static final String TAG = "termux";

// Constants from TermuxService.
private static final String TERMUX_SERVICE = "com.termux.app.TermuxService";
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/termux/boot/BootReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

public class BootReceiver extends BroadcastReceiver {

public static final int TERMUX_BOOT_JOB_ID_BASE = 1000;
static int jobId = TERMUX_BOOT_JOB_ID_BASE;

@Override
public void onReceive(Context context, Intent intent) {
if (!Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) return;
Expand All @@ -40,7 +43,7 @@ public void onReceive(Context context, Intent intent) {
extras.putString(BootJobService.SCRIPT_FILE_PATH, file.getAbsolutePath());

ComponentName serviceComponent = new ComponentName(context, BootJobService.class);
JobInfo job = new JobInfo.Builder(0, serviceComponent)
JobInfo job = new JobInfo.Builder(jobId++, serviceComponent)
.setExtras(extras)
.setOverrideDeadline(3 * 1000)
.build();
Expand Down

0 comments on commit b528661

Please sign in to comment.