Remove wakelock

This commit is contained in:
Manuel Fuhr 2022-05-07 07:50:54 +02:00
parent fc524fb4db
commit 924a33ccb5
2 changed files with 1 additions and 29 deletions

View file

@ -7,7 +7,6 @@
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

View file

@ -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<Integer> dialogIds = new HashSet<>();
private BRouterView mBRouterView;
private PowerManager mPowerManager;
private WakeLock mWakeLock;
private String[] availableProfiles;
private String selectedProfile = null;
private List<File> 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<File> getStorageDirectories() {