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

Commit 4d54cb2f authored by Achim Thesmann's avatar Achim Thesmann
Browse files

Write minimal data for unsuspicous Activity starts

To create a base line of activity starts report basic data that is not
associated with the apps starting an Activity.

Test: atest BackgroundActivityStartController*Test
Bug: 339245692
Flag: com.android.window.flags.bal_improved_metrics
Change-Id: Ic3ef3deeadfd5cbaaf53f51849af1b72cb9ddea0
parent c173829c
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1659,6 +1659,8 @@ public class BackgroundActivityStartController {
                    activityName = "";
                }
                writeBalAllowedLog(activityName, finalVerdict.getCode(), state);
            } else {
                writeBalAllowedLogMinimal(state);
            }
        } else {
            @BalCode int code = finalVerdict.getCode();
@@ -1723,6 +1725,24 @@ public class BackgroundActivityStartController {
        );
    }

    @VisibleForTesting void writeBalAllowedLogMinimal(BalState state) {
        FrameworkStatsLog.write(FrameworkStatsLog.BAL_ALLOWED,
                "",
                BAL_ALLOW_DEFAULT,
                NO_PROCESS_UID,
                NO_PROCESS_UID,
                state.mResultForCaller == null ? BAL_BLOCK : state.mResultForCaller.getRawCode(),
                state.mBalAllowedByPiCreator.allowsBackgroundActivityStarts(),
                state.callerExplicitOptInOrOut(),
                state.mResultForRealCaller == null ? BAL_BLOCK
                        : state.mResultForRealCaller.getRawCode(),
                state.mBalAllowedByPiSender.allowsBackgroundActivityStarts(),
                state.realCallerExplicitOptInOrOut(),
                getTargetSdk(state.mCallingPackage),
                getTargetSdk(state.mRealCallingPackage)
        );
    }

    /**
     * Called whenever an activity finishes. Stores the record, so it can be used by ASM grace
     * period checks.