diff options
| author | 2022-06-02 12:42:04 +0200 | |
|---|---|---|
| committer | 2022-06-14 07:59:37 +0000 | |
| commit | e2d078ef78d5ff1135479df727099f32fddff56f (patch) | |
| tree | 2c738d3697058555e6fd290aa3ef4c764975c6bb /libs/androidfw/ResourceTimer.cpp | |
| parent | 6f628631d30121a4c9aceacccf4c7238a8305fe8 (diff) | |
LogcatManagerService: Find packageName through parent PIDs
Log access requests may come from forked processes, eg. by a logcat
process started by an app. In such cases, `getPackageNameByPid` failed
to return a package name, as the process (eg. logcat) does not have a
package name associated with it. As a fallback we used the first package
name returned by `PackageManager#getPackagesForUid`, but this method
returns package names in an indeterministic order, so the same app doing
multiple log accesses could trigger multiple log access dialogs if the
order differed.
To find a better package name match, this change walks up the process
tree to find a package name that forked the requesting process and
matches the requesting UID.
As a fallback, the list returned by `PackageManager#getPackagesForUid`
is sorted before picking the first element.
Bug: 229279048
Test: Manual, sending feedback through assistant
Test: atest FrameworksServicesTests:LogcatManagerServiceTest
Change-Id: I7ac044ac012be8c3911f3c4ce35c06215d078fe6
Diffstat (limited to 'libs/androidfw/ResourceTimer.cpp')
0 files changed, 0 insertions, 0 deletions