feat: support transparet for system app

Signed-off-by: Haryslee <lihao189@huawei.com>
This commit is contained in:
Haryslee
2024-07-22 23:03:26 +08:00
parent 1e8f3dd554
commit 651d0fe435
5 changed files with 16 additions and 1 deletions
@@ -15,9 +15,9 @@
#include "save_button.h"
#include <tuple>
#include "ipc_skeleton.h"
#include "sec_comp_log.h"
#include "tokenid_kit.h"
#include "ipc_skeleton.h"
namespace OHOS {
namespace Security {
@@ -41,6 +41,7 @@ public:
int32_t PreRegisterSecCompProcess();
bool IsServiceExist();
bool LoadService();
bool IsSystemAppCalling();
void FinishStartSASuccess(const sptr<IRemoteObject>& remoteObject);
void FinishStartSAFail();
@@ -38,6 +38,7 @@ public:
static int32_t PreRegisterSecCompProcess();
static bool IsServiceExist();
static bool LoadService();
static bool IsSystemAppCalling();
};
} // namespace SecurityComponent
} // namespace Security
@@ -14,10 +14,12 @@
*/
#include "sec_comp_client.h"
#include "ipc_skeleton.h"
#include "iservice_registry.h"
#include "sec_comp_load_callback.h"
#include "sec_comp_log.h"
#include "sec_comp_proxy.h"
#include "tokenid_kit.h"
namespace OHOS {
namespace Security {
@@ -104,6 +106,12 @@ bool SecCompClient::VerifySavePermission(AccessToken::AccessTokenID tokenId)
return proxy->VerifySavePermission(tokenId);
}
bool SecCompClient::IsSystemAppCalling()
{
auto selfToken = IPCSkeleton::GetSelfTokenID();
return Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(selfToken);
}
sptr<IRemoteObject> SecCompClient::GetEnhanceRemoteObject(bool doLoadSa)
{
auto proxy = GetProxy(doLoadSa);
@@ -159,6 +159,11 @@ bool SecCompKit::LoadService()
{
return SecCompClient::GetInstance().LoadService();
}
bool SecCompKit::IsSystemAppCalling()
{
return SecCompClient::GetInstance().IsSystemAppCalling();
}
} // namespace SecurityComponent
} // namespace Security
} // namespace OHOS