Skip to content

Commit

Permalink
fix detection of android emulator (#35111)
Browse files Browse the repository at this point in the history
Summary:
at some point, the `Build.FINGERPRINT` of the emulator has changed and no longer includes `generic` as an option.

It apparently now, on all platforms, includes `google/sdk_gphone` at the beginning. Older emulators may still include `generic` in the `Build.FINGERPRINT` so we should maintain that check too.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Android] [Fixed] - Fix android emulator detection for packager host

Pull Request resolved: #35111

Test Plan: When running on a modern emulator, ensure that the packager attempts to load from `10.0.2.2`.

Reviewed By: cipolleschi

Differential Revision: D41266071

Pulled By: GijsWeterings

fbshipit-source-id: 43115dbde6a411fe2ebde23e720dff4812a4309f
  • Loading branch information
deecewan authored and facebook-github-bot committed Nov 15, 2022
1 parent adee7be commit 64ff077
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ private static boolean isRunningOnGenymotion() {
}

private static boolean isRunningOnStockEmulator() {
return Build.FINGERPRINT.contains("generic");
return Build.FINGERPRINT.contains("generic")
|| Build.FINGERPRINT.startsWith("google/sdk_gphone");
}

public static String getServerHost(Integer port) {
Expand Down

0 comments on commit 64ff077

Please sign in to comment.