Add HDR state to app data in shortcut trampoline

This commit is contained in:
Cameron Gutman
2019-07-16 22:57:30 -07:00
parent e27129fc48
commit 0ac83e1cf7
4 changed files with 41 additions and 48 deletions

View File

@@ -23,16 +23,12 @@ import java.util.UUID;
public class ShortcutTrampoline extends Activity {
private String uuidString;
private String appIdString;
private String appNameString;
private NvApp app;
private ArrayList<Intent> intentStack = new ArrayList<>();
private ComputerDetails computer;
private SpinnerDialog blockingLoadSpinner;
public final static String APP_NAME_EXTRA = "AppName";
public final static String APP_ID_EXTRA = "AppId";
private ComputerManagerService.ComputerManagerBinder managerBinder;
private final ServiceConnection serviceConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder binder) {
@@ -103,10 +99,9 @@ public class ShortcutTrampoline extends Activity {
if (details.state == ComputerDetails.State.ONLINE && details.pairState == PairingManager.PairState.PAIRED) {
// Launch game if provided app ID, otherwise launch app view
if (appIdString != null && appIdString.length() > 0) {
if (details.runningGameId == 0 || details.runningGameId == Integer.parseInt(appIdString)) {
intentStack.add(ServerHelper.createStartIntent(ShortcutTrampoline.this,
new NvApp(appNameString, Integer.parseInt(appIdString), false), details, managerBinder));
if (app != null) {
if (details.runningGameId == 0 || details.runningGameId == app.getAppId()) {
intentStack.add(ServerHelper.createStartIntent(ShortcutTrampoline.this, app, details, managerBinder));
// Close this activity
finish();
@@ -116,8 +111,7 @@ public class ShortcutTrampoline extends Activity {
} else {
// Create the start intent immediately, so we can safely unbind the managerBinder
// below before we return.
final Intent startIntent = ServerHelper.createStartIntent(ShortcutTrampoline.this,
new NvApp(appNameString, Integer.parseInt(appIdString), false), details, managerBinder);
final Intent startIntent = ServerHelper.createStartIntent(ShortcutTrampoline.this, app, details, managerBinder);
UiHelper.displayQuitConfirmationDialog(ShortcutTrampoline.this, new Runnable() {
@Override
@@ -200,7 +194,7 @@ public class ShortcutTrampoline extends Activity {
}
};
protected boolean validateInput() {
protected boolean validateInput(String uuidString, String appIdString) {
// Validate UUID
if (uuidString == null) {
Dialog.displayDialog(ShortcutTrampoline.this,
@@ -242,13 +236,16 @@ public class ShortcutTrampoline extends Activity {
UiHelper.notifyNewRootView(this);
String appIdString = getIntent().getStringExtra(Game.EXTRA_APP_ID);
uuidString = getIntent().getStringExtra(AppView.UUID_EXTRA);
appIdString = getIntent().getStringExtra(APP_ID_EXTRA);
// Optional - may be null
appNameString = getIntent().getStringExtra(APP_NAME_EXTRA);
if (validateInput(uuidString, appIdString)) {
if (appIdString != null && !appIdString.isEmpty()) {
app = new NvApp(getIntent().getStringExtra(Game.EXTRA_APP_NAME),
Integer.parseInt(appIdString),
getIntent().getBooleanExtra(Game.EXTRA_APP_HDR, false));
}
if (validateInput()) {
// Bind to the computer manager service
bindService(new Intent(this, ComputerManagerService.class), serviceConnection,
Service.BIND_AUTO_CREATE);