22
22
#include < base/logging.h>
23
23
#include < binderwrapper/binder_wrapper.h>
24
24
#include < utils/String8.h>
25
- #include < android-base/stringprintf.h>
26
25
27
26
#include " update_engine/aosp/binder_service_android_common.h"
28
- #include " update_engine/aosp/permission.h"
29
27
30
28
using android::binder::Status;
31
29
using android::os::IUpdateEngineCallback;
@@ -36,7 +34,6 @@ using update_engine::UpdateEngineStatus;
36
34
37
35
namespace chromeos_update_engine {
38
36
39
-
40
37
BinderUpdateEngineAndroidService::BinderUpdateEngineAndroidService (
41
38
ServiceDelegateAndroidInterface* service_delegate)
42
39
: service_delegate_(service_delegate) {}
@@ -59,9 +56,6 @@ void BinderUpdateEngineAndroidService::SendPayloadApplicationComplete(
59
56
60
57
Status BinderUpdateEngineAndroidService::bind (
61
58
const android::sp<IUpdateEngineCallback>& callback, bool * return_value) {
62
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
63
- return status;
64
- }
65
59
// Send an status update on connection (except when no update sent so far).
66
60
// Even though the status update is oneway, it still returns an erroneous
67
61
// status in case of a selinux denial. We should at least check this status
@@ -91,9 +85,6 @@ Status BinderUpdateEngineAndroidService::bind(
91
85
92
86
Status BinderUpdateEngineAndroidService::unbind (
93
87
const android::sp<IUpdateEngineCallback>& callback, bool * return_value) {
94
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
95
- return status;
96
- }
97
88
const android::sp<IBinder>& callback_binder =
98
89
IUpdateEngineCallback::asBinder (callback);
99
90
auto binder_wrapper = android::BinderWrapper::Get ();
@@ -108,9 +99,6 @@ Status BinderUpdateEngineAndroidService::applyPayload(
108
99
int64_t payload_offset,
109
100
int64_t payload_size,
110
101
const vector<android::String16>& header_kv_pairs) {
111
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
112
- return status;
113
- }
114
102
const string payload_url{android::String8{url}.c_str ()};
115
103
vector<string> str_headers = ToVecString (header_kv_pairs);
116
104
@@ -127,9 +115,6 @@ Status BinderUpdateEngineAndroidService::applyPayloadFd(
127
115
int64_t payload_offset,
128
116
int64_t payload_size,
129
117
const vector<android::String16>& header_kv_pairs) {
130
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
131
- return status;
132
- }
133
118
vector<string> str_headers = ToVecString (header_kv_pairs);
134
119
135
120
Error error;
@@ -141,39 +126,27 @@ Status BinderUpdateEngineAndroidService::applyPayloadFd(
141
126
}
142
127
143
128
Status BinderUpdateEngineAndroidService::suspend () {
144
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
145
- return status;
146
- }
147
129
Error error;
148
130
if (!service_delegate_->SuspendUpdate (&error))
149
131
return ErrorPtrToStatus (error);
150
132
return Status::ok ();
151
133
}
152
134
153
135
Status BinderUpdateEngineAndroidService::resume () {
154
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
155
- return status;
156
- }
157
136
Error error;
158
137
if (!service_delegate_->ResumeUpdate (&error))
159
138
return ErrorPtrToStatus (error);
160
139
return Status::ok ();
161
140
}
162
141
163
142
Status BinderUpdateEngineAndroidService::cancel () {
164
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
165
- return status;
166
- }
167
143
Error error;
168
144
if (!service_delegate_->CancelUpdate (&error))
169
145
return ErrorPtrToStatus (error);
170
146
return Status::ok ();
171
147
}
172
148
173
149
Status BinderUpdateEngineAndroidService::resetStatus () {
174
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
175
- return status;
176
- }
177
150
Error error;
178
151
if (!service_delegate_->ResetStatus (&error))
179
152
return ErrorPtrToStatus (error);
@@ -182,9 +155,6 @@ Status BinderUpdateEngineAndroidService::resetStatus() {
182
155
183
156
Status BinderUpdateEngineAndroidService::setShouldSwitchSlotOnReboot (
184
157
const android::String16& metadata_filename) {
185
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
186
- return status;
187
- }
188
158
Error error;
189
159
if (!service_delegate_->setShouldSwitchSlotOnReboot (
190
160
android::String8 (metadata_filename).c_str (), &error)) {
@@ -194,9 +164,6 @@ Status BinderUpdateEngineAndroidService::setShouldSwitchSlotOnReboot(
194
164
}
195
165
196
166
Status BinderUpdateEngineAndroidService::resetShouldSwitchSlotOnReboot () {
197
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
198
- return status;
199
- }
200
167
Error error;
201
168
if (!service_delegate_->resetShouldSwitchSlotOnReboot (&error)) {
202
169
return ErrorPtrToStatus (error);
@@ -206,9 +173,6 @@ Status BinderUpdateEngineAndroidService::resetShouldSwitchSlotOnReboot() {
206
173
207
174
Status BinderUpdateEngineAndroidService::verifyPayloadApplicable (
208
175
const android::String16& metadata_filename, bool * return_value) {
209
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
210
- return status;
211
- }
212
176
const std::string payload_metadata{
213
177
android::String8{metadata_filename}.c_str ()};
214
178
LOG (INFO) << " Received a request of verifying payload metadata in "
@@ -240,9 +204,6 @@ Status BinderUpdateEngineAndroidService::allocateSpaceForPayload(
240
204
const android::String16& metadata_filename,
241
205
const vector<android::String16>& header_kv_pairs,
242
206
int64_t * return_value) {
243
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
244
- return status;
245
- }
246
207
const std::string payload_metadata{
247
208
android::String8{metadata_filename}.c_str ()};
248
209
vector<string> str_headers = ToVecString (header_kv_pairs);
@@ -285,9 +246,6 @@ class CleanupSuccessfulUpdateCallback
285
246
286
247
Status BinderUpdateEngineAndroidService::cleanupSuccessfulUpdate (
287
248
const android::sp<IUpdateEngineCallback>& callback) {
288
- if (const auto status = CheckCallingUid (); !status.isOk ()) {
289
- return status;
290
- }
291
249
Error error;
292
250
service_delegate_->CleanupSuccessfulUpdate (
293
251
std::make_unique<CleanupSuccessfulUpdateCallback>(callback), &error);
0 commit comments