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

Commit 015d10ef authored by Shashank Mittal's avatar Shashank Mittal Committed by Sam Mortimer
Browse files

AppOps: Add more operations in app ops settings.

Add following operations in app ops settings.

-- Wifi enable/disable
-- Bluetooth enable/disable
-- Mobile data enable/disable

Change-Id: I32183d77b88c326168557444a445765b5a69de6f
parent 4aed253d
Loading
Loading
Loading
Loading
+88 −0
Original line number Diff line number Diff line
@@ -615,4 +615,92 @@
         per-device overlay. Required to build on non-hardware tunable devices -->
    <string-array name="gamma_descriptors" translatable="false">
    </string-array>

    <!-- Performance profiles -->
    <string-array name="perf_profile_entries" translatable="false">
        <item>@string/perf_profile_pwrsv</item>
        <item>@string/perf_profile_bal</item>
        <item>@string/perf_profile_perf</item>
    </string-array>

    <string-array name="perf_profile_values" translatable="false">
        <item>0</item>
        <item>1</item>
        <item>2</item>
    </string-array>

    <!-- App ops, extension of AOSP app_ops_summaries and app_ops_labels -->
    <string-array name="app_ops_summaries_cm">
        <item>coarse location</item>
        <item>fine location</item>
        <item>GPS</item>
        <item>vibrate</item>
        <item>read contacts</item>
        <item>modify contacts</item>
        <item>read call log</item>
        <item>modify call log</item>
        <item>read calendar</item>
        <item>modify calendar</item>
        <item>wi-fi scan</item>
        <item>notification</item>
        <item>cell scan</item>
        <item>call phone</item>
        <item>read SMS</item>
        <item>write SMS</item>
        <item>receive SMS</item>
        <item>receive emergency SMS</item>
        <item>receive MMS</item>
        <item>receive WAP push</item>
        <item>send SMS</item>
        <item>read ICC SMS</item>
        <item>write ICC SMS</item>
        <item>modify settings</item>
        <item>draw on top</item>
        <item>access notifications</item>
        <item>camera</item>
        <item>record audio</item>
        <item>play audio</item>
        <item>read clipboard</item>
        <item>modify clipboard</item>
        <item>@string/app_ops_summaries_wifi_change</item>
        <item>@string/app_ops_summaries_bluetooth_change</item>
        <item>@string/app_ops_summaries_data_change</item>
    </string-array>

    <string-array name="app_ops_labels_cm">
        <item>Location</item>
        <item>Location</item>
        <item>Location</item>
        <item>Vibrate</item>
        <item>Read contacts</item>
        <item>Modify contacts</item>
        <item>Read call log</item>
        <item>Modify call log</item>
        <item>Read calendar</item>
        <item>Modify calendar</item>
        <item>Location</item>
        <item>Post notification</item>
        <item>Location</item>
        <item>Call phone</item>
        <item>Receive SMS/MMS</item>
        <item>Send SMS/MMS</item>
        <item>Receive SMS/MMS</item>
        <item>Receive SMS/MMS</item>
        <item>Receive SMS/MMS</item>
        <item>Receive SMS/MMS</item>
        <item>Send SMS/MMS</item>
        <item>Receive SMS/MMS</item>
        <item>Send SMS/MMS</item>
        <item>Modify settings</item>
        <item>Draw on top</item>
        <item>Access notifications</item>
        <item>Camera</item>
        <item>Record audio</item>
        <item>Play audio</item>
        <item>Read clipboard</item>
        <item>Modify clipboard</item>
        <item>@string/app_ops_labels_wifi_change</item>
        <item>@string/app_ops_labels_bluetooth_change</item>
        <item>@string/app_ops_labels_data_change</item>
    </string-array>
</resources>
+8 −0
Original line number Diff line number Diff line
@@ -1018,4 +1018,12 @@ two in order to insert additional control points. \'Remove\' deletes the selecte

    <!-- GPS download data over wi-fi only -->
    <string name="gps_download_data_wifi_only">Download GPS assisted data only over Wi-Fi networks</string>

    <!-- App ops -->
    <string name="app_ops_summaries_wifi_change">wifi change</string>
    <string name="app_ops_labels_wifi_change">Wi-Fi change</string>
    <string name="app_ops_summaries_bluetooth_change">bluetooth change</string>
    <string name="app_ops_labels_bluetooth_change">Bluetooth change</string>
    <string name="app_ops_summaries_data_change">data change</string>
    <string name="app_ops_labels_data_change">Data change</string>
</resources>
+10 −4
Original line number Diff line number Diff line
@@ -27,9 +27,9 @@ import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.format.DateUtils;

import android.util.Log;
import android.util.SparseArray;

import com.android.settings.R;

import java.io.File;
@@ -56,8 +56,8 @@ public class AppOpsState {
        mContext = context;
        mAppOps = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
        mPm = context.getPackageManager();
        mOpSummaries = context.getResources().getTextArray(R.array.app_ops_summaries);
        mOpLabels = context.getResources().getTextArray(R.array.app_ops_labels);
        mOpSummaries = context.getResources().getTextArray(R.array.app_ops_summaries_cm);
        mOpLabels = context.getResources().getTextArray(R.array.app_ops_labels_cm);
    }

    public static class OpsTemplate implements Parcelable {
@@ -158,7 +158,10 @@ public class AppOpsState {
                    AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
                    AppOpsManager.OP_CAMERA,
                    AppOpsManager.OP_RECORD_AUDIO,
                    AppOpsManager.OP_PLAY_AUDIO },
                    AppOpsManager.OP_PLAY_AUDIO,
                    AppOpsManager.OP_WIFI_CHANGE,
                    AppOpsManager.OP_BLUETOOTH_CHANGE,
                    AppOpsManager.OP_DATA_CONNECT_CHANGE },
            new boolean[] { false,
                    false,
                    true,
@@ -167,6 +170,9 @@ public class AppOpsState {
                    true,
                    true,
                    true,
                    true,
                    true,
                    true,
                    true }
            );