Merge "Add more logging in StagingManager"
This commit is contained in:
@@ -185,6 +185,8 @@ public class StagingManager {
|
|||||||
checkDowngrade(session, activePackage, packageInfo);
|
checkDowngrade(session, activePackage, packageInfo);
|
||||||
result.add(packageInfo);
|
result.add(packageInfo);
|
||||||
}
|
}
|
||||||
|
Slog.d(TAG, "Session " + session.sessionId + " has following APEX packages: ["
|
||||||
|
+ result.stream().map(p -> p.packageName).collect(Collectors.joining(",")) + "]");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +213,7 @@ public class StagingManager {
|
|||||||
throws PackageManagerException {
|
throws PackageManagerException {
|
||||||
final long activeVersion = activePackage.applicationInfo.longVersionCode;
|
final long activeVersion = activePackage.applicationInfo.longVersionCode;
|
||||||
final long newVersionCode = newPackage.applicationInfo.longVersionCode;
|
final long newVersionCode = newPackage.applicationInfo.longVersionCode;
|
||||||
boolean allowsDowngrade = PackageManagerServiceUtils.isDowngradePermitted(
|
final boolean allowsDowngrade = PackageManagerServiceUtils.isDowngradePermitted(
|
||||||
session.params.installFlags, activePackage.applicationInfo.flags);
|
session.params.installFlags, activePackage.applicationInfo.flags);
|
||||||
if (activeVersion > newVersionCode && !allowsDowngrade) {
|
if (activeVersion > newVersionCode && !allowsDowngrade) {
|
||||||
if (!mApexManager.abortActiveSession()) {
|
if (!mApexManager.abortActiveSession()) {
|
||||||
@@ -230,6 +232,7 @@ public class StagingManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void preRebootVerification(@NonNull PackageInstallerSession session) {
|
private void preRebootVerification(@NonNull PackageInstallerSession session) {
|
||||||
|
Slog.d(TAG, "Starting preRebootVerification for session " + session.sessionId);
|
||||||
final boolean hasApex = sessionContainsApex(session);
|
final boolean hasApex = sessionContainsApex(session);
|
||||||
// APEX checks. For single-package sessions, check if they contain an APEX. For
|
// APEX checks. For single-package sessions, check if they contain an APEX. For
|
||||||
// multi-package sessions, find all the child sessions that contain an APEX.
|
// multi-package sessions, find all the child sessions that contain an APEX.
|
||||||
@@ -248,6 +251,8 @@ public class StagingManager {
|
|||||||
|
|
||||||
if (sessionContainsApk(session)) {
|
if (sessionContainsApk(session)) {
|
||||||
try {
|
try {
|
||||||
|
Slog.d(TAG, "Running a pre-reboot verification for APKs in session "
|
||||||
|
+ session.sessionId + " by performing a dry-run install");
|
||||||
installApksInSession(session, /* preReboot */ true);
|
installApksInSession(session, /* preReboot */ true);
|
||||||
// TODO(b/118865310): abort the session on apexd.
|
// TODO(b/118865310): abort the session on apexd.
|
||||||
} catch (PackageManagerException e) {
|
} catch (PackageManagerException e) {
|
||||||
@@ -282,6 +287,7 @@ public class StagingManager {
|
|||||||
// On the other hand, if the order of the calls was inverted (first call apexd, then mark
|
// On the other hand, if the order of the calls was inverted (first call apexd, then mark
|
||||||
// session as ready), then if a device gets rebooted right after the call to apexd, only
|
// session as ready), then if a device gets rebooted right after the call to apexd, only
|
||||||
// apex part of the train will be applied, leaving device in an inconsistent state.
|
// apex part of the train will be applied, leaving device in an inconsistent state.
|
||||||
|
Slog.d(TAG, "Marking session " + session.sessionId + " as ready");
|
||||||
session.setStagedSessionReady();
|
session.setStagedSessionReady();
|
||||||
if (!hasApex) {
|
if (!hasApex) {
|
||||||
// Session doesn't contain apex, nothing to do.
|
// Session doesn't contain apex, nothing to do.
|
||||||
@@ -320,6 +326,7 @@ public class StagingManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void resumeSession(@NonNull PackageInstallerSession session) {
|
private void resumeSession(@NonNull PackageInstallerSession session) {
|
||||||
|
Slog.d(TAG, "Resuming session " + session.sessionId);
|
||||||
final boolean hasApex = sessionContainsApex(session);
|
final boolean hasApex = sessionContainsApex(session);
|
||||||
if (hasApex) {
|
if (hasApex) {
|
||||||
// Check with apexservice whether the apex packages have been activated.
|
// Check with apexservice whether the apex packages have been activated.
|
||||||
@@ -353,9 +360,12 @@ public class StagingManager {
|
|||||||
+ "retry at next reboot.");
|
+ "retry at next reboot.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Slog.i(TAG, "APEX packages in session " + session.sessionId
|
||||||
|
+ " were successfully activated. Proceeding with APK packages, if any");
|
||||||
}
|
}
|
||||||
// The APEX part of the session is activated, proceed with the installation of APKs.
|
// The APEX part of the session is activated, proceed with the installation of APKs.
|
||||||
try {
|
try {
|
||||||
|
Slog.d(TAG, "Installing APK packages in session " + session.sessionId);
|
||||||
installApksInSession(session, /* preReboot */ false);
|
installApksInSession(session, /* preReboot */ false);
|
||||||
} catch (PackageManagerException e) {
|
} catch (PackageManagerException e) {
|
||||||
session.setStagedSessionFailed(e.error, e.getMessage());
|
session.setStagedSessionFailed(e.error, e.getMessage());
|
||||||
@@ -375,6 +385,7 @@ public class StagingManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Slog.d(TAG, "Marking session " + session.sessionId + " as applied");
|
||||||
session.setStagedSessionApplied();
|
session.setStagedSessionApplied();
|
||||||
if (hasApex) {
|
if (hasApex) {
|
||||||
mApexManager.markStagedSessionSuccessful(session.sessionId);
|
mApexManager.markStagedSessionSuccessful(session.sessionId);
|
||||||
|
|||||||
Reference in New Issue
Block a user