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 // ATTENTION: When adding a new enum value here, always append at the end and 27 // make sure to make proper adjustments in UpdateAttempter:ActionCompleted(). If 28 // any enum memeber is deprecated, the assigned value of other members should 29 // not change. See b/62842358. 30 enum class UpdateStatus { 31 IDLE = 0, 32 CHECKING_FOR_UPDATE = 1, 33 UPDATE_AVAILABLE = 2, 34 DOWNLOADING = 3, 35 VERIFYING = 4, 36 FINALIZING = 5, 37 UPDATED_NEED_REBOOT = 6, 38 REPORTING_ERROR_EVENT = 7, 39 ATTEMPTING_ROLLBACK = 8, 40 DISABLED = 9, 41 // Broadcast this state when an update aborts because user preferences do not 42 // allow updates, e.g. over cellular network. 43 NEED_PERMISSION_TO_UPDATE = 10, 44 }; 45 46 // Enum of bit-wise flags for controlling how updates are attempted. 47 enum UpdateAttemptFlags : int32_t { 48 kNone = 0, 49 // Treat the update like a non-interactive update, even when being triggered 50 // by the interactive APIs. 51 kFlagNonInteractive = (1 << 0), 52 // Restrict (disallow) downloading of updates. 53 kFlagRestrictDownload = (1 << 1), 54 }; 55 56 // Enable bit-wise operators for the above enumeration of flag values. 57 DECLARE_FLAGS_ENUM(UpdateAttemptFlags); 58 59 struct UpdateEngineStatus { 60 // When the update_engine last checked for updates (time_t: seconds from unix 61 // epoch) 62 int64_t last_checked_time; 63 // the current status/operation of the update_engine 64 UpdateStatus status; 65 // the current product version (oem bundle id) 66 std::string current_version; 67 // the current system version 68 std::string current_system_version; 69 // The current progress (0.0f-1.0f). 70 double progress; 71 // the size of the update (bytes) 72 uint64_t new_size_bytes; 73 // the new product version 74 std::string new_version; 75 // the new system version, if there is one (empty, otherwise) 76 std::string new_system_version; 77 }; 78 79 } // namespace update_engine 80 81 #endif // UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_ 82