diff options
| author | 2025-02-07 11:29:43 -0800 | |
|---|---|---|
| committer | 2025-02-11 16:51:55 -0800 | |
| commit | 9c0e0e8076e185c05a486bb71a021bf1bb2e6b90 (patch) | |
| tree | 65eb21ad108b9fedaa947f230964674c4839dc04 | |
| parent | e8ad98df1f8b8ac97451248d574d6214d79ea94d (diff) | |
Fix role holder atom logging
We should not abandon the pull, if a package is not
found for a particular user, rather we can just skip
that entry.
Fix: 395127723
Test: build
Flag: EXEMPT bug fix
Change-Id: I62fd9b0802dc07f0ea3b59aa5fb876ebebba0134
| -rw-r--r-- | services/core/java/com/android/server/stats/pull/StatsPullAtomService.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java index 7f2c68ff60b1..889b494ef538 100644 --- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java @@ -3661,16 +3661,17 @@ public class StatsPullAtomService extends SystemService { if (!packageNames.isEmpty()) { for (String packageName : packageNames) { - PackageInfo pkg; + int uid = INVALID_UID; try { - pkg = pm.getPackageInfoAsUser(packageName, 0, userId); + PackageInfo pkg = pm.getPackageInfoAsUser(packageName, 0, userId); + uid = pkg.applicationInfo.uid; } catch (PackageManager.NameNotFoundException e) { - Slog.w(TAG, "Role holder " + packageName + " not found"); - return StatsManager.PULL_SKIP; + Slog.w(TAG, "Role holder " + packageName + " not found for user " + + userId); } pulledData.add(FrameworkStatsLog.buildStatsEvent( - atomTag, pkg.applicationInfo.uid, packageName, roleName)); + atomTag, uid, packageName, roleName)); } } else { // Ensure that roles set to None are logged with an empty state. @@ -3679,6 +3680,9 @@ public class StatsPullAtomService extends SystemService { } } } + } catch (Throwable t) { + Log.e(TAG, "Could not read role holders", t); + return StatsManager.PULL_SKIP; } finally { Binder.restoreCallingIdentity(callingToken); } |