30 Commits

Author SHA1 Message Date
Dan Willemsen
4888b1f6f0 Convert to Soong
See build/soong/README.md for more information.

Test: m libframeworks_coretests_jni
Test: m FrameworkCoreTests_install
Test: m libshim_jni
Test: m CtsShimPrivUpgrade
Test: m libfilterfw
Test: m PMTest_Java_dual
Test: m libdefcontainer_jni
Test: m libperftestscore_jni
Test: m libpmtest32 libpmtest64
Test: m libprintspooler_jni
Test: m libsmartcamera_jni
Test: m idmap
Test: m libdrmframework_jni
Test: m libdvr_loader com.google.vr.platform com.google.vr.platform.xml
Test: m libfilterpack_imageproc libfilterpack_base
Test: m libwebviewchromium_loader
Test: m shared_mem_test
Test: m test-touchlag
Change-Id: I868561dd237fa28647896d59049ab9260373ada1
2018-05-14 16:47:02 -07:00
Mårten Kongstad
42ebcb80b5 idmap: include idmap version in check for stale file
Teach is_idmap_stale_fd to include the idmap version in the list of
criteria used to determine if an idmap file is already up to date.

Change-Id: I3e4e2aa502fe76a034c3977bdb055a1df7e665be
2017-09-04 13:16:16 +02:00
Mårten Kongstad
ea2a1b9b27 idmap: suppress print for padded resources
Bug: 31052947
Test: manual
Change-Id: I13723bf8b1cdeecfd71750123eb1f949f96b7c3e
2017-09-04 13:16:16 +02:00
Jaekyun Seok
71693e6683 Add a function to verify if idmap is made from given target/overlay packages
"--verify" will be used to verify if idmap corresponding to given fd is maded
from given target and overlay packages.

Test: building succeeded and tested on sailfish.
Bug: 37179531
Change-Id: Id19bdfd9c61670437f3e1a5c29762ce93586590f
2017-05-18 00:10:57 +09:00
Todd Lee
ea2f3be7aa OEM single-build/multi-SKU via dynamic RRO support
The purpose here is to provide support for selectively
enabling Runtime Resource Overlays (RROs) (specifically
those pertaining to a specific SKU, within a OEM's "single
build" covering multiple SKUs) at boot based on the value
of a pre-defined system property.

This mechanism is designed to be compatible with other,
recent changes to Runtime Resource Overlays - specifically:

- has no effect on 'isStatic'. Resource overlays must be
  attributed as static in order to qualify for loading into
  the system_server. The 'requiredSystemPropertyName/
  requiredSystemPropertyValue' mechanism operates
  independent of this and can be used on both static and
  non static overlays. The effect of specifying a conditional
  property on any overlay is that it will ONLY be enabled
  in the event that the system reflects both the property
  and the specified value (Note that in the ABSENCE of a
  conditional property, overlays are assumed to be enabled).

- has no effect on OverlayManagerService (OMS) API. The
  OMS provides the system with an interface through which
  overlays can be enabled/disabled and even rearranged at
  runtime. This provides the basis of support for various
  user-level features (e.g. dynamic theme selection).
  The 'requiredSystemPropertyName/requiredSystemPropertyValue'
  mechanism operates independent of this -
  with enablement being completely coupled to the available
  system properties on the device and NOT subject to change
  at runtime.

Note: as part of this change, original overlay tests have been
updated (fixed) and expanded to include tests to cover the
conditional property implementation.

Issue: http://b/35100249
Test: frameworks/base/core/tests/overlaytests/testrunner.py

Change-Id: I1990ce21a27a385db1e2f53294b69dd03988351e
(cherry picked from commit d5566c6c47faa6b9dda282741e25ac78c9487d58)
2017-04-17 14:12:00 +00:00
Jaekyun Seok
0434289c45 Apply static RRO
Static RRO package is designed to support resource overlay for system
server and they shouldn't be disabled or changed by a user.
The design details are in go/treble-static-rro.

Selection method for static RROs will be applied later when its design
is determined.

Test: building succeeded and tested on sailfish.
Bug: 35742444
Change-Id: I8cbf2fd37a73a24bf6ad291e2c5cf75a0fc757fc
2017-03-15 00:07:34 +09:00
Jaekyun Seok
7de2f9c73f Reinstate codes to enable RRO on system server
Test: building succeeded and tested with sailfish
Bug: 35742444
Change-Id: I99d0f1d097525d3eb46255d6cf823f6ae2a02385
2017-03-03 07:23:23 +09:00
Mårten Kongstad
2e0d0f3111 OMS: integrate OverlayManagerService into framework
Hand over ownership of overlays to OverlayManagerService.

Changes to a package's overlays are propagated using the activity life
cycle. Affected activities will be recreated as needed. This provides a
well-defined point to modify an application's assets while the
application is paused.

Consolidate how overlays targeting the system and overlays targeting
regular applications are handled. Previously, system overlays were
handled as a special case. Now, everything is handled identically. As a
side effect, the call to idmap --scan during Zygote boot has become
obsolete and is removed.

Information on what overlays to use is recorded in
ApplicationInfo.resourceDirs. The PackageManagerService is responsible
for the creation of ApplicationInfo objects. The OverlayManagerService
is responsible for informing the PackageManagerService in advance about
what resourceDirs to use.

When launching an application, the ApplicationInfo is already populated
with up-to-date information about overlays.

When enabling or disabling an overlay for a running application, the
OverlayManagerService first notifies the PackageManagerService about the
updated resourceDirs. It then tells the ActivityManagerService to push
the new ApplicationInfo object to the application's ActivityThread.
Finally the application requests its ResourcesManager to create new
ResourcesImpl objects based on the updated paths.

Change-Id: Ib8afa05ccab4e2db558f89ce4423983c086bb61a
Co-authored-by: Martin Wallgren <martin.wallgren@sonymobile.com>
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sonymobile.com>
Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
2017-02-23 14:01:38 -08:00
Guang Zhu
9545980692 Revert "OMS: integrate OverlayManagerService into framework"
Bug: 31052947
Bug: 35697944

This reverts commit 21a3d1ad686dee97b9cf0ed80389ee2ab0d48013.

Change-Id: I2d86931020301524c26cf8c8e80d557c97fdd6c3
2017-02-23 07:35:39 +00:00
Mårten Kongstad
21a3d1ad68 OMS: integrate OverlayManagerService into framework
Hand over ownership of overlays to OverlayManagerService.

Changes to a package's overlays are propagated using the activity life
cycle. Affected activities will be recreated as needed. This provides a
well-defined point to modify an application's assets while the
application is paused.

Consolidate how overlays targeting the system and overlays targeting
regular applications are handled. Previously, system overlays were
handled as a special case. Now, everything is handled identically. As a
side effect, the call to idmap --scan during Zygote boot has become
obsolete and is removed.

Information on what overlays to use is recorded in
ApplicationInfo.resourceDirs. The PackageManagerService is responsible
for the creation of ApplicationInfo objects. The OverlayManagerService
is responsible for informing the PackageManagerService in advance about
what resourceDirs to use.

When launching an application, the ApplicationInfo is already populated
with up-to-date information about overlays.

When enabling or disabling an overlay for a running application, the
OverlayManagerService first notifies the PackageManagerService about the
updated resourceDirs. It then tells the ActivityManagerService to push
the new ApplicationInfo object to the application's ActivityThread.
Finally the application requests its ResourcesManager to create new
ResourcesImpl objects based on the updated paths.

Co-authored-by: Martin Wallgren <martin.wallgren@sonymobile.com>
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sonymobile.com>
Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
Change-Id: Idc96dae6fc075d5373aa055bbf50e919136d7353
2017-02-21 14:29:43 -08:00
Adam Lesinski
ce5e56e243 AAPT2: Rename to match new style
Use Google3 naming style to match new
projects' and open source google projects' style.

Preferred to do this in a massive CL so as to avoid
style inconsistencies that plague legacy code bases.
This is a relatively NEW code base, may as well keep
it up to date.

Test: name/style refactor - existing tests pass
Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
2016-10-26 19:30:23 -07:00
Martin Wallgren
0fbb608110 RRO: Synchronize access to overlays.list
idmap --scan is executed as a part of the pre-loading in ZygoteInit.
The pre loading is executed in parallel for each supported architecture
(32/64 bit). This will cause a race condition in the creation of the
overlays.list file and the idmap files for the system overlays.

Apply flock on overlays.list to prevent the file from being thrown away
and recreated when it is in use by another Zygote.

Cherry-picked from AOSP.

Bug: 28032298
Test: manual
Change-Id: I51d39f121d207b11181340b68b164b60020f0c61
2016-10-12 14:56:31 +00:00
Dan Albert
0881a7445f Use std::unique_ptr instead of UniquePtr.
We're deprecating UniquePtr, so we need to move to the real thing.

Bug: http://b/22403888
Change-Id: I5b7fdf4924dd8c12a8c7dba89278714ca6fdc60a
(cherry picked from commit b0624da1181276ff4caa5e57a7a4abf766902e3e)
2015-11-05 13:03:26 -08:00
Elliott Hughes
70bef1c4bd Fix lseek argument order.
Change-Id: Ibc2f98e4c26d0ac6ac7b4a73775c5213c4df4518
2015-10-20 13:23:18 -07:00
Adam Lesinski
fe1934e470 Merge "RRO: idmap: allow flock(2) to block" 2015-10-12 19:30:23 +00:00
Adam Lesinski
bac309ca8f Merge "RRO: idmap: fix sorting of overlays.list" 2015-10-12 19:29:39 +00:00
Mårten Kongstad
7197d91eb7 RRO: idmap: fix sorting of overlays.list
Multiple overlay packages with targetPackage="android" are loaded in the
wrong order due to the incorrect order they are listed in overlays.list.
This will cause runtime resource overlay to fail when multiple overlay
packages target the same resources in framework-res.apk.

Correct the order in which overlays are loaded by changing the sorting
of overlays.list.

Background: commit f90f2f8d changed the order in which overlay packages
should be added to ResTables. The expected order is now in ascending
priority. This must be reflected in overlays.list.

Change-Id: I249984c0e34b6009e7280ce2777750c76ab16e37
2015-10-07 19:51:50 +02:00
Mårten Kongstad
83ab0d7c18 Make 'idmap --scan' accept more than one input directory
The 'idmap --scan' command was limited to only scan a single directory
for overlay packages. Update idmap to support any number of directories.

Change-Id: I851f5720a3c1d844235911a0833670652a20a3c8
2015-10-07 19:45:09 +02:00
Mårten Kongstad
df1a5b22cd RRO: idmap: allow flock(2) to block
During creation of an idmap an advisory lock is applied on the
output file using flock(2). This commit removes the LOCK_NB flag
from the call to flock(2).

The reason for this is that if the function were to return
EWOULDBLOCK, the entire idmap operation would be aborted leading
to the device booting without the correct overlay packages applied.

Change-Id: Iad319779976e950d4354e4f60b30439f6f208b77
2015-10-07 19:02:09 +02: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
Mark Salyzyn
b62286e60c idmap: scan missing include for sys/stat.h
scan.cpp gets sys/stat.h inherited from
private/android_filesystem_config.h it should
not rely on this in the future. The intent is
to move fs_config function into libcutils and
thus deprecate any need for sys/stat.h in this
include file.

Bug: 19908228
Change-Id: If547e86513b06c536972138ae571c3d9c714ffe9
2015-04-01 16:52:14 +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
Elliott Hughes
b9de25f7db Add missing <sys/file.h> include for flock.
Change-Id: I0c66c03aeb4df614f7880a830b95c40f43f804db
2015-02-16 10:43:19 -08:00
Bernhard Rosenkränzer
46c82b4cd2 Adjust format strings to work on both 32-bit and 64-bit builds
Adjust format strings to not produce Clang warnings in both 32-bit and
64-bit builds

Change-Id: I76c29d8d5d0fb4b5e9d9518077652370ffe9e871
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
2014-12-05 16:14:07 -08:00
Dan Albert
6698749dd4 Add appropriate casts for char16_t.
C++11 defines a real char16_t, which is not implicitly convertible to
uint16_t (and by extension jchar). Add casts as needed.

Bug: 18300613
Change-Id: I00752002ef2e938bdb57f70947e8fd53ec103293
2014-11-20 11:47:40 -08:00
Andreas Gampe
ebee1379ea Frameworks/base: Fix two warnings in cmds
Change-Id: Ifb9c7fb7a2d28c13010ddc186bea5f5f0daefb4a
2014-11-08 01:04:45 +00:00
Andreas Gampe
cfedceb8c1 Frameworks/base: Turn on -Wall -Werror in cmds
Fix small warnings, turn on -Wall -Werror.

Change-Id: Iab1f01a7c7ebd6ba832b75067c5e395f380a1b8b
2014-11-07 14:33:51 -08: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
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
Colin Cross
13221c9cff frameworks/base: move idmap from frameworks/native
idmap depends on libandroidfw, so it should go in frameworks/base.

Change-Id: I3c1db3baa355f53d6b523d60f4377e63eff00c30
2014-02-11 18:11:36 -08:00