[RESTRICT AUTOMERGE] Revert "Persist destroyed staged sessions until they are cleaned up" am: 07d74c4c28
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19092213 Change-Id: If22465789761ee4d6077a84b5d570f4392fedbb2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -634,7 +634,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
|
|||||||
session = new PackageInstallerSession(mInternalCallback, mContext, mPm, this,
|
session = new PackageInstallerSession(mInternalCallback, mContext, mPm, this,
|
||||||
mInstallThread.getLooper(), mStagingManager, sessionId, userId,
|
mInstallThread.getLooper(), mStagingManager, sessionId, userId,
|
||||||
installerPackageName, callingUid, params, createdMillis, stageDir, stageCid, false,
|
installerPackageName, callingUid, params, createdMillis, stageDir, stageCid, false,
|
||||||
false, false, false, null, SessionInfo.INVALID_ID, false, false, false,
|
false, false, null, SessionInfo.INVALID_ID, false, false, false,
|
||||||
SessionInfo.STAGED_SESSION_NO_ERROR, "");
|
SessionInfo.STAGED_SESSION_NO_ERROR, "");
|
||||||
|
|
||||||
synchronized (mSessions) {
|
synchronized (mSessions) {
|
||||||
@@ -784,7 +784,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
|
|||||||
synchronized (mSessions) {
|
synchronized (mSessions) {
|
||||||
final PackageInstallerSession session = mSessions.get(sessionId);
|
final PackageInstallerSession session = mSessions.get(sessionId);
|
||||||
|
|
||||||
return (session != null && !(session.isStaged() && session.isDestroyed()))
|
return session != null
|
||||||
? session.generateInfoForCaller(true /*withIcon*/, Binder.getCallingUid())
|
? session.generateInfoForCaller(true /*withIcon*/, Binder.getCallingUid())
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
@@ -805,8 +805,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
|
|||||||
synchronized (mSessions) {
|
synchronized (mSessions) {
|
||||||
for (int i = 0; i < mSessions.size(); i++) {
|
for (int i = 0; i < mSessions.size(); i++) {
|
||||||
final PackageInstallerSession session = mSessions.valueAt(i);
|
final PackageInstallerSession session = mSessions.valueAt(i);
|
||||||
if (session.userId == userId && !session.hasParentSessionId()
|
if (session.userId == userId && !session.hasParentSessionId()) {
|
||||||
&& !(session.isStaged() && session.isDestroyed())) {
|
|
||||||
result.add(session.generateInfoForCaller(false, callingUid));
|
result.add(session.generateInfoForCaller(false, callingUid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
private static final String ATTR_SESSION_STAGE_CID = "sessionStageCid";
|
private static final String ATTR_SESSION_STAGE_CID = "sessionStageCid";
|
||||||
private static final String ATTR_PREPARED = "prepared";
|
private static final String ATTR_PREPARED = "prepared";
|
||||||
private static final String ATTR_COMMITTED = "committed";
|
private static final String ATTR_COMMITTED = "committed";
|
||||||
private static final String ATTR_DESTROYED = "destroyed";
|
|
||||||
private static final String ATTR_SEALED = "sealed";
|
private static final String ATTR_SEALED = "sealed";
|
||||||
private static final String ATTR_MULTI_PACKAGE = "multiPackage";
|
private static final String ATTR_MULTI_PACKAGE = "multiPackage";
|
||||||
private static final String ATTR_PARENT_SESSION_ID = "parentSessionId";
|
private static final String ATTR_PARENT_SESSION_ID = "parentSessionId";
|
||||||
@@ -415,8 +414,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
PackageSessionProvider sessionProvider, Looper looper, StagingManager stagingManager,
|
PackageSessionProvider sessionProvider, Looper looper, StagingManager stagingManager,
|
||||||
int sessionId, int userId,
|
int sessionId, int userId,
|
||||||
String installerPackageName, int installerUid, SessionParams params, long createdMillis,
|
String installerPackageName, int installerUid, SessionParams params, long createdMillis,
|
||||||
File stageDir, String stageCid, boolean prepared, boolean committed, boolean destroyed,
|
File stageDir, String stageCid, boolean prepared, boolean committed, boolean sealed,
|
||||||
boolean sealed, @Nullable int[] childSessionIds, int parentSessionId, boolean isReady,
|
@Nullable int[] childSessionIds, int parentSessionId, boolean isReady,
|
||||||
boolean isFailed, boolean isApplied, int stagedSessionErrorCode,
|
boolean isFailed, boolean isApplied, int stagedSessionErrorCode,
|
||||||
String stagedSessionErrorMessage) {
|
String stagedSessionErrorMessage) {
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
@@ -451,7 +450,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
|
|
||||||
mPrepared = prepared;
|
mPrepared = prepared;
|
||||||
mCommitted = committed;
|
mCommitted = committed;
|
||||||
mDestroyed = destroyed;
|
|
||||||
mStagedSessionReady = isReady;
|
mStagedSessionReady = isReady;
|
||||||
mStagedSessionFailed = isFailed;
|
mStagedSessionFailed = isFailed;
|
||||||
mStagedSessionApplied = isApplied;
|
mStagedSessionApplied = isApplied;
|
||||||
@@ -562,13 +560,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@hide} */
|
|
||||||
boolean isDestroyed() {
|
|
||||||
synchronized (mLock) {
|
|
||||||
return mDestroyed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns true if a staged session has reached a final state and can be forgotten about */
|
/** Returns true if a staged session has reached a final state and can be forgotten about */
|
||||||
public boolean isStagedAndInTerminalState() {
|
public boolean isStagedAndInTerminalState() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
@@ -2436,7 +2427,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
*/
|
*/
|
||||||
void write(@NonNull XmlSerializer out, @NonNull File sessionsDir) throws IOException {
|
void write(@NonNull XmlSerializer out, @NonNull File sessionsDir) throws IOException {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mDestroyed && !params.isStaged) {
|
if (mDestroyed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2458,7 +2449,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
}
|
}
|
||||||
writeBooleanAttribute(out, ATTR_PREPARED, isPrepared());
|
writeBooleanAttribute(out, ATTR_PREPARED, isPrepared());
|
||||||
writeBooleanAttribute(out, ATTR_COMMITTED, isCommitted());
|
writeBooleanAttribute(out, ATTR_COMMITTED, isCommitted());
|
||||||
writeBooleanAttribute(out, ATTR_DESTROYED, isDestroyed());
|
|
||||||
writeBooleanAttribute(out, ATTR_SEALED, isSealed());
|
writeBooleanAttribute(out, ATTR_SEALED, isSealed());
|
||||||
|
|
||||||
writeBooleanAttribute(out, ATTR_MULTI_PACKAGE, params.isMultiPackage);
|
writeBooleanAttribute(out, ATTR_MULTI_PACKAGE, params.isMultiPackage);
|
||||||
@@ -2560,7 +2550,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
final String stageCid = readStringAttribute(in, ATTR_SESSION_STAGE_CID);
|
final String stageCid = readStringAttribute(in, ATTR_SESSION_STAGE_CID);
|
||||||
final boolean prepared = readBooleanAttribute(in, ATTR_PREPARED, true);
|
final boolean prepared = readBooleanAttribute(in, ATTR_PREPARED, true);
|
||||||
final boolean committed = readBooleanAttribute(in, ATTR_COMMITTED);
|
final boolean committed = readBooleanAttribute(in, ATTR_COMMITTED);
|
||||||
final boolean destroyed = readBooleanAttribute(in, ATTR_DESTROYED);
|
|
||||||
final boolean sealed = readBooleanAttribute(in, ATTR_SEALED);
|
final boolean sealed = readBooleanAttribute(in, ATTR_SEALED);
|
||||||
final int parentSessionId = readIntAttribute(in, ATTR_PARENT_SESSION_ID,
|
final int parentSessionId = readIntAttribute(in, ATTR_PARENT_SESSION_ID,
|
||||||
SessionInfo.INVALID_ID);
|
SessionInfo.INVALID_ID);
|
||||||
@@ -2648,8 +2637,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
return new PackageInstallerSession(callback, context, pm, sessionProvider,
|
return new PackageInstallerSession(callback, context, pm, sessionProvider,
|
||||||
installerThread, stagingManager, sessionId, userId, installerPackageName,
|
installerThread, stagingManager, sessionId, userId, installerPackageName,
|
||||||
installerUid, params, createdMillis, stageDir, stageCid, prepared, committed,
|
installerUid, params, createdMillis, stageDir, stageCid, prepared, committed,
|
||||||
destroyed, sealed, childSessionIdsArray, parentSessionId, isReady, isFailed,
|
sealed, childSessionIdsArray, parentSessionId, isReady, isFailed, isApplied,
|
||||||
isApplied, stagedSessionErrorCode, stagedSessionErrorMessage);
|
stagedSessionErrorCode, stagedSessionErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -107,9 +107,6 @@ public class StagingManager {
|
|||||||
synchronized (mStagedSessions) {
|
synchronized (mStagedSessions) {
|
||||||
for (int i = 0; i < mStagedSessions.size(); i++) {
|
for (int i = 0; i < mStagedSessions.size(); i++) {
|
||||||
final PackageInstallerSession stagedSession = mStagedSessions.valueAt(i);
|
final PackageInstallerSession stagedSession = mStagedSessions.valueAt(i);
|
||||||
if (stagedSession.isDestroyed()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
result.add(stagedSession.generateInfoForCaller(false /*icon*/, callingUid));
|
result.add(stagedSession.generateInfoForCaller(false /*icon*/, callingUid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ public class PackageInstallerSessionTest {
|
|||||||
/* stageCid */ null,
|
/* stageCid */ null,
|
||||||
/* prepared */ true,
|
/* prepared */ true,
|
||||||
/* committed */ true,
|
/* committed */ true,
|
||||||
/* destroyed */ staged ? true : false,
|
|
||||||
/* sealed */ false, // Setting to true would trigger some PM logic.
|
/* sealed */ false, // Setting to true would trigger some PM logic.
|
||||||
/* childSessionIds */ childSessionIds != null ? childSessionIds : new int[0],
|
/* childSessionIds */ childSessionIds != null ? childSessionIds : new int[0],
|
||||||
/* parentSessionId */ parentSessionId,
|
/* parentSessionId */ parentSessionId,
|
||||||
|
|||||||
Reference in New Issue
Block a user