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

Commit 5ab15b00 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Better error message when finishing non running appop

Currently it just tells you "something went wrong". Now it tells you
which appop, package, etc...

Bug: 149375028
Test: Just adding logging
Change-Id: I2284f8f73f2e85cd70a7bdcad459494bc7cb4afa
parent f9fe6f87
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -77,10 +77,10 @@ import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.AppOpsManager.AttributedOpEntry;
import android.app.AppOpsManager.HistoricalOps;
import android.app.AppOpsManager.Mode;
import android.app.AppOpsManager.OpEntry;
import android.app.AppOpsManager.AttributedOpEntry;
import android.app.AppOpsManager.OpFlags;
import android.app.AppOpsManagerInternal;
import android.app.AppOpsManagerInternal.CheckOpsDelegate;
@@ -3374,18 +3374,22 @@ public class AppOpsService extends IAppOpsService.Stub {
        synchronized (this) {
            Op op = getOpLocked(code, uid, resolvedPackageName, attributionTag, bypass, true);
            if (op == null) {
                Slog.e(TAG, "Operation not found: uid=" + uid + " pkg=" + packageName + "("
                        + attributionTag + ") op=" + AppOpsManager.opToName(code));
                return;
            }
            final AttributedOp attributedOp = op.mAttributions.get(attributionTag);
            if (attributedOp == null) {
                Slog.e(TAG, "Attribution not found: uid=" + uid + " pkg=" + packageName + "("
                        + attributionTag + ") op=" + AppOpsManager.opToName(code));
                return;
            }

            try {
            if (attributedOp.isRunning()) {
                attributedOp.finished(clientId);
            } catch (IllegalStateException e) {
                Slog.e(TAG, "Operation not started: uid=" + uid + " pkg="
                        + packageName + " op=" + AppOpsManager.opToName(code), e);
            } else {
                Slog.e(TAG, "Operation not started: uid=" + uid + " pkg=" + packageName + "("
                        + attributionTag + ") op=" + AppOpsManager.opToName(code));
            }
        }
    }