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

Commit 8adda5a0 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Stop using temp-allowlist reason to identify push msgs.

We made a temporary change a while back to identify push
messages using temp-allowlist reason so that we can get the
broadcast response stats data without needing for changes
on the client side but this logic is not needed anymore.

Bug: 217251579
Test: atest tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
Change-Id: I72a09fc6bc9a7d1cd0aeced3da09a506ea4aef76
parent 8e375e4c
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.PowerExemptionManager;
import android.os.PowerExemptionManager.ReasonCode;
import android.os.PowerExemptionManager.TempAllowListType;
import android.os.Process;
@@ -1934,9 +1933,6 @@ public final class BroadcastQueue {
    }

    private void maybeReportBroadcastDispatchedEventLocked(BroadcastRecord r, int targetUid) {
        // STOPSHIP (217251579): Temporarily use temp-allowlist reason to identify
        // push messages and record response events.
        useTemporaryAllowlistReasonAsSignal(r);
        if (r.options == null || r.options.getIdForResponseEvent() <= 0) {
            return;
        }
@@ -1951,17 +1947,6 @@ public final class BroadcastQueue {
                mService.getUidStateLocked(targetUid));
    }

    private void useTemporaryAllowlistReasonAsSignal(BroadcastRecord r) {
        if (r.options == null || r.options.getIdForResponseEvent() > 0) {
            return;
        }
        final int reasonCode = r.options.getTemporaryAppAllowlistReasonCode();
        if (reasonCode == PowerExemptionManager.REASON_PUSH_MESSAGING
                || reasonCode == PowerExemptionManager.REASON_PUSH_MESSAGING_OVER_QUOTA) {
            r.options.recordResponseEventWhileInBackground(reasonCode);
        }
    }

    @NonNull
    private UsageStatsManagerInternal getUsageStatsManagerInternal() {
        final UsageStatsManagerInternal usageStatsManagerInternal =