From 924a33ccb5661c49facf8feed0aa6a4385d23e2b Mon Sep 17 00:00:00 2001 From: Manuel Fuhr Date: Sat, 7 May 2022 07:50:54 +0200 Subject: [PATCH] Remove wakelock --- .../src/main/AndroidManifest.xml | 1 - .../btools/routingapp/BRouterActivity.java | 29 +------------------ 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/brouter-routing-app/src/main/AndroidManifest.xml b/brouter-routing-app/src/main/AndroidManifest.xml index 76f6b51..3c8f22e 100644 --- a/brouter-routing-app/src/main/AndroidManifest.xml +++ b/brouter-routing-app/src/main/AndroidManifest.xml @@ -7,7 +7,6 @@ - diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java index 7063d71..ac20455 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java @@ -9,8 +9,6 @@ import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Environment; -import android.os.PowerManager; -import android.os.PowerManager.WakeLock; import android.os.StatFs; import android.widget.EditText; @@ -49,8 +47,6 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat private static final int DIALOG_SHOW_API23_HELP_ID = 17; private final Set dialogIds = new HashSet<>(); private BRouterView mBRouterView; - private PowerManager mPowerManager; - private WakeLock mWakeLock; private String[] availableProfiles; private String selectedProfile = null; private List availableBasedirs; @@ -75,12 +71,6 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Get an instance of the PowerManager - mPowerManager = (PowerManager) getSystemService(POWER_SERVICE); - - // Create a bright wake lock - mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass().getName()); - ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE); int memoryClass = am.getMemoryClass(); @@ -441,29 +431,12 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat showNewDialog(DIALOG_SHOWRESULT_ID); } - @Override - protected void onResume() { - super.onResume(); - /* - * when the activity is resumed, we acquire a wake-lock so that the screen - * stays on, since the user will likely not be fiddling with the screen or - * buttons. - */ - mWakeLock.acquire(); - } - @Override protected void onPause() { super.onPause(); - /* - * When the activity is paused, we make sure to stop the router - */ - // Stop the simulation + // When the activity is paused, we make sure to stop the router mBRouterView.stopRouting(); - - // and release our wake-lock - mWakeLock.release(); } public ArrayList getStorageDirectories() {