Casey Dahlin | a93cd53 | 2016-01-14 16:55:11 -0800 | [diff] [blame] | 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_BINDER_SERVICE_ANDROID_H_ |
| 18 | #define UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_ |
| 19 | |
Alex Deymo | 95b8f24 | 2016-01-28 16:06:57 -0800 | [diff] [blame^] | 20 | #include <stdint.h> |
| 21 | |
Casey Dahlin | a93cd53 | 2016-01-14 16:55:11 -0800 | [diff] [blame] | 22 | #include <vector> |
| 23 | |
| 24 | #include <utils/Errors.h> |
| 25 | #include <utils/String16.h> |
| 26 | #include <utils/StrongPointer.h> |
| 27 | |
| 28 | #include "android/os/BnUpdateEngine.h" |
| 29 | #include "android/os/IUpdateEngineCallback.h" |
Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 30 | #include "update_engine/daemon_state_android.h" |
| 31 | #include "update_engine/service_observer_interface.h" |
Casey Dahlin | a93cd53 | 2016-01-14 16:55:11 -0800 | [diff] [blame] | 32 | |
| 33 | namespace chromeos_update_engine { |
| 34 | |
Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 35 | class BinderUpdateEngineAndroidService : public android::os::BnUpdateEngine, |
| 36 | public ServiceObserverInterface { |
Casey Dahlin | a93cd53 | 2016-01-14 16:55:11 -0800 | [diff] [blame] | 37 | public: |
Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 38 | BinderUpdateEngineAndroidService(DaemonStateAndroid* daemon_state); |
Alex Deymo | e97b39c | 2016-01-20 13:22:17 -0800 | [diff] [blame] | 39 | ~BinderUpdateEngineAndroidService() override = default; |
Casey Dahlin | a93cd53 | 2016-01-14 16:55:11 -0800 | [diff] [blame] | 40 | |
Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 41 | const char* ServiceName() const { |
| 42 | return "android.os.UpdateEngineService"; |
| 43 | } |
| 44 | |
| 45 | // ServiceObserverInterface overrides. |
| 46 | void SendStatusUpdate(int64_t last_checked_time, |
| 47 | double progress, |
| 48 | update_engine::UpdateStatus status, |
| 49 | const std::string& new_version, |
| 50 | int64_t new_size) override; |
| 51 | |
| 52 | // Channel tracking changes are ignored. |
| 53 | void SendChannelChangeUpdate(const std::string& tracking_channel) override {} |
| 54 | |
| 55 | // android::os::BnUpdateEngine overrides. |
Casey Dahlin | a93cd53 | 2016-01-14 16:55:11 -0800 | [diff] [blame] | 56 | android::binder::Status applyPayload( |
| 57 | const android::String16& url, |
Alex Deymo | 95b8f24 | 2016-01-28 16:06:57 -0800 | [diff] [blame^] | 58 | int64_t payload_offset, |
| 59 | int64_t payload_size, |
Casey Dahlin | a93cd53 | 2016-01-14 16:55:11 -0800 | [diff] [blame] | 60 | const std::vector<android::String16>& header_kv_pairs) override; |
| 61 | |
| 62 | android::binder::Status bind( |
| 63 | const android::sp<android::os::IUpdateEngineCallback>& callback, |
| 64 | bool* return_value) override; |
| 65 | |
| 66 | android::binder::Status suspend() override; |
| 67 | |
| 68 | android::binder::Status resume() override; |
| 69 | |
| 70 | android::binder::Status cancel() override; |
Alex Deymo | e97b39c | 2016-01-20 13:22:17 -0800 | [diff] [blame] | 71 | }; |
Casey Dahlin | a93cd53 | 2016-01-14 16:55:11 -0800 | [diff] [blame] | 72 | |
| 73 | } // namespace chromeos_update_engine |
| 74 | |
| 75 | #endif // UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_ |