This commit produces an "install bouncer" APK which is a "hollow
shell" that looks like the main Fennec APK. In particular, both APKs have:
* the same Android package name (application id); and
* the same set of <permission>, <uses-permission>, and <uses-feature>
blocks in their manifests.
The bouncer APK must always have an android:versionCode smaller than
the main Fennec APK; for now, we will just bump that manually
mobile/android/bouncer/moz.build.
Call a distribution in /data/data/$PACKAGE/distribution a "data
distribution". Right now we read data distributions only in response
to writing them via another code path (extracting from APK, or
downloading). We don't recognize a data distribution in the same way
that we recognize a system distribution (in /system/.../distribution)
in the Java code, simply because we don't look for it; and I haven't
investigated, but I think that Gecko may in fact recognize a data
distribution in this case.
This patch simply recognizes data distributions after looking for
other distributions. That way data distributions written by the
bouncer APK are recognized and initialized, but not given precedence
over other distribution channels.
DONTBUILD NPOTB
Using the real Android manifest tripped up Robolectric, so I've taken
the easy way out and added a dummy TestGeckoApplication; see comment
in the code.
This patch will prevent Firefox from downloading OMA download descriptors on
its own. Instead it will prompt to complete the action with an external app
if available. An error will be shown if no external app can handle the download.
On a CLOSED TREE
I don't understand why I didn't see this in local testing or try
builds, but I didn't. Simple enough: we now load a distribution from
/data/data as a matter of course, which means that tests that install
such a distribution need to remove it when they are done. This patch
does that.
On a CLOSED TREE.
So, apparently we race to have a non-null application context from the
target context. No matter, we can use the target context directly.
DONTBUILD NPOTB
Using the real Android manifest tripped up Robolectric, so I've taken
the easy way out and added a dummy TestGeckoApplication; see comment
in the code.
ON A CLOSED TREE
I have manually verified that this results in a byte-identical
gecko.ap_. This is because after the earlier patches there are no
definitions (or aliases) that are package-local (like .App or
.Webapp), which are the only things (other than the Android package
name) that get rewritten by --rename-manifest-package.
Way back in Fennec 33 (Bug 929865, see
https://hg.mozilla.org/mozilla-central/rev/a4f39c9db1d9) we replaced
org.mozilla.gecko.App with org.mozilla.gecko.BrowserApp and introduced
the .App <activity-alias>. Per the entry for android:name of
http://developer.android.com/guide/topics/manifest/activity-element.html,
.App translates to $ANDROID_PACKAGE_NAME.App. We haven't referenced
an Activity qualified with a non-org.mozilla.gecko *class* name (for
example, from bookmark shortcuts) since well before Fennec 33, so this
probably never did what it was intended to do: we wanted to redirect
org.mozilla.gecko.App to org.mozilla.gecko.BrowserApp, but it instead
has been redirecting org.mozilla.fennec.App to
org.mozilla.gecko.BrowserApp. I don't think we've been referring to
$ANDROID_PACKAGE_NAME.App since well before Fennec 29, if ever.
The <activity-alias> has been servicing essentially all
<intent-filter> invocations of Fennec by passing them directly to
org.mozilla.gecko.BrowserApp.
This pushes a long programme of simplification forward. Fallout might
look like very old homescreen shortcuts failing to launch, but I'm
quite confident that won't actually happen.
This <activity> and <activity-alias> support old-style homescreen
shortcuts to old-style Webapps. Such shortcuts must have been
produced at least 18 months ago, and pre-date the new-style synthetic
APK Webapps entirely. New-style APK Webapps are slated to be removed
from the product entirely, and there's no reason to keep their even
less viable predecessor around.
Telemetry from http://mzl.la/23kXGV5 shows that there were no launches
of webapps (old-style or new-style) for Fennec 43 release. Telemetry
from http://mzl.la/23kXFAs shows that there were 40.7k launches of
webapps (again, old-style or new-style) for Fennec 44 beta (of 39.0M
total -- for 0.1% total). We cannot distinguish old-style from
new-style, but it is safe to assume it's a tiny proportion.
Users with such homescreen shortcuts will see a bogus "App isn't
installed" message and need to delete and re-create their shortcut in
some way.
The org.mozilla.gecko.Webapp class cannot be removed until new-style
APK Webapps are removed.
This small change is a follow-up to Bug 1242213, which did the same
for the main package. This is a nod to the future and Gradle, which
cleanly splits the internal Java package (org.mozilla.gecko) from the
external Android package (org.mozilla.fennec and friends).
This commit produces an "install bouncer" APK which is a "hollow
shell" that looks like the main Fennec APK. In particular, both APKs have:
* the same Android package name (application id); and
* the same set of <permission>, <uses-permission>, and <uses-feature>
blocks in their manifests.
The bouncer APK must always have an android:versionCode smaller than
the main Fennec APK; for now, we will just bump that manually
mobile/android/bouncer/moz.build.
Call a distribution in /data/data/$PACKAGE/distribution a "data
distribution". Right now we read data distributions only in response
to writing them via another code path (extracting from APK, or
downloading). We don't recognize a data distribution in the same way
that we recognize a system distribution (in /system/.../distribution)
in the Java code, simply because we don't look for it; and I haven't
investigated, but I think that Gecko may in fact recognize a data
distribution in this case.
This patch simply recognizes data distributions after looking for
other distributions. That way data distributions written by the
bouncer APK are recognized and initialized, but not given precedence
over other distribution channels.
This reads from "assets/distribution/**" in the APK and writes to
"distribution/**" in the data directory. That output is the same, but
the input used to read from "distribution/**", which is not really
supported by modern build tooling (Gradle), which doesn't allow to
write files directly into the APK root.
I manually tested this without issue. I see no way to add meaningful
tests to our current Robocop test suite; the long term testing
approach is to develop a new test for this functionality and only run
it against the "distribution" build type that was added in Bug
1163080. However, that's a larger project than I have time for now.
This simply packs the assets/ subdirectory of the distribution
directory into the assets/ directory of the Android APK using existing
mechanisms. It also removes the older method of manually pushing
files into dist/bin/distribution, from where they would be packaged
into the APK under distribution/.
This reads from "assets/distribution/**" in the APK and writes to
"distribution/**" in the data directory. That output is the same, but
the input used to read from "distribution/**", which is not really
supported by modern build tooling (Gradle), which doesn't allow to
write files directly into the APK root.
I manually tested this without issue. I see no way to add meaningful
tests to our current Robocop test suite; the long term testing
approach is to develop a new test for this functionality and only run
it against the "distribution" build type that was added in Bug
1163080. However, that's a larger project than I have time for now.
This simply packs the assets/ subdirectory of the distribution
directory into the assets/ directory of the Android APK using existing
mechanisms. It also removes the older method of manually pushing
files into dist/bin/distribution, from where they would be packaged
into the APK under distribution/.
A few notes: the test is live, so I've marked it @Ignore, so that it
doesn't run during |mach gradle test|. There's some value in mocking
the service endpoint, but this is how I verify that the server works,
so it has more value right now as a live test than a mocked test. In
the future, that probably won't be true.
There are issues running the test locally because Robolectric doesn't
provide all the cipher suites we use in GlobalConstants: in
particular, the GCM suites aren't supported. This may improve as
Robolectric matures, or we may add a work-around in the code (like at
http://androidxref.com/4.4.4_r1/xref/libcore/support/src/test/java/libcore/java/security/StandardNames.java#68),
or we may add a test-specific flag. For now, I'm not going to address
it directly.
Finally, I put the code in mobile/android/services, simply because the
less that goes into base, the better our build times will be.
This seems more consistent with what Android UI callbacks do. This commit also
means all callees must be adapted to use the background thread if needed.