From 300d444f71474f8dc24c10e8df1520be1fe59ff7 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 23 Nov 2017 11:34:22 -0800 Subject: [PATCH] Ensure inForeground is set before CMS binding can complete --- app/src/main/java/com/limelight/AppView.java | 4 ++++ app/src/main/java/com/limelight/PcView.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/com/limelight/AppView.java b/app/src/main/java/com/limelight/AppView.java index 42f0362b..f08cdd25 100644 --- a/app/src/main/java/com/limelight/AppView.java +++ b/app/src/main/java/com/limelight/AppView.java @@ -235,6 +235,10 @@ public class AppView extends Activity implements AdapterFragmentCallbacks { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // Assume we're in the foreground when created to avoid a race + // between binding to CMS and onResume() + inForeground = true; + shortcutHelper = new ShortcutHelper(this); UiHelper.setLocale(this); diff --git a/app/src/main/java/com/limelight/PcView.java b/app/src/main/java/com/limelight/PcView.java index 305c7c9a..0efff0bc 100644 --- a/app/src/main/java/com/limelight/PcView.java +++ b/app/src/main/java/com/limelight/PcView.java @@ -165,6 +165,10 @@ public class PcView extends Activity implements AdapterFragmentCallbacks { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // Assume we're in the foreground when created to avoid a race + // between binding to CMS and onResume() + inForeground = true; + // Create a GLSurfaceView to fetch GLRenderer unless we have // a cached result already. final GlPreferences glPrefs = GlPreferences.readPreferences(this);