12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #ifndef UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_
- #define UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_
- #include <stdint.h>
- #include <string>
- #include <vector>
- #include <utils/Errors.h>
- #include <utils/String16.h>
- #include <utils/StrongPointer.h>
- #include "android/os/BnUpdateEngine.h"
- #include "android/os/IUpdateEngineCallback.h"
- #include "update_engine/service_delegate_android_interface.h"
- #include "update_engine/service_observer_interface.h"
- namespace chromeos_update_engine {
- class BinderUpdateEngineAndroidService : public android::os::BnUpdateEngine,
- public ServiceObserverInterface {
- public:
- explicit BinderUpdateEngineAndroidService(
- ServiceDelegateAndroidInterface* service_delegate);
- ~BinderUpdateEngineAndroidService() override = default;
- const char* ServiceName() const { return "android.os.UpdateEngineService"; }
-
- void SendStatusUpdate(
- const update_engine::UpdateEngineStatus& update_engine_status) override;
- void SendPayloadApplicationComplete(ErrorCode error_code) override;
-
- android::binder::Status applyPayload(
- const android::String16& url,
- int64_t payload_offset,
- int64_t payload_size,
- const std::vector<android::String16>& header_kv_pairs) override;
- android::binder::Status bind(
- const android::sp<android::os::IUpdateEngineCallback>& callback,
- bool* return_value) override;
- android::binder::Status unbind(
- const android::sp<android::os::IUpdateEngineCallback>& callback,
- bool* return_value) override;
- android::binder::Status suspend() override;
- android::binder::Status resume() override;
- android::binder::Status cancel() override;
- android::binder::Status resetStatus() override;
- android::binder::Status verifyPayloadApplicable(
- const android::String16& metadata_filename, bool* return_value) override;
- private:
-
-
-
- bool UnbindCallback(const IBinder* callback);
-
- std::vector<android::sp<android::os::IUpdateEngineCallback>> callbacks_;
-
-
- int last_status_{-1};
- double last_progress_{0.0};
- ServiceDelegateAndroidInterface* service_delegate_;
- };
- }
- #endif
|