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

Commit 4d39124a authored by Shashank Mittal's avatar Shashank Mittal
Browse files

AppOps: Always remember user choice in ASK mode.

Remove 'always ask' option from AppOps. Remember user choice for
all operations.

Change-Id: If16a96eb95437ce54ee8d27b84ac6c284a110147
parent f3b7c05d
Loading
Loading
Loading
Loading
+0 −69
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (c) 2013, The Linux Foundation. All rights reserved.
** Not a Contribution.
**
** Copyright 2012 The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<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>
+0 −1
Original line number Diff line number Diff line
@@ -1652,7 +1652,6 @@
    <string name="immersive_mode_confirmation" msgid="7227416894979047467">"从顶部向下滑动即可退出全屏模式。"</string>

    <!-- App Ops -->
    <string name="permission_remember_choice">记住</string>
    <string name="permission">权限</string>
    <string-array name="app_ops_labels">
        <item>试图获取位置信息</item>
+0 −2
Original line number Diff line number Diff line
@@ -4517,7 +4517,5 @@
    <string name="stk_cc_ss_to_ussd">SS request is modified to USSD request.</string>
    <string name="stk_cc_ss_to_ss">SS request is modified to new SS request.</string>

    <!-- Text of the checkbox for the permission confirmation dialog to remember the user's choice. [CHAR LIMIT=40] -->
    <string name="permission_remember_choice">Remember</string>
    <string name="permission">Permission</string>
</resources>
+0 −5
Original line number Diff line number Diff line
@@ -223,10 +223,6 @@
  <java-symbol type="id" name="pin_confirm_text" />
  <java-symbol type="id" name="pin_error_message" />
  <java-symbol type="id" name="timePickerLayout" />
  <java-symbol type="id" name="permission_text" />
  <java-symbol type="id" name="permission_remember_layout" />
  <java-symbol type="id" name="permission_remember_choice_checkbox" />
  <java-symbol type="id" name="permission_remember_choice_text" />

  <java-symbol type="attr" name="actionModeShareDrawable" />
  <java-symbol type="attr" name="alertDialogCenterButtons" />
@@ -1178,7 +1174,6 @@
  <java-symbol type="layout" name="locale_picker_item" />
  <java-symbol type="layout" name="media_controller" />
  <java-symbol type="layout" name="overlay_display_window" />
  <java-symbol type="layout" name="permission_confirmation_dialog" />
  <java-symbol type="layout" name="preference" />
  <java-symbol type="layout" name="preference_header_item" />
  <java-symbol type="layout" name="preference_list_content" />
+2 −12
Original line number Diff line number Diff line
@@ -39,8 +39,6 @@ class PermissionDialog extends BasePermissionDialog {
    private final AppOpsService mService;
    private final String mPackageName;
    private final int mCode;
    private View  mView;
    private CheckBox mChoice;
    private int mUid;
    final CharSequence[] mOpLabels;
    private Context mContext;
@@ -83,18 +81,10 @@ class PermissionDialog extends BasePermissionDialog {
                | WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
        getWindow().setAttributes(attrs);

        mView = getLayoutInflater().inflate(
             com.android.internal.R.layout.permission_confirmation_dialog,
             null);
        TextView tv = (TextView) mView.findViewById(
            com.android.internal.R.id.permission_text);
        mChoice = (CheckBox) mView.findViewById(
            com.android.internal.R.id.permission_remember_choice_checkbox);
        String name = getAppName(mPackageName);
        if(name == null)
            name = mPackageName;
        tv.setText(name + ": " + mOpLabels[mCode]);
        setView(mView);
        setMessage(name + ": " + mOpLabels[mCode]);

        // After the timeout, pretend the user clicked the quit button
        //mHandler.sendMessageDelayed(
@@ -121,7 +111,7 @@ class PermissionDialog extends BasePermissionDialog {
    private final Handler mHandler = new Handler() {
        public void handleMessage(Message msg) {
            int mode;
            boolean remember = mChoice.isChecked();
            boolean remember = true;
            switch(msg.what) {
                case ACTION_ALLOWED:
                    mode = AppOpsManager.MODE_ALLOWED;