Commit Graph

772 Commits

Author SHA1 Message Date
Yifan Hong
e1ba2e5fbf Merge "AndroidRuntime: Expose javaAttachThread / javaDetachThread." am: 6b45a9a7b9 am: 1149562e10
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1751551

Change-Id: I55d43c99df7b81fc9a8d2c04a8ab8069a95e3c5b
2021-07-14 19:07:57 +00:00
Yifan Hong
6b45a9a7b9 Merge "AndroidRuntime: Expose javaAttachThread / javaDetachThread." 2021-07-14 18:16:57 +00:00
Orion Hodson
3e5b9d4ab7 Merge "AndroidRuntime: pass odsign verification status to ART" am: 2d2d5467b5 am: 57b6391e7e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1753263

Change-Id: I33d861b530d78772f5707a9d4e808c023a0702a0
2021-07-02 10:44:29 +00:00
Orion Hodson
2d2d5467b5 Merge "AndroidRuntime: pass odsign verification status to ART" 2021-07-02 10:19:45 +00:00
Hans Boehm
13945aadb5 Merge "Add dalvik.vm.force-java-zygote-fork-loop" am: a8540eebc3 am: 12f589735b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1747950

Change-Id: If85e48ca5743b5fd1bf8e1b36fbcb1372ec1b1f3
2021-07-01 23:36:19 +00:00
Orion Hodson
a8b24392a1 AndroidRuntime: pass odsign verification status to ART
ART will refuse to load on-device generated artifacts if odsign
verification status suggests files have been tampered with.

Bug: 180949581
Test: manual
Change-Id: I772b5b7b191310bf7c7797161a304a1ab6f53c5e
2021-07-01 12:14:47 +01:00
Yifan Hong
fc66783499 AndroidRuntime: Expose javaAttachThread / javaDetachThread.
Add a new header library, libandroid_runtime_threads_headers,
that exposes javaAttachThread / javaDetachThread.

Also change the return value from int to bool, since the client
may not know about JNI_OK.

Test: boots
Bug: 190450693
Change-Id: Ifedd34a8c8a1847d89c9f2f7919ff7e4b13b7446
2021-06-30 19:37:38 -07:00
Hans Boehm
f2a815dcbf Add dalvik.vm.force-java-zygote-fork-loop
Bug: 192020504
Test: Check logcat with and without the flag.
Change-Id: Ia46a011125a6e245bbd9065d708d1f905d56e3af
2021-06-30 15:12:54 -07:00
TreeHugger Robot
cc265a58de Merge "Revert "Revert "Release cblocks back to the free pool""" into sc-dev 2021-06-18 17:28:19 +00:00
Calin Juravle
576201ad6f Parse dalvik.vm.ps-min-save-period-ms property
Test: adb shell setprop dalvik.vm.ps-min-save-period-ms 300;
Bug: 185979271

Merged-In: I2f30675b335ca0b9b1f1d30144fcdfa4fc680b41
Change-Id: I2f30675b335ca0b9b1f1d30144fcdfa4fc680b41
(cherry picked from commit a2ba369d20)
2021-06-09 13:49:44 +00:00
Calin Juravle
a2ba369d20 Parse dalvik.vm.ps-min-save-period-ms property
Test: adb shell setprop dalvik.vm.ps-min-save-period-ms 300;
Bug: 185979271
Change-Id: I2f30675b335ca0b9b1f1d30144fcdfa4fc680b41
2021-06-03 18:20:38 -07:00
Jaegeuk Kim
a3090d41fe Revert "Revert "Release cblocks back to the free pool""
This reverts commit 516cb2d025.

Reason for revert: Add back after merging f2fs/f2fs-tools changes removing immutable bit stuffs

Bug: 188928405
Change-Id: I6a6fcde1190bff14abe1a67a75b8e7be95d89072
2021-06-03 02:18:11 +00:00
John Tsai
5d1934f765 Merge "Revert "Release cblocks back to the free pool"" into sc-dev 2021-06-03 02:13:03 +00:00
John Tsai
516cb2d025 Revert "Release cblocks back to the free pool"
This reverts commit e41b029d85.

Reason for revert: b/189985437

com.android.tradefed.targetprep.TargetSetupError[APK_INSTALLATION_FAILED|520001|DEPENDENCY_ISSUE]: Failed to install com.android.devicehealthchecks with ...

Change-Id: I06fe7d94f6dab474c74b093de8692f08d4031b62
2021-06-03 02:10:26 +00:00
Svetoslav Ganov
1028eb2f62 Merge "Switch media fw permissions checks to AttributionSource" into sc-dev 2021-06-02 23:07:22 +00:00
Svet Ganov
2eebf92965 Switch media fw permissions checks to AttributionSource
Attribution source is the abstraction to capture the data
flows for private data across apps. Checking permissions
for an attribution source does this for all apps in the
chain that would receive the data as well as the relevant
app ops are checked/noted/started as needed.

Teach speech recognition service about attribution
chains. If an implementation does nothing the OS
would enforce permisisons and do blame as always.
This apporach leads to double blaming and doesn't
support attribition chains where app calls into
the default recognizer which calls into the on
device recognizer (this nests recursively). If the
implementer takes advantage of the attribution chain
mechanims the permissions for the entire chain are
checked at mic access time and all apps are blamed
only once.

Fixed a few bugs around finishing ops for attribution
chains. Also ensured that any app death in a started
attribution chain would lead to finishing the op for
this app

bug: 158792096

Test: (added tests for speech reco)
      atest CtsMediaTestCases
      atest CtsPermissionTestCases
      atest CtsPermission2TestCases
      atest CtsPermission3TestCases
      atest CtsPermission4TestCases
      atest CtsPermission5TestCases
      atest CtsAppOpsTestCases
      atest CtsAppOps2TestCases

Merged-In: Ic92c7adc14bd2d135ac13b96f17a1b393dd562e4

Change-Id: Ic92c7adc14bd2d135ac13b96f17a1b393dd562e4
2021-06-01 23:43:29 +00:00
Todd Kennedy
e41b029d85 Release cblocks back to the free pool
Modern f2fs implementations starting in S support compression
natively within the file system. The data blocks of specific
installation artifacts [eg. .apk, .so, ...] can be compressed
at the file system level, making them look and act like any
other uncompressed file, but consuming a fraction of the space.

However, the unused space is not free'd automatically. Instead,
we must manually tell the file system to release the extra
blocks [the delta between the compressed and uncompressed block
counts] back to the free pool.

Because of how compression works within the file system, once
the blocks have been released, the file becomes read-only and
cannot be modified until the free'd blocks have again been
reserved from the free pool. For these installation artifacts,
that is not a concern.

Test: atest CtsAppSecurityHostTestCases:SplitTests
Test: atest CtsAppSecurityHostTestCases:IsolatedSplitsTests
Test: atest CtsAppSecurityHostTestCases:PkgInstallSignatureVerificationTest
Test: atest CtsLibnativehelperTestCases
Test: atest PackageManagerTests
Test: Manual. Boot the device and see cblocks for stub APKs are released
Test: Manual. Disable and re-enable stub APK and see cblocks are released
Bug: 188928405
Change-Id: I4b29dab263d02a79d7b1593d35ae28101d33679a
2021-05-28 02:59:47 +00:00
Galia Peycheva
fde81bf229 Add TunnelModeStateListener in java+jni
When tunnel mode is being used (meaning when there
is a sideband stream in one of the layers in SurfaceFlinger), the
blur can't be computed over that layer. In that case, SF blurs are
disabled, which results in a translucent buffer to be drawn.

This CL introduces a listener, which is registered with the
SurfaceFlinger and receives a callback whenever the tunnel mode
enabled state changes. This way, the BlurController can properly send
updates to apps that blurs are disabled/enabled.

Bug: 171457637
Test: atest TunnelModeStateListenerTest
Test: atest TunnelModeStateReporterTest
Change-Id: I6ffba1c342352ad65a32c0efc4ecbc07811245d9
2021-05-17 20:55:19 +02:00
Wessam Hassanein
0e86b445bb Merge "Enable PerfettoJavaHeapStackProf in the zygote." am: 45087d31f8 am: 12dfac6247 am: a431288fbe
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1692305

Change-Id: I2a54da650a1e8d35530cdf77a41a338ab90582e6
2021-05-07 03:39:05 +00:00
Wessam Hassanein
45087d31f8 Merge "Enable PerfettoJavaHeapStackProf in the zygote." 2021-05-06 21:08:01 +00:00
Treehugger Robot
56d59c655c Merge "Allow ART profile saver period to be parsed from sys props" am: 44da0f67b4 am: 41cb7914b8 am: 55e2972686
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1698088

Change-Id: I00b86c46ef1b48bff084858814ad9457bc55e977
2021-05-06 16:47:06 +00:00
Calin Juravle
f93ecde2fe Allow ART profile saver period to be parsed from sys props
Test: manual

Bug: 184714236
Bug: 185979271
Change-Id: I4ab069e8c4de9f73b7951845e7cb80bc00642e22
2021-05-05 17:15:38 -07:00
Wessam Hassanein
f1d719b0a2 Enable PerfettoJavaHeapStackProf in the zygote.
This allows us to collect Java Heap Profiler data directly without
needing to set the flag similar to PerfettoHprof.

Test: Passing Tests
Local Testing

Bug: 160214819

Change-Id: Id4888107c7b12f076de8237fd42bab49319566b5
2021-05-05 11:55:34 -07:00
Treehugger Robot
24875ce692 Merge "Retire ro.kernel.android.checkjni from AndroidRuntime.cpp" am: 25807e2f86 am: 5609c37a4f am: fcd90b1a1b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1670529

Change-Id: I350c527e1fe0a6badddddcfd150f97c7207c570c
2021-04-10 00:05:23 +00:00
Roman Kiryanov
d395df7024 Retire ro.kernel.android.checkjni from AndroidRuntime.cpp
this property is deprecated and emulator now
populates `dalvik.vm.checkjni` to use instead.

Bug: 182291166
Test: getprop dalvik.vm.checkjni
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Ie94b0d6c2e48b731d9cfe0ead380e0f52f662f37
2021-04-09 12:46:34 -07:00
John Reck
24acd37203 Merge "HDR info listener" into sc-dev 2021-04-02 20:21:51 +00:00
John Reck
35aa049bc4 HDR info listener
Bug: 182312559
Test: SilkFX listener is called

Change-Id: I2c93f6ab51263a905c17a7afabb845317d33419d
2021-03-31 14:29:03 -04:00
Ioannis Ilkos
228fc0293b Per process DMA-BUF stats
In order to detect memory regressions caused by improper handling of
dma-buf buffers we need to measure how this memory is used.

This change:
- Introduces DmabufInfoReader which wraps libmeminfo and provides
per-process DMA-BUF stats.
- Specifically, measures buffers mapped to the process address space
(from /proc/pid/maps). This is supported on all devices.
- For devices running 5.4+ (where the system processes can query fdinfo)
also measures the total retained memory (either by mmap or an open fd).
- Introduces a statsd atom that collects this for all running managed
processes. Non-managed processes will also hold dmabufs, but the
likelihood of them causing issues (post-launch) is smaller so I am
trading them off for cheaper collection (if indeed we encounter such
problems, they will definitely be caught by the total dmabuf counters).

Test: manual
Bug: 183708249
Change-Id: I5e0ef58ac1a66ebe2d280c5733de46ba84f75a46
2021-03-30 10:38:10 +01:00
Remi NGUYEN VAN
7b6b006f5d Use connectivity APIs from framework-connectivity
Instead of compiling framework-connectivity source into
frameworks-minus-apex, have the APIs loaded separately from
framework-connectivity.

Bug: 171540887
Test: device boots, has connectivity
Change-Id: I8f07ff2082c3de80821e121807e66a43a870de7b
2021-03-25 06:34:52 +00:00
Jagadeesh Pakaravoor
87fce10ae7 Merge "Add madvising of .odex, .vdex and .art files" am: fcf61e805a am: 876927e795 am: 252a7a0f4f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1611231

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9d95090140d41f11fc996622c3787a2950194205
2021-03-12 21:32:04 +00:00
Nate Myren
d63065cb6f Merge "Add attributionTag to audio-recordings" into sc-dev 2021-03-11 23:48:44 +00:00
Philip P. Moltmann
fece2436d4 Add attributionTag to audio-recordings
... by switching from packageName/uid/pid to the Identity class.

This allows up to track which parts of the app trigger audio-recordings.

Test: atest CtsAppOpsTestCases
            CtsNativeMediaAAudioTestCases
Fixes: 160150145
Change-Id: I0913a336a862e4a1cb38b9d967cfbdc490513ab0
2021-03-11 08:40:40 -08:00
Jagadeesh Pakaravoor
28a5a1d51b Add madvising of .odex, .vdex and .art files
1. When mmaping {.art, .odex, .vdex} files madvise them to
MADV_WILLNEED
2. Add system properties to limit the madvise size/range

Test: presubmit
Bug: 178853586
Change-Id: I7bd882e3e1021d48f00f297c4dd1d5a8098c087d
2021-03-10 15:39:57 -08:00
Victor Hsieh
f4305279e5 Merge "Move VerityUtils from services.jar to core.jar" into sc-dev 2021-03-10 23:10:25 +00:00
Hans Boehm
1d550ecd10 Merge "Add zygote native fork loop" am: 43a9a8089f am: dd81ed70c7 am: 925ecc3f80
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1540230

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3afb617aab80b073b56fa0c61398ae6d42800a75
2021-02-26 17:20:42 +00:00
Alec Mouri
1a621e8eff Merge "JNI wrapper for FpsListener." into sc-dev 2021-02-24 22:41:10 +00:00
Hans Boehm
69d44b0bfd Add zygote native fork loop
Do not return to Java mode between consecutive fork operations.
This greatly reduces the Zygote overhead, since we no longer need to
stop and restart Java daemons.

By not switching back to Java mode, and being careful about what memory
we touch between forks, we also keep the Zygote heaps much more stable,
facilitating page sharing between the zygote and all its children.
Under normal operation we should no longer allocate any memory in the
zygote between forks. That applies to both the Java and C++ heap.
This makes the zygote behave much more like the mental model many
of us had assumed: It has nearly constant memory contents, which are
copy-on-right cloned at each fork. This does not apply to the initial
system server and webzygote forks, that are currently still handled
differently.

This includes

1. Add ZygoteCommandBuffer, and switch the argument parsing code to use it.
This slightly reduces allocation and enables (3).

2. Support process specialization in the child, even when the arguments
are already know, Leverages existing Usap code.

3. Add support for forking multiple child processes directly to the
ZygoteCommandBuffer data structure. This directly uses the buffer
internals, and avoids returning to Java so long as it can handle the
zygote commands it sees.

FUNCTIONALITY CHANGE:

We now limit the total size of the zygote command, rather than the
number of arguments.

Initial performance observations:

[ These are not perfect, since I'm comparing to numbers before I
started. There may have been other moving parts, but they should be
minor. ]

System-server-observed launch latency:

[Not the best metric, but easy to measure. In particular, this
does not represent a significant reduction in application launch
time.]

Based on measuring the last 10 launches in a lightly used cf AOSP
instance, the system server latency from requesting an app launch to
response with the pid (which does not require the child to execute
anything) went from an average of about 10.7(25) msecs to 6.8(9) and
7.9(16) in two tries with the CL. (The parenthetical numbers are
maxima from among the 10; the variance appears to have decreased
appreciably.)

Dirty pages:

The number of private dirty pages in the zygote itself appears to have
decreased from about 4000 to about 2200. The number of dalvik-main
private dirty pages went from about 1500 to nearly zero.

Initially ART benchmarking service claim -1.88% in PSS. But this is not
consistently repeatable.

Drive-by fix:

Call setAllowNetworkingForProcess on usap / native loop path.

Bug: 159631815
Bug: 174211442
Test: Boots AOSP
Change-Id: I90d2e381bada1b6c9857666d5e87372b6a4c1a70
2021-02-23 15:03:40 -08:00
TreeHugger Robot
360c3626e9 Merge "Camera2: Add jpeg encoding support for all camera extensions" into sc-dev 2021-02-23 21:48:35 +00:00
Victor Hsieh
c778551aea Move VerityUtils from services.jar to core.jar
There is a demand to use VerityUtils outside of services from core. This
allows the class to be used from both places.

Bug: 180414192
Test: m

Change-Id: I8da2e3df218547208799a238eab2d54545194d00
2021-02-22 11:00:46 -08:00
Emilian Peev
ab80824153 Camera2: Add jpeg encoding support for all camera extensions
Enable consistent Jpeg output support for all present camera
extensions. Extensions with exclusive YUV_420 support will
include an extra SW encoding pass before the processed results
can be queued back to the client surface.

Bug: 179818844
Test: Camera CTS

Change-Id: I461e54024f150925ca1a5a57ff7b327712ce0e96
2021-02-17 17:37:44 -08:00
Alec Mouri
644553d06f JNI wrapper for FpsListener.
Hidden api for exposing the fps counter to WM Shell, so that the fps for
a task can be reported.

Bug: 174956756
Test: E2E integration with SurfaceFlinger for angry birds
Change-Id: I9818aded2755ad07fd3abf3f616e8e6940bad268
2021-02-12 20:54:05 -08:00
Rafal Slawik
4574305a4a Check CPU time_in_state from one place
Move the check whether CPU eBPF tracking is supported to one place to
avoid repeating it in every reader.

Bug: 179485697
Test: existing tests pass
Change-Id: Id6d23614c3d1dde86b66de14bc09f5976f183625
2021-02-11 15:21:13 +00:00
Rafal Slawik
f278e21a61 Measure total time in state
Total CPU time in state added in https://r.android.com/1538886.

Bug: 174245730
Test: cmd stats pull-source 10095
Change-Id: I6cd27ac172e36d2e889429808bd4bd583795d7c9
2021-01-12 13:45:33 +00:00
Remi NGUYEN VAN
23f93322c2 Merge "Split NetworkUtils and NetworkUtilsInternal" am: 3ed4fd3a89 am: 635d60201d am: edc6b0fb67
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513140

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ief9d6a1fae360dbe1c43d5d6bac4dad5850c004b
2020-12-23 02:22:35 +00:00
Remi NGUYEN VAN
684a7409e6 Split NetworkUtils and NetworkUtilsInternal
NetworkUtils is planned to move to a dedicated JAR for connectivity
classes, while NetworkUtilsInternal would stay in the
frameworks-minus-apex JAR, in the com.android.internal.net package.

Bug: 171540887
Test: m, boots, wifi working
      atest FrameworksNetTests
Change-Id: I3d38d72ad23a4bf84af823c7baeb6fed25c0665f
2020-12-07 19:41:49 +09:00
Jeff Sharkey
7a38dcc938 CharsetUtils alternatives that avoid allocations.
Internally String.getBytes() calls libcore.util.CharsetUtils methods
for a handful of common charsets, but that path requires new memory
allocations for every call.

This change introduces alternative versions of those methods which
attempt to encode data directly into an already-allocated memory
region.  If the destination is to small, callers can detect and pivot
back to calling String.getBytes().

The included benchmarks reveal these raw performance improvements,
in addition to the reduced GC load which is harder to measure:

    timeLocal_LargeBuffer[simple]_mean: 424
    timeLocal_SmallBuffer[simple]_mean: 511
    timeUpstream[simple]_mean: 800

    timeLocal_LargeBuffer[complex]_mean: 977
    timeLocal_SmallBuffer[complex]_mean: 1266
    timeUpstream[complex]_mean: 1468

Bug: 171832118
Test: atest CorePerfTests:android.util.CharsetUtilsPerfTest
Test: atest FrameworksCoreTests:android.util.CharsetUtilsTest
Change-Id: Iac1151e7cb8e88bf82339cada64b0936e1a7578b
2020-11-09 17:22:03 -07:00
Dmitri Plotnikov
313d4a43d1 Rewrite KernelSingleProcessCpuThreadReader to native
For now, the native implementation is identical to the
Java implementation.  The performance improvement is ~20%
in a microbenchmarks.

Bug: 169279846
Test: atest FrameworksCoreTests:com.android.internal.os.KernelSingleProcessCpuThreadReaderTest
Change-Id: I8685a7f0adf9476209e29bb3ee3e89e99f66fa95
2020-10-09 23:50:55 +00:00
Eino-Ville Talvala
7208d0af87 Camera: Remove all camera HALv1 code
- Remove legacy wrapper implementing camera2 API on HALv1
  - Move JNI utility code into SurfaceUtils
- Remove openLegacy path, which allowed HALv1 behavior on HALv3 devices
- Remove relevant tests

Test: atest CtsCameraTestCases
Bug: 136024295
Change-Id: I49ad89bee5c4fdc09e288597821163c81494476f
2020-07-10 11:42:59 -07:00
Florian Mayer
044e2806e5 Merge "Pass -XX:PerfettoHprof=true to ART." am: ec5055f307 am: a37238fde7
Change-Id: I00d60a78092a07f9284590f267f76f01124032a4
2020-05-18 21:15:52 +00:00
Florian Mayer
7dc66b31c1 Pass -XX:PerfettoHprof=true to ART.
Bug: 147667830
Change-Id: Ibc26afc5e9e8744839dce7e863d0635788ad9507
2020-05-18 19:52:48 +02:00