Merge "Send DeleteUsers/DeleteAllUsers to Trusty" am: 003bf066b2
am: 4acdebc22d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1558920 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I5fb0cd3627ac6ef9393f6b1820ce0451105582f1
This commit is contained in:
commit
86da7ec85c
3 changed files with 53 additions and 7 deletions
|
@ -20,11 +20,13 @@
|
|||
#define GATEKEEPER_MAX_BUFFER_LENGTH 1024
|
||||
|
||||
enum gatekeeper_command {
|
||||
GK_REQ_SHIFT = 1,
|
||||
GK_RESP_BIT = 1,
|
||||
GK_REQ_SHIFT = 1,
|
||||
GK_RESP_BIT = 1,
|
||||
|
||||
GK_ENROLL = (0 << GK_REQ_SHIFT),
|
||||
GK_VERIFY = (1 << GK_REQ_SHIFT),
|
||||
GK_ENROLL = (0 << GK_REQ_SHIFT),
|
||||
GK_VERIFY = (1 << GK_REQ_SHIFT),
|
||||
GK_DELETE_USER = (2 << GK_REQ_SHIFT),
|
||||
GK_DELETE_ALL_USERS = (3 << GK_REQ_SHIFT),
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -133,13 +133,48 @@ Return<void> TrustyGateKeeperDevice::verify(
|
|||
return {};
|
||||
}
|
||||
|
||||
Return<void> TrustyGateKeeperDevice::deleteUser(uint32_t /*uid*/, deleteUser_cb _hidl_cb) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0, {}});
|
||||
Return<void> TrustyGateKeeperDevice::deleteUser(uint32_t uid, deleteUser_cb _hidl_cb) {
|
||||
if (error_ != 0) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
|
||||
return {};
|
||||
}
|
||||
|
||||
DeleteUserRequest request(uid);
|
||||
DeleteUserResponse response;
|
||||
auto error = Send(request, &response);
|
||||
|
||||
if (error != ERROR_NONE) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
|
||||
} else if (response.error == ERROR_NOT_IMPLEMENTED) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0, {}});
|
||||
} else if (response.error != ERROR_NONE) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
|
||||
} else {
|
||||
_hidl_cb({GatekeeperStatusCode::STATUS_OK, response.retry_timeout, {}});
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
Return<void> TrustyGateKeeperDevice::deleteAllUsers(deleteAllUsers_cb _hidl_cb) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0, {}});
|
||||
if (error_ != 0) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
|
||||
return {};
|
||||
}
|
||||
|
||||
DeleteAllUsersRequest request;
|
||||
DeleteAllUsersResponse response;
|
||||
auto error = Send(request, &response);
|
||||
|
||||
if (error != ERROR_NONE) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
|
||||
} else if (response.error == ERROR_NOT_IMPLEMENTED) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0, {}});
|
||||
} else if (response.error != ERROR_NONE) {
|
||||
_hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
|
||||
} else {
|
||||
_hidl_cb({GatekeeperStatusCode::STATUS_OK, response.retry_timeout, {}});
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,15 @@ class TrustyGateKeeperDevice : public ::android::hardware::gatekeeper::V1_0::IGa
|
|||
return Send(GK_VERIFY, request, response);
|
||||
}
|
||||
|
||||
gatekeeper_error_t Send(const DeleteUserRequest& request, DeleteUserResponse* response) {
|
||||
return Send(GK_DELETE_USER, request, response);
|
||||
}
|
||||
|
||||
gatekeeper_error_t Send(const DeleteAllUsersRequest& request,
|
||||
DeleteAllUsersResponse* response) {
|
||||
return Send(GK_DELETE_ALL_USERS, request, response);
|
||||
}
|
||||
|
||||
int error_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue