• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2015 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 #ifndef UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
18 #define UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
19 
20 #include <string>
21 
22 #include <brillo/enum_flags.h>
23 
24 namespace update_engine {
25 
26 enum class UpdateStatus {
27   IDLE = 0,
28   CHECKING_FOR_UPDATE,
29   UPDATE_AVAILABLE,
30   DOWNLOADING,
31   VERIFYING,
32   FINALIZING,
33   UPDATED_NEED_REBOOT,
34   REPORTING_ERROR_EVENT,
35   ATTEMPTING_ROLLBACK,
36   DISABLED,
37 };
38 
39 // Enum of bit-wise flags for controlling how updates are attempted.
40 enum UpdateAttemptFlags : int32_t {
41   kNone = 0,
42   // Treat the update like a non-interactive update, even when being triggered
43   // by the interactive APIs.
44   kFlagNonInteractive = (1 << 0),
45   // Restrict (disallow) downloading of updates.
46   kFlagRestrictDownload = (1 << 1),
47 };
48 
49 // Enable bit-wise operators for the above enumeration of flag values.
50 DECLARE_FLAGS_ENUM(UpdateAttemptFlags);
51 
52 struct UpdateEngineStatus {
53   // When the update_engine last checked for updates (time_t: seconds from unix
54   // epoch)
55   int64_t last_checked_time;
56   // the current status/operation of the update_engine
57   UpdateStatus status;
58   // the current product version (oem bundle id)
59   std::string current_version;
60   // the current system version
61   std::string current_system_version;
62   // The current progress (0.0f-1.0f).
63   double progress;
64   // the size of the update (bytes)
65   uint64_t new_size_bytes;
66   // the new product version
67   std::string new_version;
68   // the new system version, if there is one (empty, otherwise)
69   std::string new_system_version;
70 };
71 
72 }  // namespace update_engine
73 
74 #endif  // UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
75