From d6302e561d42b95094d127c1fcf81cac35365f2a Mon Sep 17 00:00:00 2001 From: qiudengcheng Date: Wed, 11 May 2022 08:09:52 +0000 Subject: [PATCH 1/2] Description:Dotting optimization Sig:appexecfwk Feature or Bugfix:Bugfix Binary Source:No #I56WWW; Signed-off-by: --- .../include/aafwk_product_adapter.h | 14 +---- .../bundle_lite/src/aafwk_product_adapter.cpp | 59 ++----------------- utils/bundle_lite/aafwk_event_error_id.h | 8 +-- 3 files changed, 12 insertions(+), 69 deletions(-) diff --git a/frameworks/bundle_lite/include/aafwk_product_adapter.h b/frameworks/bundle_lite/include/aafwk_product_adapter.h index b125c50..202f769 100644 --- a/frameworks/bundle_lite/include/aafwk_product_adapter.h +++ b/frameworks/bundle_lite/include/aafwk_product_adapter.h @@ -12,17 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef AAFWK_PRODUCT_ADAPTER_H #define AAFWK_PRODUCT_ADAPTER_H -#define AAFWK_PRODUCT_ADAPTER_H #define AAFWK_PRODUCT_ADAPTER_H +#ifndef AAFWK_PRODUCT_ADAPTER_H +#define AAFWK_PRODUCT_ADAPTER_H + #include namespace OHOS { -/** - * This handler type is so specific for product, should be designed from OS dfx level. - */ -typedef void (*EventPrintHandler)(uint8_t info1, uint8_t info2, uint8_t info3, uint8_t info4); -typedef void (*ErrCodePrintHandler)(uint8_t info1, uint8_t info2, uint8_t info3, uint16_t info4); /** * The wrapper class for some product feature implementation, since some interfaces are provided by specific product. @@ -36,10 +32,6 @@ public: AafwkProductAdapter() = delete; ~AafwkProductAdapter() = delete; - // initialization functions - static void InitTraceHandlers(EventPrintHandler eventHandler, ErrCodePrintHandler errCodeHandler); - static void InitAafwkTags(uint8_t *aceTags, uint8_t tagCount); - // wrapper functions, for aafwk internal calling static void PrintEventTrace(uint8_t info2, uint8_t info3, uint8_t info4); static void PrintErrCode(uint8_t info2, uint16_t rfu); diff --git a/frameworks/bundle_lite/src/aafwk_product_adapter.cpp b/frameworks/bundle_lite/src/aafwk_product_adapter.cpp index d54c16b..c144e95 100644 --- a/frameworks/bundle_lite/src/aafwk_product_adapter.cpp +++ b/frameworks/bundle_lite/src/aafwk_product_adapter.cpp @@ -14,67 +14,18 @@ */ #include "aafwk_product_adapter.h" +#include "event.h" +#include "errorcode.h" namespace OHOS { -/** - * Used for holding all the related dfx interfaces assigned from specific implementation. - */ -struct AafwkDFXWrapper { - AafwkDFXWrapper() - : eventTag_(0), - eventSubTag_(0), - errCodeTag_(0), - errCodeSubTag_(0), - eventPrintHandler_(nullptr), - errCodePrintHandler_(nullptr) - { - } - uint8_t eventTag_; - uint8_t eventSubTag_; - uint8_t errCodeTag_; - uint8_t errCodeSubTag_; - EventPrintHandler eventPrintHandler_; - ErrCodePrintHandler errCodePrintHandler_; -}; -static AafwkDFXWrapper sDfxWrapper; - -void AafwkProductAdapter::InitAafwkTags(uint8_t *aafwkTags, uint8_t tagCount) +void AafwkProductAdapter::PrintEventTrace(uint8_t info1, uint8_t info2, uint8_t info3) { - const uint8_t minCount = 4; - if (aafwkTags == nullptr || tagCount < minCount) { - return; - } - uint8_t index = 0; - sDfxWrapper.eventTag_ = aafwkTags[index++]; - sDfxWrapper.eventSubTag_ = aafwkTags[index++]; - sDfxWrapper.errCodeTag_ = aafwkTags[index++]; - sDfxWrapper.errCodeSubTag_ = aafwkTags[index++]; -} - -void AafwkProductAdapter::InitTraceHandlers(EventPrintHandler eventHandler, ErrCodePrintHandler errCodeHandler) -{ - sDfxWrapper.eventPrintHandler_ = eventHandler; - sDfxWrapper.errCodePrintHandler_ = errCodeHandler; -} - - -void AafwkProductAdapter::PrintEventTrace(uint8_t info2, uint8_t info3, uint8_t info4) -{ - if (sDfxWrapper.eventPrintHandler_ == nullptr || sDfxWrapper.eventTag_ == 0 || sDfxWrapper.eventSubTag_ == 0) { - return; - } - - uint8_t subTag = (info2 == 0) ? sDfxWrapper.eventSubTag_ : info2; - sDfxWrapper.eventPrintHandler_(sDfxWrapper.eventTag_, subTag, info3, info4); + EVENT(EC_PUBLIC, 0x3f, info1, info2, info3); } void AafwkProductAdapter::PrintErrCode(uint8_t info2, uint16_t rfu) { - if (sDfxWrapper.errCodePrintHandler_ == nullptr || sDfxWrapper.errCodeTag_ == 0 || - sDfxWrapper.errCodeSubTag_ == 0) { - return; - } - sDfxWrapper.errCodePrintHandler_(sDfxWrapper.errCodeTag_, sDfxWrapper.errCodeSubTag_, info2, rfu); + ERROR_CODE(EC_PUBLIC, 0x3f, 0, info2, rfu); } } // namespace OHOS \ No newline at end of file diff --git a/utils/bundle_lite/aafwk_event_error_id.h b/utils/bundle_lite/aafwk_event_error_id.h index 9d09de0..9dda236 100644 --- a/utils/bundle_lite/aafwk_event_error_id.h +++ b/utils/bundle_lite/aafwk_event_error_id.h @@ -19,7 +19,7 @@ namespace OHOS { // event codes enum { - MT_ACE_APP_START = 0x01, + MT_ACE_APP_START = 0x00, MT_ACE_APP_ACTIVE, MT_ACE_APP_BACKGROUND, MT_ACE_APP_STOP @@ -29,8 +29,8 @@ enum { const int EXCE_ACE_APP_START = 0x01; enum { - EXCE_ACE_APP_START_UNKNOWN_BUNDLE_INFO = 0x0, - EXCE_ACE_APP_START_CREATE_TSAK_FAILED = 0x3, + EXCE_ACE_APP_START_UNKNOWN_BUNDLE_INFO = 0x00, + EXCE_ACE_APP_START_CREATE_TSAK_FAILED = 0x03, EXCE_ACE_APP_START_LAUNCHER_EXIT_FAILED, EXCE_ACE_APP_STOP_NO_ABILITY_RUNNING, EXCE_ACE_APP_STOP_UNKNOWN_ABILITY_TOKEN @@ -40,7 +40,7 @@ enum { const int EXCE_ACE_APP_SCAN = 0x07; enum { - EXCE_ACE_APP_SCAN_INVALID_SYSTEM_APP = 0x0, + EXCE_ACE_APP_SCAN_INVALID_SYSTEM_APP = 0x00, EXCE_ACE_APP_SCAN_PARSE_JSON_FALIED, EXCE_ACE_APP_SCAN_PARSE_PROFILE_FALIED, EXCE_ACE_APP_SCAN_UNKNOWN_BUNDLE_INFO From a3dc7bbc337fce6548cbb4e08b5414adf225948a Mon Sep 17 00:00:00 2001 From: qiudengcheng Date: Wed, 11 May 2022 08:49:15 +0000 Subject: [PATCH 2/2] Description:Dotting optimization Sig:appexecfwk Feature or Bugfix:Bugfix Binary Source:No #I56WWW; Signed-off-by: --- frameworks/bundle_lite/include/aafwk_product_adapter.h | 4 +--- frameworks/bundle_lite/src/aafwk_product_adapter.cpp | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/frameworks/bundle_lite/include/aafwk_product_adapter.h b/frameworks/bundle_lite/include/aafwk_product_adapter.h index 202f769..1db6e4e 100644 --- a/frameworks/bundle_lite/include/aafwk_product_adapter.h +++ b/frameworks/bundle_lite/include/aafwk_product_adapter.h @@ -12,14 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef AAFWK_PRODUCT_ADAPTER_H +#ifndef AAFWK_PRODUCT_ADAPTER_H #define AAFWK_PRODUCT_ADAPTER_H - #include namespace OHOS { - /** * The wrapper class for some product feature implementation, since some interfaces are provided by specific product. */ diff --git a/frameworks/bundle_lite/src/aafwk_product_adapter.cpp b/frameworks/bundle_lite/src/aafwk_product_adapter.cpp index c144e95..45da6c1 100644 --- a/frameworks/bundle_lite/src/aafwk_product_adapter.cpp +++ b/frameworks/bundle_lite/src/aafwk_product_adapter.cpp @@ -18,7 +18,6 @@ #include "errorcode.h" namespace OHOS { - void AafwkProductAdapter::PrintEventTrace(uint8_t info1, uint8_t info2, uint8_t info3) { EVENT(EC_PUBLIC, 0x3f, info1, info2, info3);