mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-21 08:06:15 -04:00
!162 优化打点
Merge pull request !162 from qiudengcheng/OpenHarmony-2.2-Beta2
This commit is contained in:
@@ -12,18 +12,12 @@
|
||||
* 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 <cstdint>
|
||||
|
||||
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 +30,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);
|
||||
|
||||
@@ -14,67 +14,17 @@
|
||||
*/
|
||||
|
||||
#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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user