292 Commits

Author SHA1 Message Date
Christopher Tate
11ae768cf1 Add payload-size preflight stage to full transport backup
We now peform a total-size preflight pass before committing data to the
wire.  This is to eliminate the large superfluous network traffic that
would otherwise happen if the transport enforces internal quotas: we
now instead ask the transport up front whether it's prepared to accept
a given payload size for the package.

From the app's perspective this preflight operation is indistinguishable
from a full-data backup pass.  If the app has provided its own full-data
handling in a subclassed backup agent, their usual file-providing code
path will be executed.  However, the files named for backup during this
pass are not opened and read; just measured for their total size.  As
far as component lifecycles, this measurement pass is simply another
call to the agent, immediately after it is bound, with identical
timeout semantics to the existing full-data backup invocation.

Once the app's file set has been measured the preflight operation
invokes a new method on BackupTransport, called checkFullBackupSize().
This method is called after performFullBackup() (which applies any
overall whitelist/blacklist policy) but before any data is delivered
to the transport via sendBackupData().  The return code from
checkFullBackupSize() is similar to the other transport methods:
TRANSPORT_OK to permit the full backup to proceed; or
TRANSPORT_REJECT_PACKAGE to indicate that the requested payload is
unacceptable; or TRANSPORT_ERROR to report a more serious overall
transport-level problem that prevents a full-data backup operation
from occurring right now.

The estimated payload currently does not include the size of the
source-package metadata (technically, the manifest entry in its
archive payload) or the size of any widget metadata associated with
the package's install.  In practice this means the preflighted size
underestimates by 3 to 5 KB.  In addition, the preflight API currently
cannot distinguish between payload sizes larger than 2 gigabytes;
any payload estimate larger than that is passed as Integer.MAX_VALUE
to the checkFullBackupSize() query.

Bug 19846750

Change-Id: I44498201e2d4b07482dcb3ca8fa6935dddc467ca
2015-03-26 18:57:36 -07:00
Adam Lesinski
8a9355a98e Output modified bcp47 tag in ResTable_config::toString()
We expect to be able to parse the output of ResTable_config::toString(),
so it should use modified bcp47 (b+en+Latn+US).

Change-Id: I597a1779a1fa5cff171c473e6a0368d93b9c7722
2015-03-16 22:25:26 +00:00
Vishwath Mohan
6521a1b743 Enforce null-termination in ResStringPool::stringAt
Rejects any non null-terminated string that a caller asks
ResStringPool::stringAt for, returning NULL instead.

The rationale for returning NULL rather than amending the string to add
a null-terminator is that conformant APK files will have all their
strings null-terminated anyway, and that this is a possible signal of a
malformed package.

Bug: 15288069
Change-Id: I370937b92f2cadf67fbd54203cbc7d1494be969f
2015-03-11 16:36:53 -07:00
Vishwath Mohan
6a2c23dc1b Prevent integer overflow in ResourceTypes
Adds checks to 2 malloc() calls to ensure that the finally allocated
buffer size is not vulnerable to integer overflows. Also includes a
sanity check on the upper bound for type_info.numEntries before each
call.

Bug: 15171384
Change-Id: Ifdf0276bcca7e3d93da7c3577b9486d3c03a9d03
2015-03-10 12:34:08 -07:00
Narayan Kamath
23eeb2b8ae am 287c53f4: am 76507a64: am 72dc62ea: Merge "Track removal of refcounts from FileMap."
* commit '287c53f4a8bade1cb6c2dd2fe858da9c303e3e3d':
  Track removal of refcounts from FileMap.
2015-02-24 13:09:55 +00:00
Narayan Kamath
76507a64b5 am 72dc62ea: Merge "Track removal of refcounts from FileMap."
* commit '72dc62ead214bdec5c46d42f4e859b139dba0a00':
  Track removal of refcounts from FileMap.
2015-02-24 12:56:52 +00:00
Narayan Kamath
688ff4cf0f Track removal of refcounts from FileMap.
Use delete instead of release.

Change-Id: I25c841b368aa9d51e9259399b94cafa2bbb7a076
2015-02-23 15:47:54 +00:00
Adam Lesinski
43a88535df am d9bd0886: am aee7225e: Merge "Process base APK" into lmp-mr1-dev automerge: 554a6f5
* commit 'd9bd08864eaf9d8847d974eadb81806b9e086a2d':
  Process base APK
2015-01-20 22:03:16 +00:00
Adam Lesinski
d9bd08864e am aee7225e: Merge "Process base APK" into lmp-mr1-dev
automerge: 554a6f5

* commit '554a6f5278ec05077d8252249afc911897fbfe76':
  Process base APK
2015-01-20 21:55:12 +00:00
Adam Lesinski
42eea270a0 Process base APK
The base APK may have resources with configurations that compete
against some splits. The base APK must be involved in the selection
of splits.

Bug:18982001
Change-Id: Ieb29b5a36cf2c68e7831484d98a9fd275acd97e8
2015-01-16 14:11:30 -08:00
Brian Carlstrom
33d0392d3e Restore write_delete_file
(cherry picked from commit 5baa164aec06a9973a68303bc7752aa76e5c68e5)

Change-Id: Ifa9a157346edd479ce03982baf435ab213dc2e79
2015-01-14 20:39:26 -08:00
Christopher Tate
33194035a5 am 49138184: am 9568307c: am 43a4a8c7: Fix redundant file backups
* commit '49138184dee54357b1923f302e4b3fedd73ca34f':
  Fix redundant file backups
2015-01-15 04:30:34 +00:00
Brian Carlstrom
5baa164aec Restore write_delete_file
Change-Id: Id93a59ae6c82f6068c58b22e2a651ff8a3b8f530
2015-01-14 18:19:54 -08:00
Christopher Tate
49138184de am 9568307c: am 43a4a8c7: Fix redundant file backups
* commit '9568307cf32c8abc6703dc7a1b0b0fee56c4f8f5':
  Fix redundant file backups
2015-01-15 01:39:29 +00:00
Christopher Tate
43a4a8c777 Fix redundant file backups
We'd observed a bug in which an unchanged file was nevertheless
being redundantly transmitted for backup on every backup pass.
The underlying issue turns out to have been the FileBackupHelper
base implementation's logic for diffing the prior-state file
set against the current state, in the case when there had been
deletions of prior files.  In addition, there was also a
parallel bug in which file checksums were not calculated
properly in some cases, leading to at least one additional
redundant backup of the file in question.

Bug 18694053

Change-Id: Ie0dec06486b5fef4624561737019569c85d6b2a0
2015-01-14 16:36:30 -08:00
Elliott Hughes
c2b7abdbb2 am 1e147221: am d6c475dc: am 595ae39f: Merge "Use more intention-revealing tests for S_ISLNK and S_ISSOCK."
* commit '1e14722167210e176cc1f6e702f1a7a98271c6d2':
  Use more intention-revealing tests for S_ISLNK and S_ISSOCK.
2015-01-13 20:32:52 +00:00
Elliott Hughes
1e14722167 am d6c475dc: am 595ae39f: Merge "Use more intention-revealing tests for S_ISLNK and S_ISSOCK."
* commit 'd6c475dc246b1681f5c9af9e00ac74183812329c':
  Use more intention-revealing tests for S_ISLNK and S_ISSOCK.
2015-01-13 01:32:37 +00:00
Elliott Hughes
1bf2481233 Use more intention-revealing tests for S_ISLNK and S_ISSOCK.
Change-Id: Ia7f13eb7d5a36cf2b4c0a253b2b4d7f7af396951
2015-01-12 14:33:04 -08:00
Adam Lesinski
a76db13fb0 am 347040cf: am 740acf21: am c7801877: Merge "Fix issue where non-resource attributes would cause obtainStyleAttributes to fail" into lmp-mr1-dev
* commit '347040cf84401601b0d5cbb1d76e4648d1c8a461':
  Fix issue where non-resource attributes would cause obtainStyleAttributes to fail
2014-12-11 01:38:33 +00:00
Adam Lesinski
347040cf84 am 740acf21: am c7801877: Merge "Fix issue where non-resource attributes would cause obtainStyleAttributes to fail" into lmp-mr1-dev
* commit '740acf213c56c406132294790fa2fadd0380cfa7':
  Fix issue where non-resource attributes would cause obtainStyleAttributes to fail
2014-12-11 00:07:02 +00:00
Adam Lesinski
5dce5e67db Fix issue where non-resource attributes would cause obtainStyleAttributes to fail
A sentinal value of 0x00000000 was used to mark the first time an AttributeFinder
was used. If the resource ID of an attribute was also 0x00000000 (which occurs with
non-resource attributes, like 'style'), then it would be mistaken as the sentinel
start value.

Bug:18421787
Change-Id: I4be353e0f8c940cb6f262d155129f048dcc444ae
2014-12-10 10:51:48 -08:00
Adam Lesinski
7e74da3172 am e97908d3: Merge commit \'0953ab27\' into manualmerge
* commit 'e97908d32ee8ea80138d085260a0eac93841c722':
  AAPT: Move private attrs to new type for framework
2014-12-05 19:16:27 +00:00
Adam Lesinski
e97908d32e Merge commit '0953ab27' into manualmerge
Change-Id: I36dea45f7571096136ea7bda5e2680bd85a0df32
2014-12-05 11:06:21 -08:00
Adam Lesinski
63377406f7 am 8e5362f2: am 503071ae: am a2b5067a: Merge "RRO: prevent duplicate system overlays"
* commit '8e5362f20e2bc41b1dcf130a613b7e0b3cd1db58':
  RRO: prevent duplicate system overlays
2014-12-04 16:17:12 +00:00
Adam Lesinski
8e5362f20e am 503071ae: am a2b5067a: Merge "RRO: prevent duplicate system overlays"
* commit '503071ae41374a66f61e53e05a91243473db83b9':
  RRO: prevent duplicate system overlays
2014-12-04 09:21:45 +00:00
Adam Lesinski
9b624c186c AAPT: Move private attrs to new type for framework
Private attributes are typically placed after public
attributes in the resource table. Each time a new version
of the Android framework is released, new public attributes
take the place of the private attributes, and the private
attributes are shifted after the new public ones.

This means that any apps built against the newer SDK
may inadvertently be using private attributes on older
devices.

This change moves all private attributes to a completely
different type ID, so there will never be collisions across
versions.

These private attributes are automatically moved to a synthesized
type only for the system resources.

Bug:18263655

Change-Id: I7a850512953fadcc9f3524d509cea30249782db8
2014-12-03 15:59:20 -08:00
Adam Lesinski
a2b5067aee Merge "RRO: prevent duplicate system overlays" 2014-12-03 17:44:18 +00:00
Adam Lesinski
625fa573b4 am 9438ad15: am e580d661: am e89a2865: Merge changes If2c7e09f,Ie21f227c
* commit '9438ad1599716176fb6c593e77a2e93b265bbcb5':
  RRO idmap: pad with 0xffffffff, not 0x00000000
  RRO: reintroduce lost ResTable insert of assets
2014-12-03 00:30:56 +00:00
Adam Lesinski
9438ad1599 am e580d661: am e89a2865: Merge changes If2c7e09f,Ie21f227c
* commit 'e580d6617f67a1db5eff7ffe5450684cfc7e1a2b':
  RRO idmap: pad with 0xffffffff, not 0x00000000
  RRO: reintroduce lost ResTable insert of assets
2014-12-02 23:07:43 +00:00
Adam Lesinski
e89a286541 Merge changes If2c7e09f,Ie21f227c
* changes:
  RRO idmap: pad with 0xffffffff, not 0x00000000
  RRO: reintroduce lost ResTable insert of assets
2014-12-02 22:52:37 +00:00
Elliott Hughes
476edb5701 am ee46d162: am 08e2fd72: am ff4dd15c: Merge "We HAVE_LITTLE_ENDIAN."
* commit 'ee46d1621f817d626e8dd42e9ffe7051f4a829eb':
  We HAVE_LITTLE_ENDIAN.
2014-11-22 08:04:38 +00:00
Elliott Hughes
ee46d1621f am 08e2fd72: am ff4dd15c: Merge "We HAVE_LITTLE_ENDIAN."
* commit '08e2fd7238c50b5d06af41bc944ee08acb023d51':
  We HAVE_LITTLE_ENDIAN.
2014-11-22 07:56:46 +00:00
Elliott Hughes
9d074a1fb7 We HAVE_LITTLE_ENDIAN.
Change-Id: I5b5d0ef3f91fe84d629d2ddac436bd22019edfd4
2014-11-21 23:36:45 -08:00
Adam Lesinski
d97237071d am 11bdd5b1: Merge commit \'06d8b7b8\' into manualmerge
* commit '11bdd5b10b5f921b657283fa94463263171218d5':
  Implement back-tracking when searching for attributes in XML or resource bag
2014-11-17 20:27:32 +00:00
Adam Lesinski
11bdd5b10b Merge commit '06d8b7b8' into manualmerge
Conflicts:
	core/jni/android_util_AssetManager.cpp

Change-Id: I77b72d0d3ec8184ccd97419e4c76b7d55b1a52ca
2014-11-17 12:17:16 -08:00
Adam Lesinski
cd6f00c3a0 Merge "Implement back-tracking when searching for attributes in XML or resource bag" into lmp-mr1-dev 2014-11-17 19:39:17 +00:00
Elliott Hughes
32291900ec am 984d81c3: am c34e6359: Merge "bionic\'s struct stat is now POSIX-compliant."
* commit '984d81c3937d46240fb9645ffa37c5166284a983':
  bionic's struct stat is now POSIX-compliant.
2014-11-10 22:18:10 +00:00
Elliott Hughes
984d81c393 am c34e6359: Merge "bionic\'s struct stat is now POSIX-compliant."
* commit 'c34e63598e318c9aa0debde09730a26c64bc1203':
  bionic's struct stat is now POSIX-compliant.
2014-11-10 22:10:21 +00:00
Elliott Hughes
4da9dc5a62 bionic's struct stat is now POSIX-compliant.
One less hack needed...

Bug: 18298106
Change-Id: I1e9e5ebf329bd6cbaf3445201f182793ee4871ce
2014-11-10 10:48:25 -08:00
Andreas Gampe
c6dcf1fd67 am 5bbb52e8: am 189bf056: Merge "Frameworks/base: Fix more warnings"
* commit '5bbb52e8a4242efeea27921ac3e38cf6f9c56162':
  Frameworks/base: Fix more warnings
2014-11-09 00:52:52 +00:00
Andreas Gampe
5bbb52e8a4 am 189bf056: Merge "Frameworks/base: Fix more warnings"
* commit '189bf05616b854f0319c7329a96e63ad374fd6c0':
  Frameworks/base: Fix more warnings
2014-11-09 00:48:11 +00:00
Andreas Gampe
25df5fba3a Frameworks/base: Fix more warnings
Exposed by switching the target to Clang, and GCC 4.9 used by
MIPS.

Change-Id: Icb79285ab2306c39c2d381e53ea2e643ee2d2947
2014-11-07 22:24:57 -08:00
Andreas Gampe
1c0668a3f8 am 83892ecb: Merge "resolved conflicts for merge of 487ae9b8 to lmp-mr1-dev-plus-aosp" into lmp-mr1-dev-plus-aosp
* commit '83892ecb5c38f6e8a216e1596cd6a16bf7bd6a55':
  Frameworks/base: Wall Werror in libs/androidfw
2014-11-07 23:17:40 +00:00
Andreas Gampe
dc9c109af8 resolved conflicts for merge of 487ae9b8 to lmp-mr1-dev-plus-aosp
Change-Id: I395f184d885a7ef30aa113ab01fcaacc94243008
2014-11-07 15:14:02 -08:00
Andreas Gampe
2204f0bf56 Frameworks/base: Wall Werror in libs/androidfw
Turn on -Wall -Werror in libs/androidfw. Fix warnings. Refactor
some code.

Change-Id: I66fe54ace433c15dee5de328b149ca142f74b2dd
2014-11-07 13:35:05 -08:00
Mårten Kongstad
cb7b63d928 RRO: prevent duplicate system overlays
System overlays, ie overlays with targetPackage="android", were loaded
twice, which caused all sorts of issues. Ensure they are only loaded
once, which will be during Zygote initialization.

Bug: 17765434
Change-Id: Ia5064045c77f713c58fb78adc3942f6af1abdc93
2014-11-07 16:08:22 +01:00
Mårten Kongstad
96198ebae8 RRO idmap: pad with 0xffffffff, not 0x00000000
In the new idmap format (version 0x1), 0x00000000 no longer represents a
non-existing entry: 0xffffffff should be used instead.

Bug: 17765434
Change-Id: If2c7e09feba2224eeafe88fd9230e6392d81b9a7
2014-11-07 16:08:04 +01:00
Mårten Kongstad
30113131fb RRO: reintroduce lost ResTable insert of assets
With the recent introduction of AssetManager::appendPathToResTable,
overlay packages were not properly added to the AssetManager, and once
added, were not properly inserted into the ResTable.

Bug: 17765434
Change-Id: Ie21f227c654c98730f74a687d0e16ee2b80e747e
2014-11-07 16:07:42 +01:00
Adam Lesinski
1adf320606 am 8491c4ea: Merge "Merge commit \'fb96e54\' into manualmerge" into lmp-mr1-dev-plus-aosp
* commit '8491c4ead7dba5cfd406cf99a511fc1dce07cc4d':
  Add error checking to aapt for split generation
2014-11-05 20:35:27 +00:00
Adam Lesinski
685d363d7a Merge commit 'fb96e54' into manualmerge
Conflicts:
	tools/aapt/Resource.cpp

Change-Id: I4147c3550e9426f3429146eaeb16f10ba76b5b15
2014-11-05 12:30:25 -08:00