Back out "[flipper] Fix remote adb connections"

Summary:
Original commit changeset: e53aa6ad10ac

This original change relies on adb reverse being run on emulators, which isn't happening. I didn't pick it up during tests because a previous build of flipper had done it.

Reverting the change. Will fix adb reverse and then re apply it later.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10241728

fbshipit-source-id: 521c18c5a0eb45f3af0fe510defd9116b9bb0626
This commit is contained in:
John Knox
2018-10-08 14:41:41 -07:00
committed by Facebook Github Bot
parent 287542c49a
commit b95a487748

View File

@@ -89,10 +89,7 @@ public final class AndroidFlipperClient {
}
static String getServerHost(Context context) {
if (isRunningOnStockEmulator() && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// adb reverse was added in lollipop, so before this
// hard code host ip address.
// This means it will only work on emulators, not physical devices.
if (isRunningOnStockEmulator()) {
return "10.0.2.2";
} else if (isRunningOnGenymotion()) {
// This is hand-wavy but works on but ipv4 and ipv6 genymotion
@@ -101,8 +98,7 @@ public final class AndroidFlipperClient {
final int ip = info.getIpAddress();
return String.format("%d.%d.%d.2", (ip & 0xff), (ip >> 8 & 0xff), (ip >> 16 & 0xff));
} else {
// Running on physical device or modern stock emulator.
// Flipper desktop will run `adb reverse` to forward the ports.
// Running on physical device. Flipper desktop will run `adb reverse tcp:8088 tcp:8088`
return "localhost";
}
}