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

Commit 58330fdc authored by Kun Liang's avatar Kun Liang Committed by Roman Birg
Browse files

AppOps: Add nfc enable control into AppOps.

Check user permission before enabling nfc.

Change-Id: Ia84e33c299e4fdecfd66ee933d9e7d37ed29c340
parent 70106fba
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -257,7 +257,9 @@ public class AppOpsManager {
    /** @hide */
    public static final int OP_BOOT_COMPLETED = 65;
    /** @hide */
    public static final int _NUM_OP = 66;
    public static final int OP_NFC_CHANGE = 66;
    /** @hide */
    public static final int _NUM_OP = 67;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -362,6 +364,8 @@ public class AppOpsManager {
            "android:bluetooth_change";
    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
@@ -438,6 +442,7 @@ public class AppOpsManager {
            OP_WIFI_CHANGE,
            OP_BLUETOOTH_CHANGE,
            OP_BOOT_COMPLETED,
            OP_NFC_CHANGE,
    };

    /**
@@ -511,6 +516,7 @@ public class AppOpsManager {
            OPSTR_WIFI_CHANGE,
            OPSTR_BLUETOOTH_CHANGE,
            OPSTR_BOOT_COMPLETED,
            OPSTR_NFC_CHANGE,
    };

    /**
@@ -584,6 +590,7 @@ public class AppOpsManager {
            "WIFI_CHANGE",
            "BLUETOOTH_CHANGE",
            "BOOT_COMPLETED",
            "NFC_CHANGE",
    };

    /**
@@ -657,6 +664,7 @@ public class AppOpsManager {
            Manifest.permission.CHANGE_WIFI_STATE,
            Manifest.permission.BLUETOOTH,
            Manifest.permission.RECEIVE_BOOT_COMPLETED,
            Manifest.permission.NFC,
    };

    /**
@@ -731,6 +739,7 @@ public class AppOpsManager {
            null, //WIFI_CHANGE
            null, //BLUETOOTH_CHANGE
            null, //BOOT_COMPLETED
            null, //NFC_CHANGE
    };

    /**
@@ -804,6 +813,7 @@ public class AppOpsManager {
            false, // WIFI_CHANGE
            false, // BLUETOOTH_CHANGE
            false, // BOOT_COMPLETED
            false, // NFC_CHANGE
    };

    /**
@@ -876,6 +886,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_ALLOWED, // OP_WIFI_CHANGE
            AppOpsManager.MODE_ASK,     // OP_BLUETOOTH_CHANGE
            AppOpsManager.MODE_ALLOWED, // OP_BOOT_COMPLETED
            AppOpsManager.MODE_ALLOWED, // OP_NFC_CHANGE
    };

    /**
@@ -949,6 +960,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_ASK,     // OP_WIFI_CHANGE
            AppOpsManager.MODE_ASK,     // OP_BLUETOOTH_CHANGE
            AppOpsManager.MODE_ALLOWED, // OP_BOOT_COMPLETED
            AppOpsManager.MODE_ASK,     // OP_NFC_CHANGE
    };

    /**
@@ -1021,6 +1033,7 @@ public class AppOpsManager {
        true,     // OP_WIFI_CHANGE
        true,     // OP_BLUETOOTH_CHANGE
        false,    // OP_BOOT_COMPLETED
        true,     // OP_NFC_CHANGE
    };

    /**
@@ -1097,6 +1110,7 @@ public class AppOpsManager {
            false,     // OP_WIFI_CHANGE
            false,     // OP_BLUETOOTH_CHANGE
            false,     // OP_BOOT_COMPLETED
            false,     // OP_NFC_CHANGE
    };

    /**
+1 −0
Original line number Diff line number Diff line
@@ -87,5 +87,6 @@
        <item>Trying to turn on/off Wi-Fi</item>
        <item>Trying to trun on/off Bluetooth</item>
        <item>Trying to start at bootup</item>
        <item>Trying to turn on/off NFC</item>
    </string-array>
</resources>