File tree Expand file tree Collapse file tree
android-interop-testing/app
java/io/grpc/android/integrationtest Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,11 +13,18 @@ android {
1313 versionName " 1.0"
1414 }
1515 buildTypes {
16+ debug {
17+ minifyEnabled true
18+ proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
19+ }
1620 release {
17- minifyEnabled false
21+ minifyEnabled true
1822 proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
1923 }
2024 }
25+ lintOptions {
26+ disable ' InvalidPackage' , ' HardcodedText'
27+ }
2128}
2229
2330protobuf {
Original file line number Diff line number Diff line change 1515#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
1616# public *;
1717#}
18+
19+ -dontwarn com.google.common.**
20+ -dontwarn okio.**
Original file line number Diff line number Diff line change 3434import com .google .protobuf .EmptyProtos ;
3535import com .google .protobuf .nano .MessageNano ;
3636
37+ import android .annotation .TargetApi ;
3738import android .net .SSLCertificateSocketFactory ;
3839import android .os .AsyncTask ;
40+ import android .os .Build ;
3941import android .support .annotation .Nullable ;
4042import android .util .Log ;
4143
4951import java .io .InputStream ;
5052import java .io .PrintWriter ;
5153import java .io .StringWriter ;
54+ import java .lang .RuntimeException ;
5255import java .lang .reflect .Method ;
5356import java .security .KeyStore ;
5457import java .security .cert .CertificateFactory ;
@@ -343,8 +346,13 @@ private SSLSocketFactory getSslSocketFactory(@Nullable InputStream testCa) throw
343346 return context .getSocketFactory ();
344347 }
345348
349+ @ TargetApi (14 )
346350 private SSLCertificateSocketFactory getSslCertificateSocketFactory (
347351 @ Nullable InputStream testCa , String androidSocketFatoryTls ) throws Exception {
352+ if (Build .VERSION .SDK_INT < Build .VERSION_CODES .ICE_CREAM_SANDWICH /* API level 14 */ ) {
353+ throw new RuntimeException (
354+ "android_socket_factory_tls doesn't work with API level less than 14." );
355+ }
348356 SSLCertificateSocketFactory factory = (SSLCertificateSocketFactory )
349357 SSLCertificateSocketFactory .getDefault (5000 /* Timeout in ms*/ );
350358 // Use HTTP/2.0
Original file line number Diff line number Diff line change @@ -58,13 +58,15 @@ public class TesterInstrumentation extends Instrumentation {
5858 public void onCreate (Bundle args ) {
5959 super .onCreate (args );
6060
61- testCase = args .getString ("test_case" , "empty_unary" );
62- host = args .getString ("server_host" , "" );
63- port = Integer .parseInt (args .getString ("server_port" , "8080" ));
64- serverHostOverride = args .getString ("server_host_override" , null );
65- useTls = Boolean .parseBoolean (args .getString ("use_tls" , "true" ));
66- useTestCa = Boolean .parseBoolean (args .getString ("use_test_ca" , "false" ));
67- androidSocketFactoryTls = args .getString ("android_socket_factory_tls" , null );
61+ testCase = args .getString ("test_case" ) != null ? args .getString ("test_case" ) : "empty_unary" ;
62+ host = args .getString ("server_host" );
63+ port = Integer .parseInt (args .getString ("server_port" ));
64+ serverHostOverride = args .getString ("server_host_override" );
65+ useTls = args .getString ("use_tls" ) != null ?
66+ Boolean .parseBoolean (args .getString ("use_tls" )) : true ;
67+ useTestCa = args .getString ("use_test_ca" ) != null ?
68+ Boolean .parseBoolean (args .getString ("use_test_ca" )) : false ;
69+ androidSocketFactoryTls = args .getString ("android_socket_factory_tls" );
6870
6971 InputStream testCa = null ;
7072 if (useTestCa ) {
Original file line number Diff line number Diff line change 7373 android : layout_height =" wrap_content"
7474 android : paddingTop =" 12dp"
7575 android : paddingBottom =" 12dp"
76- android : textSize =" 16dp "
76+ android : textSize =" 16sp "
7777 android : text =" Response:"
7878 />
7979
8989 android : id =" @+id/grpc_response_text"
9090 android : layout_width =" fill_parent"
9191 android : layout_height =" wrap_content"
92- android : textSize =" 16dp"
93- android : layout_weight =" 1.0"
92+ android : textSize =" 16sp"
9493 />
9594
9695 </ScrollView >
You can’t perform that action at this time.
0 commit comments