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
c91ace82
Commit
c91ace82
authored
Feb 09, 2016
by
Matt Perry
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1696 from mpcomplete/fix.stop
Fix `flutter stop` to stop the right Android activity.
parents
f1168723
1cf36da1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
38 deletions
+44
-38
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+41
-1
apk.dart
packages/flutter_tools/lib/src/commands/apk.dart
+2
-36
start.dart
packages/flutter_tools/lib/src/commands/start.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/application_package.dart
View file @
c91ace82
...
...
@@ -3,8 +3,10 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
import
'package:xml/xml.dart'
as
xml
;
import
'artifacts.dart'
;
import
'build_configuration.dart'
;
...
...
@@ -32,6 +34,8 @@ class AndroidApk extends ApplicationPackage {
static
const
String
_defaultName
=
'SkyShell.apk'
;
static
const
String
_defaultId
=
'org.domokit.sky.shell'
;
static
const
String
_defaultLaunchActivity
=
'
$_defaultId
/
$_defaultId
.SkyActivity'
;
static
const
String
_defaultManifestPath
=
'apk/AndroidManifest.xml'
;
static
const
String
_defaultOutputPath
=
'build/app.apk'
;
/// The path to the activity that should be launched.
/// Defaults to 'org.domokit.sky.shell/org.domokit.sky.shell.SkyActivity'
...
...
@@ -44,6 +48,36 @@ class AndroidApk extends ApplicationPackage {
})
:
super
(
localPath:
localPath
,
id:
id
)
{
assert
(
launchActivity
!=
null
);
}
/// Creates a new AndroidApk based on the information in the Android manifest.
static
AndroidApk
getCustomApk
({
String
localPath:
_defaultOutputPath
,
String
manifest:
_defaultManifestPath
})
{
if
(!
FileSystemEntity
.
isFileSync
(
manifest
))
return
null
;
String
manifestString
=
new
File
(
manifest
).
readAsStringSync
();
xml
.
XmlDocument
document
=
xml
.
parse
(
manifestString
);
Iterable
<
xml
.
XmlElement
>
manifests
=
document
.
findElements
(
'manifest'
);
if
(
manifests
.
isEmpty
)
return
null
;
String
id
=
manifests
.
first
.
getAttribute
(
'package'
);
String
launchActivity
;
for
(
xml
.
XmlElement
category
in
document
.
findAllElements
(
'category'
))
{
if
(
category
.
getAttribute
(
'android:name'
)
==
'android.intent.category.LAUNCHER'
)
{
xml
.
XmlElement
activity
=
category
.
parent
.
parent
as
xml
.
XmlElement
;
String
activityName
=
activity
.
getAttribute
(
'android:name'
);
launchActivity
=
"
$id
/
$activityName
"
;
break
;
}
}
if
(
id
==
null
||
launchActivity
==
null
)
return
null
;
return
new
AndroidApk
(
localPath:
localPath
,
id:
id
,
launchActivity:
launchActivity
);
}
}
class
IOSApp
extends
ApplicationPackage
{
...
...
@@ -86,7 +120,13 @@ class ApplicationPackageStore {
switch
(
config
.
targetPlatform
)
{
case
TargetPlatform
.
android
:
assert
(
android
==
null
);
if
(
config
.
type
!=
BuildType
.
prebuilt
)
{
android
=
AndroidApk
.
getCustomApk
();
// Fall back to the prebuilt or engine-provided apk if we can't build
// a custom one.
// TODO(mpcomplete): we should remove both these fallbacks.
if
(
android
!=
null
)
{
break
;
}
else
if
(
config
.
type
!=
BuildType
.
prebuilt
)
{
String
localPath
=
path
.
join
(
config
.
buildDir
,
'apks'
,
AndroidApk
.
_defaultName
);
android
=
new
AndroidApk
(
localPath:
localPath
);
}
else
{
...
...
packages/flutter_tools/lib/src/commands/apk.dart
View file @
c91ace82
...
...
@@ -8,7 +8,6 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
;
import
'package:xml/xml.dart'
as
xml
;
import
'../android/device_android.dart'
;
import
'../application_package.dart'
;
...
...
@@ -406,33 +405,6 @@ int _signApk(
return
0
;
}
// Creates a new ApplicationPackage from the Android manifest.
AndroidApk
_getApplicationPackage
(
String
apkPath
,
String
manifest
)
{
if
(!
FileSystemEntity
.
isFileSync
(
manifest
))
return
null
;
String
manifestString
=
new
File
(
manifest
).
readAsStringSync
();
xml
.
XmlDocument
document
=
xml
.
parse
(
manifestString
);
Iterable
<
xml
.
XmlElement
>
manifests
=
document
.
findElements
(
'manifest'
);
if
(
manifests
.
isEmpty
)
return
null
;
String
id
=
manifests
.
toList
()[
0
].
getAttribute
(
'package'
);
String
launchActivity
;
for
(
xml
.
XmlElement
category
in
document
.
findAllElements
(
'category'
))
{
if
(
category
.
getAttribute
(
'android:name'
)
==
'android.intent.category.LAUNCHER'
)
{
xml
.
XmlElement
activity
=
category
.
parent
.
parent
as
xml
.
XmlElement
;
String
activityName
=
activity
.
getAttribute
(
'android:name'
);
launchActivity
=
"
$id
/
$activityName
"
;
break
;
}
}
if
(
id
==
null
||
launchActivity
==
null
)
return
null
;
return
new
AndroidApk
(
localPath:
apkPath
,
id:
id
,
launchActivity:
launchActivity
);
}
// Returns true if the apk is out of date and needs to be rebuilt.
bool
_needsRebuild
(
String
apkPath
,
String
manifest
)
{
FileStat
apkStat
=
FileStat
.
statSync
(
apkPath
);
...
...
@@ -504,7 +476,8 @@ Future<int> buildAndroid({
}
}
Future
<
ApplicationPackageStore
>
buildAll
(
// TODO(mpcomplete): move this to Device?
Future
buildAll
(
DeviceStore
devices
,
ApplicationPackageStore
applicationPackages
,
Toolchain
toolchain
,
...
...
@@ -531,13 +504,6 @@ Future<ApplicationPackageStore> buildAll(
force:
false
,
target:
target
);
// Replace our pre-built AndroidApk with this custom-built one.
applicationPackages
=
new
ApplicationPackageStore
(
android:
_getApplicationPackage
(
_kDefaultOutputPath
,
_kDefaultAndroidManifestPath
),
iOS:
applicationPackages
.
iOS
,
iOSSimulator:
applicationPackages
.
iOSSimulator
);
}
}
return
applicationPackages
;
}
packages/flutter_tools/lib/src/commands/start.dart
View file @
c91ace82
...
...
@@ -142,7 +142,7 @@ Future<int> startApp(
if
(
install
)
{
printTrace
(
'Running build command.'
);
a
pplicationPackages
=
a
wait
buildAll
(
await
buildAll
(
devices
,
applicationPackages
,
toolchain
,
configs
,
enginePath:
enginePath
,
target:
target
);
...
...
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