Remove wakelock
This commit is contained in:
parent
fc524fb4db
commit
924a33ccb5
2 changed files with 1 additions and 29 deletions
|
@ -7,7 +7,6 @@
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
tools:ignore="ScopedStorage" />
|
tools:ignore="ScopedStorage" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
|
|
@ -9,8 +9,6 @@ import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.PowerManager;
|
|
||||||
import android.os.PowerManager.WakeLock;
|
|
||||||
import android.os.StatFs;
|
import android.os.StatFs;
|
||||||
import android.widget.EditText;
|
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 static final int DIALOG_SHOW_API23_HELP_ID = 17;
|
||||||
private final Set<Integer> dialogIds = new HashSet<>();
|
private final Set<Integer> dialogIds = new HashSet<>();
|
||||||
private BRouterView mBRouterView;
|
private BRouterView mBRouterView;
|
||||||
private PowerManager mPowerManager;
|
|
||||||
private WakeLock mWakeLock;
|
|
||||||
private String[] availableProfiles;
|
private String[] availableProfiles;
|
||||||
private String selectedProfile = null;
|
private String selectedProfile = null;
|
||||||
private List<File> availableBasedirs;
|
private List<File> availableBasedirs;
|
||||||
|
@ -75,12 +71,6 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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);
|
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
|
||||||
int memoryClass = am.getMemoryClass();
|
int memoryClass = am.getMemoryClass();
|
||||||
|
|
||||||
|
@ -441,29 +431,12 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat
|
||||||
showNewDialog(DIALOG_SHOWRESULT_ID);
|
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
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.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();
|
mBRouterView.stopRouting();
|
||||||
|
|
||||||
// and release our wake-lock
|
|
||||||
mWakeLock.release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<File> getStorageDirectories() {
|
public ArrayList<File> getStorageDirectories() {
|
||||||
|
|
Loading…
Reference in a new issue