summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christopher Tate <ctate@google.com> 2014-10-20 16:29:20 -0700
committer Christopher Tate <ctate@google.com> 2014-10-22 11:16:33 -0700
commitaad67a3e48ad1dc9a917e036f98021c6e4d1f748 (patch)
tree3776076d62ebe7b37e27d62da944440af496ea90
parent04e6827ace936e0cbb666d8ef94635b73672aa41 (diff)
Don't cancel scheduled jobs when packages are updated
Only cancel the app's jobs when it is fully uninstalled, not when it's being updated to a newer version. Bug 18059252 Change-Id: I6cf617013ec8e9e9abd90e366d7a6ab0711790de
-rw-r--r--services/core/java/com/android/server/job/JobSchedulerService.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java
index c6d2db2ccf6e..83d6986a410f 100644
--- a/services/core/java/com/android/server/job/JobSchedulerService.java
+++ b/services/core/java/com/android/server/job/JobSchedulerService.java
@@ -137,11 +137,15 @@ public class JobSchedulerService extends com.android.server.SystemService
public void onReceive(Context context, Intent intent) {
Slog.d(TAG, "Receieved: " + intent.getAction());
if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
- int uidRemoved = intent.getIntExtra(Intent.EXTRA_UID, -1);
- if (DEBUG) {
- Slog.d(TAG, "Removing jobs for uid: " + uidRemoved);
+ // If this is an outright uninstall rather than the first half of an
+ // app update sequence, cancel the jobs associated with the app.
+ 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())) {
final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
if (DEBUG) {