From 37fca9f6e6f3d7e97abfe8de0a593b1cabd0cba7 Mon Sep 17 00:00:00 2001
From: muyuying <muyuying1@huawei.com>
Date: Thu, 12 Oct 2023 20:56:51 +0800
Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8DopenEuler?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 services/BUILD.gn                             | 16 +++----
 .../src/hiview_adapter/hisysevent_adapter.cpp | 33 +++++++-------
 .../src/hiview_adapter/hitrace_adapter.cpp    | 10 +++--
 .../permission_adapter/permission_adapter.cpp | 43 ++++++++++---------
 4 files changed, 53 insertions(+), 49 deletions(-)

diff --git a/services/BUILD.gn b/services/BUILD.gn
index 655f169..967d958 100644
--- a/services/BUILD.gn
+++ b/services/BUILD.gn
@@ -176,8 +176,8 @@ if (os_level == "mini" || os_level == "small") {
     external_deps = [
       "c_utils:utils",
       "dsoftbus:softbus_client",
-      "hisysevent_native:libhisysevent",
-      "hitrace_native:hitrace_meter",
+      # "hisysevent_native:libhisysevent",
+      # "hitrace_native:hitrace_meter",
       "hiviewdfx_hilog_native:libhilog",
     ]
     if (support_jsapi) {
@@ -225,10 +225,10 @@ if (os_level == "mini" || os_level == "small") {
     ]
 
     external_deps = [
-      "access_token:libaccesstoken_sdk",
+      # "access_token:libaccesstoken_sdk",
       "c_utils:utils",
-      "hisysevent_native:libhisysevent",
-      "hitrace_native:hitrace_meter",
+      # "hisysevent_native:libhisysevent",
+      # "hitrace_native:hitrace_meter",
       "hiviewdfx_hilog_native:libhilog",
       "init:libbegetutil",
       "ipc:ipc_core",
@@ -269,10 +269,10 @@ if (os_level == "mini" || os_level == "small") {
     ]
 
     external_deps = [
-      "access_token:libaccesstoken_sdk",
+      # "access_token:libaccesstoken_sdk",
       "c_utils:utils",
-      "hisysevent_native:libhisysevent",
-      "hitrace_native:hitrace_meter",
+      # "hisysevent_native:libhisysevent",
+      # "hitrace_native:hitrace_meter",
       "hiviewdfx_hilog_native:libhilog",
       "init:libbegetutil",
       "ipc:ipc_core",
diff --git a/services/frameworks/src/hiview_adapter/hisysevent_adapter.cpp b/services/frameworks/src/hiview_adapter/hisysevent_adapter.cpp
index 3954919..f5b3380 100644
--- a/services/frameworks/src/hiview_adapter/hisysevent_adapter.cpp
+++ b/services/frameworks/src/hiview_adapter/hisysevent_adapter.cpp
@@ -14,33 +14,34 @@
  */
 
 #include "hisysevent_adapter.h"
-#include "hisysevent.h"
+// #include "hisysevent.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-constexpr char STR_EVENT_CORE_FUNCTION[] = "CORE_FUNCTION";
-constexpr char STR_EVENT[] = "EVENT";
-constexpr char STR_APP_ID[] = "APP_ID";
-constexpr char STR_BATCH_NUMBER[] = "BATCH_NUMBER";
-constexpr char STR_RESULT[] = "RESULT";
-constexpr char STR_OS_ACCOUNT_ID[] = "OS_ACCOUNT_ID";
+// constexpr char STR_EVENT_CORE_FUNCTION[] = "CORE_FUNCTION";
+// constexpr char STR_EVENT[] = "EVENT";
+// constexpr char STR_APP_ID[] = "APP_ID";
+// constexpr char STR_BATCH_NUMBER[] = "BATCH_NUMBER";
+// constexpr char STR_RESULT[] = "RESULT";
+// constexpr char STR_OS_ACCOUNT_ID[] = "OS_ACCOUNT_ID";
 
 void ReportCoreFuncInvokeEvent(const InvokeEvent *event)
 {
+    return;
     if (event == nullptr) {
         return;
     }
-    OHOS::HiviewDFX::HiSysEvent::Write(
-        OHOS::HiviewDFX::HiSysEvent::Domain::DEVICE_AUTH,
-        STR_EVENT_CORE_FUNCTION,
-        OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC,
-        STR_EVENT, event->eventId,
-        STR_APP_ID, event->appId,
-        STR_BATCH_NUMBER, event->batchNumber,
-        STR_RESULT, event->result,
-        STR_OS_ACCOUNT_ID, event->osAccountId);
+    // OHOS::HiviewDFX::HiSysEvent::Write(
+    //     OHOS::HiviewDFX::HiSysEvent::Domain::DEVICE_AUTH,
+    //     STR_EVENT_CORE_FUNCTION,
+    //     OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC,
+    //     STR_EVENT, event->eventId,
+    //     STR_APP_ID, event->appId,
+    //     STR_BATCH_NUMBER, event->batchNumber,
+    //     STR_RESULT, event->result,
+    //     STR_OS_ACCOUNT_ID, event->osAccountId);
 }
 
 #ifdef __cplusplus
diff --git a/services/frameworks/src/hiview_adapter/hitrace_adapter.cpp b/services/frameworks/src/hiview_adapter/hitrace_adapter.cpp
index 57eca82..0beea45 100644
--- a/services/frameworks/src/hiview_adapter/hitrace_adapter.cpp
+++ b/services/frameworks/src/hiview_adapter/hitrace_adapter.cpp
@@ -15,24 +15,26 @@
 
 #include "hitrace_adapter.h"
 
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 void DevAuthStartTrace(const char *value)
-{
+{   
+    return;
     if (value == nullptr) {
         return;
     }
 
-    StartTrace(HITRACE_TAG_APP, value);
+    // StartTrace(HITRACE_TAG_APP, value);
 }
 
 void DevAuthFinishTrace(void)
 {
-    FinishTrace(HITRACE_TAG_APP);
+    return;
+    // FinishTrace(HITRACE_TAG_APP);
 }
 
 #ifdef __cplusplus
diff --git a/services/frameworks/src/permission_adapter/permission_adapter.cpp b/services/frameworks/src/permission_adapter/permission_adapter.cpp
index de5a31a..d649f1c 100644
--- a/services/frameworks/src/permission_adapter/permission_adapter.cpp
+++ b/services/frameworks/src/permission_adapter/permission_adapter.cpp
@@ -15,34 +15,35 @@
 
 #include "permission_adapter.h"
 
-#include "accesstoken_kit.h"
+// #include "accesstoken_kit.h"
 #include "ipc_skeleton.h"
 
 #include "device_auth_defines.h"
 #include "hc_log.h"
 
 using namespace OHOS;
-using namespace OHOS::Security::AccessToken;
+// using namespace OHOS::Security::AccessToken;
 
 int32_t CheckPermission(void)
 {
-    AccessTokenID tokenId = IPCSkeleton::GetCallingTokenID();
-    ATokenTypeEnum tokenType = AccessTokenKit::GetTokenTypeFlag(tokenId);
-    if (tokenType == TOKEN_NATIVE) {
-        NativeTokenInfo findInfo;
-        if (AccessTokenKit::GetNativeTokenInfo(tokenId, findInfo) != 0) {
-            LOGE("GetNativeTokenInfo failed!");
-            return HC_ERROR;
-        }
-        if ((findInfo.apl == APL_SYSTEM_CORE) || (findInfo.apl == APL_SYSTEM_BASIC)) {
-            LOGI("Check permission(APL3=SYSTEM_CORE or APL2=SYSTEM_BASIC) success!");
-            return HC_SUCCESS;
-        } else {
-            LOGE("Check permission(APL3=SYSTEM_CORE or APL2=SYSTEM_BASIC) failed! APL: %d", findInfo.apl);
-            return HC_ERROR;
-        }
-    } else {
-        LOGE("Invalid token type: %d", tokenType);
-        return HC_ERROR;
-    }
+    // AccessTokenID tokenId = IPCSkeleton::GetCallingTokenID();
+    // ATokenTypeEnum tokenType = AccessTokenKit::GetTokenTypeFlag(tokenId);
+    // if (tokenType == TOKEN_NATIVE) {
+    //     NativeTokenInfo findInfo;
+    //     if (AccessTokenKit::GetNativeTokenInfo(tokenId, findInfo) != 0) {
+    //         LOGE("GetNativeTokenInfo failed!");
+    //         return HC_ERROR;
+    //     }
+    //     if ((findInfo.apl == APL_SYSTEM_CORE) || (findInfo.apl == APL_SYSTEM_BASIC)) {
+    //         LOGI("Check permission(APL3=SYSTEM_CORE or APL2=SYSTEM_BASIC) success!");
+    //         return HC_SUCCESS;
+    //     } else {
+    //         LOGE("Check permission(APL3=SYSTEM_CORE or APL2=SYSTEM_BASIC) failed! APL: %d", findInfo.apl);
+    //         return HC_ERROR;
+    //     }
+    // } else {
+    //     LOGE("Invalid token type: %d", tokenType);
+    //     return HC_ERROR;
+    // }
+    return HC_SUCCESS;
 }
\ No newline at end of file
-- 
2.33.0

