Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
c7245041
Unverified
Commit
c7245041
authored
Nov 20, 2019
by
Jonah Williams
Committed by
GitHub
Nov 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Android CPU device detection (#45139)
parent
868578b1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
1 deletion
+82
-1
AUTHORS
AUTHORS
+1
-0
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+10
-1
android_device_test.dart
...tools/test/general.shard/android/android_device_test.dart
+71
-0
No files found.
AUTHORS
View file @
c7245041
...
...
@@ -45,3 +45,4 @@ Sarbagya Dhaubanjar <mail@sarbagyastha.com.np>
Rody Davis Jr <rody.davis.jr@gmail.com>
Robin Jespersen <info@unitedpartners.de>
Jefferson Quesado <jeff.quesado@gmail.com>
Mark Diener <rpzrpzrpz@gmail.com>
packages/flutter_tools/lib/src/android/android_device.dart
View file @
c7245041
...
...
@@ -192,7 +192,16 @@ class AndroidDevice extends Device {
// http://developer.android.com/ndk/guides/abis.html (x86, armeabi-v7a, ...)
switch
(
await
_getProperty
(
'ro.product.cpu.abi'
))
{
case
'arm64-v8a'
:
// Perform additional verification for 64 bit ABI. Some devices,
// like the Kindle Fire 8, misreport the abilist. We might not
// be able to retrieve this property, in which case we fall back
// to assuming 64 bit.
final
String
abilist
=
await
_getProperty
(
'ro.product.cpu.abilist'
);
if
(
abilist
==
null
||
abilist
.
contains
(
'arm64-v8a'
))
{
_platform
=
TargetPlatform
.
android_arm64
;
}
else
{
_platform
=
TargetPlatform
.
android_arm
;
}
break
;
case
'x86_64'
:
_platform
=
TargetPlatform
.
android_x64
;
...
...
packages/flutter_tools/test/general.shard/android/android_device_test.dart
View file @
c7245041
...
...
@@ -318,6 +318,77 @@ Use the 'android' tool to install them:
});
});
group
(
'ABI detection'
,
()
{
ProcessManager
mockProcessManager
;
String
cpu
;
String
abilist
;
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
cpu
=
'unknown'
;
abilist
=
'unknown'
;
when
(
mockProcessManager
.
run
(
argThat
(
contains
(
'getprop'
)),
stderrEncoding:
anyNamed
(
'stderrEncoding'
),
stdoutEncoding:
anyNamed
(
'stdoutEncoding'
),
)).
thenAnswer
((
_
)
{
final
StringBuffer
buf
=
StringBuffer
()
..
writeln
(
'[ro.product.cpu.abi]: [
$cpu
]'
)
..
writeln
(
'[ro.product.cpu.abilist]: [
$abilist
]'
);
final
ProcessResult
result
=
ProcessResult
(
1
,
0
,
buf
.
toString
(),
''
);
return
Future
<
ProcessResult
>.
value
(
result
);
});
});
testUsingContext
(
'detects x64'
,
()
async
{
cpu
=
'x86_64'
;
final
AndroidDevice
device
=
AndroidDevice
(
'test'
);
expect
(
await
device
.
targetPlatform
,
TargetPlatform
.
android_x64
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
});
testUsingContext
(
'detects x86'
,
()
async
{
cpu
=
'x86'
;
final
AndroidDevice
device
=
AndroidDevice
(
'test'
);
expect
(
await
device
.
targetPlatform
,
TargetPlatform
.
android_x86
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
});
testUsingContext
(
'unknown device defaults to 32bit arm'
,
()
async
{
cpu
=
'???'
;
final
AndroidDevice
device
=
AndroidDevice
(
'test'
);
expect
(
await
device
.
targetPlatform
,
TargetPlatform
.
android_arm
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
});
testUsingContext
(
'detects 64 bit arm'
,
()
async
{
cpu
=
'arm64-v8a'
;
abilist
=
'arm64-v8a,'
;
final
AndroidDevice
device
=
AndroidDevice
(
'test'
);
// If both abi properties agree, we are 64 bit.
expect
(
await
device
.
targetPlatform
,
TargetPlatform
.
android_arm64
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
});
testUsingContext
(
'detects kind fire ABI'
,
()
async
{
cpu
=
'arm64-v8a'
;
abilist
=
'arm'
;
final
AndroidDevice
device
=
AndroidDevice
(
'test'
);
// If one does not contain arm64, assume 32 bit.
expect
(
await
device
.
targetPlatform
,
TargetPlatform
.
android_arm
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
});
});
group
(
'isLocalEmulator'
,
()
{
final
ProcessManager
mockProcessManager
=
MockProcessManager
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment