libsnapshot: Check if the vendor is updated from Android S for GRF
In a GRF config, if Vendor partition is updated from Android 12; post
OTA reboot, first stage init will communicate to daemon to check if the
daemon can support socket handoff. If that succeeds, then it is a signal
that the vendor has been updated from Android 12. Use a marker in
/metadata to signal that the vendor was updated. If the marker is present,
then post OTA reboot, userspace snapshot will be used.
Bug: 333854394
Test: OTA
Android U (system) + S (vendor) -> Android V (system) + V (Vendor)
Signed-off-by: Akilesh Kailash <akailash@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:1bbf8f042f7ffb4a38657ccf6dca0798931fecd5)
Merged-In: Ie38c4379010789a84e5b44529b407f9f82135271
Change-Id: Ie38c4379010789a84e5b44529b407f9f82135271
diff --git a/init/snapuserd_transition.cpp b/init/snapuserd_transition.cpp
index 9e3ff41..2370bc2 100644
--- a/init/snapuserd_transition.cpp
+++ b/init/snapuserd_transition.cpp
@@ -100,6 +100,10 @@
}
if (client->SupportsSecondStageSocketHandoff()) {
setenv(kSnapuserdFirstStageInfoVar, "socket", 1);
+ auto sm = SnapshotManager::NewForFirstStageMount();
+ if (!sm->MarkSnapuserdFromSystem()) {
+ LOG(ERROR) << "Failed to update MarkSnapuserdFromSystem";
+ }
}
setenv(kSnapuserdFirstStagePidVar, std::to_string(pid).c_str(), 1);