@@ -133,13 +133,48 @@ Return<void> TrustyGateKeeperDevice::verify(
133
133
return {};
134
134
}
135
135
136
- Return<void > TrustyGateKeeperDevice::deleteUser (uint32_t /* uid*/ , deleteUser_cb _hidl_cb) {
137
- _hidl_cb ({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0 , {}});
136
+ Return<void > TrustyGateKeeperDevice::deleteUser (uint32_t uid, deleteUser_cb _hidl_cb) {
137
+ if (error_ != 0 ) {
138
+ _hidl_cb ({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0 , {}});
139
+ return {};
140
+ }
141
+
142
+ DeleteUserRequest request (uid);
143
+ DeleteUserResponse response;
144
+ auto error = Send (request, &response);
145
+
146
+ if (error != ERROR_NONE) {
147
+ _hidl_cb ({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0 , {}});
148
+ } else if (response.error == ERROR_NOT_IMPLEMENTED) {
149
+ _hidl_cb ({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0 , {}});
150
+ } else if (response.error != ERROR_NONE) {
151
+ _hidl_cb ({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0 , {}});
152
+ } else {
153
+ _hidl_cb ({GatekeeperStatusCode::STATUS_OK, response.retry_timeout , {}});
154
+ }
138
155
return {};
139
156
}
140
157
141
158
Return<void > TrustyGateKeeperDevice::deleteAllUsers (deleteAllUsers_cb _hidl_cb) {
142
- _hidl_cb ({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0 , {}});
159
+ if (error_ != 0 ) {
160
+ _hidl_cb ({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0 , {}});
161
+ return {};
162
+ }
163
+
164
+ DeleteAllUsersRequest request;
165
+ DeleteAllUsersResponse response;
166
+ auto error = Send (request, &response);
167
+
168
+ if (error != ERROR_NONE) {
169
+ _hidl_cb ({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0 , {}});
170
+ } else if (response.error == ERROR_NOT_IMPLEMENTED) {
171
+ _hidl_cb ({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0 , {}});
172
+ } else if (response.error != ERROR_NONE) {
173
+ _hidl_cb ({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0 , {}});
174
+ } else {
175
+ _hidl_cb ({GatekeeperStatusCode::STATUS_OK, response.retry_timeout , {}});
176
+ }
177
+
143
178
return {};
144
179
}
145
180
0 commit comments