2599 Commits

Author SHA1 Message Date
Leon Scroggins III
a730ef3f77 Handle bad ninepatch data.
Changes proposed by Ben Hawkes of Google Project Zero.

NinePatchPeeker.cpp:
Instead of asserting, return false for bad data.

ResourceTypes.h:
Store ninepatch values as unsigned.

BUG:19151999
Change-Id: Ibe35e7569f632c6bb8a34a7701e26bb6ed547ec2
2015-01-27 16:41:16 +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
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
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
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
a7d1d73a47 Implement back-tracking when searching for attributes in XML or resource bag
Shared libraries have their package ID assigned at run-time, so some
of the guarantees we used to have about sort order of attributes in
bags or XML elements no longer hold.

This CL adds back-tracking and can jump to the nearest attribute with the
same package ID and continue searching.

This means that attributes with the same package ID must be sorted by increasing
resource ID, as was the case before.

Attributes with the same package ID must be grouped together, but the groups can
be in any order. Ex: 0x02010001, 0x02010002, 0x01010000, 0x01010010, 0x7f010032

Bug:17666947
Change-Id: I9c198bbb6ca788849aac85b6323606ea5d9550d6
2014-11-04 16:34:34 -08:00
Adam Lesinski
668f0a356c Merge "Fix issues that will be present in C++11" into lmp-mr1-dev 2014-11-03 23:38:43 +00:00
Adam Lesinski
4bf58108d4 Fix issues that will be present in C++11
- char16_t is a distinct type, so stay consistent
  with it throughout the code base.
- char16_t is defined as minimum size of 16 bits.
  Since we mmap and cast data structures onto raw memory,
  we need a precise definition (uint16_t), so we cast between
  that (and static_assert that they are the same size).

Change-Id: I869c32637543bbcfb39d2643e7d9df10d33acd3c
2014-11-03 11:49:47 -08:00
Alan Viverette
f296940502 Distinguish unspecified and explicit null values in resources
BUG: 17919345
Change-Id: Ic4f04f7dd0f986f58a749b5950d80c1cfdb074ea
2014-10-29 17:09:36 -07:00
Adam Lesinski
b6812b64c4 Merge "Fix backwards compat problem with AAPT public attrs" into lmp-dev 2014-09-19 18:19:58 +00:00
Mike Lockwood
51938c205f Merge "USB string descriptors are not UTF8, so it is not safe to treat them as such." into lmp-dev 2014-09-19 02:00:26 +00:00
Adam Lesinski
82a2dd8efe Fix backwards compat problem with AAPT public attrs
AAPT has traditionally assigned resource IDs to public attributes,
and then followed those public definitions with private attributes.

--- PUBLIC ---
| 0x01010234 | attr/color
| 0x01010235 | attr/background

--- PRIVATE ---
| 0x01010236 | attr/secret
| 0x01010237 | attr/shhh

Each release, when attributes are added, they take the place of the private
attributes and the private attributes are shifted down again.

--- PUBLIC ---
| 0x01010234 | attr/color
| 0x01010235 | attr/background
| 0x01010236 | attr/shinyNewAttr
| 0x01010237 | attr/highlyValuedFeature

--- PRIVATE ---
| 0x01010238 | attr/secret
| 0x01010239 | attr/shhh

Platform code may look for private attributes set in a theme. If an app
compiled against a newer version of the platform uses a new public
attribute that happens to have the same ID as the private attribute
the older platform is expecting, then the behavior is undefined.

We get around this by detecting any newly defined attributes (in L),
copy the resource into a -v21 qualified resource, and delete the
attribute from the original resource. This ensures that older platforms
don't see the new attribute, but when running on L+ platforms, the
attribute will be respected.

We still need to address this problem in the platform moving forward,
as this will only help us in the transition from pre L to L.

Bug:17520380
Change-Id: Ia2a985798b50006c21c7c3431d30d9598f27cd91
2014-09-18 14:05:24 -07:00
Jeff Brown
00c0cd4a24 Clean entire arg block when setting process name.
When Android processes fork from Zygote, we rewrite the command line
with a new name, eg. "system_server".  When we do this, we should
fill the entire block with zeros to remove corrupted argument
information that may otherwise remain in the /proc/<pid>/cmdline buffer
and be seen in tools and stack dumps.

Fixed an issue where VM options could be overwritten after setting
the nice name if the name was too long.

Bug: 17474152
Change-Id: Ie6cf9ed7752a04300a340e26cd6812bb35c59e1b
2014-09-11 14:19:52 -07:00
Mike Lockwood
9ee5e7e17f USB string descriptors are not UTF8, so it is not safe to treat them as such.
Add AndroidRuntime::NewStringLatin1() to convert non-UTF8 strings to Java strings.

Bug: 17427781
Change-Id: I7df1d4e94a7beebc8b1a74c0c0a163b794025ae8
2014-09-08 17:05:44 -07:00
Adam Lesinski
ad2d07d2d9 Stamp platform version code into app Apks
The versionCode of theframework resources that an app is built against
gets stamped inside an app's AndroidManifest.xml in the <manifest>
tag as "platformBuildVersionCode" and "platformBuildVersionName"
attributes.

Bug:17207635
Change-Id: Id573c3dffcbca38eec9c0eb3e89f4a547e3361d3
2014-08-27 18:28:49 -07:00
Adam Lesinski
31245b4f06 Introduce anydpi density resource qualifier
This is meant to be used with scaleable vector
drawables, and are chosen as the best match unless
there is a configuration that matches the density
requested exactly.

Bug:17007265
Change-Id: Ic3288d0236fe0bff20bb1599aba2582c25b0db32
2014-08-25 17:47:30 -07:00
Adam Lesinski
6022debdbc AAPT: Fix regression generating dynamic ref table for shared libraries
AAPT stopped generating dynamic reference tables for shared libraries.

Change-Id: Ib0025811bdca1a4756eb21080dd6b6bb3fc1ca3d
2014-08-20 17:55:33 -07:00
Adam Lesinski
ec64709ce0 Merge "AAPT support for feature splits" into lmp-dev 2014-08-09 00:40:15 +00:00
Adam Lesinski
833f3ccbc8 AAPT support for feature splits
This change allows the developer to add a base package for
which to build a feature split. The generated resource types
will begin after the base APK's defined types so as not
to collide or override resources.

Multiple features can be generated by first choosing an
arbitrary order for the features. Then for each feature,
the base APK and any preceding features are specified
with the --feature-of flags.

So with a base APK 'A' and features, 'B', and 'C',
'B' would be built with

aapt package [...] --feature-of A [...]

and 'C' would be built with

aapt package [...] --feature-of A --feature-of B [...]

Change-Id: I1be66e3f8df9a737b21c71f8a93685376c7e6780
2014-08-04 18:48:14 -07:00
Brian Carlstrom
0d8fb01963 Disable compilation based on vold.decrypt. [frameworks/base]
Bug: 15165413

(cherry picked from commit 4fd561637a173c7fa6a1d71e9115db1db90514ff)

Change-Id: I2a13b63f9d4a7ffd69a8d21666c6dce84739c6ed
2014-08-06 22:25:01 -07:00
Brian Carlstrom
3fbfbb4ade Move from dalvik.vm.image-dex2oat-flags to dalvik.vm.dex2oat-filter [frameworks/base]
This will allow us to conditionally change the compiler-filter based on other properties.

Bug: 15165413

(cherry picked from commit f60d3a4702f6d00d7edb5d348c53b9b03ae16b76)

Change-Id: I293c81ba817e9abbf9c05b3fb554ef2f0ad0c4ed
2014-08-06 22:25:00 -07:00
Bo Liu
590b8d3601 Merge "Add kModeSync" into lmp-dev 2014-07-24 20:48:02 +00:00
John Reck
09d5cddf67 Add kModeSync
Bug: 16526750

Change-Id: I4c087160e80432739321172fd57880846c8de6e0
2014-07-24 10:36:08 -07:00
Derek Sollenberger
cae05e0b4c Move Canvas.h to a new location so that it can be shared with HWUI.
Bug: 15672762
Change-Id: Ia59e986cd4034e16b2e54e8d594e6941a6c9fb1b
2014-07-25 11:39:37 -04:00
Martin Kosiba
7df3625d5b Allow for appending of resources to an AssetManager.
BUG: 11505352
Change-Id: Ifa290580a6dc63c2f471d0bbf5f066db14aed4d7
2014-07-17 18:10:02 +01:00
Brian Carlstrom
2194963181 am ce75618e: am 5aba0149: am b85afb38: Merge "Make dex2oat heap size product configurable [frameworks/base]"
* commit 'ce75618e12deebe302c551281ce56c0d60138e0f':
  Make dex2oat heap size product configurable [frameworks/base]
2014-07-09 15:07:35 +00:00
Brian Carlstrom
ce75618e12 am 5aba0149: am b85afb38: Merge "Make dex2oat heap size product configurable [frameworks/base]"
* commit '5aba0149b953fb8e85851811dde995fb35c10051':
  Make dex2oat heap size product configurable [frameworks/base]
2014-07-09 12:36:47 +00:00
Brian Carlstrom
6d77eb99bf Make dex2oat heap size product configurable [frameworks/base]
Bug: 15919420
Change-Id: I9b7b4f60826fc9b0cc6bb3765ceaa36542425006
2014-07-08 15:05:41 -07:00
Adam Lesinski
f90f2f8dc3 Support multiple resource tables with same package
In order to support APK split features, the resource
table needs to support loading multiple resource
tables with the same package but potentially new set
of type IDs.

This adds some complexity as the type ID space changes
from dense and ordered to potentially sparse.

A ByteBucketArray is used to store the type IDs in
a memory efficient way that allows for fast retrieval.

In addition, the IDMAP format has changed. We no longer
need random access to the type data, since we store the
types differently. However, random access to entries of
a given type is still required.

Change-Id: If6f5be680b405b368941d9c1f2b5d2ddca964160
2014-06-18 19:20:08 +00:00
Ruben Brunk
f967a5486a camera2: Plumb DngCreator to native library.
Change-Id: Ic58bf6cf5086808b503460ef8e451fc0d6f1f850
2014-05-16 23:25:51 -07:00
Narayan Kamath
8ee0b48d60 am 97175deb: am 3856a219: am cecfb94f: Merge "Clean up argc / argv processing for runtime args."
* commit '97175deb446cdaca7f3910b71940cb443bda3cc4':
  Clean up argc / argv processing for runtime args.
2014-04-09 14:06:10 +00:00
Narayan Kamath
97175deb44 am 3856a219: am cecfb94f: Merge "Clean up argc / argv processing for runtime args."
* commit '3856a219fa414ee53c5ef3a0c35dae35e2ca80b1':
  Clean up argc / argv processing for runtime args.
2014-04-09 14:02:08 +00:00
Narayan Kamath
22ec1eefa4 Clean up argc / argv processing for runtime args.
- Make copies of argc, argv before argv is potentially
  overwritten with the process name.
- Allow multiple command line arguments to be passed to
  ZygoteInit (this is required for some of the 64 bit
  zygote work).
- Add an explanatory comment about how these argments
  are processed.

Change-Id: I752be69c5c0f97ed17d1a3dded19f46ee00929b0
2014-04-09 13:39:41 +01:00
John Spurlock
0a0454fdcc am 642421aa: am 5c31e487: Merge "Introduce new UI_MODE_TYPE_WATCH and qualifier." into klp-modular-dev
* commit '642421aa7f284817cc1a972a7f9c7a64696a0116':
  Introduce new UI_MODE_TYPE_WATCH and qualifier.
2014-04-04 19:34:11 +00:00
John Spurlock
642421aa7f am 5c31e487: Merge "Introduce new UI_MODE_TYPE_WATCH and qualifier." into klp-modular-dev
* commit '5c31e487c4577e1c47ee7c949325d6a13f0d462e':
  Introduce new UI_MODE_TYPE_WATCH and qualifier.
2014-04-04 19:28:09 +00:00
John Spurlock
6c191299a7 Introduce new UI_MODE_TYPE_WATCH and qualifier.
Default ui mode to watch if we have FEATURE_WATCH.

Bug:13395758
Change-Id: Ie5ff95de60e69e91ad3612c7d2f1fca7f49061bd
2014-04-04 15:21:53 -04:00
Narayan Kamath
c6f6ba3265 am 71ae2bd4: am f87b3a25: am 374db6c3: Merge "Remove ProcessState::mArgc,mArgV,mArgLen"
* commit '71ae2bd42be21de6d25d1f8c52e3973c172462df':
  Remove ProcessState::mArgc,mArgV,mArgLen
2014-04-03 16:56:32 +00:00
Narayan Kamath
a23fcd7be8 Remove ProcessState::mArgc,mArgV,mArgLen
These look like historical oddities, and weren't really being
used for anything useful.

Process:setArgV0 was being called by android.util.Process, but
that functionality can be moved directly into the implementation
of that class.

bug: 13647418

Change-Id: I216c8f8a4c065f0cf3a61f19f9e32decd26f93f6
2014-04-03 12:29:07 +00:00
John Reck
0d1f634f4b Add invokeFunctor
Change-Id: I09e675d3e02e3e528642175ada00b2b17fab7652
2014-03-28 20:57:32 -07:00
John Reck
750ca6dbdb Remove kStatusInvoke & kStatusDraw
They are unused

Change-Id: I44ecf1164dc6bc1b09438e733976d5a97a25f00e
2014-03-28 16:43:15 -07:00
Adam Lesinski
de898ff429 Shared library resource support
Shared libraries can now export resources for applications
to use.

Exporting resources works the same way the framework exports
resources, by defining the public symbols in res/values/public.xml.

Building a shared library requires aapt to be invoked with the
--shared-lib option. Shared libraries will be assigned a package
ID of 0x00 at build-time. At runtime, all loaded shared libraries
will be assigned a new package ID.

Currently, shared libraries should not import other shared libraries,
as those dependencies will not be loaded at runtime.

At runtime, reflection is used to update the package ID of resource
symbols in the shared library's R class file. The package name of
the R class file is assumed to be the same as the shared library's
package name declared in its manifest. This will be customizable in
a future commit.

See /tests/SharedLibrary/ for examples of a shared library and its
client.

Bug:12724178
Change-Id: I60c0cb8ab87849f8f8a1a13431562fe8603020a7
2014-03-25 12:09:56 -07:00
Narayan Kamath
b5c4e7fd38 resolved conflicts for merge of 92860a74 to master
Change-Id: I3036ef9f1251c756092dc5ee2c4fed8146855e1e
2014-03-10 10:57:05 +00:00
Narayan Kamath
6381dd4ff2 LP64: Make 9 patches architecture agnostic.
The Res_png_9patch struct had several pointer members
whose size differed between 32 and 64 bit platforms.

These members have been replaced by uint32_t offsets
to serialized data. The serialized form for 9patches
places a Res_png_9patch object at the beginning of
serialized data, followed by int32_t arrays of xDivs,
yDivs and colors.

Note that these offsets are not strictly required,
since they can be computed from the values of numXDivs,
numYDivs & numColors, however they are called in tight
loops so having them computed once is a beneficial.

This change also removed the unused patch_equals function
from aapt's Image.cpp.

Change-Id: I3b9ac8ae5c05510d41377cae4dff1c69b40c2531
2014-03-10 10:00:02 +00:00
Brian Carlstrom
aa1d023bb9 am 674fd6c4: am a258b4a9: am 485e3b45: am 5c126c3d: Merge "Add dex2oat-flags plumbing to AndroidRuntime"
* commit '674fd6c442cd3886b3ab12be1d36c5d05ef48cdb':
  Add dex2oat-flags plumbing to AndroidRuntime
2014-03-05 20:09:52 +00:00
Brian Carlstrom
3beff1e023 Add dex2oat-flags plumbing to AndroidRuntime
Change-Id: Idaa7e5351e146d76e1972cbe4d93af69f0b999a6
2014-03-04 14:08:46 -08:00
Narayan Kamath
788fa41482 Extended locales in AAPT / AssetManager.
Support 3 letter language codes, script codes &
variants. The bulk of the changes are related to
the implementation of command line filtering of
locales etc. The previous code assumed that the
value of each "axis" (locale, density, size etc.)
could be represented by a 4 byte type. This is
no longer the case.

This change introduces a new class, AaptLocaleValue
which holds a (normalized) locale parsed from a
directory name or a filter string. This class takes
responsibility for parsing locales as well as
writing them to ResTable_config structures, which is
their representation in the resource table.

This includes minor changes at the java / JNI level
for AssetManager. We now call locale.toLanguageTag()
to give the native layer a well formed BCP-47 tag.
I've removed some duplicated parsing code in
AssetManager.cpp and replaced them with functions on
ResTable_config. The native getLocales function has
been changed to return well formed BCP-47 locales as
well, so that the corresponding java function can use
Locale.forLanguageTag to construct a Locale object
out of it.

Finally, this change introduces default and copy
constructors for ResTable_config to prevent having
to memset() the associated memory to 0 on every
stack allocation.

(cherry-picked from commit 91447d88f2bdf9c2bf8d1a53570efef6172fba74)

Change-Id: I1b43086860661012f949fb8e5deb7df44519b854
2014-02-14 14:08:57 +00:00
Narayan Kamath
48620f1d1b AssetManager support for 3 letter lang/country codes.
- 3 letter codes are packed into the existing 32 bit locale
  field in ResTable_config
- We introduce new fields for script / variant information.

Note that we define a "match" between two ResTable_config
structures to be purely on the basis of their language &
country (disregarding the script and the variant). However,
configs with scripts and variants are considered to be more
specific than those without.

(cherry picked from commit 378c6775a62d9c461cde51f06c1b14bb014c78fd)

Change-Id: I7dce82a3fe2412834252723f458826ae41535a78
2014-02-14 14:08:23 +00:00
Andreas Huber
d430354c6b Merge "Revert "Split AndroidRuntime into AndroidRuntimeBase base-class and the rest."" 2014-02-13 17:22:49 +00:00
Andreas Huber
9ae000ca8c Revert "Split AndroidRuntime into AndroidRuntimeBase base-class and the rest."
This reverts commit 7825334929b098b36e1144872200e75ba6d24b13.

Change-Id: I1702eb3ff9d7192d64039c8bf4bc3fc5d8e458c4
2014-02-13 17:22:33 +00:00
Andreas Huber
04f0cab79d Merge "Split AndroidRuntime into AndroidRuntimeBase base-class and the rest." 2014-02-13 16:35:03 +00:00