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

Commit a4c8b623 authored by Kun Liang's avatar Kun Liang Committed by Steve Kondik
Browse files

AppOps: fix "contact" delete ops check failed

applyBatch() is another API that can delete "contact". Add ops
check to block delete ops.

Change-Id: Ia0c4c4abb68ec257d2b88d56c824545382bb677a
parent b7870c52
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -278,7 +278,13 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
                        throw new OperationApplicationException("App op not allowed", 0);
                    }
                }
                if (operation.isWriteOperation()) {

                if (operation.isDeleteOperation()) {
                    if (enforceDeletePermission(callingPkg, uri)
                            != AppOpsManager.MODE_ALLOWED) {
                        throw new OperationApplicationException("App op not allowed", 0);
                    }
                } else if (operation.isWriteOperation()) {
                    if (enforceWritePermission(callingPkg, uri)
                            != AppOpsManager.MODE_ALLOWED) {
                        throw new OperationApplicationException("App op not allowed", 0);
+5 −0
Original line number Diff line number Diff line
@@ -208,6 +208,11 @@ public class ContentProviderOperation implements Parcelable {
        return mType;
    }

    /** @hide */
    public boolean isDeleteOperation() {
        return mType == TYPE_DELETE;
    }

    public boolean isWriteOperation() {
        return mType == TYPE_DELETE || mType == TYPE_INSERT || mType == TYPE_UPDATE;
    }