Compare commits

..
6 Commits
9 changed files with 34 additions and 26 deletions

No files matched your search

+2 -2
View File
@@ -8,8 +8,8 @@ android {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
versionName "6.1.1" versionName "6.1.3"
versionCode = 183 versionCode = 185
} }
flavorDimensions "root" flavorDimensions "root"
+7 -2
View File
@@ -1,5 +1,6 @@
package com.limelight; package com.limelight;
import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.util.List; import java.util.List;
@@ -43,6 +44,8 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import org.xmlpull.v1.XmlPullParserException;
public class AppView extends Activity implements AdapterFragmentCallbacks { public class AppView extends Activity implements AdapterFragmentCallbacks {
private AppGridAdapter appGridAdapter; private AppGridAdapter appGridAdapter;
private String uuidString; private String uuidString;
@@ -214,7 +217,9 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
blockingLoadSpinner.dismiss(); blockingLoadSpinner.dismiss();
blockingLoadSpinner = null; blockingLoadSpinner = null;
} }
} catch (Exception ignored) {} } catch (XmlPullParserException | IOException e) {
e.printStackTrace();
}
} }
}); });
@@ -278,7 +283,7 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
List<NvApp> applist = NvHTTP.getAppListByReader(new StringReader(lastRawApplist)); List<NvApp> applist = NvHTTP.getAppListByReader(new StringReader(lastRawApplist));
updateUiWithAppList(applist); updateUiWithAppList(applist);
LimeLog.info("Loaded applist from cache"); LimeLog.info("Loaded applist from cache");
} catch (Exception e) { } catch (IOException | XmlPullParserException e) {
if (lastRawApplist != null) { if (lastRawApplist != null) {
LimeLog.warning("Saved applist corrupted: "+lastRawApplist); LimeLog.warning("Saved applist corrupted: "+lastRawApplist);
e.printStackTrace(); e.printStackTrace();
+5 -2
View File
@@ -53,6 +53,8 @@ import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import org.xmlpull.v1.XmlPullParserException;
import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10; import javax.microedition.khronos.opengles.GL10;
@@ -420,7 +422,7 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
message = getResources().getString(R.string.error_unknown_host); message = getResources().getString(R.string.error_unknown_host);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
message = getResources().getString(R.string.error_404); message = getResources().getString(R.string.error_404);
} catch (Exception e) { } catch (XmlPullParserException | IOException e) {
e.printStackTrace(); e.printStackTrace();
message = e.getMessage(); message = e.getMessage();
} }
@@ -521,8 +523,9 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
message = getResources().getString(R.string.error_unknown_host); message = getResources().getString(R.string.error_unknown_host);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
message = getResources().getString(R.string.error_404); message = getResources().getString(R.string.error_404);
} catch (Exception e) { } catch (XmlPullParserException | IOException e) {
message = e.getMessage(); message = e.getMessage();
e.printStackTrace();
} }
final String toastMessage = message; final String toastMessage = message;
@@ -154,7 +154,7 @@ public class AndroidCryptoProvider implements LimelightCryptoProvider {
} catch (Exception e) { } catch (Exception e) {
// Nothing should go wrong here // Nothing should go wrong here
e.printStackTrace(); e.printStackTrace();
return false; throw new RuntimeException(e);
} }
LimeLog.info("Generated a new key pair"); LimeLog.info("Generated a new key pair");
@@ -167,7 +167,6 @@ public class VirtualController {
} }
void sendControllerInputContext() { void sendControllerInputContext() {
try {
_DBG("INPUT_MAP + " + inputContext.inputMap); _DBG("INPUT_MAP + " + inputContext.inputMap);
_DBG("LEFT_TRIGGER " + inputContext.leftTrigger); _DBG("LEFT_TRIGGER " + inputContext.leftTrigger);
_DBG("RIGHT_TRIGGER " + inputContext.rightTrigger); _DBG("RIGHT_TRIGGER " + inputContext.rightTrigger);
@@ -185,8 +184,5 @@ public class VirtualController {
inputContext.rightStickY inputContext.rightStickY
); );
} }
} catch (Exception e) {
e.printStackTrace();
}
} }
} }
@@ -166,7 +166,6 @@ public abstract class VirtualControllerElement extends View {
} }
protected void showConfigurationDialog() { protected void showConfigurationDialog() {
try {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getContext()); AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getContext());
alertBuilder.setTitle("Configuration"); alertBuilder.setTitle("Configuration");
@@ -215,9 +214,6 @@ public abstract class VirtualControllerElement extends View {
AlertDialog alert = alertBuilder.create(); AlertDialog alert = alertBuilder.create();
// show menu // show menu
alert.show(); alert.show();
} catch (Exception e) {
e.printStackTrace();
}
} }
@Override @Override
@@ -360,13 +360,14 @@ public class ComputerManagerService extends Service {
// Since we're on the same network, we can use STUN to find // Since we're on the same network, we can use STUN to find
// our WAN address, which is also very likely the WAN address // our WAN address, which is also very likely the WAN address
// of the PC. We can use this later to connect remotely. // of the PC. We can use this later to connect remotely.
fakeDetails.remoteAddress = NvConnection.findExternalAddressForMdns(); fakeDetails.remoteAddress = NvConnection.findExternalAddressForMdns("stun.moonlight-stream.org", 3478);
} }
// Block while we try to fill the details // Block while we try to fill the details
try { try {
runPoll(fakeDetails, true, 0); // We cannot use runPoll() here because it will attempt to persist the state of the machine
if (fakeDetails.state == ComputerDetails.State.ONLINE) { // in the database, which would be bad because we don't have our pinned cert loaded yet.
if (pollComputer(fakeDetails)) {
// See if we have record of this PC to pull its pinned cert // See if we have record of this PC to pull its pinned cert
synchronized (pollingTuples) { synchronized (pollingTuples) {
for (PollingTuple tuple : pollingTuples) { for (PollingTuple tuple : pollingTuples) {
@@ -377,11 +378,10 @@ public class ComputerManagerService extends Service {
} }
} }
if (fakeDetails.serverCert != null) { // Poll again, possibly with the pinned cert, to get accurate pairing information.
// Poll again with the pinned cert to get accurate pairing information // This will insert the host into the database too.
runPoll(fakeDetails, true, 0); runPoll(fakeDetails, true, 0);
} }
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
return false; return false;
} }
@@ -457,8 +457,12 @@ public class ComputerManagerService extends Service {
ComputerDetails newDetails = http.getComputerDetails(); ComputerDetails newDetails = http.getComputerDetails();
// Check if this is the PC we expected // Check if this is the PC we expected
if (details.uuid != null && newDetails.uuid != null && if (newDetails.uuid == null) {
!details.uuid.equals(newDetails.uuid)) { LimeLog.severe("Polling returned no UUID!");
return null;
}
// details.uuid can be null on initial PC add
else if (details.uuid != null && !details.uuid.equals(newDetails.uuid)) {
// We got the wrong PC! // We got the wrong PC!
LimeLog.info("Polling returned the wrong PC!"); LimeLog.info("Polling returned the wrong PC!");
return null; return null;
@@ -468,7 +472,7 @@ public class ComputerManagerService extends Service {
newDetails.activeAddress = address; newDetails.activeAddress = address;
return newDetails; return newDetails;
} catch (Exception e) { } catch (XmlPullParserException | IOException e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }
@@ -13,7 +13,10 @@ import com.limelight.nvstream.http.GfeHttpResponseException;
import com.limelight.nvstream.http.NvApp; import com.limelight.nvstream.http.NvApp;
import com.limelight.nvstream.http.NvHTTP; import com.limelight.nvstream.http.NvHTTP;
import org.xmlpull.v1.XmlPullParserException;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateEncodingException;
@@ -84,8 +87,9 @@ public class ServerHelper {
message = parent.getResources().getString(R.string.error_unknown_host); message = parent.getResources().getString(R.string.error_unknown_host);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
message = parent.getResources().getString(R.string.error_404); message = parent.getResources().getString(R.string.error_404);
} catch (Exception e) { } catch (IOException | XmlPullParserException e) {
message = e.getMessage(); message = e.getMessage();
e.printStackTrace();
} finally { } finally {
if (onComplete != null) { if (onComplete != null) {
onComplete.run(); onComplete.run();