1 //
2 // Copyright (C) 2016 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_PARCELABLE_UPDATE_ENGINE_STATUS_H_
18 #define UPDATE_ENGINE_PARCELABLE_UPDATE_ENGINE_STATUS_H_
19 
20 #include <binder/Parcelable.h>
21 #include <utils/String16.h>
22 
23 #include "update_engine/client_library/include/update_engine/update_status.h"
24 
25 namespace android {
26 namespace brillo {
27 
28 // Parcelable object containing the current status of update engine, to be sent
29 // over binder to clients from the server.
30 class ParcelableUpdateEngineStatus : public Parcelable {
31  public:
32   ParcelableUpdateEngineStatus() = default;
33   explicit ParcelableUpdateEngineStatus(
34       const update_engine::UpdateEngineStatus& status);
35   virtual ~ParcelableUpdateEngineStatus() = default;
36 
37   status_t writeToParcel(Parcel* parcel) const override;
38   status_t readFromParcel(const Parcel* parcel) override;
39 
40   // This list is kept in the Parcelable serialization order.
41 
42   // When the update_engine last checked for updates (seconds since unix Epoch)
43   int64_t last_checked_time_;
44   // The current status/operation of the update_engine.
45   android::String16 current_operation_;
46   // The current progress (0.0f-1.0f).
47   double progress_;
48   // The current product version.
49   android::String16 current_version_;
50   // The current system version.
51   android::String16 current_system_version_;
52   // The size of the update (bytes).  This is int64_t for java compatibility.
53   int64_t new_size_;
54   // The new product version.
55   android::String16 new_version_;
56   // The new system version, if there is one (empty, otherwise).
57   android::String16 new_system_version_;
58 };
59 
60 }  // namespace brillo
61 }  // namespace android
62 
63 #endif  // UPDATE_ENGINE_PARCELABLE_UPDATE_ENGINE_STATUS_H_
64