Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88f46667 authored by Kurt Partridge's avatar Kurt Partridge
Browse files

[FileEncap4] Simplify logic

Change-Id: Ibb8660d12812b867856259d3e5c04a31e281027d
parent 7f7850d2
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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;
        }