Merge "Don't cancel scheduled jobs when packages are updated" into lmp-mr1-dev

This commit is contained in:
Christopher Tate
2014-10-22 20:27:14 +00:00
committed by Android (Google) Code Review

View File

@@ -137,11 +137,15 @@ public class JobSchedulerService extends com.android.server.SystemService
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Slog.d(TAG, "Receieved: " + intent.getAction()); Slog.d(TAG, "Receieved: " + intent.getAction());
if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) { if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
int uidRemoved = intent.getIntExtra(Intent.EXTRA_UID, -1); // If this is an outright uninstall rather than the first half of an
if (DEBUG) { // app update sequence, cancel the jobs associated with the app.
Slog.d(TAG, "Removing jobs for uid: " + uidRemoved); if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
int uidRemoved = intent.getIntExtra(Intent.EXTRA_UID, -1);
if (DEBUG) {
Slog.d(TAG, "Removing jobs for uid: " + uidRemoved);
}
cancelJobsForUid(uidRemoved);
} }
cancelJobsForUid(uidRemoved);
} else if (Intent.ACTION_USER_REMOVED.equals(intent.getAction())) { } else if (Intent.ACTION_USER_REMOVED.equals(intent.getAction())) {
final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0); final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
if (DEBUG) { if (DEBUG) {