New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android emulator detection yields false positives #10203

Closed
tvolkert opened this Issue May 19, 2017 · 7 comments

Comments

Projects
None yet
3 participants
@tvolkert
Copy link
Contributor

tvolkert commented May 19, 2017

Our Android emulator detection currently looks for the string "emulator" in the output of adb shell getprop ro.build.characteristics

Customer six discovered that on the Samsung Galaxy S8, the output of adb shell getprop ro.build.characteristics is "phone,emulator" even though it is obviously a physical device.

In release mode, this is causing the runner to fail with the message "Release mode is not supported for emulators".

Device details:

  • Device: Samsung Galaxy S8
  • Model: SM-G950F
  • Android 7.0
  • Samsung Experience 8.1
  • Kernel 4.4.13-11168760

@tvolkert tvolkert added this to the 3: Make conferences happy milestone May 19, 2017

@tvolkert

This comment has been minimized.

Copy link
Contributor Author

tvolkert commented May 19, 2017

@eseidelGoogle

This comment has been minimized.

Copy link
Contributor

eseidelGoogle commented May 19, 2017

Can someone post (or send to @tvolkert) the full adb getprop log from one of these devices? :)

@tvolkert

This comment has been minimized.

Copy link
Contributor Author

tvolkert commented May 19, 2017

I have an open request to get that info in the internal sibling of this bug -- I'll paste the output here when I get it (or someone else can -- whichever comes first)

@tvolkert

This comment has been minimized.

Copy link
Contributor Author

tvolkert commented May 19, 2017

Comments from internal Android expert:

ro.hardware will be "goldfish" or "ranchu" for qemu or qemu2 based emulators

With regards to 3P emulators:

all these props get set as part of the build of the system image. 3ps can redefine
them however they want :(
There is no standard way of communicating whether or not something is 'an emulator' :(

tvolkert added a commit that referenced this issue May 22, 2017

Add initial list of known Android hardware (#10249)
Our emulator detection was based on a simple heuristic that was
failing for the Samsung Galaxy S8. Any heuristic is flawed since
Android devices can report whatever they want to adb, but this
change attempts to tighten the detection by listing known models
(by their ro.hardware property). Again, these values could be
spoofed by emulator system images, but it's less likely to be
an issue than with our previous (and fall-back) heuristic.

Fixes #10203
Related: #10248
@aafa

This comment has been minimized.

Copy link

aafa commented Jun 30, 2017

I'm having exactly this case on my device (samsung s7 edge)

$ adb shell getprop ro.hardware
samsungexynos8890

$ adb shell getprop ro.build.characteristics
phone,emulator

$ flutter devices
1 connected device:

SM G935F • ad0616030806e2dbae • android-arm • Android 7.0 (API 24) (emulator)

My blunt assumption is that samsungexynos8890 needs to be added here
https://github.com/tvolkert/flutter/blob/f1977a8d96b3523e3fb6da8fe52461185863ceea/packages/flutter_tools/lib/src/android/android_device.dart#L38

@tvolkert

This comment has been minimized.

Copy link
Contributor Author

tvolkert commented Jun 30, 2017

@aafa I just sent #11056 to add that device to the known-hardware list.

@aafa

This comment has been minimized.

Copy link

aafa commented Jun 30, 2017

@tvolkert thank you! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment