Reordered TermuxService.actionAcquireWakeLock()

This commit is contained in:
agnostic-apollo
2021-03-19 18:44:39 +05:00
parent 5d6a98452a
commit 7d53a147d8

View File

@@ -212,7 +212,11 @@ public final class TermuxService extends Service {
/** Process action to acquire Power and Wi-Fi WakeLocks. */
@SuppressLint({"WakelockTimeout", "BatteryLife"})
private void actionAcquireWakeLock() {
if (mWakeLock == null) {
if (mWakeLock != null) {
Logger.logDebug(LOG_TAG, "Ignoring acquiring WakeLocks since they are already held");
return;
}
Logger.logDebug(LOG_TAG, "Acquiring WakeLocks");
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
@@ -241,9 +245,7 @@ public final class TermuxService extends Service {
updateNotification();
Logger.logDebug(LOG_TAG, "WakeLocks acquired successfully");
} else {
Logger.logDebug(LOG_TAG, "Ignoring acquiring WakeLocks since they are already held");
}
}
/** Process action to release Power and Wi-Fi WakeLocks. */