@@ -18,6 +18,7 @@ show_usage () {
1818 echo " --battery-not-low boolean run only when battery is not low, default true (at least Android O)"
1919 echo " --storage-not-low boolean run only when storage is not low, default false (at least Android O)"
2020 echo " --charging boolean run only when charging, default false"
21+ echo " --persisted boolean should the job survive reboots, default false"
2122 echo " --trigger-content-uri text (at least Android N)"
2223 echo " --trigger-content-flag int default 1, (at least Android N)"
2324 exit 0
@@ -34,6 +35,7 @@ OPT_NETWORK=""
3435OPT_BATTERY_NOT_LOW=" "
3536OPT_STORAGE_NOT_LOW=" "
3637OPT_CHARGING=" "
38+ OPT_PERSISTED=" "
3739OPT_TRIGGER_CONTENT_URI=" "
3840OPT_TRIGGER_CONTENT_FLAG=" "
3941
@@ -45,7 +47,7 @@ job-id:,pending,\
4547cancel,cancel-all,\
4648period-ms:,network:,\
4749battery-not-low:,storage-not-low:,\
48- charging:,help,\
50+ charging:,persisted:, help,\
4951trigger_content_flag:,trigger-content-uri: \
5052 -s bash \
5153 -- " $@ " `
@@ -63,6 +65,7 @@ while true; do
6365 --battery-not-low) OPT_BATTERY_NOT_LOW=" $2 " ; shift 2;;
6466 --storage-not-low) OPT_STORAGE_NOT_LOW=" $2 " ; shift 2;;
6567 --charging) OPT_CHARGING=" $2 " ; shift 2;;
68+ --persisted) OPT_PERSISTED=" $2 " ; shift 2;;
6669 --trigger-content-flag) OPT_TRIGGER_CONTENT_FLAG=" $2 " ; shift 2;;
6770 --trigger-content-uri) OPT_TRIGGER_CONTENT_URI=" $2 " ; shift 2;;
6871 -h | --help) show_usage;;
@@ -83,6 +86,7 @@ if [ -n "$OPT_NETWORK" ]; then set -- "$@" --es network "$OPT_NETWORK"; fi
8386if [ -n " $OPT_BATTERY_NOT_LOW " ]; then set -- " $@ " --ez battery_not_low " $OPT_BATTERY_NOT_LOW " ; fi
8487if [ -n " $OPT_STORAGE_NOT_LOW " ]; then set -- " $@ " --ez storage_not_low " $OPT_STORAGE_NOT_LOW " ; fi
8588if [ -n " $OPT_CHARGING " ]; then set -- " $@ " --ez charging " $OPT_CHARGING " ; fi
89+ if [ -n " $OPT_PERSISTED " ]; then set -- " $@ " --ez persisted " $OPT_PERSISTED " ; fi
8690if [ -n " $OPT_TRIGGER_CONTENT_URI " ]; then set -- " $@ " --es trigger_content_uri " $OPT_TRIGGER_CONTENT_URI " ; fi
8791if [ -n " $OPT_TRIGGER_CONTENT_FLAG " ]; then set -- " $@ " --ez trigger_content_flag " $OPT_TRIGGER_CONTENT_FLAG " ; fi
8892
0 commit comments