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

Commit 534ffa76 authored by Alex Buynytskyy's avatar Alex Buynytskyy
Browse files

Use snapshot API to avoid locks.

Bug: 294438703
Fixes: 294438703
Test: presubmit
Change-Id: Icbdac7828c7684b4cea10a5673aa006c31444dc9
parent c1edc4a8
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -2892,13 +2892,10 @@ public class PackageManagerService implements PackageSender, TestUtilityService

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

    /*package*/ DexManager getDexManager() {
@@ -6681,10 +6678,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService

        @Override
        public void notifyPackageUse(String packageName, int reason) {
            synchronized (mLock) {
            PackageManagerService.this.notifyPackageUseInternal(packageName, reason);
        }
        }

        @Nullable
        @Override