Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c0e0e80 authored by mrulhania's avatar mrulhania Committed by Manjeet Rulhania
Browse files

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
parent e8ad98df
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -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);
        }