Merge "Fix ApexManager#snapshotCeData (3/n)" am: 3a9796a8c6 am: 299da8f790

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1535142

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If8eafd6289ef9aede446b3b7c16dd30b29fd25d9
This commit is contained in:
Nikita Ioffe
2020-12-23 13:39:48 +00:00
committed by Automerger Merge Worker
2 changed files with 9 additions and 13 deletions

View File

@@ -323,9 +323,9 @@ public abstract class ApexManager {
* Copies the CE apex data directory for the given {@code userId} to a backup location, for use
* in case of rollback.
*
* @return long inode for the snapshot directory if the snapshot was successful, or -1 if not
* @return boolean true if the snapshot was successful
*/
public abstract long snapshotCeData(int userId, int rollbackId, String apexPackageName);
public abstract boolean snapshotCeData(int userId, int rollbackId, String apexPackageName);
/**
* Restores the snapshot of the CE apex data directory for the given {@code userId}.
@@ -826,7 +826,7 @@ public abstract class ApexManager {
}
@Override
public long snapshotCeData(int userId, int rollbackId, String apexPackageName) {
public boolean snapshotCeData(int userId, int rollbackId, String apexPackageName) {
String apexModuleName;
synchronized (mLock) {
Preconditions.checkState(mPackageNameToApexModuleName != null,
@@ -835,13 +835,14 @@ public abstract class ApexManager {
}
if (apexModuleName == null) {
Slog.e(TAG, "Invalid apex package name: " + apexPackageName);
return -1;
return false;
}
try {
return waitForApexService().snapshotCeData(userId, rollbackId, apexModuleName);
waitForApexService().snapshotCeData(userId, rollbackId, apexModuleName);
return true;
} catch (Exception e) {
Slog.e(TAG, e.getMessage(), e);
return -1;
return false;
}
}
@@ -1124,7 +1125,7 @@ public abstract class ApexManager {
}
@Override
public long snapshotCeData(int userId, int rollbackId, String apexPackageName) {
public boolean snapshotCeData(int userId, int rollbackId, String apexPackageName) {
throw new UnsupportedOperationException();
}

View File

@@ -129,13 +129,8 @@ public class AppDataRollbackHelper {
if (packageRollbackInfo.isApex()) {
// For APEX, only snapshot CE here
if ((flags & Installer.FLAG_STORAGE_CE) != 0) {
long ceSnapshotInode = mApexManager.snapshotCeData(
return mApexManager.snapshotCeData(
userId, rollbackId, packageRollbackInfo.getPackageName());
if (ceSnapshotInode > 0) {
packageRollbackInfo.putCeSnapshotInode(userId, ceSnapshotInode);
} else {
return false;
}
}
} else {
// APK