305 Commits

Author SHA1 Message Date
Yusuke Sato
34fe3df851 Let findSupportedAbi and hasRenderscriptBitcode scan only relevant files
for better performance. Without the optimization, these two functions
may check more than 100k file names in the pre-installed APK files,
which can take a few seconds to finish even on a recent device.

Bug: 21957428
Change-Id: I315fd3c6d5aa1076b993752525de449a9933de12
2015-06-22 16:11:32 -07:00
Narayan Kamath
4600dd053d ZipFileRO: Use precise widths for zip file types.
getEntryInfo crashes on 64-bit devices because "long" types
were being passed int pointers (that pointed to a stack frame)
that were reinterpret_cast'ed to long* (sigh.). To fix this issue
once and for all, use types with explicitly defined widths.

This change also removes some dead invariant checking from
Asset.cpp instead of cleaning it up.

Note that we've introduced a wart in NativeLibraryHelper, where
we need to deal with zlib's uLong type, which is "at least 32 bits
wide".

bug: 21622286

Change-Id: Iae675a9601db7aae03a8b80b40321d2cc1d97f50
2015-06-17 08:40:25 +00:00
Adam Lesinski
2738c96d99 Add -round and -notround qualifier to android runtime/aapt
The round qualifier denotes a device with a screen shape that
is round. The qualifier shows up after the 'long/notlong' qualifier
and before the orientation 'port/land/square' qualifiers.

Change-Id: I3044258b2703a9165694b79725bade770fa6cea1
2015-05-15 15:10:58 -07:00
Narayan Kamath
5a7587fa90 Fix file descriptor leak when opening invalid archives.
I've inspected all other callers of OpenArchive and this seems
to be the only broken one. The easiest way to reproduce this is
by using getPackageArchiveInfo or by adding an asset path that
isn't a valid APK.

bug: https://code.google.com/p/android/issues/detail?id=171099
Change-Id: I41cd85d20f26ad47968e2a6f1384cc03330b558b
2015-05-12 10:37:18 +00:00
Alan Viverette
e54d245b99 Improve keying for theme caches, rebase system theme on config change
Themes now use an array of applied styles rather than a String to store
their history. They are keyed based on a hash code computed from the
history of applied styles. The themed drawable cache has been abstracted
out into its own class.

Also updates system context to use DayNight as the default and ensures
that GlobalActions uses the correct context, which exercises the change.

CTS tests have been added in another CL.

Bug: 20421157
Change-Id: I9eb4b7dffd198ad24d02f656eaf0839570b59caa
2015-05-06 10:41:43 -07:00
Alan Viverette
261208e002 Merge "Add API for obtaining changing configurations bitmask from Theme" into mnc-dev 2015-05-05 16:50:29 +00:00
Alan Viverette
c1d527926e Add API for obtaining changing configurations bitmask from Theme
Required to know when to reload the system context's theme in response
to configuration changes, and thus needed to support the DayNight theme.

Bug: 20267825
Change-Id: I7df5e28b7a6d8b611ea030032544cf4800788514
2015-05-05 09:49:03 -07:00
Narayan Kamath
bb4ed9aa3a am 815d9bb1: Merge "Add a static dependency on libbase."
* commit '815d9bb178a0488ed1579cd230d447630ad0891b':
  Add a static dependency on libbase.
2015-04-29 14:38:15 +00:00
Narayan Kamath
9c8ba9666d Add a static dependency on libbase.
Used by libziparchive.

Change-Id: I120494b620c72b36a725b01f1f274f5dc862a9a3
2015-04-29 14:07:41 +00:00
Nick Kralevich
2eb10c0075 am 05ad674a: am 00e165ae: am e8101c04: Merge "fix compiler error under FORTIFY_SOURCE=2"
* commit '05ad674aa888e3f9217de0e5c3176161dd8e31aa':
  fix compiler error under FORTIFY_SOURCE=2
2015-04-25 22:05:25 +00:00
Nick Kralevich
9709a1f04c fix compiler error under FORTIFY_SOURCE=2
frameworks/base/libs/androidfw/ObbFile.cpp:340:5: error: ignoring return value of function declared with warn_unused_result attribute [-Werror,-Wunused-result]
    ftruncate(fd, mFooterStart);
    ^~~~~~~~~ ~~~~~~~~~~~~~~~~
1 error generated.
amake: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libandroidfw_intermediates/ObbFile.o] Error 1

Change-Id: I7080d64e7a830a10b41c1ebf33c60d32b7c8356e
2015-04-24 20:27:06 -07:00
Dan Albert
39606e9f78 am 7b09e7a9: am 44d7989a: am 571c5a26: Merge "Fix UB in ResourceTable::stringToInt."
* commit '7b09e7a9f3ef804e9cd159023b64eac1ef8b7931':
  Fix UB in ResourceTable::stringToInt.
2015-04-15 00:07:01 +00:00
Dan Albert
1b4f316651 Fix UB in ResourceTable::stringToInt.
Was here because UBsan found integer overflow in the parsing for hex
numbers, since hex numbers here are actually unsigned but assigned to
a signed integer.

Also fixes a number of missing error conditions.

Change-Id: Iaea576daedfc6c75521cde02de3fe9dd0198a3b7
2015-04-08 14:12:21 -07:00
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