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

Commit 471e8340 authored by Kun Liang's avatar Kun Liang Committed by Linux Build Service Account
Browse files

AppOps: Add nfc enable control into AppOps.

Check user permission before enabling nfc.

Change-Id: Ia84e33c299e4fdecfd66ee933d9e7d37ed29c340
parent 81c2c310
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -231,7 +231,9 @@ public class AppOpsManager {
    /** @hide */
    public static final int OP_BOOT_COMPLETED = 53;
    /** @hide */
    public static final int _NUM_OP = 54;
    public static final int OP_NFC_CHANGE = 54;
    /** @hide */
    public static final int _NUM_OP = 55;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION =
@@ -348,6 +350,8 @@ public class AppOpsManager {
            "android:write_mms";
    private static final String OPSTR_BOOT_COMPLETED =
            "android:boot_completed";
    private static final String OPSTR_NFC_CHANGE =
            "android:nfc_change";

    /**
     * This maps each operation to the operation that serves as the
@@ -412,6 +416,7 @@ public class AppOpsManager {
            OP_READ_MMS,
            OP_WRITE_MMS,
            OP_BOOT_COMPLETED,
            OP_NFC_CHANGE,
    };

    /**
@@ -473,6 +478,7 @@ public class AppOpsManager {
            null,
            null,
            null,
            null,
    };

    /**
@@ -534,6 +540,7 @@ public class AppOpsManager {
        OPSTR_READ_MMS,
        OPSTR_WRITE_MMS,
        OPSTR_BOOT_COMPLETED,
        OPSTR_NFC_CHANGE,
    };

    /**
@@ -595,6 +602,7 @@ public class AppOpsManager {
            "READ_MMS",
            "WRITE_MMS",
            "BOOT_COMPLETED",
            "NFC_CHANGE",
    };

    /**
@@ -656,6 +664,7 @@ public class AppOpsManager {
            android.Manifest.permission.READ_SMS,
            android.Manifest.permission.WRITE_SMS,
            android.Manifest.permission.RECEIVE_BOOT_COMPLETED,
            android.Manifest.permission.NFC,
    };

    /**
@@ -718,6 +727,7 @@ public class AppOpsManager {
            null, //READ_MMS
            null, //WRITE_MMS
            null, //BOOT_COMPLETED
            null, //NFC_CHANGE
    };

    /**
@@ -779,6 +789,7 @@ public class AppOpsManager {
            false, // READ_MMS
            false, // WRITE_MMS
            false, // BOOT_COMPLETED
            false, // NFC_CHANGE
    };

    /**
@@ -839,6 +850,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_ALLOWED,
            AppOpsManager.MODE_ALLOWED,
            AppOpsManager.MODE_ALLOWED,
            AppOpsManager.MODE_ALLOWED,
    };

    /**
@@ -900,6 +912,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_ASK,     // OP_READ_MMS
            AppOpsManager.MODE_ASK,     // OP_WRITE_MMS
            AppOpsManager.MODE_ALLOWED, // OP_BOOT_COMPLETED
            AppOpsManager.MODE_ASK,     // OP_NFC_CHANGE
    };

    /**
@@ -960,6 +973,7 @@ public class AppOpsManager {
        true,     // OP_READ_MMS
        true,     // OP_WRITE_MMS
        false,    // OP_BOOT_COMPLETED
        true,     // OP_NFC_CHANGE
    };

    /**
@@ -1024,6 +1038,7 @@ public class AppOpsManager {
            false,     // OP_READ_MMS
            false,     // OP_WRITE_MMS
            false,     // OP_BOOT_COMPLETED
            false,     // OP_NFC_CHANGE
    };

    private static HashMap<String, Integer> sOpStrToOp = new HashMap<String, Integer>();
+1 −0
Original line number Diff line number Diff line
@@ -1960,5 +1960,6 @@
        <item>Trying to read MMS</item>
        <item>Trying to write MMS</item>
        <item>Trying to start at bootup</item>
        <item>Trying to turn on/off NFC</item>
    </string-array>
</resources>