Fix Arm64 detection logic for devices#40373
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
|
@googlebot I signed it! |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
jmagman
left a comment
There was a problem hiding this comment.
- You have analyzer issues, braces go on the same line, spaces between
//and the comment text. Match the code around where you are changing.
info • Prefer final for variable declarations if they are not reassigned • packages/flutter_tools/lib/src/android/android_device.dart:195:18 • prefer_final_locals
Check out the style guide: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
2. You will needs tests for this. See android_device_test.dart.
| Diego Velásquez <[email protected]> | ||
| Sarbagya Dhaubanjar <[email protected]> No newline at end of file | ||
| Sarbagya Dhaubanjar <[email protected]> | ||
| Mark Diener <[email protected]> No newline at end of file |
| case 'arm64-v8a': | ||
| _platform = TargetPlatform.android_arm64; | ||
|
|
||
| //Original code assumed that CPU was enough. But you need to verify 64 bit OS as well. |
There was a problem hiding this comment.
This code will be around for a long time and edited by many people, so comments like "original code" aren't super informative. A better comment would explain why just checking the CPU isn't sufficient.
| String gabilist = await _getProperty('ro.product.cpu.abilist'); | ||
| if (gabilist == null) | ||
| { | ||
| //Have not seen a device without an abilist in adb, but it is possible. |
| } | ||
|
|
||
| //Confirm that our 64 bit arm cpu has a 64 bit OS running on it | ||
| if (gabilist.contains('arm64-v8a') == true) |
| } | ||
| else | ||
| { | ||
| //Sorry Amazon Kindle Fire 8, You tried trick me, but you failed. |
There was a problem hiding this comment.
This comment is cute, but not super informative. Maybe something like:
Some devices, like the Kindle Fire 8, misreport abilist as <blah>. Fall back to android_arm64.
jonahwilliams
left a comment
There was a problem hiding this comment.
We should have some existing tests that cover this code. They should be updated with new cases + synthetic devices to ensure this logic is covered and doesn't get accidentally reverted
| //Original code assumed that CPU was enough. But you need to verify 64 bit OS as well. | ||
| String gabilist = await _getProperty('ro.product.cpu.abilist'); | ||
| if (gabilist == null) | ||
| { |
There was a problem hiding this comment.
Please follow the style guide at https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
In this case place the opening brace on the same line as the if.
| case 'arm64-v8a': | ||
| _platform = TargetPlatform.android_arm64; | ||
|
|
||
| //Original code assumed that CPU was enough. But you need to verify 64 bit OS as well. |
There was a problem hiding this comment.
Some links to external documentation or issues here would be helpful too.
To clarify, that probably means mock out out the results of the |
|
I will get back to this very shortly. I am just trying to get some other deadlines met in the meantime. |
|
Closing due to lack of activity. I've filled #44999 to capture the issue here |
Description
Flutter tools assumes that all 64 bit ARM cpus are able to run 64 bit code.
There are manufacturers that use 64 bit ARM cpus while installing 32 bit Android OS on it.
Added code that looks at the OS for 32 or 64 bit arm so dev tools do not try to download
64 bit code to 32 bit Operating systems.
Tests
As far as tests, I have tested with my available android devices including Kindle Fire 8 and Motorola LG v30.
But this is device detection, so it requires physical devices more than I have available.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Does your PR require Flutter developers to manually update their apps to accommodate your change?