Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76004e02 authored by Kunal Malhotra's avatar Kunal Malhotra
Browse files

Adding in FGS Logger AIDL methods for use in C++ code

Test: manual testing on device
Bug: b/263304156
Change-Id: I3b934cbc72dae718479e45a2a794046745a3ca2f
parent 119087d5
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -131,6 +131,53 @@ public:
        *outResult = reply.readInt32();
        return NO_ERROR;
    }

    virtual status_t logFgsApiBegin(int32_t apiType, int32_t appUid, int32_t appPid) {
        Parcel data, reply;
        data.writeInterfaceToken(IActivityManager::getInterfaceDescriptor());
        data.writeInt32(apiType);
        data.writeInt32(appUid);
        data.writeInt32(appPid);
        status_t err = remote()->transact(LOG_FGS_API_BEGIN_TRANSACTION, data, &reply);
        if (err != NO_ERROR || ((err = reply.readExceptionCode()) != NO_ERROR)) {
            ALOGD("FGS Logger Transaction failed");
            ALOGD("%d", err);
            return err;
        }
        return NO_ERROR;
    }

    virtual status_t logFgsApiEnd(int32_t apiType, int32_t appUid, int32_t appPid) {
        Parcel data, reply;
        data.writeInterfaceToken(IActivityManager::getInterfaceDescriptor());
        data.writeInt32(apiType);
        data.writeInt32(appUid);
        data.writeInt32(appPid);
        status_t err = remote()->transact(LOG_FGS_API_END_TRANSACTION, data, &reply);
        if (err != NO_ERROR || ((err = reply.readExceptionCode()) != NO_ERROR)) {
            ALOGD("FGS Logger Transaction failed");
            ALOGD("%d", err);
            return err;
        }
        return NO_ERROR;
    }

    virtual status_t logFgsApiStateChanged(int32_t apiType, int32_t state, int32_t appUid,
                                           int32_t appPid) {
        Parcel data, reply;
        data.writeInterfaceToken(IActivityManager::getInterfaceDescriptor());
        data.writeInt32(apiType);
        data.writeInt32(state);
        data.writeInt32(appUid);
        data.writeInt32(appPid);
        status_t err = remote()->transact(LOG_FGS_API_BEGIN_TRANSACTION, data, &reply);
        if (err != NO_ERROR || ((err = reply.readExceptionCode()) != NO_ERROR)) {
            ALOGD("FGS Logger Transaction failed");
            ALOGD("%d", err);
            return err;
        }
        return NO_ERROR;
    }
};

// ------------------------------------------------------------------------------------
+7 −0
Original line number Diff line number Diff line
@@ -42,6 +42,10 @@ public:
                                    const pid_t pid,
                                    const uid_t uid,
                                    int32_t* outResult) = 0;
    virtual status_t logFgsApiBegin(int32_t apiType, int32_t appUid, int32_t appPid) = 0;
    virtual status_t logFgsApiEnd(int32_t apiType, int32_t appUid, int32_t appPid) = 0;
    virtual status_t logFgsApiStateChanged(int32_t apiType, int32_t state, int32_t appUid,
                                           int32_t appPid) = 0;

    enum {
        OPEN_CONTENT_URI_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
@@ -50,6 +54,9 @@ public:
        IS_UID_ACTIVE_TRANSACTION,
        GET_UID_PROCESS_STATE_TRANSACTION,
        CHECK_PERMISSION_TRANSACTION,
        LOG_FGS_API_BEGIN_TRANSACTION,
        LOG_FGS_API_END_TRANSACTION,
        LOG_FGS_API_STATE_CHANGED_TRANSACTION
    };
};