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
e2181a6a
Unverified
Commit
e2181a6a
authored
May 22, 2018
by
Danny Tuppeny
Committed by
GitHub
May 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First run simulator with -n to ensure it always opens a device (#17460)
parent
4beb57c3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
11 deletions
+28
-11
android_emulator.dart
packages/flutter_tools/lib/src/android/android_emulator.dart
+6
-4
emulator.dart
packages/flutter_tools/lib/src/emulator.dart
+1
-1
ios_emulators.dart
packages/flutter_tools/lib/src/ios/ios_emulators.dart
+20
-5
emulator_test.dart
packages/flutter_tools/test/emulator_test.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/android/android_emulator.dart
View file @
e2181a6a
...
...
@@ -41,20 +41,22 @@ class AndroidEmulator extends Emulator {
String
get
label
=>
_properties
[
'avd.ini.displayname'
];
@override
Future
<
void
>
launch
()
async
{
final
Future
<
void
>
launchResult
=
Future
<
bool
>
launch
()
async
{
final
Future
<
bool
>
launchResult
=
runAsync
(<
String
>[
getEmulatorPath
(),
'-avd'
,
id
])
.
then
((
RunResult
runResult
)
{
if
(
runResult
.
exitCode
!=
0
)
{
printError
(
'
$runResult
'
);
return
false
;
}
return
true
;
});
// emulator continues running on a successful launch so if we
// haven't quit within 3 seconds we assume that's a success and just
// return.
await
Future
.
any
<
void
>(<
Future
<
void
>>[
return
Future
.
any
<
bool
>(<
Future
<
bool
>>[
launchResult
,
new
Future
<
void
>.
delayed
(
const
Duration
(
seconds:
3
))
new
Future
<
void
>.
delayed
(
const
Duration
(
seconds:
3
))
.
then
((
_
)
=>
true
)
]);
}
}
...
...
packages/flutter_tools/lib/src/emulator.dart
View file @
e2181a6a
...
...
@@ -95,7 +95,7 @@ abstract class Emulator {
return
id
==
other
.
id
;
}
Future
<
void
>
launch
();
Future
<
bool
>
launch
();
@override
String
toString
()
=>
name
;
...
...
packages/flutter_tools/lib/src/ios/ios_emulators.dart
View file @
e2181a6a
...
...
@@ -36,12 +36,27 @@ class IOSEmulator extends Emulator {
String
get
label
=>
null
;
@override
Future
<
void
>
launch
()
async
{
final
RunResult
launchResult
=
await
runAsync
(<
String
>[
'open'
,
'-a'
,
getSimulatorPath
()]);
if
(
launchResult
.
exitCode
!=
0
)
{
printError
(
'
$launchResult
'
);
Future
<
bool
>
launch
()
async
{
Future
<
bool
>
launchSimulator
(
List
<
String
>
additionalArgs
)
async
{
final
List
<
String
>
args
=
<
String
>[
'open'
]
.
followedBy
(
additionalArgs
)
.
followedBy
(<
String
>[
'-a'
,
getSimulatorPath
()]);
final
RunResult
launchResult
=
await
runAsync
(
args
);
if
(
launchResult
.
exitCode
!=
0
)
{
printError
(
'
$launchResult
'
);
return
false
;
}
return
true
;
}
// First run with `-n` to force a device to boot if there isn't already one
if
(!
await
launchSimulator
(<
String
>[
'-n'
]))
return
false
;
// Run again to force it to Foreground (using -n doesn't force existing
// devices to the foreground)
return
launchSimulator
(<
String
>[]);
}
}
...
...
packages/flutter_tools/test/emulator_test.dart
View file @
e2181a6a
...
...
@@ -62,7 +62,7 @@ class _MockEmulator extends Emulator {
final
String
label
;
@override
Future
<
void
>
launch
()
{
Future
<
bool
>
launch
()
{
throw
new
UnimplementedError
(
'Not implemented in Mock'
);
}
}
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