Add the app name to the shortcut trampoline

This commit is contained in:
Cameron Gutman 2019-07-16 22:32:37 -07:00
parent d54fdc9f5f
commit e27129fc48
4 changed files with 11 additions and 6 deletions

View File

@ -276,10 +276,8 @@ public class Game extends Activity implements SurfaceHolder.Callback,
shortcutHelper = new ShortcutHelper(this); shortcutHelper = new ShortcutHelper(this);
shortcutHelper.reportComputerShortcutUsed(computer); shortcutHelper.reportComputerShortcutUsed(computer);
if (appName != null) { if (appName != null) {
NvApp app = new NvApp(); // This may be null if launched from the "Resume Session" PC context menu item
app.setAppId(appId); shortcutHelper.reportGameLaunched(computer, new NvApp(appName, appId, willStreamHdr));
app.setAppName(appName);
shortcutHelper.reportGameLaunched(computer, app);
} }
// Initialize the MediaCodec helper before creating the decoder // Initialize the MediaCodec helper before creating the decoder

View File

@ -24,11 +24,13 @@ import java.util.UUID;
public class ShortcutTrampoline extends Activity { public class ShortcutTrampoline extends Activity {
private String uuidString; private String uuidString;
private String appIdString; private String appIdString;
private String appNameString;
private ArrayList<Intent> intentStack = new ArrayList<>(); private ArrayList<Intent> intentStack = new ArrayList<>();
private ComputerDetails computer; private ComputerDetails computer;
private SpinnerDialog blockingLoadSpinner; private SpinnerDialog blockingLoadSpinner;
public final static String APP_NAME_EXTRA = "AppName";
public final static String APP_ID_EXTRA = "AppId"; public final static String APP_ID_EXTRA = "AppId";
private ComputerManagerService.ComputerManagerBinder managerBinder; private ComputerManagerService.ComputerManagerBinder managerBinder;
@ -104,7 +106,7 @@ public class ShortcutTrampoline extends Activity {
if (appIdString != null && appIdString.length() > 0) { if (appIdString != null && appIdString.length() > 0) {
if (details.runningGameId == 0 || details.runningGameId == Integer.parseInt(appIdString)) { if (details.runningGameId == 0 || details.runningGameId == Integer.parseInt(appIdString)) {
intentStack.add(ServerHelper.createStartIntent(ShortcutTrampoline.this, intentStack.add(ServerHelper.createStartIntent(ShortcutTrampoline.this,
new NvApp(null, Integer.parseInt(appIdString), false), details, managerBinder)); new NvApp(appNameString, Integer.parseInt(appIdString), false), details, managerBinder));
// Close this activity // Close this activity
finish(); finish();
@ -115,7 +117,7 @@ public class ShortcutTrampoline extends Activity {
// Create the start intent immediately, so we can safely unbind the managerBinder // Create the start intent immediately, so we can safely unbind the managerBinder
// below before we return. // below before we return.
final Intent startIntent = ServerHelper.createStartIntent(ShortcutTrampoline.this, final Intent startIntent = ServerHelper.createStartIntent(ShortcutTrampoline.this,
new NvApp(null, Integer.parseInt(appIdString), false), details, managerBinder); new NvApp(appNameString, Integer.parseInt(appIdString), false), details, managerBinder);
UiHelper.displayQuitConfirmationDialog(ShortcutTrampoline.this, new Runnable() { UiHelper.displayQuitConfirmationDialog(ShortcutTrampoline.this, new Runnable() {
@Override @Override
@ -243,6 +245,9 @@ public class ShortcutTrampoline extends Activity {
uuidString = getIntent().getStringExtra(AppView.UUID_EXTRA); uuidString = getIntent().getStringExtra(AppView.UUID_EXTRA);
appIdString = getIntent().getStringExtra(APP_ID_EXTRA); appIdString = getIntent().getStringExtra(APP_ID_EXTRA);
// Optional - may be null
appNameString = getIntent().getStringExtra(APP_NAME_EXTRA);
if (validateInput()) { if (validateInput()) {
// Bind to the computer manager service // Bind to the computer manager service
bindService(new Intent(this, ComputerManagerService.class), serviceConnection, bindService(new Intent(this, ComputerManagerService.class), serviceConnection,

View File

@ -153,6 +153,7 @@ public class ShortcutHelper {
i.putExtra(AppView.NAME_EXTRA, computer.name); i.putExtra(AppView.NAME_EXTRA, computer.name);
i.putExtra(AppView.UUID_EXTRA, computer.uuid); i.putExtra(AppView.UUID_EXTRA, computer.uuid);
i.putExtra(ShortcutTrampoline.APP_NAME_EXTRA, app.getAppName());
i.putExtra(ShortcutTrampoline.APP_ID_EXTRA, ""+app.getAppId()); i.putExtra(ShortcutTrampoline.APP_ID_EXTRA, ""+app.getAppId());
i.setAction(Intent.ACTION_DEFAULT); i.setAction(Intent.ACTION_DEFAULT);

View File

@ -130,6 +130,7 @@ public class TvChannelHelper {
i.putExtra(AppView.NAME_EXTRA, computer.name); i.putExtra(AppView.NAME_EXTRA, computer.name);
i.putExtra(AppView.UUID_EXTRA, computer.uuid); i.putExtra(AppView.UUID_EXTRA, computer.uuid);
i.putExtra(ShortcutTrampoline.APP_NAME_EXTRA, app.getAppName());
i.putExtra(ShortcutTrampoline.APP_ID_EXTRA, ""+app.getAppId()); i.putExtra(ShortcutTrampoline.APP_ID_EXTRA, ""+app.getAppId());
i.setAction(Intent.ACTION_DEFAULT); i.setAction(Intent.ACTION_DEFAULT);