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

Commit 6555e78f authored by Shashank Mittal's avatar Shashank Mittal Committed by Steve Kondik
Browse files

AppOps: Add BOOT_COMPLETED operation

Add BOOT_COMPLETED operation in AppOps.

This operation is used to allow user to control auto start of
applications and services at bootup.

Change-Id: Ie8488ec1b4683c8617ca569cfc858709f0d35ba2
parent 676846ce
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -229,7 +229,9 @@ public class AppOpsManager {
    /** @hide */
    public static final int OP_WRITE_MMS = 52;
    /** @hide */
    public static final int _NUM_OP = 53;
    public static final int OP_BOOT_COMPLETED = 53;
    /** @hide */
    public static final int _NUM_OP = 54;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION =
@@ -344,6 +346,8 @@ public class AppOpsManager {
            "android:read_mms";
    private static final String OPSTR_WRITE_MMS =
            "android:write_mms";
    private static final String OPSTR_BOOT_COMPLETED =
            "android:boot_completed";

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

    /**
@@ -467,6 +472,7 @@ public class AppOpsManager {
            null,
            null,
            null,
            null,
    };

    /**
@@ -527,6 +533,7 @@ public class AppOpsManager {
        OPSTR_SEND_MMS,
        OPSTR_READ_MMS,
        OPSTR_WRITE_MMS,
        OPSTR_BOOT_COMPLETED,
    };

    /**
@@ -587,6 +594,7 @@ public class AppOpsManager {
            "SEND_MMS",
            "READ_MMS",
            "WRITE_MMS",
            "BOOT_COMPLETED",
    };

    /**
@@ -647,6 +655,7 @@ public class AppOpsManager {
            android.Manifest.permission.SEND_SMS,
            android.Manifest.permission.READ_SMS,
            android.Manifest.permission.WRITE_SMS,
            android.Manifest.permission.RECEIVE_BOOT_COMPLETED,
    };

    /**
@@ -708,6 +717,7 @@ public class AppOpsManager {
            null, //SEND_MMS
            null, //READ_MMS
            null, //WRITE_MMS
            null, //BOOT_COMPLETED
    };

    /**
@@ -768,6 +778,7 @@ public class AppOpsManager {
            false, // SEND_MMS
            false, // READ_MMS
            false, // WRITE_MMS
            false, // BOOT_COMPLETED
    };

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

    /**
@@ -887,6 +899,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_ASK,     // OP_SEND_MMS
            AppOpsManager.MODE_ASK,     // OP_READ_MMS
            AppOpsManager.MODE_ASK,     // OP_WRITE_MMS
            AppOpsManager.MODE_ALLOWED, // OP_BOOT_COMPLETED
    };

    /**
@@ -946,6 +959,7 @@ public class AppOpsManager {
        true,     // OP_SEND_MMS
        true,     // OP_READ_MMS
        true,     // OP_WRITE_MMS
        false,    // OP_BOOT_COMPLETED
    };

    /**
@@ -1009,6 +1023,7 @@ public class AppOpsManager {
            false,     // OP_SEND_MMS
            false,     // OP_READ_MMS
            false,     // OP_WRITE_MMS
            false,     // OP_BOOT_COMPLETED
    };

    private static HashMap<String, Integer> sOpStrToOp = new HashMap<String, Integer>();
+1 −0
Original line number Diff line number Diff line
@@ -1956,5 +1956,6 @@
        <item>Trying to send MMS</item>
        <item>Trying to read MMS</item>
        <item>Trying to write MMS</item>
        <item>Trying to start at bootup</item>
    </string-array>
</resources>
+5 −4
Original line number Diff line number Diff line
@@ -6399,8 +6399,8 @@ public final class ActivityManagerService extends ActivityManagerNative
                                },
                                0, null, null,
                                android.Manifest.permission.RECEIVE_BOOT_COMPLETED,
                                AppOpsManager.OP_NONE, true, false, MY_PID, Process.SYSTEM_UID,
                                userId);
                                AppOpsManager.OP_BOOT_COMPLETED, true, false,
                                MY_PID, Process.SYSTEM_UID, userId);
                    }
                }
                scheduleStartProfilesLocked();
@@ -18735,8 +18735,9 @@ public final class ActivityManagerService extends ActivityManagerNative
                intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT);
                broadcastIntentLocked(null, null, intent,
                        null, null, 0, null, null,
                        android.Manifest.permission.RECEIVE_BOOT_COMPLETED, AppOpsManager.OP_NONE,
                        true, false, MY_PID, Process.SYSTEM_UID, userId);
                        android.Manifest.permission.RECEIVE_BOOT_COMPLETED,
                        AppOpsManager.OP_BOOT_COMPLETED, true, false, MY_PID,
                        Process.SYSTEM_UID, userId);
            }
        }
    }