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

Commit f3f7f92e authored by Winson Chiu's avatar Winson Chiu Committed by Android (Google) Code Review
Browse files

Merge "Fix high traffic PMS lockless methods" into tm-dev

parents f0094b8d e574a37d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -418,7 +418,9 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable,
        } else if (changed) {
            invalidateCache("grantImplicitAccess: " + recipientUid + " -> " + visibleUid);
        }
        if (changed) {
            onChanged();
        }
        return changed;
    }

+7 −4
Original line number Diff line number Diff line
@@ -2859,12 +2859,15 @@ public class PackageManagerService implements PackageSender, TestUtilityService
        mDexOptHelper.performPackageDexOptUpgradeIfNeeded();
    }


    private void notifyPackageUseInternal(String packageName, int reason) {
        long time = System.currentTimeMillis();
        commitPackageStateMutation(null, packageName, packageState -> {
            packageState.setLastPackageUsageTime(reason, time);
        });
        synchronized (mLock) {
            final PackageSetting pkgSetting = mSettings.getPackageLPr(packageName);
            if (pkgSetting == null) {
                return;
            }
            pkgSetting.getPkgState().setLastPackageUsageTimeInMills(reason, time);
        }
    }

    /*package*/ DexManager getDexManager() {
+4 −1
Original line number Diff line number Diff line
@@ -79,7 +79,10 @@ public class PackageStateUnserialized {
            return this;
        }
        getLastPackageUsageTimeInMills()[reason] = time;
        mPackageSetting.onChanged();
        // TODO(b/236180425): This method does not notify snapshot changes because it's called too
        //  frequently, causing too many re-takes. This should be moved to a separate data structure
        //  or merged with the general UsageStats to avoid tracking heavily mutated data in the
        //  package data snapshot.
        return this;
    }