From 6d71d238e2e072802cb36a011a52f38f3efd9c40 Mon Sep 17 00:00:00 2001 From: Kurt Partridge Date: Wed, 27 Feb 2013 17:27:12 -0800 Subject: [FileEncap18] Clean up uploading scheduling - Move scheduling logic from ResearchLogger.java to UploaderService.java - Switch to a one-shot timer. Previously the uploader was scheduled on an inexact repeating schedule. It's better to reschedule the next upload after the current one is finished to reduce the chances of multiple uploads happening at the same time. - Avoid double-execution - Previously a scheduled upload might run right after an explicit one if they occured at the same time. This change reduces the chances of this. - Some method extraction and naming Change-Id: I9efda11be77d334c7f61bd40a36d65f0421ebde4 --- java/src/com/android/inputmethod/research/BootBroadcastReceiver.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'java/src/com/android/inputmethod/research/BootBroadcastReceiver.java') diff --git a/java/src/com/android/inputmethod/research/BootBroadcastReceiver.java b/java/src/com/android/inputmethod/research/BootBroadcastReceiver.java index c5f095919..4f86526a7 100644 --- a/java/src/com/android/inputmethod/research/BootBroadcastReceiver.java +++ b/java/src/com/android/inputmethod/research/BootBroadcastReceiver.java @@ -25,9 +25,10 @@ import android.content.Intent; */ public final class BootBroadcastReceiver extends BroadcastReceiver { @Override - public void onReceive(Context context, Intent intent) { + public void onReceive(final Context context, final Intent intent) { if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { - ResearchLogger.scheduleUploadingService(context); + UploaderService.cancelAndRescheduleUploadingService(context, + true /* needsRescheduling */); } } } -- cgit v1.2.3-83-g751a