Fix connection with old SDKs

Summary:
D20559197 inadvertantly broke support for old SDKs by properly handling an
exception that we previously ignored. However, this meant that Android versions
that don't support reverse-proxying will not fail to get registered although
they're otherwise supported.

Changelog: Fix connections on Android devices with older SDKs (19)

Reviewed By: jknoxville

Differential Revision: D20868923

fbshipit-source-id: 409fe20a0875dc26ecc971d33264a1145012d586
This commit is contained in:
Pascal Hartig
2020-04-06 06:34:33 -07:00
committed by Facebook GitHub Bot
parent 64e5fff9e1
commit 9ba990999c

View File

@@ -46,7 +46,15 @@ function createDevice(
? KaiOSDevice ? KaiOSDevice
: AndroidDevice)(device.id, type, name, adbClient); : AndroidDevice)(device.id, type, name, adbClient);
if (ports) { if (ports) {
await androidLikeDevice.reverse([ports.secure, ports.insecure]); await androidLikeDevice
.reverse([ports.secure, ports.insecure])
// We may not be able to establish a reverse connection, e.g. for old Android SDKs.
// This is *generally* fine, because we hard-code the ports on the SDK side.
.catch((e) => {
console.warn(
`Failed to reverse-proxy ports on device ${androidLikeDevice.serial}: ${e}`,
);
});
} }
resolve(androidLikeDevice); resolve(androidLikeDevice);
} catch (e) { } catch (e) {