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

Commit cfd88000 authored by c_jyuan's avatar c_jyuan Committed by Linux Build Service Account
Browse files

framework: Add permission dialog

Add permission pop UI for CTA test.

Change-Id: Iead5facfc9d2437a8682870e699e5c0fba71b44f
parent bc5d7407
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -239,8 +239,12 @@ public class AppOpsManager {
    public static final int OP_GET_ACCOUNTS = 62;
    /** @hide Control whether an application is allowed to run in the background. */
    public static final int OP_RUN_IN_BACKGROUND = 63;
    /** @hide CHANGE_WIFI_STATE . */
    public static final int OP_CHANGE_WIFI_STATE = 64;
    /** @hide BLUETOOTH_ADMIN . */
    public static final int OP_BLUETOOTH_ADMIN = 65;
    /** @hide */
    public static final int _NUM_OP = 64;
    public static final int _NUM_OP = 66;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -338,6 +342,12 @@ public class AppOpsManager {
    /** @hide Get device accounts. */
    public static final String OPSTR_GET_ACCOUNTS
            = "android:get_accounts";
    /** @hide CHANGE_WIFI_STATE . */
    public static final String OPSTR_CHANGE_WIFI_STATE
            = "android:change_wifi_state";
    /** @hide BLUETOOTH_ADMIN . */
    public static final String OPSTR_BLUETOOTH_ADMIN
            = "android:bluetooth_admin";

    private static final int[] RUNTIME_PERMISSIONS_OPS = {
            // Contacts
@@ -449,6 +459,8 @@ public class AppOpsManager {
            OP_TURN_SCREEN_ON,
            OP_GET_ACCOUNTS,
            OP_RUN_IN_BACKGROUND,
            OP_CHANGE_WIFI_STATE,
            OP_BLUETOOTH_ADMIN,
    };

    /**
@@ -520,6 +532,8 @@ public class AppOpsManager {
            null,
            OPSTR_GET_ACCOUNTS,
            null,
            OPSTR_CHANGE_WIFI_STATE,
            OPSTR_BLUETOOTH_ADMIN,
    };

    /**
@@ -591,6 +605,8 @@ public class AppOpsManager {
            "TURN_ON_SCREEN",
            "GET_ACCOUNTS",
            "RUN_IN_BACKGROUND",
            "CHANGE_WIFI_STATE",
            "BLUETOOTH_ADMIN",
    };

    /**
@@ -662,6 +678,8 @@ public class AppOpsManager {
            null, // no permission for turning the screen on
            Manifest.permission.GET_ACCOUNTS,
            null, // no permission for running in background
            android.Manifest.permission.CHANGE_WIFI_STATE,
            android.Manifest.permission.BLUETOOTH_ADMIN,
    };

    /**
@@ -734,6 +752,8 @@ public class AppOpsManager {
            null, // TURN_ON_SCREEN
            null, // GET_ACCOUNTS
            null, // RUN_IN_BACKGROUND
            null, // OP_CHANGE_WIFI_STATE
            null, // OP_BLUETOOTH_ADMIN
    };

    /**
@@ -805,6 +825,8 @@ public class AppOpsManager {
            false, // TURN_ON_SCREEN
            false, // GET_ACCOUNTS
            false, // RUN_IN_BACKGROUND
            false, // OP_CHANGE_WIFI_STATE
            false, // OP_BLUETOOTH_ADMIN
    };

    /**
@@ -875,6 +897,8 @@ public class AppOpsManager {
            AppOpsManager.MODE_ALLOWED,  // OP_TURN_ON_SCREEN
            AppOpsManager.MODE_ALLOWED,
            AppOpsManager.MODE_ALLOWED,  // OP_RUN_IN_BACKGROUND
            AppOpsManager.MODE_ALLOWED,  //OP_CHANGE_WIFI_STATE
            AppOpsManager.MODE_ALLOWED,  //OP_BLUETOOTH_ADMIN
    };

    /**
@@ -949,6 +973,8 @@ public class AppOpsManager {
            false,
            false,
            false,
            false, //OP_CHANGE_WIFI_STATE
            false, //OP_BLUETOOTH_ADMIN
    };

    /**
+75 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2015, The Linux Foundation. All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are
     met:
         * Redistributions of source code must retain the above copyright
           notice, this list of conditions and the following disclaimer.
         * Redistributions in binary form must reproduce the above
           copyright notice, this list of conditions and the following
           disclaimer in the documentation and/or other materials provided
           with the distribution.
         * Neither the name of The Linux Foundation nor the names of its
           contributors may be used to endorse or promote products derived
           from this software without specific prior written permission.

     THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
     WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
     ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
     BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
     IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parentPanel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="8dip"
    android:layout_marginRight="8dip"
    android:orientation="vertical">

    <TextView android:id="@+id/permission_text"
        style="?android:attr/textAppearanceMedium"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="20dip"
        android:paddingRight="20dip"
        android:paddingTop="16dip"
        android:paddingBottom="16dip" />

    <TableLayout android:id="@+id/permission_remember_layout"
        android:shrinkColumns="1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="16dip"
        android:paddingRight="16dip">

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
            <RelativeLayout android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingTop="12dip"
                android:paddingLeft="8dip" >
            <CheckBox android:id="@+id/permission_remember_choice_checkbox"
                android:paddingTop="11dip"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
            </RelativeLayout>
            <TextView android:id="@+id/permission_remember_choice_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingTop="18dip"
                android:text="@string/permission_remember_choice" />
        </TableRow>

    </TableLayout>

</LinearLayout>
+35 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are
     met:
         * Redistributions of source code must retain the above copyright
           notice, this list of conditions and the following disclaimer.
         * Redistributions in binary form must reproduce the above
           copyright notice, this list of conditions and the following
           disclaimer in the documentation and/or other materials provided
           with the distribution.
         * Neither the name of The Linux Foundation nor the names of its
           contributors may be used to endorse or promote products derived
           from this software without specific prior written permission.

     THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
     WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
     ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
     BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
     IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <!-- User display names for app ops codes -->
    <string-array name="app_ops_labels">
        <item>尝试打开WLAN</item>
        <item>尝试打开蓝牙</item>
    </string-array>
</resources>

core/res/res/values/arrays.xml

100644 → 100755
+4 −0
Original line number Diff line number Diff line
@@ -234,5 +234,9 @@
        <item>@string/unpin_target</item>
        <item>@string/app_info</item>
    </string-array>
    <string-array name="app_ops_labels">
        <item>Trying to enable WLAN</item>
        <item>Trying to enable BT</item>
    </string-array>

</resources>
+5 −0
Original line number Diff line number Diff line
@@ -4394,4 +4394,9 @@
    <string name="China_Mobile">China Mobile</string>
    <string name="China_Unicom">China Unicom</string>
    <string name="China_Telecom">China Telecom</string>
    <string name="other_permissions">other permissions</string>
    <string name="permission_remember_choice">Remember</string>
    <string name="permission_title">Permission</string>
    <string name="allow_button">Allow</string>
    <string name="deny_button">Deny</string>
</resources>
Loading