update_engine: Save and reload ping prefs from powerwash prefs.
Improve device active accuracy by updating prefs with last ping time.
Check if |kPrefsLastActivePingDay| and |kPrefsLastRollCallPingDay|
were preserved after powerwash and move to prefs if the key
does not already exist. Delete from powerwash to preserve user
privacy.
BUG=b:173145783
TEST=FEATURES=test emerge-{board} update_engine
Cq-Depend: chromium:2558521
Change-Id: I2f71d767ac90b5214c1f0e988137277e4fbe8ec3
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2558010
Tested-by: Vyshu Khota <vyshu@google.com>
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/cros/update_attempter.h b/cros/update_attempter.h
index aeb7f9b..6010484 100644
--- a/cros/update_attempter.h
+++ b/cros/update_attempter.h
@@ -290,6 +290,7 @@
FRIEND_TEST(UpdateAttempterTest, UpdateIsNotRunningWhenUpdateAvailable);
FRIEND_TEST(UpdateAttempterTest, GetSuccessfulDlcIds);
FRIEND_TEST(UpdateAttempterTest, QuickFixTokenWhenDeviceIsEnterpriseEnrolled);
+ FRIEND_TEST(UpdateAttempterTest, MoveToPrefs);
// Returns the special flags to be added to ErrorCode values based on the
// parameters used in the current update attempt.
@@ -387,6 +388,10 @@
// on the |omaha_request_params_| object.
void CalculateP2PParams(bool interactive);
+ // For each key, reads value from powerwash safe prefs and adds it to prefs
+ // if key doesnt already exist. Then deletes the powerwash safe keys.
+ void MoveToPrefs(const std::vector<std::string>& keys);
+
// Starts P2P if it's enabled and there are files to actually share.
// Called only at program startup. Returns true only if p2p was
// started and housekeeping was performed.