multi-user

Signed-off-by: jerry <sijunjie@huawei.com>
This commit is contained in:
jerry
2022-01-08 09:07:32 +00:00
parent 21be653610
commit dfb095c57d
2 changed files with 13 additions and 4 deletions
@@ -1813,9 +1813,15 @@ int AbilityManagerProxy::StopUser(int userId, const sptr<IStopUserCallback> &cal
HILOG_ERROR("StopUser:WriteInt32 fail.");
return ERR_INVALID_VALUE;
}
if (!data.WriteParcelable(callback->AsObject())) {
HILOG_ERROR("StopUser:write IStopUserCallback fail.");
return ERR_INVALID_VALUE;
if (!callback) {
data.WriteBool(false);
} else {
data.WriteBool(true);
if (!data.WriteParcelable(callback->AsObject())) {
HILOG_ERROR("StopUser:write IStopUserCallback fail.");
return ERR_INVALID_VALUE;
}
}
error = Remote()->SendRequest(IAbilityManager::STOP_USER, data, reply, option);
if (error != NO_ERROR) {
@@ -1066,7 +1066,10 @@ int AbilityManagerStub::StartUserInner(MessageParcel &data, MessageParcel &reply
int AbilityManagerStub::StopUserInner(MessageParcel &data, MessageParcel &reply)
{
int32_t userId = data.ReadInt32();
auto callback = iface_cast<IStopUserCallback>(data.ReadParcelable<IRemoteObject>());
sptr<IStopUserCallback> callback = nullptr;
if (data.ReadBool()) {
callback = iface_cast<IStopUserCallback>(data.ReadParcelable<IRemoteObject>());
}
int result = StopUser(userId, callback);
if (!reply.WriteInt32(result)) {
HILOG_ERROR("StopUser failed.");