Loading services/core/java/com/android/server/job/controllers/JobStatus.java +5 −1 Original line number Diff line number Diff line Loading @@ -698,7 +698,8 @@ public final class JobStatus { static final int CONSTRAINTS_OF_INTEREST = CONSTRAINT_CHARGING | CONSTRAINT_BATTERY_NOT_LOW | CONSTRAINT_STORAGE_NOT_LOW | CONSTRAINT_TIMING_DELAY | CONSTRAINT_CONNECTIVITY | CONSTRAINT_UNMETERED | CONSTRAINT_NOT_ROAMING | CONSTRAINT_CONNECTIVITY | CONSTRAINT_UNMETERED | CONSTRAINT_NOT_ROAMING | CONSTRAINT_METERED | CONSTRAINT_IDLE | CONSTRAINT_CONTENT_TRIGGER; // Soft override covers all non-"functional" constraints Loading Loading @@ -865,6 +866,9 @@ public final class JobStatus { if ((constraints&CONSTRAINT_NOT_ROAMING) != 0) { pw.print(" NOT_ROAMING"); } if ((constraints&CONSTRAINT_METERED) != 0) { pw.print(" METERED"); } if ((constraints&CONSTRAINT_APP_NOT_IDLE) != 0) { pw.print(" APP_NOT_IDLE"); } Loading tests/JobSchedulerTestApp/res/layout/activity_main.xml +8 −0 Original line number Diff line number Diff line Loading @@ -73,10 +73,18 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <RadioButton android:id="@+id/checkbox_none" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/none"/> <RadioButton android:id="@+id/checkbox_any" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/any"/> <RadioButton android:id="@+id/checkbox_metered" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/metered"/> <RadioButton android:id="@+id/checkbox_unmetered" android:layout_width="wrap_content" android:layout_height="wrap_content" Loading tests/JobSchedulerTestApp/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -30,7 +30,9 @@ limitations under the License. <string name="persisted_caption">Persisted:</string> <string name="constraints">Constraints</string> <string name="connectivity">Connectivity:</string> <string name="none">None</string> <string name="any">Any</string> <string name="metered">Metered</string> <string name="unmetered">WiFi</string> <string name="timing">Timing:</string> <string name="delay">Delay:</string> Loading tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ public class MainActivity extends Activity { mDeadlineEditText = findViewById(R.id.deadline_time); mWiFiConnectivityRadioButton = findViewById(R.id.checkbox_unmetered); mAnyConnectivityRadioButton = findViewById(R.id.checkbox_any); mCellConnectivityRadioButton = findViewById(R.id.checkbox_metered); mRequiresChargingCheckBox = findViewById(R.id.checkbox_charging); mRequiresIdleCheckbox = findViewById(R.id.checkbox_idle); mIsPersistedCheckbox = findViewById(R.id.checkbox_persisted); Loading @@ -85,6 +86,7 @@ public class MainActivity extends Activity { EditText mDeadlineEditText; RadioButton mWiFiConnectivityRadioButton; RadioButton mAnyConnectivityRadioButton; RadioButton mCellConnectivityRadioButton; CheckBox mRequiresChargingCheckBox; CheckBox mRequiresIdleCheckbox; CheckBox mIsPersistedCheckbox; Loading Loading @@ -141,9 +143,12 @@ public class MainActivity extends Activity { builder.setOverrideDeadline(Long.parseLong(deadline) * 1000); } boolean requiresUnmetered = mWiFiConnectivityRadioButton.isChecked(); boolean requiresMetered = mCellConnectivityRadioButton.isChecked(); boolean requiresAnyConnectivity = mAnyConnectivityRadioButton.isChecked(); if (requiresUnmetered) { builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED); } else if (requiresMetered) { builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_METERED); } else if (requiresAnyConnectivity) { builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY); } Loading tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java +2 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,8 @@ public class TestJobService extends JobService { @Override public boolean onStartJob(JobParameters params) { Log.i(TAG, "on start job: " + params.getJobId()); Log.i(TAG, "on start job: " + params.getJobId() + " deadline?=" + params.isOverrideDeadlineExpired()); currentId++; jobParamsMap.put(currentId, params); final int currId = this.currentId; Loading Loading
services/core/java/com/android/server/job/controllers/JobStatus.java +5 −1 Original line number Diff line number Diff line Loading @@ -698,7 +698,8 @@ public final class JobStatus { static final int CONSTRAINTS_OF_INTEREST = CONSTRAINT_CHARGING | CONSTRAINT_BATTERY_NOT_LOW | CONSTRAINT_STORAGE_NOT_LOW | CONSTRAINT_TIMING_DELAY | CONSTRAINT_CONNECTIVITY | CONSTRAINT_UNMETERED | CONSTRAINT_NOT_ROAMING | CONSTRAINT_CONNECTIVITY | CONSTRAINT_UNMETERED | CONSTRAINT_NOT_ROAMING | CONSTRAINT_METERED | CONSTRAINT_IDLE | CONSTRAINT_CONTENT_TRIGGER; // Soft override covers all non-"functional" constraints Loading Loading @@ -865,6 +866,9 @@ public final class JobStatus { if ((constraints&CONSTRAINT_NOT_ROAMING) != 0) { pw.print(" NOT_ROAMING"); } if ((constraints&CONSTRAINT_METERED) != 0) { pw.print(" METERED"); } if ((constraints&CONSTRAINT_APP_NOT_IDLE) != 0) { pw.print(" APP_NOT_IDLE"); } Loading
tests/JobSchedulerTestApp/res/layout/activity_main.xml +8 −0 Original line number Diff line number Diff line Loading @@ -73,10 +73,18 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <RadioButton android:id="@+id/checkbox_none" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/none"/> <RadioButton android:id="@+id/checkbox_any" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/any"/> <RadioButton android:id="@+id/checkbox_metered" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/metered"/> <RadioButton android:id="@+id/checkbox_unmetered" android:layout_width="wrap_content" android:layout_height="wrap_content" Loading
tests/JobSchedulerTestApp/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -30,7 +30,9 @@ limitations under the License. <string name="persisted_caption">Persisted:</string> <string name="constraints">Constraints</string> <string name="connectivity">Connectivity:</string> <string name="none">None</string> <string name="any">Any</string> <string name="metered">Metered</string> <string name="unmetered">WiFi</string> <string name="timing">Timing:</string> <string name="delay">Delay:</string> Loading
tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ public class MainActivity extends Activity { mDeadlineEditText = findViewById(R.id.deadline_time); mWiFiConnectivityRadioButton = findViewById(R.id.checkbox_unmetered); mAnyConnectivityRadioButton = findViewById(R.id.checkbox_any); mCellConnectivityRadioButton = findViewById(R.id.checkbox_metered); mRequiresChargingCheckBox = findViewById(R.id.checkbox_charging); mRequiresIdleCheckbox = findViewById(R.id.checkbox_idle); mIsPersistedCheckbox = findViewById(R.id.checkbox_persisted); Loading @@ -85,6 +86,7 @@ public class MainActivity extends Activity { EditText mDeadlineEditText; RadioButton mWiFiConnectivityRadioButton; RadioButton mAnyConnectivityRadioButton; RadioButton mCellConnectivityRadioButton; CheckBox mRequiresChargingCheckBox; CheckBox mRequiresIdleCheckbox; CheckBox mIsPersistedCheckbox; Loading Loading @@ -141,9 +143,12 @@ public class MainActivity extends Activity { builder.setOverrideDeadline(Long.parseLong(deadline) * 1000); } boolean requiresUnmetered = mWiFiConnectivityRadioButton.isChecked(); boolean requiresMetered = mCellConnectivityRadioButton.isChecked(); boolean requiresAnyConnectivity = mAnyConnectivityRadioButton.isChecked(); if (requiresUnmetered) { builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED); } else if (requiresMetered) { builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_METERED); } else if (requiresAnyConnectivity) { builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY); } Loading
tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java +2 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,8 @@ public class TestJobService extends JobService { @Override public boolean onStartJob(JobParameters params) { Log.i(TAG, "on start job: " + params.getJobId()); Log.i(TAG, "on start job: " + params.getJobId() + " deadline?=" + params.isOverrideDeadlineExpired()); currentId++; jobParamsMap.put(currentId, params); final int currId = this.currentId; Loading