am 1bc20700: Merge "[FileEncap4] Simplify logic"
* commit '1bc20700d594af28bb87575df4279b0bed624c52': [FileEncap4] Simplify logicmain
commit
be4e180fab
|
@ -110,6 +110,10 @@ public final class UploaderService extends IntentService {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean isConvenientToUpload() {
|
||||
return isExternallyPowered() && hasWifiConnection();
|
||||
}
|
||||
|
||||
private boolean isExternallyPowered() {
|
||||
final Intent intent = registerReceiver(null, new IntentFilter(
|
||||
Intent.ACTION_BATTERY_CHANGED));
|
||||
|
@ -126,10 +130,7 @@ public final class UploaderService extends IntentService {
|
|||
}
|
||||
|
||||
private void doUpload(final boolean isUploadingUnconditionally) {
|
||||
if (!isUploadingUnconditionally && (!isExternallyPowered() || !hasWifiConnection()
|
||||
|| IS_INHIBITING_AUTO_UPLOAD)) {
|
||||
return;
|
||||
}
|
||||
if (!(isUploadingUnconditionally || isConvenientToUpload())) return;
|
||||
if (mFilesDir == null) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue