Commit Graph

700 Commits

Author SHA1 Message Date
Matt Buckley
56093a77a9 Add rate limiter to sendHint API call
Adds a rate limiter to the HintSession.sendHint API for safety, and
update tests to reflect this.

Bug: b/243973548
Test: atest PerformanceHintNativeTestCases
Test: atest FrameworksCoreTests:android.os.PerformanceHintManagerTest
Change-Id: Ic68683bacf7df3e11efc3d59689b5470c3fa4274
2022-12-03 03:45:41 +00:00
Wei Wang
7e72d299ff Merge "PerformanceHint: optimize rate limit" 2022-12-01 19:34:24 +00:00
Bart Van Assche
3ddd6e2774 Merge "Switch to C++20" am: a7acd5d5a7 am: b1dfb7b9d7 am: 4e29c9d09b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2307908

Change-Id: I2901bb4bc990b35e3c2b0f8c264ef4d34a160d21
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-30 19:45:21 +00:00
Bart Van Assche
b1dfb7b9d7 Merge "Switch to C++20" am: a7acd5d5a7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2307908

Change-Id: I06ab1e1d7a9db21f14ac33f2eebf84ef6875d02f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-29 20:24:48 +00:00
Bart Van Assche
b66923ab2d Switch to C++20
Prepare for using std::array<> and std::span<> in headers included from
this library. Remove the AFont constructors to prevent that the build
fails as follows:

frameworks/base/native/android/system_fonts.cpp:265:35: error: no matching member function for call to 'insert'
                            fonts.insert(
                            ~~~~~~^~~~~~

Removing these constructors is necessary because of the following rule:
"An aggregate is one of the following types [...] class type (struct or
union) that has [...] no user-declared or inherited constructors (since
C++20)". Source:
https://en.cppreference.com/w/cpp/language/aggregate_initialization.

Bug:  260725458
Change-Id: I384d05f5d3e471f8f58294119d04eb8ab16697ba
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-11-29 09:42:48 -08:00
Wei Wang
00feb50078 PerformanceHint: optimize rate limit
Skip rate limit when first hit target.
Also for 1st frame boost

Bug: 254293108
Test: Build
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I0268de156ba2c34723c1593c76a64331016cc87c
2022-11-23 03:15:39 +00:00
Bo Liu
80c690554a Merge "Rename SC ndk jni API" 2022-11-14 21:07:31 +00:00
Bo Liu
23af702a13 Rename SC ndk jni API
Rename to ASurfaceControl_fromJava / ASurfaceTransaction_fromJava.

Test: Compiles
Bug: 258245761
Change-Id: Ic9cedd83bad3facb46947ecdac6324f4318d8db6
2022-11-11 15:01:01 -05:00
Matt Buckley
b091fb85de Merge "Add support for ADPF HintSession sendHint to JNI" 2022-11-11 17:54:42 +00:00
Matt Buckley
354cc0a140 Add support for ADPF HintSession sendHint to JNI
* Add sendHint API to HintManagerService and PerformanceHintManager
 * Plumb relevant calls through the existing implementation
 * Extend existing tests to cover new API calls
 * Update the relevant build files to use power API v4

Bug: b/243973548
Test: atest PerformanceHintNativeTestCases
Test: atest FrameworksCoreTests:android.os.PerformanceHintManagerTest
Test: atest HintManagerServiceTest

Change-Id: Ice7ed8f32e877bd845afad77fcc6ae16f1a1b78c
2022-11-09 01:49:41 +00:00
Leon Scroggins III
f38eee4014 Add Dichen to cc's for imagedecoder_fuzzer
Dichen is taking over my image decoding responsibilities, so add him to
cc. Leave myself in cc so I can provide context when needed.

Bug: 257475598
Test: N/A
Change-Id: I2adf43d61d214b3f7352d528ba1af32c0ce4bf32
2022-11-04 12:24:36 -04:00
Bo Liu
dd89c3b56e SurfaceControl ndk-jni API review
ASurfaceControl_fromSurfaceControl should acquire a reference before
returning.

Abort if the arguments are invalid, make the return code nonnull.

Test: ASurfaceControlTest#testSurfaceControl_fromSurfaceControl
      and ASurfaceControlTest#testSurfaceTransaction_fromTransaction
Bug: 253053203
Change-Id: If48ff4a534c5765c4831e518e44f77d0429e8981
2022-10-12 13:08:35 +00:00
Rob Carr
88fa84315b Merge "surface_control NDK: Track frameworks/native changes" into tm-qpr-dev am: 1d3ecebe6c am: 9f4876b6a6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20058993

Change-Id: I31c393482d6f285809d033a168f57cef07993697
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-30 18:05:08 +00:00
Rob Carr
9f4876b6a6 Merge "surface_control NDK: Track frameworks/native changes" into tm-qpr-dev am: 1d3ecebe6c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20058993

Change-Id: I46d358e2f2334f224292ccd774f5b57055c37f70
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-30 17:32:06 +00:00
Treehugger Robot
a74a1546b8 Merge changes Ifd00d8d4,Id8db2858 am: eb3651fe72 am: a2ba909c39 am: 71db43c5e2 am: 419f137b85 am: 68099d357b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2212407

Change-Id: If0d77d1808f215970bd6bd63aad66794d482e16d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-28 02:52:25 +00:00
Spandan Das
76d971d0d6 Declare the headers of the ndk_library
This creates a dependency edge between the ndk_library and its headers,
which should be a no-op in regular Soong builds. This dependency edge
will be used in the Multi-tree project to export the relevant .h files into a well
known location

The headers are in a different git project (frameworks/native)

Test: m nothing
Bug: 239044713
Change-Id: Ifd00d8d4d3771b2dbd924cea4f2ade0bafc15ed6
2022-09-27 16:58:15 +00:00
Rob Carr
7c70373e25 surface_control NDK: Track frameworks/native changes
A BBQ changes requires adding an additional member to
SurfaceControlStats which requires updating this destructuring
assignment.

Bug: 247246160
Test: Existing tests pass
Change-Id: Ic485fe3ae97c4243ab9993717c674c66b28c7fee
2022-09-27 01:00:08 +00:00
Harry Cutts
2d6d757b00 Merge "Add input owners of native/android/input.cpp" 2022-09-26 14:41:15 +00:00
Harry Cutts
ee431fc08b Add input owners of native/android/input.cpp
Test: none
Change-Id: Ieee0ab493130eba7d825d463cfbdae4369db165c
2022-09-26 14:33:56 +00:00
Harry Cutts
339b0ee4f7 Merge "Add CLASSIFICATION_TWO_FINGER_SCROLL for touchpad scrolling" 2022-09-26 14:19:40 +00:00
Harry Cutts
7013c869e6 Add CLASSIFICATION_TWO_FINGER_SCROLL for touchpad scrolling
This will be used to denote the single-finger touches that
TouchInputMapper creates to simulate scrolling when the user makes
two-finger swipes on the touchpad.

Bug: 246758376
Test: check new value is sent to a test app when scrolling on a touchpad
Change-Id: Id93cba764522e36d850f7013ab8a117f64716fac
2022-09-23 13:38:21 +00:00
Bo Liu
789103b97a NDK methods to get SurfaceControl/Transction from java
Test: ASurfaceControlTest#testSurfaceControl_fromSurfaceControl
      and ASurfaceControlTest#testSurfaceTransaction_fromTransaction
Change-Id: Ic15bfaae22b50f70c1c82c8945c09b749654a00f
2022-09-17 16:17:08 -04:00
Kriti Dang
4bfeeb4ec5 Add Surface.clearFrameRate API
This API is same as using setFrameRate with 0 as frame-rate value. But
this causes confusion, as the remaining two arguments are ignored, when
frame-rate is 0.

Bug: 241096917
Test: android.graphics.cts.SetFrameRateTest#testClearFrameRate
Change-Id: I1324c64ac75dacb78a733df2b91d7a5b46fc7455
2022-08-26 16:29:25 +02:00
Kohsuke Yatoh
1e62e215d4 Consolidate getFamilyAt() calls to minikin.
- Typeface: Use FontCollection::createCollectionWithFamilies() instead
  of creating fallback list inside hwui.
- system_fonts: Use SystemFonts::getFontSet() intead of getFontMap().

Bug: 174672300
Test: atest CtsGraphicsTestCases:android.graphics.cts.TypefaceTest
Test: atest CtsGraphicsTestCases:android.graphics.fonts.NativeSystemFontTest
Change-Id: I940f8de441b7bd102eca2d08bc5dd4d0fc4a2685
2022-08-20 03:50:57 +00:00
Kohsuke Yatoh
146c6a93d7 Replace getFamilies() with getFamilyAt().
Following minikin signature change.

Bug: 174672300
Test: m libhwui
Test: m libandroid
Change-Id: I25c5d27c406f49b5ee91a7f4390484296d4a6c7f
2022-07-20 21:48:22 +00:00
Jimmy Shiu
e1cf4b7601 Merge "Send the hint immediately when actual > target" into tm-dev am: 49c95b1618 am: 92a6873890
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17011864

Change-Id: I3b5d080d3acc0b0908ee70be7d6818d9b6b81058
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 14:55:04 +00:00
Wei Wang
9f174f4bbb Send the hint immediately when actual > target
Send the hint immediately when actual duration is longer than target
duration.

Test: boot
Bug: 198379880
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I6c80940b27d65a1e34e40f61eef3f81990957711
2022-04-19 17:19:54 +00:00
Huihong Luo
36b55bc2ac Sync with ISurfaceComposerClient changes
ISurfaceComposerClient in libgui is migrated to AIDL interface.

Bug: 172002646
Test: atest libgui_test
Change-Id: I5301a710a84bcf90ca4a789e184748e889115045
2022-04-07 20:53:48 +00:00
Huihong Luo
4fed9b4544 Sync with FrameTimelineInfo aidl migration
libgui FrameTimelineInfo has been converted to aidl  parcelable.

Bug: 222537482
Test: atest libgui_test libsurfaceflinger_unittest SurfaceFlinger_test
Change-Id: I6bf8433d7786485faef61633917659cca5d7f512
2022-04-05 15:20:02 -07:00
Ken Chen
562bef09f2 Merge "Update data type and comments on tagSocket/untagSocket APIs" am: ef89731cd3 am: aa82affbc0 am: 292d5f01ec am: 72d6df3c6f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2049804

Change-Id: I223848fa1800c332ebb751191139da604f78ba4f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-31 04:19:44 +00:00
Ken Chen
72d6df3c6f Merge "Update data type and comments on tagSocket/untagSocket APIs" am: ef89731cd3 am: aa82affbc0 am: 292d5f01ec
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2049804

Change-Id: Id759de693eb64fe729c99b141d267790767a806c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-31 04:10:28 +00:00
Ken Chen
9c315eb11f Update data type and comments on tagSocket/untagSocket APIs
- Fix comment in version script to say LL-NDK, not NDK
- Use uint32_t for tag

Bug: 223423155
Test: CtsNetTestCases:android.net.TrafficStatsTest
Test: CtsNativeNetPlatformTestCases
Change-Id: Ifb819ed0adeb8f173b98c3f131a4bf2e0715dd4e
2022-03-31 00:28:15 +08:00
Austin Borger
f3dfe9fa66 Merge changes from topics "b124224342", "change_procstate_flag" into tm-dev am: 45081ab6a0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16994323

Change-Id: Ifd340dfba8a24ea83678b8ce7359faa846bb7222
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-29 22:11:51 +00:00
Austin Borger
db9165baf2 Add new onUidProcAdjChanged callback to be consumed by the camera
service.

The camera service needs to know when individual process oom adj scores
are changed in order to address bug #124224342. When two separate
processes are displayed in split screen and focus is switched between
them, both proc states will remain the same while their oom scores
change. This is a problem if both have access to the camera - we want
only one owner of the camera stream at any given time and for the app
in focus to be the one to own it.

This patch adds a new IUidObserver registration level for individual
process oom score changes. In addition a new callback has been added to
IUidObserver to track these changes.

Change-Id: I68d964f474d20f819f54b614a4e314ce00aac8fb
Bug: 124224342
Test: -- ActivityManagerServiceTest
      -- ActivityManagerProcessStateTest
      -- ActivityManagerFgsBgStartTest
      -- UidObserverControllerTest
      -- NetworkPolicyManagerServiceTest
      -- ShortcutManagerTest2
      -- HintManagerServiceTest
      -- VibrationSettingsTest
      -- CameraEvictionTest#testCamera2AccessCallbackInSplitMode (x100)
2022-03-28 19:46:45 -07:00
Kevin Lubick
c3046ab2d4 Merge "Fix transitive dependencies on SkImageEncoder" 2022-03-07 20:03:58 +00:00
Eric Biggers
4fb38d5fc3 Merge "Remove broken code for mounting encrypted OBB files" am: a4f24f08b0 am: 56c37e5778 am: 089a351d31
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2003052

Change-Id: I87cbb67af5e1dc62ddbb8ff7d58a256ee4569b44
2022-03-04 22:11:49 +00:00
Eric Biggers
56c37e5778 Merge "Remove broken code for mounting encrypted OBB files" am: a4f24f08b0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2003052

Change-Id: Id027c555af21e46922a1c0ce29195d95bb7bb876
2022-03-04 21:27:43 +00:00
Kevin Lubick
1175dc00a8 Fix transitive dependencies on SkImageEncoder
In https://skia-review.googlesource.com/c/skia/+/512416,
we would like to decouple SkImage and SkImageEncoder. This CL
was created by searching for use of these objects:
 - SkEncodedImageFormat
 - SkStream
 - SkData
 - SkBitmap
 - SkPixmap

and making sure those files followed the Include What You Use
(IWYU) guidelines.

Signed-off-by: Kevin Lubick <kjlubick@google.com>
Change-Id: I8edbcd1c9a526b8084d7e2c023895d1ad2f8c9b1
2022-03-04 10:37:49 -05:00
Eric Biggers
8bc9340b4c Remove broken code for mounting encrypted OBB files
Mounting encrypted OBB files has never worked reliably across devices,
partly due to its reliance on Twofish encryption support in the kernel.
This is because Twofish support (CONFIG_CRYPTO_TWOFISH) has never been
required or even recommended for Android.  It has never been enabled in
GKI, but even before GKI it wasn't required or recommended.  Moreover,
this is now the only Android feature that still uses dm-crypt
(CONFIG_DM_CRYPT), and some devices don't have that enabled either.

Therefore, it appears that this feature is unused.  That's perhaps not
surprising, considering that the documentation for OBBs
(https://developer.android.com/google/play/expansion-files) says that
they are deprecated, and also it explains OBBs as being app files that
are opaque to the platform; the ability of the platform to mount OBBs
that happen to be in a particular format is never mentioned.  That means
that OBB mounting is probably rarely used even with unencrypted OBBs.
Finally, the usefulness of OBBs having their own encryption layer (in
addition to what the platform already provides via FBE) is not clear
either, especially with such an unusual choice of cipher.

To avoid the confusion that is being caused by having the broken code
for mounting encrypted OBBs still sitting around, let's remove it.

Test: atest StorageManagerTest # on Cuttlefish
Test: atest StorageManagerIntegrationTest # on Cuttlefish
Bug: 216475849
Change-Id: I6e6a6462ab8343299dc5e0145b87dc28b16b0bc1
2022-03-04 04:51:54 +00:00
TreeHugger Robot
92553f3ce8 Merge "Use start time in SurfaceControl setFrameTimeline." into tm-dev 2022-03-02 19:17:38 +00:00
Bo Liu
9acc558c29 adpf: Use one client token per process for all hint sessions
So it doesn't leak when gc is delayed in service process.

Update HintManagerService to allow multiple sessions tied to the same
token.

Bug: 218129784
Test: chrome no longer gets killed
Change-Id: I67a66041cc67d01e4cfcd3ded303a1bed6050f60
2022-03-01 12:04:06 -05:00
Rachel Lee
b6c93aa789 Use start time in SurfaceControl setFrameTimeline.
Users of the API will see in the "Actual Timeline" the actual start time
rather than expected start time.

Bug: 210043506
Test: perfetto log of with & w/o CL, using Chromium apk, bug 198192946
Change-Id: I013bf6e28de32c82c9d645cc4cacf0cc01e0dd9f
2022-02-26 01:23:00 +00:00
Rachel Lee
a52e963d38 Merge "Rename to VsyncCallback & presentation time." 2022-02-17 19:49:55 +00:00
Rachel Lee
1a44c62b74 Rename to VsyncCallback & presentation time.
Bug: 217370454
Test: atest ChoreographerNativeTest
Change-Id: Icf460a82c1f59e930bdfc456e4a75ae341ce4394
2022-02-15 18:25:11 -08:00
Vaibhav
e85c348731 Add implementation for new NDK functions added to input.h
Added new methods for getActionButton and getClassification in input.h.
In this CL we are adding implementations for the corresponding functions

Test: atest android.view.cts.MotionEventTest

Bug: 213266814

Change-Id: Ia7c7b83fe19bac7d5e5c7c107e86328e160ba2b5
2022-02-14 16:19:45 +00:00
Xin Li
5ad6db7742 Merge sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I8cfa435bb6233818adb9cc99dadeeb06a03443d5
Change-Id: Ib93992d88fd1704179009a3872798b9e7b83a6d1
2022-02-11 07:25:43 +00:00
Ady Abraham
5f7f72779e Merge "surface_control: handle acquire fence on BLAST callbacks" 2022-02-10 18:29:24 +00:00
Treehugger Robot
5c816689a9 Merge "Adjust base/native/android OWNERs" am: d8f74421fb am: 82e8873cba am: e7eb1dce20 am: 8fb92de72b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1977192

Change-Id: I6ddf92eed85ae95a902fc1d1781e67d157b5d2d8
2022-02-10 17:58:08 +00:00
Treehugger Robot
8fb92de72b Merge "Adjust base/native/android OWNERs" am: d8f74421fb am: 82e8873cba am: e7eb1dce20
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1977192

Change-Id: I19f032cabc787356be291a500e639d223ddf41a2
2022-02-10 17:37:21 +00:00
Treehugger Robot
e7eb1dce20 Merge "Adjust base/native/android OWNERs" am: d8f74421fb am: 82e8873cba
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1977192

Change-Id: Ifc576cf8e977102786755a7abeb0c8686ae5c9c5
2022-02-10 17:22:13 +00:00