From c6f0fa25ccbf7ee4ac21d9c0b21ba7d2cd0fc9ee Mon Sep 17 00:00:00 2001 From: Victor Hsieh Date: Wed, 30 Nov 2022 19:08:43 +0000 Subject: [PATCH] Revert "Enable fs-verity in background thread" This reverts commit 03a0c6c7375931b41a4ef858480e93200e0a978a. Reason for revert: b/260856890. Possible race condition: test calls ApkChecksum before the setup is completed. Change-Id: Ib42d136549284765deb9d17cbbf409738f844d73 --- .../server/pm/InstallPackageHelper.java | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java index af78e044fd1b9..b02d1a8c03536 100644 --- a/services/core/java/com/android/server/pm/InstallPackageHelper.java +++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java @@ -2228,26 +2228,20 @@ final class InstallPackageHelper { incrementalStorages.add(storage); } - // Enabling fs-verity is a blocking operation. To reduce the impact to the install time, - // run in a background thread. - new Thread("fsverity-setup") { - @Override public void run() { - try { - if (!VerityUtils.hasFsverity(pkg.getBaseApkPath())) { - VerityUtils.setUpFsverity(pkg.getBaseApkPath(), (byte[]) null); - } - for (String path : pkg.getSplitCodePaths()) { - if (!VerityUtils.hasFsverity(path)) { - VerityUtils.setUpFsverity(path, (byte[]) null); - } - } - } catch (IOException e) { - // There's nothing we can do if the setup failed. Since fs-verity is - // optional, just ignore the error for now. - Slog.e(TAG, "Failed to fully enable fs-verity to " + packageName); + try { + if (!VerityUtils.hasFsverity(pkg.getBaseApkPath())) { + VerityUtils.setUpFsverity(pkg.getBaseApkPath(), (byte[]) null); + } + for (String path : pkg.getSplitCodePaths()) { + if (!VerityUtils.hasFsverity(path)) { + VerityUtils.setUpFsverity(path, (byte[]) null); } } - }.start(); + } catch (IOException e) { + // There's nothing we can do if the setup failed. Since fs-verity is + // optional, just ignore the error for now. + Slog.e(TAG, "Failed to fully enable fs-verity to " + packageName); + } // Hardcode previousAppId to 0 to disable any data migration (http://b/221088088) mAppDataHelper.prepareAppDataPostCommitLIF(pkg, 0);