Skip building root hash if not incremental

BUG: 235386854
Test: manually install a non-incremental app from Play Store and observe
the logcat. Before the change there is always a line saying "ERROR: could not load root hash from incremental install". After the change there is no more.

Change-Id: Iade72d4c5fd030885c82d0344f67952780f69996
This commit is contained in:
Songchun Fan
2022-07-20 15:20:34 -07:00
parent 395e63d26a
commit 2c5404cab5

View File

@@ -65,6 +65,7 @@ import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.incremental.IncrementalManager;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.text.TextUtils;
@@ -426,10 +427,11 @@ final class VerifyingSession {
final String baseCodePath = mPackageLite.getBaseApkPath();
final String[] splitCodePaths = mPackageLite.getSplitApkPaths();
final String rootHashString = PackageManagerServiceUtils.buildVerificationRootHashString(
baseCodePath, splitCodePaths);
if (rootHashString != null) {
if (IncrementalManager.isIncrementalPath(baseCodePath)) {
final String rootHashString =
PackageManagerServiceUtils.buildVerificationRootHashString(
baseCodePath, splitCodePaths);
verification.putExtra(PackageManager.EXTRA_VERIFICATION_ROOT_HASH, rootHashString);
}