472 Commits

Author SHA1 Message Date
TreeHugger Robot
024d22fdb7 Merge "AAPT2: Fix pseudolocalization to respect <xliff:g>" 2017-02-09 16:17:18 +00:00
Adam Lesinski
7542162cb1 AAPT2: Fix pseudolocalization to respect <xliff:g>
The XLIFF 'g' tag specifies content that should NOT be translated.
AAPT2's pseudolocalization process should respect it.

Bug:34064599
Test: make libandroidfw_tests
Change-Id: Ice437d7f0ff246730ee04896fd035e2d846148fb
2017-02-08 06:23:45 -08:00
Adam Lesinski
929d6517df AssetManager2: Add GetResourceId
Add ability to lookup a resource by name.

Test: make libandroidfw_tests
Change-Id: I262ba5ce4c9892458226fbdb44cf21f9877fb92d
2017-02-08 06:04:52 -08:00
Adam Lesinski
0c40524953 AssetManager2: Add other support methods
- Add GetResourceConfigurations()
- Add GetResourceLocales()
- Add ResolveReference()
- Add stub for GetResourceId()
- Change LoadedArsc and ApkAssets factory method to return const

Test: make libandroidfw_tests
Change-Id: Ia797dc9381a523b1a3e7029048a413e544730379
2017-01-31 16:20:29 -08:00
Adam Lesinski
c6aada9c57 LoadedArsc: Support feature splits.
Test: make libandroidfw_tests
Change-Id: I278273e688da597f4af86dd55f87750501ef8154
2017-01-27 16:52:53 -08:00
Adam Lesinski
90572a4ab8 Merge "libandroidfw: Add new support for shared libraries" 2017-01-27 22:30:24 +00:00
Mårten Kongstad
6bb13da278 Fix memory leak during idmap creation
Plug a memory leak in AssetManager::createIdmap.

Bug: 31052947
Test: use Valgrind and dummy native app
Change-Id: I83af3a40516ed2d50d5a7c8ee175ed960fde9933
2017-01-24 20:26:51 -08:00
Romain Guy
4832745b84 Add color mode to activity/window
The color mode lets an application request a wide color gamut for
a specific window. This will also be used in the future to request
HDR. The color mode is currently either default (sRGB) or an undefined
wide gamut color space chosen by the platform. These attributes could
later be used to choose a specific color space if we deem this important
or useful.

This change also renames the various "colorimetry" attributes and
constants to "color mode" for consistency. These symbols were
added in O and can be safely renamed.

Test: CtsColorModeTestCases
Bug: 32984164
Change-Id: I4d4691dd12dbe3f3aa6a5cf893cff39aa16c739e
2017-01-24 15:55:09 -08:00
Romain Guy
c9ba559021 Add wide color gamut and HDR resource qualifiers
Bug: 32984164
Test: Config_test, AaptConfig_test and aapt2_tests
Change-Id: Ie9c82bfe2d36b1d6180ee223250ab5bb2ce90dd4
2017-01-19 18:44:00 -08:00
TreeHugger Robot
1f9f11007d Merge "Move StringPiece to libandroidfw" 2017-01-19 23:40:06 +00:00
Roozbeh Pournader
2d00c0952e Merge "Update locale data from in-tree ICU" 2017-01-18 17:03:35 +00:00
Adam Lesinski
d5083f6f6b Move StringPiece to libandroidfw
libandroidfw needs to make use of StringPiece, so
move it to libandroidfw and update all code referencing
StringPiece in aapt2.

Test: make libandroidfw_tests libaapt2_tests
Change-Id: I68d7f0fc7c651b048d9d1f5e7971f10ef5349fa1
2017-01-17 18:55:51 -08:00
Adam Lesinski
fdaa9c58c9 Merge "New implementation of AssetManager/ResTable" 2017-01-17 23:58:36 +00:00
Roozbeh Pournader
9bddb48413 Update locale data from in-tree ICU
Also add back script information for Yiddish old code (ji) that was
removed in ICU.

Bug: 26756576
Test: none
Change-Id: Ia785f86bf0407aeed6134ef9d44e504494256da2
2017-01-13 17:37:04 -08:00
Zak Cohen
9013325c3a Merge changes from topic 'vrmode'
* changes:
  Set ui mode in UiModeManagerService to vrheadset when VR mode is enabled.
  Introduce new UI_MODE_TYPE_VR_HEADSET and qualifier.
2017-01-13 23:15:00 +00:00
Roozbeh Pournader
383ac409df Merge "Treat Latin American locales specially" 2017-01-13 01:53:15 +00:00
Mark Salyzyn
6f773a0d87 Replace cutils/log.h and android/log.h with log/log.h
Test: compile
Bug: 34250038
Change-Id: I42185a879beaa9bb244f53a968800392b854ac45
2017-01-12 20:29:11 +00:00
Adam Lesinski
da431a22da libandroidfw: Add new support for shared libraries
This adds support for shared resource libraries in the new
ResTable/AssetManager implementation.

The dynamic package map encoded in resources.arsc is parsed
and stored with LoadedArsc, and combined to form a resolved table
in AssetManager2.

Benchmarks show that this implementation is an order of magnitude
faster on angler-userdebug (make libandroidfw_benchmarks).

Test: libandroidfw_tests
Change-Id: I57c80248728b63b162bf8269ac9495b53c3e7fa0
2017-01-11 17:20:36 -08:00
Roozbeh Pournader
a192a8ced6 Treat Latin American locales specially
Due to legacy reasons, Android translations of European Spanish were
kept under 'es', while Latin American Spanish translations were kept
under 'es-US'. The combination of this, and the new locale
preference rules in Nougat, resulted in 'es' winning over 'es-US' for
all Latin American locales, since 'es' was a direct ancestor, while
'es-US' was just a fallback.

The changes in Nougat had assumed that app developers would put Latin
American Spanish translations under 'es-419', but that could create a
backward-compatibility problem under older Android versions that did
not support three-digit region codes properly.

This CL keeps the Nougat logic and its locale parent tree, but
special-cases es-US and es-MX to be treated as equivalents of es-419
in cases where they are present and es-419 is not.

Bug: 31545805
Bug: 34126460
Test: unit tests are included
Change-Id: Iab26f41294587ee044685a5a6560520c7cbb06f7
2017-01-11 15:52:08 -08:00
Adam Lesinski
7ad1110ecd New implementation of AssetManager/ResTable
The multiwindow model and Resources-per-activity
model that came in N puts greater demands on AssetManagers.
They are created whenever window dimensions change, which
can be frequently. There is a need to be able to cheaply
create a new AssetManager for each Activity, which shares
a lot of underlying state.

In order to make the creation of AssetManagers cheap,
we need a new implementation of the native AssetManager
and ResTable to support immutable representations of
APKs. This new data structure/class is ApkAssets.

ApkAssets have the same functionality of an AssetManager, except
that they operate on a single APK, and they do not do any caching.
Once loaded, they are immutable.

ApkAssets will be exposed as a Java object, with its implementation in
native code. The existing Java StringBlock will be owned by ApkAssets,
which means that Strings can be shared across AssetManagers.

ApkAssets can be cached by the ResourcesManager. Creating an AssetManager
requires only a list of ApkAssets and a configuration.

AssetManager2 (named with the suffix '2' for now while transitioning
to the new implementation) caches bags that are accessed.

Since ApkAssets are expected to be kept around longer, they do more validation
of the resource table, which cause slower load times. Measured on an angler-userdebug,
loading the framework assets takes 11ms with ApkAssets, and 2ms with the old
AssetManager implementation.

The tradeoff is that there does not need to be any security checks once an ApkAssets
is loaded, and regular resource retrieval is faster. Measured on an angler-userdebug,
accessing resource (android:string/ok) with many locales takes 18us with AssetManager2,
and 19us with AssetManager (this is per resource, so these add up).

Test: make libandroidfw_tests
Change-Id: Id0e57ee828f17008891fe3741935a9be8830b01d
2017-01-11 13:30:57 -08:00
Zak Cohen
1a6acdbb86 Introduce new UI_MODE_TYPE_VR_HEADSET and qualifier.
Bug: 30989383
Test: Unit test for aapt2
Change-Id: I66dc65af6327b94fed74538bee08cada0b8be4fa
2017-01-11 11:44:47 -08:00
Mark Salyzyn
db15537e6e resolve merge conflicts of 082a1721b516 to master
Test: compile
Bug: 26552300
Bug: 31289077
Change-Id: I17f178f425975c1c0dbd48091d25b101956d505e
2017-01-11 08:30:17 -08:00
Mark Salyzyn
ef8ccc8510 Merge "Replace cutils/log.h and log/logger.h with log/log.h" am: e7fcbcb991
am: 6143cbf1e5

Change-Id: Id192d8dd973fe9e70acab72bae9856bc8a62ac75
2017-01-11 15:40:24 +00:00
Mark Salyzyn
52eb4e01a4 Replace cutils/log.h and log/logger.h with log/log.h
Test: compile
Bug: 26552300
Bug: 31289077
Change-Id: I578b15b48f0fc2807a92abbc69a377c3d2191496
2017-01-09 14:31:34 -08:00
Adam Lesinski
06d3e8fec7 libandroidfw: Revert null check in ApplyStyle
The out parameter `out_indices` is expected to be non-null
and so the extra null check adds a cost to performance
and opens the door to misusing the API by not supplying
`out_indices`.

Test: make libandroidfw_tests
Change-Id: Ie66fd837c5e24ec2838156e7b67f54c15cd27933
2017-01-06 16:51:48 -08:00
Adam Lesinski
351471f928 libandroidfw: Make tests less flaky
Changing any of the test APKs could change resource IDs.
The resource IDs are all made public and assigned an ID
to avoid this issue.
Test: make libandroidfw_tests

Change-Id: Idd17c25f4ac86a0ad5b2b8da6f968e5d9b2346c1
2016-12-12 14:10:46 -08:00
Adam Lesinski
4c67a475a3 Make tests use APKs instead of exploded APKs
Tests would expect parts of the APK to be unzipped and
maintained. Instead, we now decompress the required files
from the test APKs on test setup. This simplifies
test maintenance substantially.

Test: make libandroidfw_tests && libandroidfw_tests --testdata=frameworks/base/libs/androidfw/tests/data
Change-Id: I3d2100af22df913e02401dedcf9842cdb32b2a3b
2016-12-05 19:03:47 -08:00
Colin Cross
434e16c7bc Merge "Convert libandroidfw to Android.bp" am: 46ec8dba83
am: 9625912b7f

Change-Id: I1f52bfd7e0dc8b5a543b41f8c4a3b7b2a35355c9
2016-12-03 04:22:44 +00:00
Colin Cross
9625912b7f Merge "Convert libandroidfw to Android.bp"
am: 46ec8dba83

Change-Id: I32a737c491eeb95ad080adacd47602ee814ba0cb
2016-12-03 04:14:58 +00:00
John Reck
f32adf4475 Clean up ApplyStyle JNI
Bug: 32573798

Mark input uint32_t[] as const. Use Read-only JNI
array access for input as it's faster than critical access.

Use non-movable arrays for TypedArray so that the address can
be resolved and stored, avoiding the need to do JNI array
access for the output.

Indicies is always non-null, so remove the optional checks.

Eliminate unused return value.

Benchmark results:
twelveKeyInflate 4963us -> 4713us
simpleViewInflate 73us -> 60us

Test: Device boots, benchmarks show faster

Change-Id: Ic3bde5aee31407d8903913f97f2218daf074499a
2016-12-02 12:49:20 -08:00
Jaekyun Seok
ae21f6f5b0 Merge "Remove static link in Android framework under /frameworks/base." am: c60963e451
am: 5705ad69db

Change-Id: I3f2c38332115a7b52b893629f2a5007d75c2831d
2016-12-02 19:43:36 +00:00
Jaekyun Seok
5705ad69db Merge "Remove static link in Android framework under /frameworks/base."
am: c60963e451

Change-Id: I0bbb3cf9a66752f6ee8218a4ac5545091130bbed
2016-12-02 19:35:03 +00:00
Colin Cross
ce2221e0ff Convert libandroidfw to Android.bp
See build/soong/README.md for more information.

Test: libandroidfw_tests
Merged-In: I4e575d62f724d5ffe43f12ff5642fb6799f7819e
Change-Id: I4e575d62f724d5ffe43f12ff5642fb6799f7819e
(cherry picked from commit 4f8d9e69eb63878a99abedfdc7b92c6284f30605)
2016-12-02 11:23:12 -08:00
Colin Cross
4f8d9e69eb Convert libandroidfw to Android.bp
See build/soong/README.md for more information.

Test: libandroidfw_tests
Change-Id: I4e575d62f724d5ffe43f12ff5642fb6799f7819e
2016-12-02 09:33:18 -08:00
Jaekyun Seok
377878b4d4 Remove static link in Android framework under /frameworks/base.
The dependencies to static libraries in frameworks should be removed
as many as possible to reduce a size of the system partition.
And that will improve coverage of the VNDK libraries because this
effort might find new necessary shared libs which were linked
statically before.

Size diffs of libs in /system/lib on angler-userdebug build are as
following.

libandroidfw.so      : 243748 -> 205196 (-38552)
libhwui.so           : 562028 -> 562580 (+552)
libmedia_jni.so      : 293652 -> 293656 (+4)
(All the others have the same size.)

total: (-37996)

Test: building succeeded, and the image was tested on angler.
Bug: 33056637
Change-Id: I3021fb438778eaea2be935b990ec85c4aec6c008
(cherry picked from commit 2b14c5eaf61635d1c3a69a2e59faa23cb6b7f7cb)
2016-12-01 10:31:12 +09:00
Adam Lesinski
ea7897954f Add --testdata flag for easier testing
Instead of hardcoding or assuming a path for testdata,
allow the testdata path to be specified via the command
line.
Test: make libandroidfw_tests

Change-Id: Ideae880b21c157b70a11bb5a90a94556771aead6
2016-11-29 15:01:15 -08:00
Jaekyun Seok
2b14c5eaf6 Remove static link in Android framework under /frameworks/base.
The dependencies to static libraries in frameworks should be removed
as many as possible to reduce a size of the system partition.
And that will improve coverage of the VNDK libraries because this
effort might find new necessary shared libs which were linked
statically before.

Size diffs of libs in /system/lib on angler-userdebug build are as
following.

libandroidfw.so      : 243748 -> 205196 (-38552)
libhwui.so           : 562028 -> 562580 (+552)
libmedia_jni.so      : 293652 -> 293656 (+4)
(All the others have the same size.)

total: (-37996)

Test: building succeeded, and the image was tested on angler.
Bug: 33056637
Change-Id: I3021fb438778eaea2be935b990ec85c4aec6c008
2016-11-29 11:59:20 +09:00
Wan He
08a77b1f9f Merge "Fix incorrect calculation of sizeof package structure" am: 757e286cc8 am: 530fdccbe4 am: 2f176bb2cd
am: 8e5ff07293

Change-Id: I0a0cefef7df2cebfc9687f17abc9797f7cd61ca7
2016-11-18 23:00:15 +00:00
Wan He
2f176bb2cd Merge "Fix incorrect calculation of sizeof package structure" am: 757e286cc8
am: 530fdccbe4

Change-Id: I92417758a165741a4346d6b6c3f3491776b86729
2016-11-18 22:48:28 +00:00
Wan He
530fdccbe4 Merge "Fix incorrect calculation of sizeof package structure"
am: 757e286cc8

Change-Id: Ia16ee8f4efaee3e43c656f753c878b13b4a4706c
2016-11-18 22:39:43 +00:00
Wan He
3ff4226363 Fix incorrect calculation of sizeof package structure
Argument "package" is a pointer, not the structure.

Signed-off-by: Wan He <xiaolin.gxl@alibaba-inc.com>
2016-11-17 18:05:20 +08:00
Jason Monk
2dc804be11 Allow persistent changes to the vendor overlay theme
This allows the overlay being used to be changed without a new build
but still will require a reboot to take effect. Should no longer be
needed once hierarchical resources are in place, and can be removed.

Also fix check in fd_utils to point at correct location.

Test: Manual
Bug: 32721178
Change-Id: I2a63aea0c87791c8eb845d735cb1182716c8174d
2016-11-07 20:46:07 -05:00
Colin Cross
e1166dd488 Merge "Move one more libandroidfw header" am: c5c74f9f49
am: e81eb61399

Change-Id: I813a1f3c40681c92c7cc7bc27afd1344c15d0792
2016-11-05 00:21:41 +00:00
Colin Cross
e81eb61399 Merge "Move one more libandroidfw header"
am: c5c74f9f49

Change-Id: Ib4d1c81aba13543da2454140548252cf013c95e1
2016-11-05 00:15:01 +00:00
Colin Cross
1d80addee4 Move one more libandroidfw header
The libandroidfw headers were moved into the library directory, move one
more that did not exist in the original patch.

Test: builds
Change-Id: Ic74a41558e1bc3984d98dd766f69d081edd8fc08
2016-11-04 15:49:43 -07:00
John Reck
b365b0db93 Merge "Re-unite sources with their headers" am: e43444a00b
am: 946d11d216

Change-Id: Ib9fac5fff2f2ce90eebc2c6eb5208de33ea28723
2016-11-04 21:52:43 +00:00
John Reck
946d11d216 Merge "Re-unite sources with their headers"
am: e43444a00b

Change-Id: I8f3ef6a1ddcf78d28f7444b6e83c552b8305fd8c
2016-11-04 21:47:34 +00:00
John Reck
03b5d506bc Re-unite sources with their headers
Move all the includes for androidfw under
a common base path for that library instead
of frameworks/base/includes.

Also fixes -Werror issues that resulted in
no longer being -isystem.

Test: builds
Change-Id: Ic4312eb61b197af114dded5691d5ae1ec82923f7
Merged-In: Ic4312eb61b197af114dded5691d5ae1ec82923f7
(cherry picked from commit f6113af2d6f6eebee68d3ac510fe96d38a7a39e9)
2016-11-04 13:27:37 -07:00
John Reck
f6113af2d6 Re-unite sources with their headers
Move all the includes for androidfw under
a common base path for that library instead
of frameworks/base/includes.

Also fixes -Werror issues that resulted in
no longer being -isystem.

Test: builds
Change-Id: Ic4312eb61b197af114dded5691d5ae1ec82923f7
2016-11-03 16:26:59 -07:00
neo.chae
6c8b93cf54 Merge "Fix idmap leak in zygote process" am: f5ad44b60a am: 4720125a3c am: 3e15d09ed4
am: d3a209399a

Change-Id: I2c7272b5f79e029ac88fa6b6acb598bdf68f28e2
2016-11-02 21:30:36 +00:00