432 Commits

Author SHA1 Message Date
Yunlian Jiang
0889a8a070 Merge "Fix warning: Potential leak of memory pointed to by 'set'"
am: 58ba53bd53

Change-Id: I7186dc35fb7f4a3c226e35447ce9c748164e7bf8
2017-03-22 00:21:57 +00:00
Treehugger Robot
58ba53bd53 Merge "Fix warning: Potential leak of memory pointed to by 'set'" 2017-03-22 00:17:33 +00:00
Roozbeh Pournader
4115c64313 Treat Latin American locales specially
am: cf246af30d

Change-Id: I98ff3b1774e6cc3511fcd296d9cec5ccfce03c40
2017-01-14 01:10:25 +00:00
Roozbeh Pournader
cf246af30d 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
(cherry picked from commit a192a8ced65ceea8bfe44f0eac6a394cbf80d936)
2017-01-13 01:54:01 +00: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
Yunlian Jiang
a7645bd947 Fix warning: Potential leak of memory pointed to by 'set'
Bug: None
Test: The warning is gone.
Change-Id: Iacd0b53411ad07c1f45eb5b995138ac30ab51c76
2016-12-13 19:42:30 -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
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
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
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
neo.chae
7530ea7ec0 Fix idmap leak in zygote process am: 0244ca8d10 am: 82537abc3b am: 85afb42c16 am: b4b2203c5e am: fb74b8773a am: c58ec27e1c am: 7489336fed am: 0212d4f3fa am: aaf785c827
am: 4b72904585

Change-Id: I365cdb2764ffb15f233cfeb43339e6acbc369e49
2016-11-14 13:40:37 +00:00
neo.chae
4b72904585 Fix idmap leak in zygote process am: 0244ca8d10 am: 82537abc3b am: 85afb42c16 am: b4b2203c5e am: fb74b8773a am: c58ec27e1c am: 7489336fed am: 0212d4f3fa
am: aaf785c827

Change-Id: I34d0175499e1a47e3e6c9aecd2ac2805a6b4ad51
2016-11-14 13:25:11 +00:00
neo.chae
0212d4f3fa Fix idmap leak in zygote process am: 0244ca8d10 am: 82537abc3b am: 85afb42c16 am: b4b2203c5e am: fb74b8773a am: c58ec27e1c
am: 7489336fed

Change-Id: I53fb00542e417e200b46ac941b4255e310348e18
2016-11-14 12:57:53 +00:00
neo.chae
b4b2203c5e Fix idmap leak in zygote process am: 0244ca8d10 am: 82537abc3b
am: 85afb42c16

Change-Id: Ibb5ac24b2149637bf19b9a16153b1fcde5dbb45f
2016-11-09 20:25:12 +00:00
neo.chae
82537abc3b Fix idmap leak in zygote process
am: 0244ca8d10

Change-Id: Ia35ded23161ad5c5c6fe4dea388e74b8d8af2955
2016-11-09 09:21:46 +00:00
neo.chae
0244ca8d10 Fix idmap leak in zygote process
Fix a idmap leak in AssetManager::addSystemOverlays.
And, The fix could also prevent fd leak of idmap.

Test: none
Bug: 32691930

Signed-off-by: Hyangseok Chae <neo.chae@lge.com>

(cherry picked from commit 6a742a38509693f8b39ee9a5ad2803fca12688bf)

Change-Id: Idc4af77db2b0cb739bd6b009b6af0f9123be1aac
2016-11-08 09:59:44 +00: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
neo.chae
3e15d09ed4 Merge "Fix idmap leak in zygote process" am: f5ad44b60a
am: 4720125a3c

Change-Id: If66e9476583ec50d2dca5a15376a4b84ae2a2885
2016-11-02 21:21:32 +00:00
neo.chae
4720125a3c Merge "Fix idmap leak in zygote process"
am: f5ad44b60a

Change-Id: Ia9977c8166f797ad716284eda03076e282a9fde7
2016-11-02 21:16:33 +00:00
neo.chae
6a742a3850 Fix idmap leak in zygote process
Fix a idmap leak in AssetManager::addSystemOverlays.
And, The fix could also prevent fd leak of idmap.

Test: none

Change-Id: Iff8831e1951a1ca103821f64a612a8b28d2c14e7
Signed-off-by: Hyangseok Chae <neo.chae@lge.com>
2016-11-01 08:53:35 +09:00
Jakub Adamek
6bbb63ad91 Change name of overlay subdir 'sku'->'theme'
am: 54dcaaba4f

Change-Id: I4536de644c20171e175cddaff0cd041fb05b3038
2016-10-21 07:05:17 +00:00
Jakub Adamek
54dcaaba4f Change name of overlay subdir 'sku'->'theme'
The name 'sku' does not fit well as we recommend to use the same
value for different SKUs if vendors wish to have the same colors
on those SKUs.

Bug: 32268656
Change-Id: Ib5e5a3386676453dafeb13a6a6bf91f81bb48a11
2016-10-19 14:06:32 +01:00
Adam Lesinski
08a870cd6d Fix race with Asset destruction and printing allocation stats am: 2582465bb4
am: 882f8168b0

Change-Id: I613fabdaad38be88ff9c4527e100e33a87f9d601
2016-10-18 20:53:59 +00:00
Adam Lesinski
882f8168b0 Fix race with Asset destruction and printing allocation stats
am: 2582465bb4

Change-Id: I1dbb7609fa4d770e513e6f628e4c598600607383
2016-10-18 20:40:50 +00:00
George Burgess IV
1db1a86bba Merge "Fix static analyzer warnings."
am: ff5c3ad08b

Change-Id: I655fd765cfeae407c070261cfe07ce8b739b06fa
2016-10-18 01:43:24 +00:00
Adam Lesinski
2582465bb4 Fix race with Asset destruction and printing allocation stats
A race could occur when printing the list of Asset allocations for
debugging purposes.

Each Asset object would insert themselves into a global linked list
on construction and remove themselves on destruction. Iterating the list
and the insertion/remove operations all acquire a global lock.

The race occurs after the Asset subclass destructor runs but before the Asset
base class destructor runs, which performs the actual removal from the list.

The vtable of the object being destroyed ends up pointing at the base Asset class'
vtable, and during the iteration of the global list, a pure virtual method is called
leading to an abort, since the wrong vtable is dereferenced.

This change moves the insertion/removal of the Asset object into the global list
to the concrete class, which adds some maintenance overhead but solves the problem.

Bug:31113965
Test: make libandroidfw_tests
Change-Id: I1a620897e5e04a8519ee247883bba0719b1fa6f3
(cherry picked from commit 0358efe4f76f42d9eea91600202a5ab0831d9cef)
2016-10-18 01:27:39 +00:00
George Burgess IV
e8efec56f0 Fix static analyzer warnings.
frameworks/base/libs/androidfw/ResourceTypes.cpp:742:46: warning: Result
of 'calloc' is converted to a pointer of type 'char16_t *', which is
incompatible with sizeof operand type 'char16_t **'
    mCache = (char16_t**)calloc(mHeader->stringCount,
        sizeof(char16_t**));

frameworks/base/libs/androidfw/ResourceTypes.cpp:4359:28: warning:
Potential leak of memory pointed to by 'set'
     return NO_MEMORY;

Bug: None
Test: Builds without the aforementioned warnings.
Change-Id: I1f84c1b9f4cba05f5cc7c3ae9fec1a07bc9cd8fe
2016-10-13 15:32:33 -07:00
Martin Wallgren
3970c44547 RRO: Synchronize access to overlays.list am: 0fbb608110
am: dce79f10ba

Change-Id: Idc121ffe64f1bc7b5bdcb1a800305165f27f1c0a
2016-10-12 21:09:42 +00:00
Martin Wallgren
dce79f10ba RRO: Synchronize access to overlays.list
am: 0fbb608110

Change-Id: I44a716df3954b6d2d58d7c9784f8b55cf041b10b
2016-10-12 21:03:11 +00: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
Martin Wallgren
f12af5e907 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.

Bug: 28032298

Change-Id: I51d39f121d207b11181340b68b164b60020f0c61
2016-10-12 15:42:04 +09:00
songjinshi
09901f3bc9 Fix thread race caused double free issue.
am: 5754b41c20

Change-Id: Ic9dd6e9c6d216753d997da99158816682d5464d1
2016-10-06 20:13:00 +00:00
Adam Lesinski
224ffd3cb2 Merge "[AssetManager]:Fix thread race caused double free issue." am: 126e022095 am: f48d0b8f19
am: 73b91c63ad

Change-Id: I27f5cc6106f0a8f0a58721e1e8ed836144347b6a
2016-10-03 20:26:41 +00:00
songjinshi
5754b41c20 Fix thread race caused double free issue.
The SharedZip's Asset is not thread-safety,the getResourceTableAsset()
and setResourceTableAsset(Asset* asset) function of the SharedZip is
not sync with a same lock.

Consider the following sequence of events:
Thread A calls setResourceTableAsset(Asset* asset),it will set
mResourceTableAsset = asset; then to calls getBuffer() of the asset.
Thread B calls getResourceTableAsset(),which return mResourceTableAsset,
then to calls getBuffer() of the mResourceTableAsset,the asset and
mResourceTableAsset is same one object.
Thread A to delete mZipInflater in getBuffer().
Thread B to delete mZipInflater in getBuffer().

It will cause crash becuase double delete mZipInflater in getBuffer().

https://code.google.com/p/android/issues/detail?id=211941

Bug:31734545
Change-Id: I5a7d67fdf64c4aa03f505b37a2fa840f4443d158
Signed-off-by: songjinshi <songjinshi@xiaomi.com>
2016-10-03 20:13:12 +00:00
Jakub Adamek
e60842aba3 Change name of overlay subdir property to sku.
am: c03d9483f0

Change-Id: I1368890b9c2dde2c5177473da3af0872c0c937a1
2016-10-03 10:30:14 +00:00
Jakub Adamek
c03d9483f0 Change name of overlay subdir property to sku.
Also move the SKU subdirectories directly under /vendor/overlay.

Bug: 31692079
Change-Id: I68c712b13918cc99629534580ee4f77d9e5b3823
2016-10-03 10:14:12 +01:00
Jakub Adamek
ff5cb98888 Search for runtime resource overlays in subdir.
am: 1c15c63578

Change-Id: Ie6614c07851a2365b623a455b2ccc85672d4c846
2016-09-28 10:27:41 +00:00
Jakub Adamek
1c15c63578 Search for runtime resource overlays in subdir.
See go/sku-colors. This changes the directory to search for framework
overlays if the right system property is defined. This allows
OEMs to specify different resources based on device SKUs.

Bug: 31692079
Change-Id: I9cb121b286b7f52aa26de1757fde1f3110cd47fd
2016-09-28 10:09:20 +01:00
songjinshi
49921f2c05 [AssetManager]:Fix thread race caused double free issue.
The SharedZip's Asset is not thread-safety,the getResourceTableAsset()
and setResourceTableAsset(Asset* asset) function of the SharedZip is
not sync with a same lock.

Consider the following sequence of events:
Thread A calls setResourceTableAsset(Asset* asset),it will set
mResourceTableAsset = asset; then to calls getBuffer() of the asset.
Thread B calls getResourceTableAsset(),which return mResourceTableAsset,
then to calls getBuffer() of the mResourceTableAsset,the asset and
mResourceTableAsset is same one object.
Thread A to delete mZipInflater in getBuffer().
Thread B to delete mZipInflater in getBuffer().

It will cause crash becuase double delete mZipInflater in getBuffer().

https://code.google.com/p/android/issues/detail?id=211941

Change-Id: I5a7d67fdf64c4aa03f505b37a2fa840f4443d158
Signed-off-by: songjinshi <songjinshi@xiaomi.com>
2016-09-20 01:31:19 +00:00