blob: 2fb9ca1695e23dade1935702a156eb61fc269f6f [file] [log] [blame]
Casey Dahlina93cd532016-01-14 16:55:11 -08001//
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
20#include <vector>
21
22#include <utils/Errors.h>
23#include <utils/String16.h>
24#include <utils/StrongPointer.h>
25
26#include "android/os/BnUpdateEngine.h"
27#include "android/os/IUpdateEngineCallback.h"
Alex Deymofa78f142016-01-26 21:36:16 -080028#include "update_engine/daemon_state_android.h"
29#include "update_engine/service_observer_interface.h"
Casey Dahlina93cd532016-01-14 16:55:11 -080030
31namespace chromeos_update_engine {
32
Alex Deymofa78f142016-01-26 21:36:16 -080033class BinderUpdateEngineAndroidService : public android::os::BnUpdateEngine,
34 public ServiceObserverInterface {
Casey Dahlina93cd532016-01-14 16:55:11 -080035 public:
Alex Deymofa78f142016-01-26 21:36:16 -080036 BinderUpdateEngineAndroidService(DaemonStateAndroid* daemon_state);
Alex Deymoe97b39c2016-01-20 13:22:17 -080037 ~BinderUpdateEngineAndroidService() override = default;
Casey Dahlina93cd532016-01-14 16:55:11 -080038
Alex Deymofa78f142016-01-26 21:36:16 -080039 const char* ServiceName() const {
40 return "android.os.UpdateEngineService";
41 }
42
43 // ServiceObserverInterface overrides.
44 void SendStatusUpdate(int64_t last_checked_time,
45 double progress,
46 update_engine::UpdateStatus status,
47 const std::string& new_version,
48 int64_t new_size) override;
49
50 // Channel tracking changes are ignored.
51 void SendChannelChangeUpdate(const std::string& tracking_channel) override {}
52
53 // android::os::BnUpdateEngine overrides.
Casey Dahlina93cd532016-01-14 16:55:11 -080054 android::binder::Status applyPayload(
55 const android::String16& url,
56 const std::vector<android::String16>& header_kv_pairs) override;
57
58 android::binder::Status bind(
59 const android::sp<android::os::IUpdateEngineCallback>& callback,
60 bool* return_value) override;
61
62 android::binder::Status suspend() override;
63
64 android::binder::Status resume() override;
65
66 android::binder::Status cancel() override;
Alex Deymoe97b39c2016-01-20 13:22:17 -080067};
Casey Dahlina93cd532016-01-14 16:55:11 -080068
69} // namespace chromeos_update_engine
70
71#endif // UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_