diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index b7ee510c..3560eedf 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -127,6 +127,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, private int suppressPipRefCount = 0; private String pcName; private String appName; + private NvApp app; private float desiredRefreshRate; private InputCaptureProvider inputCaptureProvider; @@ -146,8 +147,6 @@ public class Game extends Activity implements SurfaceHolder.Callback, private int requestedNotificationOverlayVisibility = View.GONE; private TextView performanceOverlayView; - private ShortcutHelper shortcutHelper; - private MediaCodecDecoderRenderer decoderRenderer; private boolean reportedCrash; @@ -318,10 +317,11 @@ public class Game extends Activity implements SurfaceHolder.Callback, int httpsPort = Game.this.getIntent().getIntExtra(EXTRA_HTTPS_PORT, 0); // 0 is treated as unknown int appId = Game.this.getIntent().getIntExtra(EXTRA_APP_ID, StreamConfiguration.INVALID_APP_ID); String uniqueId = Game.this.getIntent().getStringExtra(EXTRA_UNIQUEID); - String uuid = Game.this.getIntent().getStringExtra(EXTRA_PC_UUID); boolean appSupportsHdr = Game.this.getIntent().getBooleanExtra(EXTRA_APP_HDR, false); byte[] derCertData = Game.this.getIntent().getByteArrayExtra(EXTRA_SERVER_CERT); + app = new NvApp(appName != null ? appName : "app", appId, appSupportsHdr); + X509Certificate serverCert = null; try { if (derCertData != null) { @@ -337,17 +337,6 @@ public class Game extends Activity implements SurfaceHolder.Callback, return; } - // Report this shortcut being used - ComputerDetails computer = new ComputerDetails(); - computer.name = pcName; - computer.uuid = uuid; - shortcutHelper = new ShortcutHelper(this); - shortcutHelper.reportComputerShortcutUsed(computer); - if (appName != null) { - // This may be null if launched from the "Resume Session" PC context menu item - shortcutHelper.reportGameLaunched(computer, new NvApp(appName, appId, appSupportsHdr)); - } - // Initialize the MediaCodec helper before creating the decoder GlPreferences glPrefs = GlPreferences.readPreferences(this); MediaCodecHelper.initialize(this, glPrefs.glRenderer); @@ -479,7 +468,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, .setResolution(prefConfig.width, prefConfig.height) .setLaunchRefreshRate(prefConfig.fps) .setRefreshRate(chosenFrameRate) - .setApp(new NvApp(appName != null ? appName : "app", appId, appSupportsHdr)) + .setApp(app) .setBitrate(prefConfig.bitrate) .setEnableSops(prefConfig.enableSops) .enableLocalAudioPlayback(prefConfig.playHostAudio) @@ -2445,6 +2434,17 @@ public class Game extends Activity implements SurfaceHolder.Callback, hideSystemUi(1000); } }); + + // Report this shortcut being used (off the main thread to prevent ANRs) + ComputerDetails computer = new ComputerDetails(); + computer.name = pcName; + computer.uuid = Game.this.getIntent().getStringExtra(EXTRA_PC_UUID); + ShortcutHelper shortcutHelper = new ShortcutHelper(this); + shortcutHelper.reportComputerShortcutUsed(computer); + if (appName != null) { + // This may be null if launched from the "Resume Session" PC context menu item + shortcutHelper.reportGameLaunched(computer, app); + } } @Override diff --git a/app/src/main/java/com/limelight/PcView.java b/app/src/main/java/com/limelight/PcView.java index 3ca9cb2c..4ec6094f 100644 --- a/app/src/main/java/com/limelight/PcView.java +++ b/app/src/main/java/com/limelight/PcView.java @@ -260,6 +260,11 @@ public class PcView extends Activity implements AdapterFragmentCallbacks { updateComputer(details); } }); + + // Add a launcher shortcut for this PC (off the main thread to prevent ANRs) + if (details.pairState == PairState.PAIRED) { + shortcutHelper.createAppViewShortcutForOnlineHost(details); + } } } }); @@ -720,11 +725,6 @@ public class PcView extends Activity implements AdapterFragmentCallbacks { } } - // Add a launcher shortcut for this PC - if (details.pairState == PairState.PAIRED) { - shortcutHelper.createAppViewShortcutForOnlineHost(details); - } - if (existingEntry != null) { // Replace the information in the existing entry existingEntry.details = details;