Remove kPrefsDynamicPartitionMetadataInitialized.

DeltaPerformer::InitPartitionMetadata() should always happen when
populating the InstallPlan on each update attempt. Persisting the value
across attempts would wrongly skip the initialization on resuming.

Bug: 120465293
Test: Cancel and resume an update that uses dynamic partitions.
Change-Id: Ia41c65bc26aa438f92edf5a8dff08d691afa64db
(cherry picked from commit 6b456f58958fc7296fe326ee14e6a6ba184f1566)
(cherry picked from commit 9a97572f491789023b4342c4e45a18ce34421dbe)
diff --git a/common/constants.cc b/common/constants.cc
index 3ae7a60..4bca105 100644
--- a/common/constants.cc
+++ b/common/constants.cc
@@ -37,8 +37,6 @@
 const char kPrefsDailyMetricsLastReportedAt[] =
     "daily-metrics-last-reported-at";
 const char kPrefsDeltaUpdateFailures[] = "delta-update-failures";
-const char kPrefsDynamicPartitionMetadataInitialized[] =
-    "dynamic-partition-metadata-initialized";
 const char kPrefsFullPayloadAttemptNumber[] = "full-payload-attempt-number";
 const char kPrefsInstallDateDays[] = "install-date-days";
 const char kPrefsLastActivePingDay[] = "last-active-ping-day";
diff --git a/common/constants.h b/common/constants.h
index 61e5ddd..1057a65 100644
--- a/common/constants.h
+++ b/common/constants.h
@@ -41,7 +41,6 @@
 extern const char kPrefsCurrentUrlIndex[];
 extern const char kPrefsDailyMetricsLastReportedAt[];
 extern const char kPrefsDeltaUpdateFailures[];
-extern const char kPrefsDynamicPartitionMetadataInitialized[];
 extern const char kPrefsFullPayloadAttemptNumber[];
 extern const char kPrefsInstallDateDays[];
 extern const char kPrefsLastActivePingDay[];
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 3cce4d2..2ff9df0 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -935,14 +935,6 @@
 }
 
 bool DeltaPerformer::InitPartitionMetadata() {
-  bool metadata_initialized;
-  if (prefs_->GetBoolean(kPrefsDynamicPartitionMetadataInitialized,
-                         &metadata_initialized) &&
-      metadata_initialized) {
-    LOG(INFO) << "Skipping InitPartitionMetadata.";
-    return true;
-  }
-
   BootControlInterface::PartitionMetadata partition_metadata;
   if (manifest_.has_dynamic_partition_metadata()) {
     std::map<string, uint64_t> partition_sizes;
@@ -976,8 +968,6 @@
                << BootControlInterface::SlotName(install_plan_->target_slot);
     return false;
   }
-  TEST_AND_RETURN_FALSE(
-      prefs_->SetBoolean(kPrefsDynamicPartitionMetadataInitialized, true));
   LOG(INFO) << "InitPartitionMetadata done.";
 
   return true;
@@ -1901,7 +1891,6 @@
     prefs->SetInt64(kPrefsResumedUpdateFailures, 0);
     prefs->Delete(kPrefsPostInstallSucceeded);
     prefs->Delete(kPrefsVerityWritten);
-    prefs->Delete(kPrefsDynamicPartitionMetadataInitialized);
   }
   return true;
 }
diff --git a/payload_consumer/delta_performer_integration_test.cc b/payload_consumer/delta_performer_integration_test.cc
index 9368e11..ba5fa18 100644
--- a/payload_consumer/delta_performer_integration_test.cc
+++ b/payload_consumer/delta_performer_integration_test.cc
@@ -697,8 +697,6 @@
       .WillRepeatedly(Return(true));
   EXPECT_CALL(prefs, SetString(kPrefsUpdateStateSignedSHA256Context, _))
       .WillRepeatedly(Return(true));
-  EXPECT_CALL(prefs, SetBoolean(kPrefsDynamicPartitionMetadataInitialized, _))
-      .WillRepeatedly(Return(true));
   if (op_hash_test == kValidOperationData && signature_test != kSignatureNone) {
     EXPECT_CALL(prefs, SetString(kPrefsUpdateStateSignatureBlob, _))
         .WillOnce(Return(true));