Fix #removeChildSessionId (4/n)
Removing a non-owning child should be no-op. The current implementation will set the parent id to -1 incorrectly. Bug: 162286562 Test: Will be added in next CLs Change-Id: I483c570079511d5f10dcfdc93e7daf006004b226
This commit is contained in:
@@ -3143,14 +3143,15 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
synchronized (mLock) {
|
||||
assertCallerIsOwnerOrRootLocked();
|
||||
assertPreparedAndNotSealedLocked("removeChildSessionId");
|
||||
|
||||
final int indexOfSession = mChildSessionIds.indexOfKey(sessionId);
|
||||
if (session != null) {
|
||||
session.setParentSessionId(SessionInfo.INVALID_ID);
|
||||
}
|
||||
if (indexOfSession < 0) {
|
||||
// not added in the first place; no-op
|
||||
return;
|
||||
}
|
||||
if (session != null) {
|
||||
session.setParentSessionId(SessionInfo.INVALID_ID);
|
||||
}
|
||||
mChildSessionIds.removeAt(indexOfSession);
|
||||
}
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user