Merge "Add SYNCHRONOUS to EnabledFlags for PackageManager"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d1b1f6fc68
@@ -11908,6 +11908,7 @@ package android.content.pm {
|
||||
field public static final int SIGNATURE_NO_MATCH = -3; // 0xfffffffd
|
||||
field public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; // 0xfffffffe
|
||||
field public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; // 0xfffffffc
|
||||
field public static final int SYNCHRONOUS = 2; // 0x2
|
||||
field public static final int VERIFICATION_ALLOW = 1; // 0x1
|
||||
field public static final int VERIFICATION_REJECT = -1; // 0xffffffff
|
||||
field public static final int VERSION_CODE_HIGHEST = -1; // 0xffffffff
|
||||
|
||||
@@ -917,8 +917,9 @@ public abstract class PackageManager {
|
||||
public static final int INSTALL_DRY_RUN = 0x00800000;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = {
|
||||
DONT_KILL_APP
|
||||
@IntDef(flag = true, value = {
|
||||
DONT_KILL_APP,
|
||||
SYNCHRONOUS
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface EnabledFlags {}
|
||||
@@ -931,6 +932,14 @@ public abstract class PackageManager {
|
||||
*/
|
||||
public static final int DONT_KILL_APP = 0x00000001;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public static final int SYNCHRONOUS = 0x00000002;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "INSTALL_REASON_" }, value = {
|
||||
INSTALL_REASON_UNKNOWN,
|
||||
|
||||
@@ -19980,7 +19980,11 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
}
|
||||
synchronized (mLock) {
|
||||
scheduleWritePackageRestrictionsLocked(userId);
|
||||
if ((flags & PackageManager.SYNCHRONOUS) != 0) {
|
||||
flushPackageRestrictionsAsUserInternalLocked(userId);
|
||||
} else {
|
||||
scheduleWritePackageRestrictionsLocked(userId);
|
||||
}
|
||||
updateSequenceNumberLP(pkgSetting, new int[] { userId });
|
||||
final long callingId = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -20041,11 +20045,16 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
mPermissionManager.enforceCrossUserPermission(Binder.getCallingUid(), userId, false /* requireFullPermission*/,
|
||||
false /* checkShell */, "flushPackageRestrictions");
|
||||
synchronized (mLock) {
|
||||
mSettings.writePackageRestrictionsLPr(userId);
|
||||
mDirtyUsers.remove(userId);
|
||||
if (mDirtyUsers.isEmpty()) {
|
||||
mHandler.removeMessages(WRITE_PACKAGE_RESTRICTIONS);
|
||||
}
|
||||
flushPackageRestrictionsAsUserInternalLocked(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@GuardedBy("mLock")
|
||||
private void flushPackageRestrictionsAsUserInternalLocked(int userId) {
|
||||
mSettings.writePackageRestrictionsLPr(userId);
|
||||
mDirtyUsers.remove(userId);
|
||||
if (mDirtyUsers.isEmpty()) {
|
||||
mHandler.removeMessages(WRITE_PACKAGE_RESTRICTIONS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user