summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/applications
diff options
context:
space:
mode:
authorBilly Lau <billylau@google.com>2015-07-30 17:30:01 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-30 17:30:01 +0000
commit82e6edfe1bad73b6757aa93725e74fb7f69a26a4 (patch)
tree9f78ad519a76e03e1ba478d9af093db5935f67cb /src/com/android/settings/applications
parente520015efa55b02938c8f1bafb5e45313c057dd1 (diff)
parent95026e032809f39fb2aece05e8b3d8f74eca77ea (diff)
downloadpackages_apps_Settings-82e6edfe1bad73b6757aa93725e74fb7f69a26a4.zip
packages_apps_Settings-82e6edfe1bad73b6757aa93725e74fb7f69a26a4.tar.gz
packages_apps_Settings-82e6edfe1bad73b6757aa93725e74fb7f69a26a4.tar.bz2
am 95026e03: am eb372c93: Merge "Bug: 22718745 Intents to \'draw over other apps\' should go direct to the package\'s page instead of the top level one" into mnc-dev
* commit '95026e032809f39fb2aece05e8b3d8f74eca77ea': Bug: 22718745 Intents to 'draw over other apps' should go direct to the package's page instead of the top level one
Diffstat (limited to 'src/com/android/settings/applications')
-rw-r--r--src/com/android/settings/applications/AppStateAppOpsBridge.java15
-rw-r--r--src/com/android/settings/applications/AppStateOverlayBridge.java1
-rw-r--r--src/com/android/settings/applications/AppStateUsageBridge.java1
-rw-r--r--src/com/android/settings/applications/AppStateWriteSettingsBridge.java1
-rw-r--r--src/com/android/settings/applications/DrawOverlayDetails.java2
-rw-r--r--src/com/android/settings/applications/UsageAccessDetails.java1
-rw-r--r--src/com/android/settings/applications/WriteSettingsDetails.java2
7 files changed, 17 insertions, 6 deletions
diff --git a/src/com/android/settings/applications/AppStateAppOpsBridge.java b/src/com/android/settings/applications/AppStateAppOpsBridge.java
index 20a00bd..1a69322 100644
--- a/src/com/android/settings/applications/AppStateAppOpsBridge.java
+++ b/src/com/android/settings/applications/AppStateAppOpsBridge.java
@@ -88,10 +88,12 @@ public abstract class AppStateAppOpsBridge extends AppStateBaseBridge {
int[] permissionFlags = permissionState.packageInfo.requestedPermissionsFlags;
if (requestedPermissions != null) {
for (int i = 0; i < requestedPermissions.length; i++) {
- if (mPermissions[0].equals(requestedPermissions[i]) &&
- (permissionFlags[i] & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0) {
+ if (mPermissions[0].equals(requestedPermissions[i])) {
permissionState.permissionDeclared = true;
- break;
+ if ((permissionFlags[i] & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0) {
+ permissionState.staticPermissionGranted = true;
+ break;
+ }
}
}
}
@@ -164,7 +166,7 @@ public abstract class AppStateAppOpsBridge extends AppStateBaseBridge {
}
/*
- * This method will set the packageInfo and permissionDeclared field of the associated
+ * This method will set the packageInfo and staticPermissionGranted field of the associated
* PermissionState, which describes a particular package.
*/
private void loadPermissionsStates(SparseArray<ArrayMap<String, PermissionState>> entries) {
@@ -185,7 +187,7 @@ public abstract class AppStateAppOpsBridge extends AppStateBaseBridge {
final PermissionState pe = entriesForProfile.get(packageInfo.packageName);
if (pe != null) {
pe.packageInfo = packageInfo;
- pe.permissionDeclared = true;
+ pe.staticPermissionGranted = true;
}
}
}
@@ -279,6 +281,7 @@ public abstract class AppStateAppOpsBridge extends AppStateBaseBridge {
public final String packageName;
public final UserHandle userHandle;
public PackageInfo packageInfo;
+ public boolean staticPermissionGranted;
public boolean permissionDeclared;
public int appOpMode;
@@ -293,7 +296,7 @@ public abstract class AppStateAppOpsBridge extends AppStateBaseBridge {
// permission (this means pre-M gets approval during install time; M apps gets approval
// during runtime.
if (appOpMode == AppOpsManager.MODE_DEFAULT) {
- return permissionDeclared;
+ return staticPermissionGranted;
}
return appOpMode == AppOpsManager.MODE_ALLOWED;
}
diff --git a/src/com/android/settings/applications/AppStateOverlayBridge.java b/src/com/android/settings/applications/AppStateOverlayBridge.java
index 75900a4..c603028 100644
--- a/src/com/android/settings/applications/AppStateOverlayBridge.java
+++ b/src/com/android/settings/applications/AppStateOverlayBridge.java
@@ -66,6 +66,7 @@ public class AppStateOverlayBridge extends AppStateAppOpsBridge {
this.packageInfo = permissionState.packageInfo;
this.appOpMode = permissionState.appOpMode;
this.permissionDeclared = permissionState.permissionDeclared;
+ this.staticPermissionGranted = permissionState.staticPermissionGranted;
}
}
diff --git a/src/com/android/settings/applications/AppStateUsageBridge.java b/src/com/android/settings/applications/AppStateUsageBridge.java
index a152901..ef5a2c7 100644
--- a/src/com/android/settings/applications/AppStateUsageBridge.java
+++ b/src/com/android/settings/applications/AppStateUsageBridge.java
@@ -57,6 +57,7 @@ public class AppStateUsageBridge extends AppStateAppOpsBridge {
this.packageInfo = permissionState.packageInfo;
this.appOpMode = permissionState.appOpMode;
this.permissionDeclared = permissionState.permissionDeclared;
+ this.staticPermissionGranted = permissionState.staticPermissionGranted;
}
}
diff --git a/src/com/android/settings/applications/AppStateWriteSettingsBridge.java b/src/com/android/settings/applications/AppStateWriteSettingsBridge.java
index e43b5f5..9dbe13b 100644
--- a/src/com/android/settings/applications/AppStateWriteSettingsBridge.java
+++ b/src/com/android/settings/applications/AppStateWriteSettingsBridge.java
@@ -66,6 +66,7 @@ public class AppStateWriteSettingsBridge extends AppStateAppOpsBridge {
this.packageInfo = permissionState.packageInfo;
this.appOpMode = permissionState.appOpMode;
this.permissionDeclared = permissionState.permissionDeclared;
+ this.staticPermissionGranted = permissionState.staticPermissionGranted;
}
}
diff --git a/src/com/android/settings/applications/DrawOverlayDetails.java b/src/com/android/settings/applications/DrawOverlayDetails.java
index 4ea45b1..ef92c21 100644
--- a/src/com/android/settings/applications/DrawOverlayDetails.java
+++ b/src/com/android/settings/applications/DrawOverlayDetails.java
@@ -143,6 +143,8 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
boolean isAllowed = mOverlayState.isPermissible();
mSwitchPref.setChecked(isAllowed);
+ // you cannot ask a user to grant you a permission you did not have!
+ mSwitchPref.setEnabled(mOverlayState.permissionDeclared);
mOverlayPrefs.setEnabled(isAllowed);
getPreferenceScreen().removePreference(mOverlayPrefs);
diff --git a/src/com/android/settings/applications/UsageAccessDetails.java b/src/com/android/settings/applications/UsageAccessDetails.java
index 5317282..7af1d9b 100644
--- a/src/com/android/settings/applications/UsageAccessDetails.java
+++ b/src/com/android/settings/applications/UsageAccessDetails.java
@@ -130,6 +130,7 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
boolean hasAccess = mUsageState.isPermissible();
mSwitchPref.setChecked(hasAccess);
+ mSwitchPref.setEnabled(mUsageState.permissionDeclared);
mUsagePrefs.setEnabled(hasAccess);
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
diff --git a/src/com/android/settings/applications/WriteSettingsDetails.java b/src/com/android/settings/applications/WriteSettingsDetails.java
index 30533c6..c89e7b3 100644
--- a/src/com/android/settings/applications/WriteSettingsDetails.java
+++ b/src/com/android/settings/applications/WriteSettingsDetails.java
@@ -142,6 +142,8 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
boolean canWrite = mWriteSettingsState.isPermissible();
mSwitchPref.setChecked(canWrite);
+ // you can't ask a user for a permission you didn't even declare!
+ mSwitchPref.setEnabled(mWriteSettingsState.permissionDeclared);
mWriteSettingsPrefs.setEnabled(canWrite);
getPreferenceScreen().removePreference(mWriteSettingsPrefs);