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

Commit a3bc86ea authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Merge "Save AsyncOps for later forwarding instead of SyncOps." into...

Merge "Merge "Save AsyncOps for later forwarding instead of SyncOps." into rvc-dev am: 7ec25249 am: 4b94dff3 am: b41ace77" into rvc-qpr-dev-plus-aosp am: 49cc74c6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11913241

Change-Id: I77bc10cc1173b2a653d5c796ddd4d4ef76fc1455
parents 7a69f049 49cc74c6
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -227,7 +227,7 @@ public class AppOpsManager {
     * {@link #sMessageCollector}, which forces {@link COLLECT_SYNC} mode.
     * {@link #sMessageCollector}, which forces {@link COLLECT_SYNC} mode.
     */
     */
    @GuardedBy("sLock")
    @GuardedBy("sLock")
    private static ArrayList<SyncNotedAppOp> sUnforwardedOps = new ArrayList<>();
    private static ArrayList<AsyncNotedAppOp> sUnforwardedOps = new ArrayList<>();


    /**
    /**
     * Additional collector that collect accesses and forwards a few of them them via
     * Additional collector that collect accesses and forwards a few of them them via
@@ -8195,7 +8195,10 @@ public class AppOpsManager {
                        if (sOnOpNotedCallback != null) {
                        if (sOnOpNotedCallback != null) {
                            sOnOpNotedCallback.onNoted(new SyncNotedAppOp(code, attributionTag));
                            sOnOpNotedCallback.onNoted(new SyncNotedAppOp(code, attributionTag));
                        } else {
                        } else {
                            sUnforwardedOps.add(new SyncNotedAppOp(code, attributionTag));
                            String message = getFormattedStackTrace();
                            sUnforwardedOps.add(
                                    new AsyncNotedAppOp(code, Process.myUid(), attributionTag,
                                            message, System.currentTimeMillis()));
                            if (sUnforwardedOps.size() > MAX_UNFORWARDED_OPS) {
                            if (sUnforwardedOps.size() > MAX_UNFORWARDED_OPS) {
                                sUnforwardedOps.remove(0);
                                sUnforwardedOps.remove(0);
                            }
                            }
@@ -8268,10 +8271,10 @@ public class AppOpsManager {
                synchronized (this) {
                synchronized (this) {
                    int numMissedSyncOps = sUnforwardedOps.size();
                    int numMissedSyncOps = sUnforwardedOps.size();
                    for (int i = 0; i < numMissedSyncOps; i++) {
                    for (int i = 0; i < numMissedSyncOps; i++) {
                        final SyncNotedAppOp syncNotedAppOp = sUnforwardedOps.get(i);
                        final AsyncNotedAppOp syncNotedAppOp = sUnforwardedOps.get(i);
                        if (sOnOpNotedCallback != null) {
                        if (sOnOpNotedCallback != null) {
                            sOnOpNotedCallback.getAsyncNotedExecutor().execute(
                            sOnOpNotedCallback.getAsyncNotedExecutor().execute(
                                    () -> sOnOpNotedCallback.onNoted(syncNotedAppOp));
                                    () -> sOnOpNotedCallback.onAsyncNoted(syncNotedAppOp));
                        }
                        }
                    }
                    }
                    sUnforwardedOps.clear();
                    sUnforwardedOps.clear();