Skip to content

Commit

Permalink
all: clean up code related to android api level less than 19
Browse files Browse the repository at this point in the history
  • Loading branch information
dapengzhang0 authored Jan 7, 2022
1 parent 6f22392 commit 3ad4d9b
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import android.util.Log;
import androidx.test.InstrumentationRegistry;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
Expand All @@ -30,7 +29,6 @@
import java.io.InputStream;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -46,12 +44,6 @@ public class InteropInstrumentationTest {
private boolean useTestCa;
private String testCase;

// Ensures Looper is initialized for tests running on API level 15. Otherwise instantiating an
// AsyncTask throws an exception.
@Rule
public ActivityTestRule<TesterActivity> activityRule =
new ActivityTestRule<TesterActivity>(TesterActivity.class);

@Before
public void setUp() throws Exception {
host = InstrumentationRegistry.getArguments().getString("server_host", "10.0.2.2");
Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
jmh project(':grpc-core')

signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
signature "net.sf.androidscents.signature:android-api-level-19:4.4.2_r4@signature"
}

javadoc {
Expand Down
2 changes: 1 addition & 1 deletion auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ dependencies {
testImplementation project(':grpc-testing'),
libraries.google_auth_oauth2_http
signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
signature "net.sf.androidscents.signature:android-api-level-19:4.4.2_r4@signature"
}
2 changes: 1 addition & 1 deletion context/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ dependencies {
exclude group: 'junit', module: 'junit'
}
signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
signature "net.sf.androidscents.signature:android-api-level-19:4.4.2_r4@signature"
}
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
jmh project(':grpc-testing')

signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
signature "net.sf.androidscents.signature:android-api-level-19:4.4.2_r4@signature"
}

javadoc {
Expand Down
9 changes: 1 addition & 8 deletions core/src/main/java/io/grpc/internal/ProxyDetectorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,7 @@ public ProxiedSocketAddress proxyFor(SocketAddress targetServerAddress) throws I

private ProxiedSocketAddress detectProxy(InetSocketAddress targetAddr) throws IOException {
URI uri;
String host;
try {
host = GrpcUtil.getHost(targetAddr);
} catch (Throwable t) {
// Workaround for Android API levels < 19 if getHostName causes a NetworkOnMainThreadException
log.log(Level.WARNING, "Failed to get host for proxy lookup, proceeding without proxy", t);
return null;
}
String host = GrpcUtil.getHost(targetAddr);
try {
uri =
new URI(
Expand Down
2 changes: 1 addition & 1 deletion okhttp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
project(':grpc-testing'),
project(':grpc-netty')
signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
signature "net.sf.androidscents.signature:android-api-level-19:4.4.2_r4@signature"
}

project.sourceSets {
Expand Down
2 changes: 1 addition & 1 deletion protobuf-lite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies {
testImplementation project(':grpc-core')

signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
signature "net.sf.androidscents.signature:android-api-level-19:4.4.2_r4@signature"
}

compileTestJava {
Expand Down
2 changes: 1 addition & 1 deletion stub/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
testImplementation libraries.truth,
project(':grpc-testing')
signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
signature "net.sf.androidscents.signature:android-api-level-19:4.4.2_r4@signature"
}

javadoc {
Expand Down

0 comments on commit 3ad4d9b

Please sign in to comment.