10773 Commits

Author SHA1 Message Date
Mike Ma
892ccd9bd5 Optimize memory usage in incidentd
EncodedBuffer is used a lot in incidentd. EncodedBuffer uses malloc
internally to acquire memory. Frequently creating and destroying
EncodedBuffer creates memory fragmentation, leading to high memory
usage after taking an incident report.
Also fixes a few other places with lots of malloc/free operations.

This change:
* Creates a pool of EncodedBuffer in incidentd. The saving is
significant. It reduces EncodedBuffer creation from 3 per section to
3 per report.
* Replaces malloc with mmap inside EncodedBuffer. mmap is guaranteed
to be mem page aligned, so there will be no mem fragmentation after
destroying EncodedBuffer.
* Replaces new with mmap inside TombstoneSection
* Forks a process to execute LogSection, because liblog malloc & free
significant amount of memory

Result:
PSS before taking a report: 1295 KB
PSS after taking a report: 1336 KB

Bug: 150311553
Test: heapprofd
Change-Id: I83bd9c969b751c80b2f42747020799bd85d8aae6
2020-03-23 18:46:58 -07:00
TreeHugger Robot
14f33ae83e Merge "Native API Council asked that we remove the C++ class from the public header." into rvc-dev 2020-03-24 01:35:40 +00:00
Joe Onorato
084aa3cb17 Native API Council asked that we remove the C++ class from the public header.
The API is simple enough, so just reimplement everything using the
C API directly.

Bug: 148940365
Test: treehugger
Change-Id: I0a75744e975e8d3c2a557e533eacd03200388ddc
2020-03-21 18:33:28 -07:00
TreeHugger Robot
1e377304cb Merge "Statsd update for native puller api feedback" into rvc-dev 2020-03-21 03:15:06 +00:00
Ryan Mitchell
b0544a733c Merge changes from topic "res_loader_dir" into rvc-dev
* changes:
  Allow using loaders on non-RM Resources instances
  Move AssetsProvider to native layer
  Add ResourcesProvider.loadFromDirectory
  Refactor tests for ApkAsset loading APIs
  Refactor ApkAsset loading APIs
  Fix bugprone-use-after-move warnings
  Fix bugprone-use-after-move warnings
2020-03-20 18:16:30 +00:00
Tej Singh
73597dcb9a Statsd update for native puller api feedback
Update statsd to take in times in milliseconds instead of nanoseconds.

Also make appropriate updates for graphics stats, odpm, subsystem sleep
state, and LibStatsPullTests

Test: atest LibStatsPullTests
Test: bit statsd_test:*
Bug: 150788562
Change-Id: I593552d6c50bb4dcb89ca9cc1c737781653e7cc5
2020-03-20 11:16:18 -07:00
Ryan Mitchell
39cacf2de7 Allow using loaders on non-RM Resources instances
Currently there is a limitation where ResourcesLoaders cannot be  used
on Resources object not created through ResourcesManager. This change
creates an update handler for Resources objects that are not registered
with ResourcesManager.

The handler changes the loaders on the asset manager owned by the
Resources instance.

Bug: 151666644
Test: atest ResourceLoaderValuesTest
Change-Id: I5a89f686386bdb088dc964014e7becc0c2b4770f
2020-03-19 18:33:55 -07:00
Ryan Mitchell
4ea1e42889 Move AssetsProvider to native layer
Querying in the native layer for assets provided through
AssetsProviders does not currently work. This change refactors the
AssetProvider API to return a file descriptor that is read in the
native layer and can bubble up to the java layer.

This change also removes the InputStream API to favor of developers
using memfd_create.

Bug: 142716192
Test: atest ResourceLoaderValuesTest
Change-Id: I1a7eca0994c3b7cc32008d9a72bf91086ff0e816
2020-03-19 18:33:55 -07:00
Ryan Mitchell
c07aa70270 Add ResourcesProvider.loadFromDirectory
This API allows a directory to be loaded as if it was a zipped APK.
This is a substitute for the DirectoryAssetProvider API that
currently does not work in the native layer.

Bug: 142716192
Test: atest FrameworksResourceLoaderTests
Change-Id: Ia13e15653e75b421423dd56f9fe89e183ab4cb9a
2020-03-19 18:33:55 -07:00
Ryan Mitchell
ef40d2e832 Refactor ApkAsset loading APIs
To add the partner requested ResourcesProvider#loadFromDir APIs, this
change adds format type integer that allows us to reduce the number of
ApkAssets loading overrides.

This change also adds hidden offset and length based ResourcesProvider
APIs that could not make R.

Bug: 142716192
Test: atest FrameworksResourceLoaderTests
Change-Id: I926fde257cae701901dcd4ca408024feae8c90a6
Merged-In: I926fde257cae701901dcd4ca408024feae8c90a6
2020-03-19 18:33:55 -07:00
Ryan Mitchell
e35e87f514 Fix bugprone-use-after-move warnings
Bug: 150783499
Test: WITH_TIDY=1 make
Change-Id: I185cb21521676ddbc4f2b7f098611a2efc7275e6
(cherry picked from commit c658184d366ee08cedd9ec208ea327530b52bfad)
Merged-In: I185cb21521676ddbc4f2b7f098611a2efc7275e6
2020-03-19 16:57:50 -07:00
Nikita Iashchenko
099927dc5d Merge "Regenerate LocaleDataTables.cpp wtih Unicode 13 update" into rvc-dev 2020-03-17 12:55:13 +00:00
Nikita Iashchenko
93a9e785ea Regenerate LocaleDataTables.cpp wtih Unicode 13 update
LocaleDataTables.cpp is regenerated with Unicode 13 updates from CLDR.

Bug: 149845726
Test: ./tools/localedata/extract_icu_data.py $ANDROID_BUILD_TOP
Test: m droid
Merged-In: Id2d023723b50c1c2f73fe07f46fb9b3cae990752
Change-Id: Id2d023723b50c1c2f73fe07f46fb9b3cae990752
2020-03-16 12:39:27 +00:00
Kazuhiro Inaba
a74d637df1 Let LayerDrawable choose the best scaling filter for readback.
The check used in Readback.cpp did not take the transformation
matrix into account for judging whether the copy was scaling.

libs/hwui/pipeline/skia/LayerDrawable.cpp already incorporates
the logic to detect non-scaling copy, so we can just let it
check the condition. This version regards 90-degree rotation
without size change as non-scaling and disables filters.

Bug: 151126720
Bug: 150839078
Test: atest android.view.cts.PixelCopyTest
Change-Id: I69e987e6a2e48299c5e579f8c218c42a724dc606
2020-03-11 00:01:53 +09:00
Andrii Kulian
24cfad9c2c Merge "DO NOT MERGE Test sidecar OEM implementation for WM support library" into rvc-dev 2020-03-06 04:24:36 +00:00
TreeHugger Robot
ec6198e99d Merge "Add an option to zip incident report" into rvc-dev 2020-03-05 22:59:49 +00:00
Andrii Kulian
73b23c9a3e DO NOT MERGE Test sidecar OEM implementation for WM support library
This provides an example implementation of the Sidecar interface
for the Window support library, which allows mocking a foldable
device by reading its current configuration from settings.

This implementation also makes sure that the reported display
features are adjusted to the window position and coordinate space,
as required by the Sidecar interface contract.

The reported values can be updated by using the following shell
commands:
settings put global device_posture <posture>
settings put global display_features <type>-[<sX>,<sY>,<eX>,<eY>]

Bug: 146188055
Test: Manual, see instructions doc
Change-Id: I4764298d7633bc3ef574b5cbc2dee256e9cf3f03
(cherry picked from commit d66f77b0b762091464c850bb79744ea5d07e0053)
2020-03-05 13:56:02 -08:00
Mike Ma
b6f7c47252 Add an option to zip incident report
Incident reports are getting bigger as we add more sections. Add an
option (-z, default off) to zip incident report.

Bug: 150160547
Test: atest incidentd_test
Test: adb shell incident -z -p EXPLICIT | gunzip | ./out/soong/host/linux-x86/bin/aprotoc --decode=android.os.IncidentProto --proto_path=./ --proto_path=external/protobuf/src frameworks/base/core/proto/android/os/incident.proto
Change-Id: I7c8ff1d91df842c200462ee29f15feae68e62739
2020-03-05 12:42:50 -08:00
Tim Murray
894f132ba0 Revert "hwui: remove FatVector"
Revert "libui: rewrite Region with FatVector"

Revert submission 10248126-fatvector-region

Reason for revert: b/149254345
Reverted Changes:
I09dc2fddd:hwui: remove FatVector
I265c6c831:libui: rewrite Region with FatVector

also fix wrong license in FatVector.h

Test: boots
Bug: 149254345

Change-Id: I8ac66acb8b635324051edd41c5d4092c223157ff
2020-03-05 12:15:40 -08:00
Winson
f56ade365a Actor signature overlayable policy
There are cases where an app can ship overlays for itself,
but the "signature" policy as described would open up
a vulnerability by allowing the system actor to create
and sign any arbitrary overlay that will apply to the target.

To prevent this, redefine "signature" as target package only,
and introduce "actor" for checking against the actor signature.
Any app that wishes to use both can include both policies.

Bug: 130563563

Test: m aapt2_tests idmapt2_tests and run from host test output
Test: atest libandroidfw_tests

Change-Id: I1c583a5b37f4abbeb18fc6a35c502377d8977a41
2020-02-26 15:59:44 -08:00
Winson
62ac8b56a9 Refactor overlayable policy
To make it easier to add the actor policy in a follow up CL,
move most of the policy handling to a central location.

The strings and transformation between strings and flags is
now handled in libidmap2policies, with libandroidfw
containing the single source of policy flags.

This also extracts all the test resource IDs into an R.h
so they can be swapped without having to edit a dozen files
each time.

Bug: 130563563

Test: m aapt2_tests idmapt2_tests and run from host test output
Test: atest libandroidfw_tests

Change-Id: Ie533c9cebf938215df7586f00c38763ae467e606
2020-02-26 15:59:43 -08:00
Derek Sollenberger
76e7430bae Merge changes from topic "HWUI_JNI"
* changes:
  Export symbols for the newly exposed APEX/internal headers
  Remove dependence on libandroid_runtime from Bitmap.cpp
  Update Region.cpp to use AParcel NDK APIs
  Cleanup header and build targets for libhwui clients.
  Remove dependencies on headers outside UI module
  Cleanup LOG_TAG when bundled in HWUI
  Move android.graphics JNI & APEX files into HWUI
2020-02-21 11:43:02 +00:00
Derek Sollenberger
2173ea286a Export symbols for the newly exposed APEX/internal headers
Bug: 137655431
Test: CtsUiRenderingTestCases
Change-Id: I71c6d1a53ae080bf104848679ee62a77cf07c9fa
2020-02-20 21:50:06 -05:00
Derek Sollenberger
42c50042d1 Remove dependence on libandroid_runtime from Bitmap.cpp
The end goal is to have Bitmap.cpp use AParcel, but until that
API is extended to support this use case this is an alternative
way to isolate the graphics files from the libandroid_runtime.

Test: CtsGraphicsTestCases
Bug: 145227478
Change-Id: Ie3854fe03dec4f7b1b485295bb9a5ebba52ddb7c
2020-02-20 21:50:06 -05:00
Derek Sollenberger
15da7e24a5 Update Region.cpp to use AParcel NDK APIs
Test: CtsGraphicsTestCases
Bug: 145227478
Change-Id: I36f5d3e760bce3c302277c7897c7f8df0ac3cb61
2020-02-20 21:50:06 -05:00
Derek Sollenberger
ee538a3a85 Cleanup header and build targets for libhwui clients.
Targets that will also be contained within the UI module
are allowed to access internal headers.  All other targets
that depend on libhwui are restricted to using the APEX headers.

Bug: 137655431
Test: CtsUiRenderingTestCases
Change-Id: Id92e9874dafb98bd79839d45ab8f22ab999689de
2020-02-20 21:50:06 -05:00
Derek Sollenberger
c5882c4eb6 Remove dependencies on headers outside UI module
This includes AndroidRuntime and core_jni_helper.h

Bug: 137655431
Test: CtsUiRenderingTestCases
Change-Id: If3d26f41eaf4981505ee47634097f3645fd563fd
2020-02-20 21:49:44 -05:00
Leon Scroggins III
3d334d816a Make Bitmap::createFrom() account for zero stride
Bug: 143470518
Test: android.graphics.cts.ImageDecoderTest#testConserveMemoryPlusHardware

Follow up to ag/10045682, which was resolving a merge conflict. The
original fix (https://android-review.googlesource.com/1203783) was
on the single Bitmap constructor which took a GraphicBuffer parameter.
The conflict was with ag/9130111, which switched the input to an
AHardwareBuffer and split this version of Bitmap::createFrom into two
methods. The constructor no longer has access to the information
regarding the buffer stride, so that got moved into Bitmap::createFrom.
But both versions should have the fix. (In fact, it appears that the
version that did *not* have the fix is the one being called in
testConserveMemoryPlusHardware.)

Move the rowBytes computation into a common method so that both will
have the fix.

Change-Id: I16f77528abdb331af556bbe5d0485fe342f2325e
2020-02-20 13:41:17 +00:00
Anton Hansson
1254f6740a Merge "Remove obsolete subdirs and optional_subdirs" 2020-02-20 11:35:42 +00:00
Derek Sollenberger
5368eda512 Cleanup LOG_TAG when bundled in HWUI
Bug: 137655431
Test: CtsUiRenderingTestCases
Change-Id: If0f1377e0ab831f38d752c3bbe282397c061b02c
2020-02-19 21:13:34 -05:00
Derek Sollenberger
83ccff716f Move android.graphics JNI & APEX files into HWUI
The graphics JNI code is now separate from libandroid_runtime
and it along with HWUI headers are no longer visible to targets
outside the boundary of what is to become the UI mainline module

The exposed headers to targets outside the module are now restriced
to C APIs contained in the apex header directory.

Bug: 137655431
Test: CtsUiRenderingTestCases
Change-Id: I30d34055b6870dc1039f190a88f4a747cee17300
2020-02-19 21:13:34 -05:00
Anton Hansson
305fb2fc1a Remove obsolete subdirs and optional_subdirs
I was looking for documentation of what these mean, but discovered
that these attributes have been obsolete for years.

Test: m
Change-Id: Ifcf47e99d22b1546780968d1030f835173612a27
2020-02-19 16:37:42 +00:00
TreeHugger Robot
2ae81c3c0f Merge "Update GraphicsStats proto definition" 2020-02-19 14:23:20 +00:00
Stan Iliev
b65171956c Update GraphicsStats proto definition
Follow ProtoBestPractices and comments suggested by cl/295218381.
Changing proto definition, should be fine, because these are
fields added after the last Android release.
Move PipelineType enum inside GraphicsStats and add a default
UNKNOWN state.
Rename start_millis and end_millis in GraphicsStats atom.
Fields in GraphicsStatsProto cannot be renamed as these were
part of previous Android releases.

Test: Ran "adb shell cmd stats pull-source 10068"
Test: Ran "statsd_testdrive 10068" and it looks OK
Bug: 149646555
Change-Id: Idc326eb2a7eb9ff0be39026e6fec544491b7d8a6
2020-02-18 10:12:42 -05:00
TreeHugger Robot
d8c867b117 Merge "[HWUI] Remove libgui from libhwui's dependency list" 2020-02-15 02:21:42 +00:00
TreeHugger Robot
805edec77d Merge "[HWUI] Remove references to gui/Surface." 2020-02-15 02:16:16 +00:00
TreeHugger Robot
9d0ab78e40 Merge "Use updated factory for SkOverdrawColorFilter" 2020-02-15 00:16:54 +00:00
Howard Ro
c7ddb87337 Merge "Allow statsd to link against libprotoutil" 2020-02-14 23:28:02 +00:00
Alec Mouri
680414e09e [HWUI] Remove libgui from libhwui's dependency list
* Add sync features extensions into EglExtensions
* Header cleanup

Bug: 136263382
Test: builds
Change-Id: Ibd29cfe5201419210c9dc09e82af10524454b6cd
2020-02-14 15:24:22 -08:00
Alec Mouri
43fe6fcde5 [HWUI] Remove references to gui/Surface.
ANativeWindow usage now has enough feature parity so that we can use
that instead.

Bug: 137012798
Test: builds
Test: Scroll through settings
Change-Id: I0054315058b28bcb5e779a6f71a3cfb164625a5f
2020-02-14 15:24:16 -08:00
Mike Reed
331c4e1207 Use updated factory for SkOverdrawColorFilter
Test: make

Change-Id: Ibf67a37e90152326b3088d2f15f17a6ad261658c
2020-02-14 17:50:18 -05:00
Jeffrey Huang
260613f89f Allow statsd to link against libprotoutil
Bug: 145923087
Test: m -j
Change-Id: I8e21903d8a1c142499ee5b772da54b0fcbae3b67
2020-02-14 10:08:22 -08:00
TreeHugger Robot
bc12e084cd Merge "[ANativeWindow] Rename allocateBuffers to tryAllocateBuffers" 2020-02-14 12:04:48 +00:00
Alec Mouri
c9d5f3d952 [ANativeWindow] Rename allocateBuffers to tryAllocateBuffers
Renaming was done in response to API feedback.

Bug: 148962594
Test: builds
Change-Id: I05b3e99800d967dda243b6e7af48f1b645909bdd
2020-02-13 13:58:50 -08:00
Alec Mouri
8a82b141d1 [HWUI] use ANativeWindow_getLastQueuedBuffer api
Bug: 137012798
Test: builds
Change-Id: Ic33a21a73b0579726f47c53cc102fb91b5ead0d6
2020-02-13 13:28:36 -08:00
Automerger Merge Worker
7cd9daebb1 Merge "Merge "Remove String16 operator<<, now provided in header" am: 35d04c27ee am: f1e6950510" into qt-qpr1-dev-plus-aosp am: 2593e104d5
Change-Id: I5cc3034b3d8ad29a3244ab436325f1f6a5cf243c
2020-02-11 23:26:19 +00:00
Automerger Merge Worker
f1e6950510 Merge "Remove String16 operator<<, now provided in header" am: 35d04c27ee
Change-Id: I225b599e1bb7ba052361c0c0cb926b2c015f7baf
2020-02-11 23:03:21 +00:00
Ryan Mitchell
2ad1f912c0 Merge "Sort bag by attribute key when using libs" 2020-02-10 23:38:59 +00:00
Steven Moreland
849ccdeafe Remove String16 operator<<, now provided in header
Bug: N/A
Test: N/A
Change-Id: Ic0418d81d37726dcfc100ce919b6f79be4077c8a
2020-02-10 15:28:41 -08:00
Ryan Mitchell
155d539634 Sort bag by attribute key when using libs
When shared libraries are assigned package ids in a different order
than compile order, bag resources that use attributes from both
multiple libraries will not be sorted in ascending attribute id order.
This change detects when the attribute ids are not in order and sorts
the bag entries accordingly.

The change is designed to be less invasive. Deduping the GetBag logic
should probably be spun off in a separate bug.

Bug: 147674078
Test: libandroidfw_tests
Change-Id: Id8ce8e9c7ef294fcc312b77468136067d392dbd0
2020-02-10 14:12:00 -08:00