Fixed polling resuming in the background in some cases

This commit is contained in:
Cameron Gutman
2016-02-23 23:47:49 -05:00
parent 667ffd4dfd
commit 5142f978cf
2 changed files with 19 additions and 17 deletions

View File

@@ -50,6 +50,7 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
private String lastRawApplist;
private int lastRunningAppId;
private boolean suspendGridUpdates;
private boolean inForeground;
private final static int START_OR_RESUME_ID = 1;
private final static int QUIT_ID = 2;
@@ -108,7 +109,8 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
};
private void startComputerUpdates() {
if (managerBinder == null) {
// Don't start polling if we're not bound or in the foreground
if (managerBinder == null || !inForeground) {
return;
}
@@ -252,6 +254,7 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
protected void onResume() {
super.onResume();
inForeground = true;
startComputerUpdates();
}
@@ -259,6 +262,7 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
protected void onPause() {
super.onPause();
inForeground = false;
stopComputerUpdates();
}