1 //
2 // Copyright (C) 2013 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #include "update_engine/common/constants.h"
18 
19 namespace chromeos_update_engine {
20 
21 const char kExclusionPrefsSubDir[] = "exclusion";
22 
23 const char kDlcPrefsSubDir[] = "dlc";
24 
25 const char kPowerwashSafePrefsSubDirectory[] = "update_engine/prefs";
26 
27 const char kPrefsSubDirectory[] = "prefs";
28 
29 const char kStatefulPartition[] = "/mnt/stateful_partition";
30 
31 const char kPostinstallDefaultScript[] = "postinst";
32 
33 // Constants defining keys for the persisted state of update engine.
34 const char kPrefsAttemptInProgress[] = "attempt-in-progress";
35 const char kPrefsBackoffExpiryTime[] = "backoff-expiry-time";
36 const char kPrefsBootId[] = "boot-id";
37 const char kPrefsCurrentBytesDownloaded[] = "current-bytes-downloaded";
38 const char kPrefsCurrentResponseSignature[] = "current-response-signature";
39 const char kPrefsCurrentUrlFailureCount[] = "current-url-failure-count";
40 const char kPrefsCurrentUrlIndex[] = "current-url-index";
41 const char kPrefsDailyMetricsLastReportedAt[] =
42     "daily-metrics-last-reported-at";
43 const char kPrefsDeltaUpdateFailures[] = "delta-update-failures";
44 const char kPrefsDynamicPartitionMetadataUpdated[] =
45     "dynamic-partition-metadata-updated";
46 const char kPrefsFullPayloadAttemptNumber[] = "full-payload-attempt-number";
47 const char kPrefsInstallDateDays[] = "install-date-days";
48 const char kPrefsLastActivePingDay[] = "last-active-ping-day";
49 const char kPrefsLastRollCallPingDay[] = "last-roll-call-ping-day";
50 const char kPrefsManifestMetadataSize[] = "manifest-metadata-size";
51 const char kPrefsManifestSignatureSize[] = "manifest-signature-size";
52 const char kPrefsMetricsAttemptLastReportingTime[] =
53     "metrics-attempt-last-reporting-time";
54 const char kPrefsMetricsCheckLastReportingTime[] =
55     "metrics-check-last-reporting-time";
56 const char kPrefsNoIgnoreBackoff[] = "no-ignore-backoff";
57 const char kPrefsNumReboots[] = "num-reboots";
58 const char kPrefsNumResponsesSeen[] = "num-responses-seen";
59 const char kPrefsOmahaCohort[] = "omaha-cohort";
60 const char kPrefsOmahaCohortHint[] = "omaha-cohort-hint";
61 const char kPrefsOmahaCohortName[] = "omaha-cohort-name";
62 const char kPrefsOmahaEolDate[] = "omaha-eol-date";
63 const char kPrefsP2PEnabled[] = "p2p-enabled";
64 const char kPrefsP2PFirstAttemptTimestamp[] = "p2p-first-attempt-timestamp";
65 const char kPrefsP2PNumAttempts[] = "p2p-num-attempts";
66 const char kPrefsPayloadAttemptNumber[] = "payload-attempt-number";
67 // Keep |kPrefsPingActive| in sync with |kDlcMetadataFilePingActive| in
68 // dlcservice.
69 const char kPrefsPingActive[] = "active";
70 const char kPrefsPingLastActive[] = "date_last_active";
71 const char kPrefsPingLastRollcall[] = "date_last_rollcall";
72 const char kPrefsPostInstallSucceeded[] = "post-install-succeeded";
73 const char kPrefsPreviousVersion[] = "previous-version";
74 const char kPrefsResumedUpdateFailures[] = "resumed-update-failures";
75 const char kPrefsRollbackHappened[] = "rollback-happened";
76 const char kPrefsRollbackVersion[] = "rollback-version";
77 const char kPrefsChannelOnSlotPrefix[] = "channel-on-slot-";
78 const char kPrefsSystemUpdatedMarker[] = "system-updated-marker";
79 const char kPrefsTargetVersionAttempt[] = "target-version-attempt";
80 const char kPrefsTargetVersionInstalledFrom[] = "target-version-installed-from";
81 const char kPrefsTargetVersionUniqueId[] = "target-version-unique-id";
82 const char kPrefsTotalBytesDownloaded[] = "total-bytes-downloaded";
83 const char kPrefsUpdateCheckCount[] = "update-check-count";
84 const char kPrefsUpdateCheckResponseHash[] = "update-check-response-hash";
85 const char kPrefsUpdateCompletedBootTime[] = "update-completed-boot-time";
86 const char kPrefsUpdateCompletedOnBootId[] = "update-completed-on-boot-id";
87 const char kPrefsUpdateDurationUptime[] = "update-duration-uptime";
88 const char kPrefsUpdateFirstSeenAt[] = "update-first-seen-at";
89 const char kPrefsUpdateOverCellularPermission[] =
90     "update-over-cellular-permission";
91 const char kPrefsUpdateOverCellularTargetVersion[] =
92     "update-over-cellular-target-version";
93 const char kPrefsUpdateOverCellularTargetSize[] =
94     "update-over-cellular-target-size";
95 const char kPrefsUpdateServerCertificate[] = "update-server-cert";
96 const char kPrefsUpdateStateNextDataLength[] = "update-state-next-data-length";
97 const char kPrefsUpdateStateNextDataOffset[] = "update-state-next-data-offset";
98 const char kPrefsUpdateStateNextOperation[] = "update-state-next-operation";
99 const char kPrefsUpdateStatePayloadIndex[] = "update-state-payload-index";
100 const char kPrefsUpdateStateSHA256Context[] = "update-state-sha-256-context";
101 const char kPrefsUpdateStateSignatureBlob[] = "update-state-signature-blob";
102 const char kPrefsUpdateStateSignedSHA256Context[] =
103     "update-state-signed-sha-256-context";
104 const char kPrefsUpdateBootTimestampStart[] = "update-boot-timestamp-start";
105 const char kPrefsUpdateTimestampStart[] = "update-timestamp-start";
106 const char kPrefsUrlSwitchCount[] = "url-switch-count";
107 const char kPrefsVerityWritten[] = "verity-written";
108 const char kPrefsWallClockScatteringWaitPeriod[] = "wall-clock-wait-period";
109 const char kPrefsWallClockStagingWaitPeriod[] =
110     "wall-clock-staging-wait-period";
111 const char kPrefsManifestBytes[] = "manifest-bytes";
112 
113 // These four fields are generated by scripts/brillo_update_payload.
114 const char kPayloadPropertyFileSize[] = "FILE_SIZE";
115 const char kPayloadPropertyFileHash[] = "FILE_HASH";
116 const char kPayloadPropertyMetadataSize[] = "METADATA_SIZE";
117 const char kPayloadPropertyMetadataHash[] = "METADATA_HASH";
118 // The Authorization: HTTP header to be sent when downloading the payload.
119 const char kPayloadPropertyAuthorization[] = "AUTHORIZATION";
120 // The User-Agent HTTP header to be sent when downloading the payload.
121 const char kPayloadPropertyUserAgent[] = "USER_AGENT";
122 // Set "POWERWASH=1" to powerwash (factory data reset) the device after
123 // applying the update.
124 const char kPayloadPropertyPowerwash[] = "POWERWASH";
125 // The network id to pass to android_setprocnetwork before downloading.
126 // This can be used to zero-rate OTA traffic by sending it over the correct
127 // network.
128 const char kPayloadPropertyNetworkId[] = "NETWORK_ID";
129 // Set "SWITCH_SLOT_ON_REBOOT=0" to skip marking the updated partitions active.
130 // The default is 1 (always switch slot if update succeeded).
131 const char kPayloadPropertySwitchSlotOnReboot[] = "SWITCH_SLOT_ON_REBOOT";
132 // Set "RUN_POST_INSTALL=0" to skip running optional post install.
133 // The default is 1 (always run post install).
134 const char kPayloadPropertyRunPostInstall[] = "RUN_POST_INSTALL";
135 
136 const char kOmahaUpdaterVersion[] = "0.1.0.0";
137 
138 // X-Goog-Update headers.
139 const char kXGoogleUpdateInteractivity[] = "X-Goog-Update-Interactivity";
140 const char kXGoogleUpdateAppId[] = "X-Goog-Update-AppId";
141 const char kXGoogleUpdateUpdater[] = "X-Goog-Update-Updater";
142 const char kXGoogleUpdateSessionId[] = "X-Goog-SessionId";
143 
144 }  // namespace chromeos_update_engine
145