Merge "Add background thread notes for package restriction serialisation."
This commit is contained in:
committed by
Android (Google) Code Review
commit
4358010076
@@ -983,7 +983,8 @@ public abstract class PackageManager {
|
||||
* Flag parameter for
|
||||
* {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
|
||||
* that the given user's package restrictions state will be serialised to disk after the
|
||||
* component state has been updated.
|
||||
* component state has been updated. Note that this is synchronous disk access, so calls using
|
||||
* this flag should be run on a background thread.
|
||||
*/
|
||||
public static final int SYNCHRONOUS = 0x00000002;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.UserIdInt;
|
||||
import android.annotation.WorkerThread;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Intent;
|
||||
@@ -261,6 +262,7 @@ public abstract class PackageManagerInternal {
|
||||
/**
|
||||
* Flushes package restrictions for the given user immediately to disk.
|
||||
*/
|
||||
@WorkerThread
|
||||
public abstract void flushPackageRestrictions(int userId);
|
||||
|
||||
/**
|
||||
|
||||
@@ -130,6 +130,7 @@ import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.UserIdInt;
|
||||
import android.annotation.WorkerThread;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AppOpsManager;
|
||||
import android.app.ApplicationPackageManager;
|
||||
@@ -213,7 +214,6 @@ import android.content.pm.dex.ArtManager;
|
||||
import android.content.pm.dex.DexMetadataHelper;
|
||||
import android.content.pm.dex.IArtManager;
|
||||
import android.content.pm.parsing.PackageInfoWithoutStateUtils;
|
||||
import android.content.pm.parsing.ParsingPackageRead;
|
||||
import android.content.pm.parsing.ParsingPackageUtils;
|
||||
import android.content.pm.parsing.component.ParsedActivity;
|
||||
import android.content.pm.parsing.component.ParsedInstrumentation;
|
||||
@@ -20180,6 +20180,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@Override
|
||||
public void flushPackageRestrictionsAsUser(int userId) {
|
||||
if (getInstantAppPackageName(Binder.getCallingUid()) != null) {
|
||||
@@ -20197,6 +20198,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
|
||||
@GuardedBy("mLock")
|
||||
private void flushPackageRestrictionsAsUserInternalLocked(int userId) {
|
||||
// NOTE: this invokes synchronous disk access, so callers using this
|
||||
// method should consider running on a background thread
|
||||
mSettings.writePackageRestrictionsLPr(userId);
|
||||
mDirtyUsers.remove(userId);
|
||||
if (mDirtyUsers.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user