Merge "[Rlog13] Add flag to inhibit uploading"

main
Kurt Partridge 2012-12-20 13:13:20 -08:00 committed by Android (Google) Code Review
commit 11bc86adcb
1 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,7 @@ import android.os.Bundle;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.define.ProductionFlag;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
@ -45,6 +46,9 @@ import java.net.URL;
public final class UploaderService extends IntentService { public final class UploaderService extends IntentService {
private static final String TAG = UploaderService.class.getSimpleName(); private static final String TAG = UploaderService.class.getSimpleName();
// Set IS_INHIBITING_AUTO_UPLOAD to true for local testing
private static final boolean IS_INHIBITING_AUTO_UPLOAD =
false && ProductionFlag.IS_EXPERIMENTAL_DEBUG; // Force false in production
public static final long RUN_INTERVAL = AlarmManager.INTERVAL_HOUR; public static final long RUN_INTERVAL = AlarmManager.INTERVAL_HOUR;
private static final String EXTRA_UPLOAD_UNCONDITIONALLY = UploaderService.class.getName() private static final String EXTRA_UPLOAD_UNCONDITIONALLY = UploaderService.class.getName()
+ ".extra.UPLOAD_UNCONDITIONALLY"; + ".extra.UPLOAD_UNCONDITIONALLY";
@ -116,7 +120,8 @@ public final class UploaderService extends IntentService {
} }
private void doUpload(final boolean isUploadingUnconditionally) { private void doUpload(final boolean isUploadingUnconditionally) {
if (!isUploadingUnconditionally && (!isExternallyPowered() || !hasWifiConnection())) { if (!isUploadingUnconditionally && (!isExternallyPowered() || !hasWifiConnection()
|| IS_INHIBITING_AUTO_UPLOAD)) {
return; return;
} }
if (mFilesDir == null) { if (mFilesDir == null) {