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

Commit 3acd0970 authored by Yuting Fang's avatar Yuting Fang Committed by Android (Google) Code Review
Browse files

Merge "Pass reject count in batched noteOp call" into main

parents 4ad9d3df 3e84466d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -7731,8 +7731,8 @@ public class AppOpsManager {
                    && Objects.equals(mAttributionTag, that.mAttributionTag)
                    && mVirtualDeviceId == that.mVirtualDeviceId
                    && Objects.equals(mMessage, that.mMessage)
                    && Objects.equals(mShouldCollectAsyncNotedOp, that.mShouldCollectAsyncNotedOp)
                    && Objects.equals(mShouldCollectMessage, that.mShouldCollectMessage);
                    && mShouldCollectAsyncNotedOp == that.mShouldCollectAsyncNotedOp
                    && mShouldCollectMessage == that.mShouldCollectMessage;
        }

        @Override
+5 −5
Original line number Diff line number Diff line
@@ -3458,7 +3458,7 @@ public class AppOpsService extends IAppOpsService.Stub {
            final UidState uidState = ops.uidState;
            if (isOpRestrictedLocked(uid, code, packageName, attributionTag, virtualDeviceId,
                    pvr.bypass, false)) {
                attributedOp.rejected(uidState.getState(), flags);
                attributedOp.rejected(uidState.getState(), flags, notedCount);
                scheduleOpNotedIfNeededLocked(code, uid, packageName, attributionTag,
                        virtualDeviceId, flags, AppOpsManager.MODE_IGNORED);
                return new SyncNotedAppOp(AppOpsManager.MODE_IGNORED, code, attributionTag,
@@ -3483,7 +3483,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                    if (DEBUG) Slog.d(TAG, "noteOperation: uid reject #" + uidMode + " for code "
                            + switchCode + " (" + code + ") uid " + uid + " package "
                            + packageName + " flags: " + AppOpsManager.flagsToString(flags));
                    attributedOp.rejected(uidState.getState(), flags);
                    attributedOp.rejected(uidState.getState(), flags, notedCount);
                    scheduleOpNotedIfNeededLocked(code, uid, packageName, attributionTag,
                            virtualDeviceId, flags, uidMode);
                    // TODO(b/333931259): Remove extra logging after this issue is diagnosed.
@@ -3507,7 +3507,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                    if (DEBUG) Slog.d(TAG, "noteOperation: reject #" + mode + " for code "
                            + switchCode + " (" + code + ") uid " + uid + " package "
                            + packageName + " flags: " + AppOpsManager.flagsToString(flags));
                    attributedOp.rejected(uidState.getState(), flags);
                    attributedOp.rejected(uidState.getState(), flags, notedCount);
                    scheduleOpNotedIfNeededLocked(code, uid, packageName, attributionTag,
                            virtualDeviceId, flags, mode);
                    // TODO(b/333931259): Remove extra logging after this issue is diagnosed.
@@ -4122,7 +4122,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                                + packageName + " flags: "
                                + AppOpsManager.flagsToString(flags));
                    }
                    attributedOp.rejected(uidState.getState(), flags);
                    attributedOp.rejected(uidState.getState(), flags, 1);
                    scheduleOpStartedIfNeededLocked(code, uid, packageName, attributionTag,
                            virtualDeviceId, flags, uidMode, startType, attributionFlags,
                            attributionChainId);
@@ -4146,7 +4146,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                                + packageName + " flags: "
                                + AppOpsManager.flagsToString(flags));
                    }
                    attributedOp.rejected(uidState.getState(), flags);
                    attributedOp.rejected(uidState.getState(), flags, 1);
                    scheduleOpStartedIfNeededLocked(code, uid, packageName, attributionTag,
                            virtualDeviceId, flags, mode, startType, attributionFlags,
                            attributionChainId);
+3 −2
Original line number Diff line number Diff line
@@ -160,11 +160,12 @@ final class AttributedOp {
     * @param uidState UID state of the app noteOp is called for
     * @param flags    OpFlags of the call
     */
    public void rejected(@AppOpsManager.UidState int uidState, @AppOpsManager.OpFlags int flags) {
    public void rejected(@AppOpsManager.UidState int uidState, @AppOpsManager.OpFlags int flags,
            int rejectedCount) {
        rejected(System.currentTimeMillis(), uidState, flags);

        mAppOpsService.mHistoricalRegistry.incrementOpRejectedCount(parent.op, parent.uid,
                parent.packageName, tag, uidState, flags);
                parent.packageName, tag, uidState, flags, rejectedCount);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public interface HistoricalRegistryInterface {
     */
    void incrementOpRejectedCount(int op, int uid, @NonNull String packageName,
            @Nullable String attributionTag, @AppOpsManager.UidState int uidState,
            @AppOpsManager.OpFlags int flags);
            @AppOpsManager.OpFlags int flags, int rejectCount);

    /**
     * Read historical ops from both aggregated and discrete events based on input filter.
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public class HistoricalRegistrySql implements HistoricalRegistryInterface {

    @Override
    public void incrementOpRejectedCount(int op, int uid, @NonNull String packageName,
            @Nullable String attributionTag, int uidState, int flags) {
            @Nullable String attributionTag, int uidState, int flags, int rejectCount) {

    }

Loading