mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Merge "[FileEncap4] Simplify logic"
This commit is contained in:
commit
1bc20700d5
@ -110,6 +110,10 @@ public final class UploaderService extends IntentService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isConvenientToUpload() {
|
||||||
|
return isExternallyPowered() && hasWifiConnection();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isExternallyPowered() {
|
private boolean isExternallyPowered() {
|
||||||
final Intent intent = registerReceiver(null, new IntentFilter(
|
final Intent intent = registerReceiver(null, new IntentFilter(
|
||||||
Intent.ACTION_BATTERY_CHANGED));
|
Intent.ACTION_BATTERY_CHANGED));
|
||||||
@ -126,10 +130,7 @@ public final class UploaderService extends IntentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void doUpload(final boolean isUploadingUnconditionally) {
|
private void doUpload(final boolean isUploadingUnconditionally) {
|
||||||
if (!isUploadingUnconditionally && (!isExternallyPowered() || !hasWifiConnection()
|
if (!(isUploadingUnconditionally || isConvenientToUpload())) return;
|
||||||
|| IS_INHIBITING_AUTO_UPLOAD)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mFilesDir == null) {
|
if (mFilesDir == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user