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
2d283504
Unverified
Commit
2d283504
authored
May 19, 2021
by
Marian Triebe
Committed by
GitHub
May 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cold boot option to emulator launch command (#82647)
parent
647712e9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
10 deletions
+36
-10
AUTHORS
AUTHORS
+1
-0
android_emulator.dart
packages/flutter_tools/lib/src/android/android_emulator.dart
+9
-4
emulators.dart
packages/flutter_tools/lib/src/commands/emulators.dart
+7
-3
emulator.dart
packages/flutter_tools/lib/src/emulator.dart
+1
-1
ios_emulators.dart
packages/flutter_tools/lib/src/ios/ios_emulators.dart
+1
-1
android_emulator_test.dart
...ols/test/general.shard/android/android_emulator_test.dart
+16
-0
emulator_test.dart
packages/flutter_tools/test/general.shard/emulator_test.dart
+1
-1
No files found.
AUTHORS
View file @
2d283504
...
...
@@ -77,3 +77,4 @@ Hidenori Matsubayashi <Hidenori.Matsubayashi@sony.com>
Perqin Xie <perqinxie@gmail.com>
Seongyun Kim <helloworld@cau.ac.kr>
Ludwik Trammer <ludwik@gmail.com>
Marian Triebe <m.triebe@live.de>
packages/flutter_tools/lib/src/android/android_emulator.dart
View file @
2d283504
...
...
@@ -149,10 +149,15 @@ class AndroidEmulator extends Emulator {
String
_prop
(
String
name
)
=>
_properties
!=
null
?
_properties
[
name
]
:
null
;
@override
Future
<
void
>
launch
({
@visibleForTesting
Duration
startupDuration
})
async
{
final
Process
process
=
await
_processUtils
.
start
(
<
String
>[
_androidSdk
.
emulatorPath
,
'-avd'
,
id
],
);
Future
<
void
>
launch
({
@visibleForTesting
Duration
startupDuration
,
bool
coldBoot
=
false
})
async
{
final
List
<
String
>
command
=
<
String
>[
_androidSdk
.
emulatorPath
,
'-avd'
,
id
,
if
(
coldBoot
)
'-no-snapshot-load'
];
final
Process
process
=
await
_processUtils
.
start
(
command
);
// Record output from the emulator process.
final
List
<
String
>
stdoutList
=
<
String
>[];
...
...
packages/flutter_tools/lib/src/commands/emulators.dart
View file @
2d283504
...
...
@@ -15,6 +15,9 @@ class EmulatorsCommand extends FlutterCommand {
EmulatorsCommand
()
{
argParser
.
addOption
(
'launch'
,
help:
'The full or partial ID of the emulator to launch.'
);
argParser
.
addFlag
(
'cold'
,
help:
'Used with the "--launch" flag to cold boot the emulator instance (Android only).'
,
negatable:
false
);
argParser
.
addFlag
(
'create'
,
help:
'Creates a new Android emulator based on a Pixel device.'
,
negatable:
false
);
...
...
@@ -43,7 +46,8 @@ class EmulatorsCommand extends FlutterCommand {
}
if
(
argResults
.
wasParsed
(
'launch'
))
{
await
_launchEmulator
(
stringArg
(
'launch'
));
final
bool
coldBoot
=
argResults
.
wasParsed
(
'cold'
);
await
_launchEmulator
(
stringArg
(
'launch'
),
coldBoot:
coldBoot
);
}
else
if
(
argResults
.
wasParsed
(
'create'
))
{
await
_createEmulator
(
name:
stringArg
(
'name'
));
}
else
{
...
...
@@ -57,7 +61,7 @@ class EmulatorsCommand extends FlutterCommand {
return
FlutterCommandResult
.
success
();
}
Future
<
void
>
_launchEmulator
(
String
id
)
async
{
Future
<
void
>
_launchEmulator
(
String
id
,
{
bool
coldBoot
}
)
async
{
final
List
<
Emulator
>
emulators
=
await
emulatorManager
.
getEmulatorsMatching
(
id
);
...
...
@@ -69,7 +73,7 @@ class EmulatorsCommand extends FlutterCommand {
"More than one emulator matches '
$id
':"
,
);
}
else
{
await
emulators
.
first
.
launch
();
await
emulators
.
first
.
launch
(
coldBoot:
coldBoot
);
}
}
...
...
packages/flutter_tools/lib/src/emulator.dart
View file @
2d283504
...
...
@@ -268,7 +268,7 @@ abstract class Emulator {
&&
other
.
id
==
id
;
}
Future
<
void
>
launch
();
Future
<
void
>
launch
(
{
bool
coldBoot
}
);
@override
String
toString
()
=>
name
;
...
...
packages/flutter_tools/lib/src/ios/ios_emulators.dart
View file @
2d283504
...
...
@@ -40,7 +40,7 @@ class IOSEmulator extends Emulator {
PlatformType
get
platformType
=>
PlatformType
.
ios
;
@override
Future
<
void
>
launch
()
async
{
Future
<
void
>
launch
(
{
bool
coldBoot
=
false
}
)
async
{
Future
<
bool
>
launchSimulator
(
List
<
String
>
additionalArgs
)
async
{
final
List
<
String
>
args
=
<
String
>[
'open'
,
...
...
packages/flutter_tools/test/general.shard/android/android_emulator_test.dart
View file @
2d283504
...
...
@@ -144,6 +144,22 @@ void main() {
await
emulator
.
launch
(
startupDuration:
Duration
.
zero
);
});
testWithoutContext
(
'succeeds with coldboot launch'
,
()
async
{
final
List
<
String
>
kEmulatorLauchColdBootCommand
=
<
String
>[
...
kEmulatorLaunchCommand
,
'-no-snapshot-load'
];
final
AndroidEmulator
emulator
=
AndroidEmulator
(
emulatorID
,
processManager:
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
kEmulatorLauchColdBootCommand
),
]),
androidSdk:
mockSdk
,
logger:
BufferLogger
.
test
(),
);
await
emulator
.
launch
(
startupDuration:
Duration
.
zero
,
coldBoot:
true
);
});
testWithoutContext
(
'prints error on failure'
,
()
async
{
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
AndroidEmulator
emulator
=
AndroidEmulator
(
emulatorID
,
...
...
packages/flutter_tools/test/general.shard/emulator_test.dart
View file @
2d283504
...
...
@@ -367,7 +367,7 @@ class FakeEmulator extends Emulator {
PlatformType
get
platformType
=>
PlatformType
.
android
;
@override
Future
<
void
>
launch
()
{
Future
<
void
>
launch
(
{
bool
coldBoot
=
false
}
)
{
throw
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