mirror of
https://gitee.com/openharmony/advertising_oaid
synced 2025-02-12 11:18:18 +00:00
oaid重置上报HA!
Signed-off-by: lipan <lipan111@huawei.com>
This commit is contained in:
parent
d4d8c2b47c
commit
50a0263a95
@ -1,5 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_CLOUD_OAID_IREMOTE_CONFIG_OBSERVER_H
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_CLOUD_OAID_REMOTE_CONFIG_OBSERVER_STUB_H
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "oaid_remote_config_observer_stub.h"
|
||||
|
@ -226,7 +226,9 @@ napi_value ResetOAID(napi_env env, napi_callback_info info)
|
||||
int32_t errorCode = Cloud::OAIDServiceClient::GetInstance()->ResetOAID();
|
||||
OAID_HILOGI(OHOS::Cloud::OAID_MODULE_JS_NAPI, "ResetOAID code = %{public}d", errorCode);
|
||||
if (errorCode == OAID_ERROR_CODE_NOT_SYSTEM_APP) {
|
||||
napi_throw_error(env, std::to_string(errorCode).c_str(), "Permission verification failed. A non-system application calls a system API.");
|
||||
napi_throw_error(env,
|
||||
std::to_string(errorCode).c_str(),
|
||||
"Permission verification failed. A non-system application calls a system API.");
|
||||
}
|
||||
|
||||
if (errorCode == OAID_ERROR_NOT_IN_TRUST_LIST) {
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_CLOUD_OAID_REMOTE_CONFIG_OBSERVER_MANAGER_H
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_CLOUD_OAID_REMOTE_CONFIG_OBSERVER_PROXY_H
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "oaid_remote_config_observer_proxy.h"
|
||||
|
@ -137,22 +137,8 @@ bool LoadAndCheckOaidTrustList(const std::string &bundleName)
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t OAIDServiceStub::OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
OAID_HILOGI(OAID_MODULE_SERVICE, "Start, code is %{public}u.", code);
|
||||
std::string bundleName;
|
||||
pid_t uid = IPCSkeleton::GetCallingUid();
|
||||
DelayedSingleton<BundleMgrHelper>::GetInstance()->GetBundleNameByUid(static_cast<int>(uid), bundleName);
|
||||
if (code == static_cast<uint32_t>(OAIDInterfaceCode::GET_OAID) &&
|
||||
!CheckPermission(OAID_TRACKING_CONSENT_PERMISSION)) {
|
||||
OAID_HILOGW(
|
||||
OAID_MODULE_SERVICE, "bundleName %{public}s not granted the app tracking permission", bundleName.c_str());
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
if (code == static_cast<uint32_t>(OAIDInterfaceCode::RESET_OAID)) {
|
||||
if (!LoadAndCheckOaidTrustList(bundleName)) {
|
||||
int32_t CheckResetOaid(uint32_t code){
|
||||
if (!LoadAndCheckOaidTrustList(bundleName)) {
|
||||
OAID_HILOGW(
|
||||
OAID_MODULE_SERVICE, "CheckOaidTrustList fail.errorCode = %{public}d", OAID_ERROR_NOT_IN_TRUST_LIST);
|
||||
if (!reply.WriteInt32(OAID_ERROR_NOT_IN_TRUST_LIST)) {
|
||||
@ -171,6 +157,24 @@ int32_t OAIDServiceStub::OnRemoteRequest(
|
||||
}
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t OAIDServiceStub::OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
OAID_HILOGI(OAID_MODULE_SERVICE, "Start, code is %{public}u.", code);
|
||||
std::string bundleName;
|
||||
pid_t uid = IPCSkeleton::GetCallingUid();
|
||||
DelayedSingleton<BundleMgrHelper>::GetInstance()->GetBundleNameByUid(static_cast<int>(uid), bundleName);
|
||||
if (code == static_cast<uint32_t>(OAIDInterfaceCode::GET_OAID) &&
|
||||
!CheckPermission(OAID_TRACKING_CONSENT_PERMISSION)) {
|
||||
OAID_HILOGW(
|
||||
OAID_MODULE_SERVICE, "bundleName %{public}s not granted the app tracking permission", bundleName.c_str());
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
if (code == static_cast<uint32_t>(OAIDInterfaceCode::RESET_OAID)) {
|
||||
return CheckResetOaid(code);
|
||||
}
|
||||
std::u16string myDescripter = OAIDServiceStub::GetDescriptor();
|
||||
std::u16string remoteDescripter = data.ReadInterfaceToken();
|
||||
|
Loading…
x
Reference in New Issue
Block a user