Commit Graph

8291 Commits

Author SHA1 Message Date
Christian Wailes
db6628bb7d Merge changes I04ac8fba,Ia0a8548f
* changes:
  Autoformatter changes.
  Inclusivity cleanup of the Zygote.
2021-03-04 21:09:52 +00:00
Remi NGUYEN VAN
9c16d8e25d Merge "Add Build.IS_DEBUGGABLE to public API" 2021-03-04 03:02:56 +00:00
Chris Wailes
a6f8803c85 Inclusivity cleanup of the Zygote.
Changed "whitelist" to "allowlist" in many Zygote files.

BYPASS_INCLUSIVE_LANGUAGE_REASON="compatability with vendor files"

Test: cts
Change-Id: Ia0a8548f2e254fc36a9dce7e50af8284ed0caa47
2021-03-03 14:23:32 -08:00
Remi NGUYEN VAN
e5e3843176 Add Build.IS_DEBUGGABLE to public API
For testing purposes, system components such as mainline modules may
need to relax some security restrictions on debuggable builds only, in
cases where there is no testing strategy that would be reasonable on
user builds security-wise.
One example is to test interfaces between a mainline module and the
rest of the system, which typically require very privileged permissions.

There is no particular reason or permission check to keep the symbol
non-public so add it to the public API.

Test: m
Fixes: 163699557
Change-Id: I15c093af04f024eed5567151b241a4bc35c611d4
2021-03-03 11:16:35 +09:00
Abhijeet Kaur
b68c51d4c4 Merge "Removed unused mount mode constants" am: 14f35d5f2d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1605513

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I80d0c585e742f33ce90fac787f54b5c0903f070f
2021-03-02 20:59:46 +00:00
Remi NGUYEN VAN
4f6f17230f Merge "Move UidRange to connectivity" am: 5a81037576
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612295

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I672615b0804b9a9de4befa1ba5aea2efb9c962df
2021-03-02 20:24:20 +00:00
Chiachang Wang
fed4ec6ff6 Merge changes Ifc561b6d,I63137b24 am: 0d7553b30e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1605334

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I23cce279f53babac5b90364dd4fc0e55eb382dfa
2021-03-02 19:22:34 +00:00
Abhijeet Kaur
14f35d5f2d Merge "Removed unused mount mode constants" 2021-03-02 16:37:30 +00:00
Remi NGUYEN VAN
5a81037576 Merge "Move UidRange to connectivity" 2021-03-02 09:27:50 +00:00
Remi NGUYEN VAN
c983440dd8 Move UidRange to connectivity
UidRange is a data class that is an implementation detail of
Connectivity. Move it to the connectivity boundary.

Remaining usages of UidRange outside of Connectivity (in VPN) should be
migrated to other classes, like Range<Integer> or UidRangeParcel.

Bug: 181512874
Test: m
Change-Id: I6f2e3685ad1c07171dd90480d1e546329de8732d
2021-03-02 15:35:36 +09:00
Chiachang Wang
0d7553b30e Merge changes Ifc561b6d,I63137b24
* changes:
  Remove RouteInfo hidden depdendency in NMS
  Remove the hidden ConnectivityManager dependency in NMS
2021-03-02 05:13:22 +00:00
Hunter Knepshield
b79c80ba78 Merge "[API review] Additional detail in BugreportCallback javadoc." am: 39742a519c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607112

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id0c2b746e1be4944a6caa05c6764f37cf960bace
2021-02-26 18:52:56 +00:00
Hunter Knepshield
39742a519c Merge "[API review] Additional detail in BugreportCallback javadoc." 2021-02-26 18:31:22 +00:00
Almaz Mingaleev
c76d1a4c26 Merge "Re-throw system server exception." am: 112cd8df86
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1608233

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I39697856d7fee18200e7405d84a45add58d60921
2021-02-26 09:19:15 +00:00
Almaz Mingaleev
112cd8df86 Merge "Re-throw system server exception." 2021-02-26 08:42:36 +00:00
Hunter Knepshield
433d357604 [API review] Additional detail in BugreportCallback javadoc.
This covers edge cases left out of the previous generalization.

Bug: 180015324
Test: make
Change-Id: I309d17cd09434469b5d88275cd59e864f4830c3a
2021-02-25 23:16:20 +00:00
Almaz Mingaleev
b0d08720dc Re-throw system server exception.
Previous "return 0" was not reachable, this makes intention
cleaner.

Bug: minor cleanup
Test: TH only
Change-Id: I50d7d1a2ed53b8f8fe245c6ac6aad4fb8b4ce6e3
2021-02-25 15:13:26 +00:00
Hans Boehm
dd81ed70c7 Merge "Add zygote native fork loop" am: 43a9a8089f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1540230

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I92e404bd6ce19df88d832127f738ec8c6305fe74
2021-02-25 00:30:09 +00:00
Hans Boehm
43a9a8089f Merge "Add zygote native fork loop" 2021-02-25 00:02:19 +00:00
Zim
e72059c0bd Removed unused mount mode constants
Since FUSE in R, there are only 4 mount modes that are used
from IVold.aidl:

REMOUNT_MODE_NONE
REMOUNT_MODE_DEFAULT
REMOUNT_MODE_INSTALLER
REMOUNT_MODE_PASS_THROUGH
REMOUNT_MODE_ANDROID_WRITABLE

Bug: 148454884
Test: Manual
Change-Id: I62b66083f2099b429474872b6f9c7cffb9fb906d
Merged-In: I62b66083f2099b429474872b6f9c7cffb9fb906d
2021-02-24 18:27:26 +00:00
Chiachang Wang
ce554e8152 Remove RouteInfo hidden depdendency in NMS
Update legecy route is replaced by calling INetd directly.
addLegacyRouteForNetId() is no longer needed. This method also
have dependency with the hidden method in RouteInfo which will
be a part of incoming connectivity module. Thus, remove the
addLegacyRouteForNetId() to resolve the dependency.

Bug: 172183305
Test: m ; atest FrameworksNetTests
Change-Id: Ifc561b6dfb45bc51dee244ae114029ae520d8556
2021-02-24 20:04:49 +08:00
Chiachang Wang
7c7ca85882 Remove the hidden ConnectivityManager dependency in NMS
NetworkManagementService that is outside the incoming
connectivity module should stop using hidden NETID_UNSET
in ConnectivityManager. The only usage in NMS is
setDnsForwarders() method which is previously used by CS.
The reference is now replaced by calling INetd directly.
The method could be removed now, so remove it to resolve
the dependency.

Bug: 172183305
Test: m ; atest FrameworksNetTests
Change-Id: I63137b240c4938b082c460bb1a25b447e7f29e80
2021-02-24 17:27:08 +08:00
Treehugger Robot
c8e42d59e7 Merge "BugreportManager API review updates." am: e0db8b998f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1584520

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I41e43baa35a660165075df1bc602cf197656df82
2021-02-23 23:58:26 +00:00
Tianjie Xu
4d208ac97e Merge "Throw an exception in RoR api on no-pin case" am: 7444774737
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1584516

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic466002e50e6125c27f52eb2e989505720fc30c0
2021-02-23 23:52:30 +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
e0db8b998f Merge "BugreportManager API review updates." 2021-02-22 21:46:41 +00:00
Tianjie Xu
7444774737 Merge "Throw an exception in RoR api on no-pin case" 2021-02-22 20:42:35 +00:00
Xin Li
be473bf819 Merge ab/7061308 into stage.
Bug: 180401296
Merged-In: I4bf82035631ccff6d5a6144d6d9b1d203b076851
Change-Id: I1b5f3a672a55eaabba0f5389bab110b395553559
2021-02-21 09:39:53 -08:00
Chiachang Wang
63bc7bd3c2 Merge changes I0a75c440,Ief9e8925,Ie03e8276,If0ac9a64,I716bd771
* changes:
  [IT06]Move INetworkActivityListener into connectivity module
  [IT05] Remove the unused network activity logic out from NMS
  [IT4.7] Add network activity info into dumpsys for debugging
  [IT4.6] Unbundle NMS out from ConnectivityManager
  [IT4.5] Update radio power from CS directly
2021-02-20 02:02:46 +00:00
Tianjie
9dbd5e7457 Throw an exception in RoR api on no-pin case
If the device doesn't have a pin, the current RoR preparation will
go through; but the lskf capture event won't happen. In order not
to confuse the caller, throw an exception instead in the no-pin
case.

Bug: 170664917
Test: remove pin, request RoR with adb shell
Change-Id: Ib04c629234b71e3f6cb36bdfe47759a715a69146
2021-02-18 15:26:33 -08:00
Hunter Knepshield
8c4887a7ce BugreportManager API review updates.
- Expand BugreportManager class javadoc
    - Explain what "privileged" means
    - Highlight only one-BR-at-a-time behavior
- Add more detail to BugreportCallback javadocs
    - Explain standard callback invocation flow
    - More detail on when BUGREPORT_ERROR_INVALID_INPUT is used
- Add @WorkerThread to {start{,Connectivity},cancel}Bugreport

Bug: 180015324
Test: make
Change-Id: Id3400b1cdd271f47bdeaf8cdc1a0dea61aafc933
2021-02-18 19:31:44 +00:00
Primiano Tucci
355753053c Merge "Do not check for debuggable / profilable for app tracing." 2021-02-18 17:52:31 +00:00
Chiachang Wang
6080999ebe [IT06]Move INetworkActivityListener into connectivity module
INetworkActivityListener is hidden and the only usage is inside
the connectivity module. Thus, move this into module scope.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I0a75c440c1daa773217bbd362b212fda4d07ec64
2021-02-18 12:03:21 +08:00
lucaslin
be5d09359c [IT05] Remove the unused network activity logic out from NMS
The network activity logic is moved to ConnectivityService.
CS is no longer setting the idle timer via NMS to netd. The
idle timer should only set from CS, so remove the network
activity logic out from NMS.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: Ief9e892586aaee8e9542b9313088fa50d1d411e5
2021-02-18 12:02:02 +08:00
Jiashen Wang
6851cf0c51 Add the immutable flag to EuiccManager calls in RecoverySystem
Bug: 170432460
Test: refactoring CL. Existing unit tests still pass
Change-Id: Ibce939eec341cb9f572d13a33762cc5bc6e2ef42
Merged-In: Ibce939eec341cb9f572d13a33762cc5bc6e2ef42
2021-02-17 22:04:23 +00:00
Treehugger Robot
2a2456d3a4 Merge "dumpsys: Print total DMA-BUFs exported from the DMA-BUF heaps framework" 2021-02-16 17:58:25 +00:00
Lorenzo Colitti
b8d9e77b2a Merge "New API for getting uids have specific permissions from SystemConfig" 2021-02-16 08:24:21 +00:00
Florian Mayer
f287f6900c Do not check for debuggable / profilable for app tracing.
This is publicly undocumented and surprising behaviour.

Bug: 179883548
Change-Id: Iceee54c63dc9f5d61e9dcc76a47e11cc4088ed19
2021-02-12 20:27:59 +00:00
Hridya Valsaraju
1ff4e91e6c dumpsys: Print total DMA-BUFs exported from the DMA-BUF heaps framework
This patch adds the total size of DMA-BUFs exported from the DMA-BUF
heaps framework to dumpsys meminfo.

Bug: 167709539
Test: adb shell dumpsys meminfo
Change-Id: I153721a0dc91ee5084a446ba1ce4f8ec9c51c4f0
Merged-In: I153721a0dc91ee5084a446ba1ce4f8ec9c51c4f0
2021-02-12 10:08:23 -08:00
Kalesh Singh
1a8d198b5b Provide an interface to query dmabuf GPU allocations
The DMA buffers mapped by GPU device(s) are already accounted for
in the total exported dmabuf size (ionHeap) size.

To remove GPU memory from lost RAM, provide an API to get only the
DMA buf memory mapped by the GPU device(s).

Bug: 176477627
Test: adb shell dumpsys meminfo
Change-Id: Ie72f46c8de026b143629406714f413677ce6693b
Merged-In: Ie72f46c8de026b143629406714f413677ce6693b
2021-02-12 10:07:30 -08:00
Suren Baghdasaryan
c17cbb303c Extend getPssPid to report itemized memtrack values
Currently getPssPid includes memtrack HAL reported values in the pss
calculation. This makes it impossible to get these values separately.
Extend this interface to include itemized memtrack values.

Bug: 165832481
Test: dumpsys meminfo
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ieb7e1b79ad8ecae6023338d9992467952558e2bd
2021-02-12 01:11:39 +00:00
Treehugger Robot
ad688d3e8c Merge changes from topic "b/167709539"
* changes:
  Add total DMA-BUF heap pool size information to dumpsys meminfo
  Add total size of DMA-BUFs exported to 'dumpsys meminfo'
  Rename getIonMappedSizeKb to getDmabufMappedSizeKb
2021-02-10 17:37:30 +00:00
Hridya Valsaraju
365ffff4b5 Add total DMA-BUF heap pool size information to dumpsys meminfo
Some DMA-BUF heaps maintain pools of pre-zeroed memory for faster
allocations. Print the total size of all DMA-BUF heap pools as part of
dumpsys meminfo and use the same in LostRam calculation.

Test: dumpsys meminfo
Bug: 167709539
Change-Id: Ifb61fe596c1a8fab1bd536ec904285e532629b71
Merged-In: Ifb61fe596c1a8fab1bd536ec904285e532629b71
2021-02-10 06:05:36 +00:00
Hridya Valsaraju
363d44d7a0 Add total size of DMA-BUFs exported to 'dumpsys meminfo'
When ION support is not detected, print the total size of DMA-BUFs
exported as part of dumpsys meminfo.

Bug: 167709539
Test: dumpsys meminfo
Change-Id: I3439a8f00cf1aef37e5043b505ed53d47a8a4756
Merged-In: I3439a8f00cf1aef37e5043b505ed53d47a8a4756
2021-02-10 06:05:02 +00:00
Hridya Valsaraju
6ae0be89b9 Rename getIonMappedSizeKb to getDmabufMappedSizeKb
The function is actually calculating the total mapped DMA-BUF memory.

Test: dumpsys meminfo
Bug: 167709539
Change-Id: I5c19dc604cf48c3d7ccbfd2d9a83ddd7b35f20d5
Merged-In: I5c19dc604cf48c3d7ccbfd2d9a83ddd7b35f20d5
2021-02-10 06:04:12 +00:00
paulhu
ba70fa80ac New API for getting uids have specific permissions from SystemConfig
SysetmConfig is internal service for frameworks only which cannot
use by Connectivity mainline module, but PermissionMonitor which
is part of the module needs to get uids that have been granted
INTERNET/UPDATE_DEVICE_STATS permission from SystemConfig.
Therefore, add a new API to SystemConfigManager that can get
these uids from SysetmConfig.

Bug: 177188455
Test: atest SystemConfigTest
Change-Id: I62bdd969b1b813631ed6223df97bda21a39aec2c
2021-02-09 10:11:41 +08:00
Chiachang Wang
8f43b2be54 Create new system API in UserHandle to get uid
For the incoming connectivity mainline, it need to compute the
intersection of a set of uids and appIds for the permission
control. As @UserIdInt values are internal implementation details
of the OS, any mainline modules should use strongly-typed
UserHandle arguments. Thus, create a new API that accepts
UserHandle and appId to get the computed uid.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I046546d2c5c76eac7a251e63e4234776975bf2bc
2021-02-05 02:26:23 +00:00
Steven Moreland
52f933552a Merge "binder: race condition by parcel finalize" 2021-02-03 18:46:50 +00:00
Steven Moreland
f6fee67b6e WatchDog: support dumping AIDL HALs
Similar to how HIDL HALs are here, we don't know the commandline of the
service, so we can dump them based on service name prefixes.

Power stats and lights are added here, for parity w/ HIDL since these
hvae been converted to AIDL.

Fixes: 175322136
Test: after `adb shell am hang`, we can verify the light service is
  dumped, when it wasn't before:

  vsoc_x86_64:/data/anr # cat anr_2021-01-28-22-42-44-969  | grep light
  Cmd line: /vendor/bin/hw/android.hardware.lights-service.example

Change-Id: I8c8b0cff0c102221875114015a5524c03cfb5b5c
2021-01-28 22:53:23 +00:00
Jintao Zhu
15b49e10ae binder: race condition by parcel finalize
Root cause:
1) a client thread calls "transact", and then, reads a java binder object from the java parcel object
2) the java binder object sends BC_ACQUIRE/BC_INCREFS, but still in the queue, not yet flushed to driver
3) the java parcel object is garbage-collect-ed, and, its finalize method may possibly sends BC_FREE_BUFFER

  Because "BC_FREE_BUFFER" is from the java finalize thread, which is different from the "client thread", so, it is possible that "BC_FREE_BUFFER" will be flushed to driver before "BC_ACQUIRE/BC_INCREFS", which makes driver destroy the related "binder_ref" object prematurely.

Consequences of the issue:
  The user space process might always hold the above java binder object, whose "handle value" is indeed invalid because the related "binder_ref" in driver is destroyed. This causes a lot of chaos inside the process:
<a> any binder call on the java binder object will be a failure, with kernel log complain: ...got transaction to invalid handle...
<b> afterward, any new bind object passed to this process will NOT create a brand new one for it, instead, it will be simply and incorrectly mapped to the above old biner object, because the new incoming one will use the same "handle value" as the old one. This will make a mess and many weird bugs.
 First, it may break "binder object identity" compare based functionality. For example, after registering a listener to a service, all following registering may fail because the latter new listener object is mapped to the old one incorrectly. The service will reject them as "already registered".
 Second, binder call on the old binder object is actually dispatched to the new remote binder object, it might even be a success if they are of the same class/interface, which is actually not we expected; and on the other hand, the new binder object may even be of different class/interface, and of course, the binder call may be a failure due to "interface descriptor check".
<c> the user space process cannot recover from the bug automatically unless restart.

Solution:
  Hold a temporary reference to the parcel object until "BC_ACQUIRE/BC_INCREFS" flushed to driver.

Bug: 139327211
Test: monkey test for one day and one night

Co-authored-by: Steven Moreland <smoreland@google.com>

Signed-off-by: Jintao Zhu <zhujtcsieee@gmail.com>
Change-Id: I9345f443996b0bdef9d57ddaad119b86205e817f
2021-01-28 19:38:18 +08:00