Commit Graph

10805 Commits

Author SHA1 Message Date
Ryan Mitchell
2201f8b626 Merge "Add policies and enforce overlayable to header" into rvc-dev 2020-06-05 16:07:28 +00:00
Ryan Mitchell
a707013b78 Add policies and enforce overlayable to header
If the fulfilled policies change without the contents of the target
and overlay APKs changing, the idmap for the overlay should be
regenerated. This change adds fulfilled policies and enforce
overlayable to the idmap header so that idmap2d can determine if the
polices or enforce overlayable changed from what was used to generate
the idmap.

Bug: 119328308
Test: idmap2_tests
Test: atest RegenerateIdmapTest

Change-Id: I96f970e82b5243be01b205ac2cb6ab249c6100bc
2020-06-01 16:15:35 -07:00
Ryan Mitchell
d338dfe583 Avoid Asset::LoadImpl crash when getBuffer is null
If for some reason Asset::getBuffer returns a null pointer, error out
instead of dereferencing the null pointer.

Bug: 125943266
Bug: 154461471

Test: boots
Change-Id: I957be4f9b8c49c2a6829e8b82fae0ae8d8d7639e
2020-05-28 14:03:27 -07:00
Jerome Gaillard
a818713c5e Use JNI types for return types of JNI methods
JNI methods should use JNI types for their return types so as to ensure
type compatibility between Java and C++.

Bug: 152250228
Test: N/A
Change-Id: Iae05806b91ebe5f173607d243d8504ec9e938589
2020-05-26 16:55:43 +00:00
Chris Li
cd13452cfb Merge "Update WM Jetpack impl to use WindowMetrics" into rvc-dev 2020-05-15 04:49:40 +00:00
Chris Li
50df43e354 Update WM Jetpack impl to use WindowMetrics
Before, SettingsExtensionImpl#getWindowLayoutInfo returned empty window
info when Activity was not attached. Now, it returns the correct info
after Activity create.

Test: atest CtsWindowManagerJetpackTestCases:ExtensionTest
Fixes: 152534741
Fixes: 155121604
Fixes: 155692339
Change-Id: Ieded3b70ff14aba03581bf7501cc5e923b5eed33
2020-05-08 18:00:31 -07:00
John Reck
acf8443e9a Merge "Avoid excessive KGSL maps" into rvc-dev 2020-05-08 18:44:55 +00:00
John Reck
8ddbc59d55 Avoid excessive KGSL maps
Hook MIN_UNDEQUEUED_BUFFERS if possible to avoid thrashing kgsl
maps when render_ahead is being used

Bug: 143555869
Test: verified kgsl maps only happened once per buffer
Change-Id: I985fae0a9a7635be3a1cf6177186e5541a1169df
2020-05-07 16:47:10 -07:00
Haibo Huang
a2588f766f Fix the use of pdfium
FPDF_LoadPage returns FPDF_PAGE and that's also what expected by other
APIs. There's no need for conversion.

This works now because FPDF_PAGE is defined as void*. But will fails
with new pdfium.

Bug: 155031873
Change-Id: I74381ec8ec36797a5901ea3de845c2b5d798ba0c
(cherry picked from commit 24fca180a1)
2020-05-07 22:01:01 +00:00
Dheeraj Shetty
21b6e912c2 Merge "Revert^2 "hwui: remove FatVector"" into rvc-dev 2020-05-01 23:27:43 +00:00
Chavi Weingarten
882ba30b8a Merge "Send drawFinish callback even if did not draw" into rvc-dev 2020-05-01 18:27:59 +00:00
Jagadeesh Pakaravoor
b624af3dca Revert^2 "hwui: remove FatVector"
Revert submission 10449863-revert-fatvector

Reason for revert: b/149254345

Original change (of introducing FatVector) was reverted as a stop-gap solution to fix the aforementioned bug.

The bug was caused by an ABI lock between Surface's definition (that changed with Region) and lib-imsvt prebuilt.

Enabling this change now as we have re-compiled the prebuilt with the change enabled. Doing that via a revert of the revert.

Reverted Changes:
I8ac66acb8:Revert "hwui: remove FatVector"
Ib60dbf3ef:Revert "libui: rewrite Region with FatVector"

Original changes:
I09dc2fddd:hwui: remove FatVector
I265c6c831:libui: rewrite Region with FatVector

bug: 149254345

Change-Id: I9fb5e8908434abb9a763992e922445a2dc37e865
2020-05-01 15:57:15 +00:00
Leon Scroggins III
950f2aa825 Fix setShadowLayer + drawTextOnPath
Bug: 140255441
Test: I49c468b0f4cc142e5d6b03f0aee917b3d85153f3

Fix two issues that prevented this combination from working:
- make() the SkTextBlob once and reuse it for each iteration of the
  loop. This is necessary because make() resets the SkTextBlobBuilder,
  so a second call does nothing.
- use the altered SkPaint, passed as a parameter to the lambda, rather
  than the Paint passed to apply_looper.
Incidentally, reference mCanvas directly like the other methods, rather
than calling asSkCanvas(), which returns mCanvas.

Change-Id: I48ea1232b12df4f5f8afffc20c7dc8e5dc2bb511
2020-05-01 15:38:26 +00:00
chaviw
5fc80e7b32 Send drawFinish callback even if did not draw
There are cases where ViewRootImpl requests to draw, but there was
nothing new to draw. In that case, the callback will never be invoked
and ViewRootImpl will wait forever.

This change will invoke the callback even if there is nothing to draw.
It will use the last frameNumber since nothing new has drawn

Test: Request draw with nothing new. Callback is invoked
Fixes: 155429223
Change-Id: I7c9ed7fd63a451b17133a11ffbcf8fb64be558e5
2020-04-30 14:38:52 -07:00
TreeHugger Robot
ac774e3304 Merge "Restore preserving mutability over parceling" into rvc-dev 2020-04-13 21:12:54 +00:00
John Reck
9054ca2b34 Restore preserving mutability over parceling
Bug: 150836900
Test: CTS test BitmapTest#testWriteToParcelPreserveMutability
Change-Id: I2caba900a3259e2fb7b4e83d7241cebd7441fa06
Merged-In: I133047acfccae7af81199098caaf20ea8d641a89
2020-04-13 16:14:21 +00:00
Ryan Mitchell
b8a61d13c2 Merge "Fail install when resources.arsc is compressed" into rvc-dev 2020-04-13 14:57:19 +00:00
Ryan Mitchell
192400cf33 Fail install when resources.arsc is compressed
If an application targets R+, prevent the application from being
installed if the app has a compressed resources.arsc or if the
resources.arsc is not aligned on a 4-byte boundary. Resources tables
that cannot be memory mapped have to be read into a buffer in RAM
and exert unnecessary memory pressure on the system.

Bug: 132742131
Test: manual (adding CTS tests)
Change-Id: Ieef764c87643863de24531fac12cc520fe6d90d0
2020-04-09 11:01:54 -07:00
Ryan Mitchell
a90930528d Invalidate idmap when target updates
When the target package update, check if the idmap file must change.
If so, propagate the idmap changes to the targets overlay paths, and
invalidate cached overlay ApkAssets in ResourcesManager.

Bug: 147794117
Bug: 150877400
Test: OverlayRemountedTest
Test: libandroidfw_tests
Change-Id: I6115c30bae3672b188a5ff270720a0eea15b43b5
2020-04-07 12:14:51 -07:00
TreeHugger Robot
5d3fc109ec Merge "Don't reset the capture mode after each frame when using the CallbackAPI" into rvc-dev 2020-04-07 17:04:49 +00:00
Derek Sollenberger
5f9753d770 Don't reset the capture mode after each frame when using the CallbackAPI
When multiframe skp support was introduced it set the capture mode to
none for everything but the multiframe use case. This was incorrect in
the case of the CallbackAPI where we want to continue to capture frames.

Bug: 152084866
Test: hwui_unit_tests
Change-Id: I7e3caf41a3725d03252df1ab7bedfe1b69a238c2
2020-04-07 11:26:52 -04:00
TreeHugger Robot
10dd5e9a18 Merge "Don't update the genID for an immutable bitmap" into rvc-dev 2020-04-07 13:46:17 +00:00
Leon Scroggins III
f97b29d2e3 Switch get_env_or_die to requireEnv
Fixes: 153099745
Test: manual

The heif decoder may need to continue reading the input from a
JavaInputStreamAdaptor on the AnimatedImageThread. Attach the JVM like
we do for ByteBufferStream and ByteArrayStream.

Similarly, if the AnimatedImageThread is holding a reference to an
AnimatedImageDrawable, it is possible to call its destructor, and
ultimately InvokeListener's destructor or ByteBufferStreamAdaptor's
release_proc on that thread without the JVM attached. Attach in that
case, too.

Change-Id: I84d236eed2fb5c8617533aed0cae4c762d1eb6dd
2020-04-06 21:11:37 +00:00
Derek Sollenberger
d3e9eecf5b Don't update the genID for an immutable bitmap
AndroidBitmap_unlockPixels is the only way to release the ref on
pixels acquired using AndroidBitmap_lockPixels.  Apps that lock an
immutable bitmap therefore are forced to call unlock pixels. Prior
to this CL the unlock would update the GenID of the bitmap and also
print a warning that the app was modifying an immutable bitmap. After
this CL the bitmap's GenID will not be updated and no warning will be
printed.

As a result, apps that were using the NDK to allow them to mutate
immutable bitmaps will break without getting a warning message.

Test: hwui_unit_tests
Bug: 150823341
Change-Id: Ie5e5cf86a7a83d53c179c9b3cf9be1a0566cfd93
2020-04-06 20:26:49 +00:00
Ryan Mitchell
1b922d56c0 Merge "Begin moving FrameworkResourceLoaderTest to cts" into rvc-dev 2020-04-03 16:03:24 +00:00
Leon Scroggins III
f889444fa9 AImageDecoder: Suppress log messages
Bug: 153071768
Test: AImageDecoderTest

For simplicity, I1aff544e8d6932b9ed0931a00da66a0aba6cd536 made
ImageDecoder skip specifying kOpaque when setting the SkImageInfo for
decoding. For some formats (e.g. jpeg and heif), this results in a log
message:

"Warning: an opaque image should be decoded as opaque - it is being
 decoded as non-opaque, which will draw slower"

This isn't relevant to AImageDecoder, which doesn't let you specify
kOpaque or not (since the intent is not to create an SkBitmap for Skia).

Now that ImageDecoder specifies kOpaque properly, the JNI code no longer
needs to correct it.

Replace another opacity check with ::opaque() for simplicity.

Change-Id: I7c270d9b9db61a61a338f40b056ce5d23a56e14d
2020-04-02 16:01:52 +00:00
Ryan Mitchell
199b09a1a7 Begin moving FrameworkResourceLoaderTest to cts
This changes removes FrameworkResourceLoaderTest from frameworks/base
before it is moved to CTS.

Bug: 152979463
Test: atest CtsResourcesLoaderTest
Change-Id: I4b899564ab93472cb6d2a5ed0917026753c2827f
2020-04-01 20:09:29 +00:00
TreeHugger Robot
c2e20c4b8a Merge "[HWUI] Add null check for CanvasContext" into rvc-dev 2020-03-28 04:02:31 +00:00
Ryan Mitchell
8275fb7d66 Merge changes If7ea17d5,If6364fd6 into rvc-dev
* changes:
  Assigned package ids to overlays last
  Revert "Assign shared libraries stable package ids"
2020-03-27 17:38:32 +00:00
Alec Mouri
026106f6d6 [HWUI] Add null check for CanvasContext
If ReliableSurface is forced to acquire a fallback buffer then the
Surface may be abandoned. When getting frame timestamps we need to check
that the Surface still exists.

Bug: 152262035
Test: builds, boots
Test: dumpsys gfxinfo
Change-Id: Ifdb198ebf74cc9dc681c4ab51c4901176a7f5fc9
2020-03-26 18:09:53 -07:00
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
Ryan Mitchell
824cc490c5 Assigned package ids to overlays last
Before overlays could reference internal resources, overlays were
added to AssetManagers before shared libraries. Overlays are now
loaded as shared libraries so they must be assigned package ids
after non-overlay shared libraries so enabling and disabling
overlays does not affect the package ids of the non-overlay shared
libraries.

Since overlays are added to the end of the AssetManager by
ResourcesManager, enabling and disabling overlays will not change
the assets cookie of shared libraries loaded through ResourcesManager,
but it will change the apk assets cookie or overlays added through
AssetManager#addAssetPathAsSharedLibrary.

The package ids of shared libraries added through
AssetManager#addAssetPathAsSharedLibrary will not be affected by
overlays since overlay package ids are assigned last.

Bug: 146685730
Test: CtsHostsideWebViewTests
Change-Id: If7ea17d51b18769bf2465e29af3ae6a71004d06c
2020-03-23 18:14:11 -07:00
Ryan Mitchell
b894c274d0 Revert "Assign shared libraries stable package ids"
This change must be reverted because it broke packages with the same
package name but different package ids loaded at once.

Bug: 146685730
Test: MultiSplitInstallTest
This reverts commit fe50d739f7.

Change-Id: If6364fd660c76284452f77e7d4f09a3df9dede1d
2020-03-23 18:05:40 -07: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 c658184d36)
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 d66f77b0b7)
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