Fix race condition on AppView activity startup

This commit is contained in:
Cameron Gutman 2018-10-30 17:52:46 -07:00
parent 7126055ad6
commit a7e65b47f9

View File

@ -81,11 +81,8 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
// Wait for the binder to be ready
localBinder.waitForReady();
// Now make the binder visible
managerBinder = localBinder;
// Get the computer object
computer = managerBinder.getComputer(UUID.fromString(uuidString));
computer = localBinder.getComputer(UUID.fromString(uuidString));
if (computer == null) {
finish();
return;
@ -95,13 +92,18 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
appGridAdapter = new AppGridAdapter(AppView.this,
PreferenceConfiguration.readPreferences(AppView.this).listMode,
PreferenceConfiguration.readPreferences(AppView.this).smallIconMode,
computer, managerBinder.getUniqueId());
computer, localBinder.getUniqueId());
} catch (Exception e) {
e.printStackTrace();
finish();
return;
}
// Now make the binder visible. We must do this after appGridAdapter
// is set to prevent us from reaching updateUiWithServerinfo() and
// touching the appGridAdapter prior to initialization.
managerBinder = localBinder;
// Load the app grid with cached data (if possible).
// This must be done _before_ startComputerUpdates()
// so the initial serverinfo response can update the running