Merge "Fix incorrect PackageSetting in the SharedUserSetting" into tm-dev
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package com.android.server.pm;
|
package com.android.server.pm;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.SigningDetails;
|
import android.content.pm.SigningDetails;
|
||||||
import android.service.pm.PackageServiceDumpProto;
|
import android.service.pm.PackageServiceDumpProto;
|
||||||
@@ -33,7 +34,9 @@ import com.android.server.pm.pkg.component.ComponentMutateUtils;
|
|||||||
import com.android.server.pm.pkg.component.ParsedProcess;
|
import com.android.server.pm.pkg.component.ParsedProcess;
|
||||||
import com.android.server.pm.pkg.component.ParsedProcessImpl;
|
import com.android.server.pm.pkg.component.ParsedProcessImpl;
|
||||||
import com.android.server.utils.SnapshotCache;
|
import com.android.server.utils.SnapshotCache;
|
||||||
|
import com.android.server.utils.Watchable;
|
||||||
import com.android.server.utils.WatchedArraySet;
|
import com.android.server.utils.WatchedArraySet;
|
||||||
|
import com.android.server.utils.Watcher;
|
||||||
|
|
||||||
import libcore.util.EmptyArray;
|
import libcore.util.EmptyArray;
|
||||||
|
|
||||||
@@ -66,6 +69,16 @@ public final class SharedUserSetting extends SettingBase implements SharedUserAp
|
|||||||
final WatchedArraySet<PackageSetting> mDisabledPackages;
|
final WatchedArraySet<PackageSetting> mDisabledPackages;
|
||||||
private final SnapshotCache<WatchedArraySet<PackageSetting>> mDisabledPackagesSnapshot;
|
private final SnapshotCache<WatchedArraySet<PackageSetting>> mDisabledPackagesSnapshot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The observer that watches for changes from array members
|
||||||
|
*/
|
||||||
|
private final Watcher mObserver = new Watcher() {
|
||||||
|
@Override
|
||||||
|
public void onChange(@Nullable Watchable what) {
|
||||||
|
SharedUserSetting.this.onChanged();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
final PackageSignatures signatures = new PackageSignatures();
|
final PackageSignatures signatures = new PackageSignatures();
|
||||||
Boolean signaturesChanged;
|
Boolean signaturesChanged;
|
||||||
|
|
||||||
@@ -97,6 +110,7 @@ public final class SharedUserSetting extends SettingBase implements SharedUserAp
|
|||||||
mDisabledPackagesSnapshot = new SnapshotCache.Auto<>(mDisabledPackages, mDisabledPackages,
|
mDisabledPackagesSnapshot = new SnapshotCache.Auto<>(mDisabledPackages, mDisabledPackages,
|
||||||
"SharedUserSetting.mDisabledPackages");
|
"SharedUserSetting.mDisabledPackages");
|
||||||
processes = new ArrayMap<>();
|
processes = new ArrayMap<>();
|
||||||
|
registerObservers();
|
||||||
mSnapshot = makeCache();
|
mSnapshot = makeCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +133,11 @@ public final class SharedUserSetting extends SettingBase implements SharedUserAp
|
|||||||
mSnapshot = new SnapshotCache.Sealed<>();
|
mSnapshot = new SnapshotCache.Sealed<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerObservers() {
|
||||||
|
mPackages.registerObserver(mObserver);
|
||||||
|
mDisabledPackages.registerObserver(mObserver);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a read-only snapshot of this object.
|
* Return a read-only snapshot of this object.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user