136 Commits

Author SHA1 Message Date
Geoff Mendal
ad8bdc9fae Import translations. DO NOT MERGE
Change-Id: I74dde9cd7fb513553a5da3614ff24724db011042
Auto-generated-cl: translation import
2015-04-22 05:17:28 -07:00
Geoff Mendal
0ae2b12c29 Import translations. DO NOT MERGE
Change-Id: I1bdbaf86f8f5fd957938b9d186e824d115054e10
Auto-generated-cl: translation import
2015-03-20 23:17:07 -07:00
Jeff Sharkey
c02f304c3a am 58b699c3: am 636baa0d: Merge "Introduce revision codes for split APKs." into lmp-mr1-dev
* commit '58b699c366dea7abc26f34c1e5f1cc6031c04e23':
  Introduce revision codes for split APKs.
2014-11-25 17:39:16 +00:00
Jeff Sharkey
88d2a3c0e1 Introduce revision codes for split APKs.
Apps delivered as multiple split APKs must have identical package
names, version code, and signatures.  However, developers may want
to iterate quickly on a subset of splits without having to increment
the version code, which would require delivery of the entire app.

This change introduces "revision codes" which can vary between
split APKs belonging to the same app.  An install is valid as long
as the normal version code is identical across all splits.  Splits
can be added/removed to an app over time, but if a split is present
across an upgrade the revision code must not decrease.

Since system apps could have been updated with splits, only revert
to the built-in APKs if the version code is strictly greater than the
data version.  Also fix bug to enable inheriting from system apps
when adding splits.

Bug: 18481866
Change-Id: I34d8e14c141a8eb95c33ffe24b4e52d6af5c8260
2014-11-24 12:13:11 -08:00
Andreas Gampe
423ba098bd Frameworks/base: Wall Werror in packages
Turn on -Wall -Werror in packages/. Fix warnings.

Change-Id: I4ec7256a7df46017e1895575719f2b5aca978bd0
2014-11-13 15:25:34 -08:00
Jeff Sharkey
941a8ba1a6 Installing splits into ASECs!
Sessions can now zero-copy data directly into pre-allocated ASEC
containers.  Then at commit time, we compute the total size of the
final app, including any inherited APKs and unpacked libraries, and
resize the container in one step.

This supports both brand new ASEC installs and inheriting from
existing ASEC installs.  To keep things simple, it currently requires
copying any inherited ASEC contents, but this could be optimized in
the future.

Expose new vold resize command, and allow read-write mounting of ASEC
containers.  Move native library extraction into the installer flow,
since it needs to happen before ASEC is sealed.  Move multiArch flag
into NativeLibraryHelper, instead of making everyone pass it
around.  Migrate size calculation to shared location.

Separate "other" package name in public API, provide a path to a
storage device when relevant, and add more docs.

Bug: 16514385
Change-Id: I06c6ce588d312ee7e64cce02733895d640b88456
2014-08-22 16:25:04 -07:00
Jeff Sharkey
bb7b7bea19 More progress towards split APKs in ASECs.
Teach DefaultContainerService to install split APKs, which will be
needed when moving to/from ASECs.  Also support forward locking for
testing purposes, even though its deprecated.

Move native library unpacking code to NativeLibraryHelper location
where it can be shared by both DCS and PMS.  Also update footprint
calculation logic to mirror the later unpack codepaths.

Immediately persist sealed sessions.  When resolving install
locations, prefer location of any existing install of that
package.  Lightweight parse requesting certificates now always
verifies that all contents are signed correctly.

Bug: 16514385
Change-Id: Ida1c4eb0f95b065104dd971e19126d4085ebf1f0
2014-08-20 12:47:27 -07:00
Jeff Sharkey
742e790294 Progress towards staging ASECs.
Move location selection logic into shared PackageHelper location,
and share it between DCS and PackageInstaller.  Fix bugs related to
installed footprint calculation; always count unpacked native libs.

Have PMS do its own threshold checking, since it's fine to stat
devices.  PMS only ever deleted staging ASECs, so move that logic
into installer and nuke unclaimed staging ASECs.  Allocate legacy
ASEC names using PackageInstaller to make sure they don't conflict
with sessions.

Start wiring up session to allocate ASEC and pass through staged
container for installation.

Fix bug to actually delete invalid cluster-style installs.

Bug: 16514385
Change-Id: I325e0c4422fc128398c921ba45fd73ecf05fc2a9
2014-08-18 15:52:24 -07:00
Baligh Uddin
50af6d7ae6 Remove deprecated locales - DO NOT MERGE
Change-Id: Iac5489639edae2373ed0ce92f7d0fe22629a249a
2014-07-19 13:05:12 -07:00
Narayan Kamath
ff110bd61a Multi-arch application installs.
Each application now has two ABIs, the primary
and the secondary. The app is always launched with
the primary, but the secondary might be used by other apps
that load the given applications code. This implies we
must:

- dex2oat the app both ways.
- extract shared libraries for both abis.

The former is relatively straightforward but the latter
requires us to change the layout for shared libs that we
unpack from applications. The bulk of this change deals
with the latter.

This change continues to fill in nativeLibraryPath during
scans for backwards compatibility. This will be removed in
a future patch.

Change-Id: Ia943dd11ef815c5cbfc60f17929eaa2a652a385a
2014-07-10 17:16:14 +01:00
Jeff Sharkey
d746057f24 Change new file installs to be cluster-based!
Now that all the other pieces are in place, we're ready to start
installing new file-based packages as a cluster (the new unified
directory-based layout).  This greatly simplifies the renaming
process.

Also add helper methods to ApplicationInfo to give a much clearer
mapping between it and internal field names, since we can't change
the public API.

Add recursive restorecon().

Bug: 14975160
Change-Id: I72a63c5ddbc594c2fec4a91dd59f73ef253fbfd7
2014-07-08 00:38:57 -07:00
Baligh Uddin
8ca00fc68e Merge "Import translations. DO NOT MERGE" 2014-07-02 18:50:12 +00:00
Baligh Uddin
9de2621072 Import translations. DO NOT MERGE
Change-Id: I7a8d4c4a5758261843535c247ceaf20c3d57e257
Auto-generated-cl: translation import
2014-07-05 15:14:46 -07:00
Jeff Sharkey
be520fba1e Teach DCS about cluster packages.
For the time being, DCS is going to still be doing heavy lifting for
some install tasks, so it need to know how to handle both monolithic
and cluster packages.  This change is mostly plumbing work to
eventually handle any various splits APKs that we may encounter.

Bug: 14975160
Change-Id: I39848d5666f9083cb4eca493e5cdaa868f3f99fb
2014-07-05 19:16:53 -07:00
Jeff Sharkey
0c54798aac Start removing ContainerEncryptionParams.
The new PackageInstallerSession APIs will allow installers to deliver
bits directly into system protected storage, so we no longer need
encrypted containers.

Change-Id: I8b598cb149b7dfd1d41e6626c1359610a573edf1
2014-07-05 15:49:07 -07:00
Jeff Sharkey
73767b9d60 Extract native code from split APKs.
In the new split APK world, multiple APKs work together to define a
single package.  This means that native code may be split among those
APKs.  To handle this, extend NativeLibraryHelper to examine all
APKs in a package ordered by splitName.

A package has valid native code as long as one matching ABI is found
inside.  The "best" ABI found across all APKs is picked for the
entire package.  No attempt is made to ensure that every native
library defined is available for the picked ABI; that's the
responsibility of the installer.

Re-introduce PackageLite to represent a lightweight parsing of an
entire package, which may be a single monolithic APK or a cluster
of one or more APKs.

Remove native code extraction from InstallerSession, since it'll be
handled inside PMS for this release.

Bug: 14975160
Change-Id: I4f4db0f82e88a46101c7777499ebc0a11fd911f9
2014-07-04 21:00:33 -07:00
Jeff Sharkey
57dcf5b177 Slow progress towards APK clusters.
Differentiate between "split APKs" and "cluster packages".  A cluster
package is a directory containing zero or more APKs (base+splits),
and a monolithic package is a single APK (base).

PackageSetting will use the directory name as its codePath, so track
the baseCodePath separately.  Clarify documentation in several
places.

Require that all installers provide file:// URIs through existing
hidden APIs; PackageInstaller hasn't been able to read content://
URIs for a long time.

Bug: 14975160
Change-Id: I1c6fed1b55205c2474b09871161a98a26669d22e
2014-07-02 19:03:54 -07:00
Narayan Kamath
cef0b39b92 Fix native crashes when APKs can't be opened.
There was lax / incomplete error checking around the
construction of Apk handles. This change changes the ApkHandle
API and makes it throw IOException if the zipfile couldn't
be opened.

Additionally :
- Fix a resource leak in DefaultContainerService
- Report errors correctly during package moves.

bug: 15563874
(cherry picked from commit ec4516470d7ce6e47769591d678c838bd3f6f388)

Change-Id: Ia35b464355467d0d36faf34fae85acbbab3f2896
2014-07-02 12:43:52 +01:00
Baligh Uddin
167f20bfdf Import translations. DO NOT MERGE
Change-Id: I535470c423b374d61cdd11ded404f8f80e94af74
Auto-generated-cl: translation import
2014-06-30 14:36:19 +00:00
Jeff Sharkey
275e085d5a Stronger PackageParser contract, more split work.
Require that method callers always provide relevant paths, instead of
relying on constructor.  Move DisplayMetrics to be an overall parser
parameter, and move PARSE_TRUSTED_OVERLAY to flags.

Parse split APKs and apply deterministic ordering based on split
names.  Assert consistent package name and version code across all
split APKs in a package, and enforce unique split names and required
base APK.

Collect certificates for split APKs, enforcing they're all signed
consistently.  Better flow control and resource cleanup when
collecting certs.  Refactor validation code so it's easier to reason
about.  Cleaner maintenance of read buffer when draining stream
contents.

Change-Id: I8bc8c62095fbb933227b9e76ad8771f4b1246fe8
2014-06-18 16:04:13 -07:00
Jeff Sharkey
c4858a2ba9 Switch PackageParser to reference single path.
It previously kept mPath separate from mScanPath for some very odd
edge cases around moving apps-on-SD.  This changes it to always use
a single path, refactors moving to keep separate paths.

Refactors method names in PackageParser to be clearer about their
APK-versus-package relationship.

Beginnings of a split package parser.  Instead of requiring that
callers check error codes when null, switch to always throwing on
parse errors, to require that callers deal with the error.  Longer
term the entire parser should switch to this style, but its too
pervasive for a simple refactoring.

Change-Id: If071d8e55e46e56cc201fadfb51cb471713ae973
2014-06-16 13:20:18 -07:00
Narayan Kamath
2cbc51f5ac am 00e3c58d: am 73f7cd98: Merge "Fix build."
* commit '00e3c58d0232952bdcafd02f71e6c9fb00b4d248':
  Fix build.
2014-06-03 14:11:55 +00:00
Narayan Kamath
c32a244e90 am dd2e9d33: am 7cb13f8a: Merge "Scan for renderscript files before deciding ABIs."
* commit 'dd2e9d3386d2d74f99f79bcad951ff5cdefa6fab':
  Scan for renderscript files before deciding ABIs.
2014-06-03 13:58:35 +00:00
Narayan Kamath
26c6c03196 Fix build.
Bad resolution of a manual rebase.

Change-Id: I56d4c7a343c8fd7a715f983b2db15767849f9af7
2014-06-03 14:54:52 +01:00
Narayan Kamath
d47e38b634 Scan for renderscript files before deciding ABIs.
The presence of ".bc" files in an APK implies
incompatibility with any of the 64 bit ABIs.

bug: 14900093

Change-Id: I66ca339a9a149cb3b7e7b349033d80acdeb4140a
2014-06-03 12:58:35 +01:00
Narayan Kamath
116bdbd823 Add an --abi argument to "pm install"
This allows callers to force an install to a particular
ABI. This is intended only for testing (and CTS) and is
not meant for usage by the installer package.

bug: 14453227

(cherry picked from commit 6431d11cd420536aaa9d93ae510a3151ccc4df1d)

Change-Id: I85d4f8785deea02a6a4d3cb0b05e6ef8bf64826b
2014-06-03 11:35:49 +01:00
Narayan Kamath
6431d11cd4 Add an --abi argument to "pm install"
This allows callers to force an install to a particular
ABI. This is intended only for testing (and CTS) and is
not meant for usage by the installer package.

Change-Id: Icb1528c0cd35b1aa9323386cb35ff4aaba374fcb
2014-06-03 11:11:47 +01:00
Baligh Uddin
f982274db9 Import translations. DO NOT MERGE
Change-Id: If356617f03ddecc5b3512f53e4061887c9e74bb0
Auto-generated-cl: translation import
2014-05-20 09:08:39 -07:00
Elliott Hughes
d9e6101862 am 05678e17: resolved conflicts for merge of 3ce4f3d0 to master
* commit '05678e17e8c079a1c1c144e23e40a7a644a0b040':
  Track libcore.os' move to android.system.
2014-04-28 21:22:01 +00:00
Elliott Hughes
10596fbcce resolved conflicts for merge of 3ce4f3d0 to master
Change-Id: Id5c5997ad8f801b32e1dbd97413ea42e38c27210
2014-04-28 13:53:25 -07:00
Elliott Hughes
34385d352d Track libcore.os' move to android.system.
(This is partial, but should cover everything in AOSP master except
for the zygote.)

Change-Id: I1042c99245765746a744c44e714095cb2c6cb75d
2014-04-28 11:11:32 -07:00
Baligh Uddin
6b5a2f97b7 Import translations. DO NOT MERGE
Change-Id: Ic8c5ae13c6ed3ad711170586a245452195c6d963
Auto-generated-cl: translation import
2014-04-23 12:12:46 -07:00
Ying Wang
38250d9b84 Use LOCAL_JNI_SHARED_LIBRARIES to install JNI libs.
Change-Id: Ibef01983891377b859d28cff801f48ef5d8eabb2
2014-04-18 16:39:47 -07:00
Ying Wang
56f43240f9 Use LOCAL_JNI_SHARED_LIBRARIES to install JNI libs.
Change-Id: Ibef01983891377b859d28cff801f48ef5d8eabb2
2014-04-17 18:14:50 -07:00
Narayan Kamath
d11f223c53 resolved conflicts for merge of 286a247e to master
Change-Id: I63df9d482da3ce2ac851959223b9180020ffad0c
2014-04-10 10:38:31 +01:00
Ramin Zaghi
1378aba7ae Re-implement native library search and copies.
We now use a two step approach :

- First we look through the list of shared libraries in an
  APK, and choose an ABI based on the (priority)  list of ABIs
  a given device supports.
- Then we look through the list of shared libraries and copy
  all shared libraries that match the ABI we've selected.

This fixes a long-standing bug where we would sometimes copy
a mixture of different ABIs to the device, and also allows us
to clearly pick an ABI to run an app with.

The code in NativeLibraryHelper has been refactored so that all
file name validation & matching logic is done in a single place
(NativeLibrariesIterator). This allows us to avoid a lot of
redundant logic and straightens out a few corner cases (for eg.
where the abi determination & copying logic do not agree on
what files to skip).

bug: https://code.google.com/p/android/issues/detail?id=65053
bug: 13647418

Change-Id: I34d08353f24115b0f6b800a7eda3ac427fa25fef
Co-Authored-By: Zhenghua Wang <zhenghua.wang0923@gmail.com>
Co-Authored-By: Ramin Zaghi <ramin.zaghi@arm.com>
Co-Authored-By: Narayan Kamath <narayan@google.com>
2014-04-09 17:16:40 +01:00
Baligh Uddin
38bae539f8 Remove deprecated locales
Bug:11340849
Change-Id: Ib99486303927a6bce308b113d70f8e5b5bce4a13
2013-12-09 22:41:12 +00:00
John Spurlock
6090995951 Remove unused imports from frameworks/base.
Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
2013-11-20 11:31:47 -05:00
Baligh Uddin
27b7534f8e Import translations. DO NOT MERGE
Change-Id: I6b9b8488aabcd5c903c1fa32b66b04d9b29101ac
Auto-generated-cl: translation import
2013-08-28 18:32:51 -07:00
Baligh Uddin
6dbfa15f98 Import translations. DO NOT MERGE
Change-Id: I626a2582ed52cc4fe4c45d52c6f15527e1d5715e
Auto-generated-cl: translation import
2013-08-26 09:50:53 -07:00
Baligh Uddin
f27b037012 Import translations. DO NOT MERGE
Change-Id: Ifff3fa5dd9cfb5a7f3fc84f4cf14ffa42446fbe0
Auto-generated-cl: translation import
2013-08-19 08:20:40 -07:00
Jeff Sharkey
7f392defcc Catch a few extra users of UserEnvironment.
Change-Id: I3112773b72c329893e4118ef1c4f4087d899139e
2013-08-11 17:42:17 -07:00
Elliott Hughes
a7ac8be1f5 am dff4ec87: am e16a21c6: resolved conflicts for merge of 4a59376d to stage-aosp-master
* commit 'dff4ec87e7b942b7b4410f639fc74c2cffb386d6':
  Track libcore API change.
2013-07-11 10:16:46 -07:00
Elliott Hughes
e16a21c6b4 resolved conflicts for merge of 4a59376d to stage-aosp-master
Change-Id: I0e40180b46dc58781c218b8d382299dab73d49cc
2013-07-09 15:25:23 -07:00
Elliott Hughes
befd0b1bdf Track libcore API change.
Change-Id: Ib818a7f21325c5f918bf497033a90d76b25ec9e7
2013-07-09 14:46:18 -07:00
Christopher Tate
ccbf84f44c Some system apps are more system than others
"signatureOrSystem" permissions are no longer available to all apps
residing en the /system partition.  Instead, there is a new /system/priv-app
directory, and only apps whose APKs are in that directory are allowed
to use signatureOrSystem permissions without sharing the platform cert.
This will reduce the surface area for possible exploits of system-
bundled applications to try to gain access to permission-guarded
operations.

The ApplicationInfo.FLAG_SYSTEM flag continues to mean what it is
says in the documentation: it indicates that the application apk was
bundled on the /system partition.  A new hidden flag FLAG_PRIVILEGED
has been introduced that reflects the actual right to access these
permissions.

At some point the "system" permission category will be
renamed to "privileged".

Bug 8765951

Change-Id: I6f0fd9cdb9170e076dfc66d83ecea76f8dd7335d
2013-06-17 12:47:35 -07:00
Jeff Sharkey
5adb34f022 Always close incoming PFD to avoid leaking.
Change-Id: I9559bb1e83c9bf2f9fd2af9c7b0d8b9e3aadc4ae
2013-04-25 11:35:12 -07:00
Ying Wang
d685894212 Add liblog
Bug: 8580410
Change-Id: I746aa8258866508c3a725d0773faf4518096548f
2013-04-09 21:54:12 -07:00
Jeff Sharkey
63d0a06799 Improve performance of storage measurement.
When calculating directory sizes of data living on emulated external
storage, translate the path to use the internal backing data, which
avoids going through the emulation layer.  It carefully retreats to
the original path when it runs into trouble.

Testing with a hierarchy of 10 directories deep and 2 directories
and 10 files wide at each level, this change improves performance
from 5900ms before to 250ms after; over 20 times faster (!).

Bug: 8172425
Change-Id: Ia7365416f091e102bf7345a49f7d7209a22580a9
2013-03-01 16:36:52 -08:00
Dianne Hackborn
221d59f723 am afdd978c: am 68e0da7e: Merge "Quiet down a lot of logging." into jb-mr1.1-dev
* commit 'afdd978ccd8d45ac789873dd4cf0ab0dd3f46d20':
  Quiet down a lot of logging.
2012-11-29 14:25:40 -08:00