diff options
author | 2013-02-27 17:27:12 -0800 | |
---|---|---|
committer | 2013-03-25 17:50:26 -0700 | |
commit | 6d71d238e2e072802cb36a011a52f38f3efd9c40 (patch) | |
tree | ed9160b8651586e356c4b6f206fdfde19542d4f7 /java/src/com/android/inputmethod/research/BootBroadcastReceiver.java | |
parent | fb658d6c531de8cfd55e4d36bffc9ccabc401f94 (diff) | |
download | latinime-6d71d238e2e072802cb36a011a52f38f3efd9c40.tar.gz latinime-6d71d238e2e072802cb36a011a52f38f3efd9c40.tar.xz latinime-6d71d238e2e072802cb36a011a52f38f3efd9c40.zip |
[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
Diffstat (limited to 'java/src/com/android/inputmethod/research/BootBroadcastReceiver.java')
-rw-r--r-- | java/src/com/android/inputmethod/research/BootBroadcastReceiver.java | 5 |
1 files changed, 3 insertions, 2 deletions
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 */); } } } |