diff options
author | Billy Lau <billylau@google.com> | 2015-07-30 17:14:17 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-30 17:14:17 +0000 |
commit | eb372c93ee00fa9365206129136501497e6341c7 (patch) | |
tree | c3098265c22cb12cb2624625d9ac68c488a3c047 /src/com | |
parent | 19128bd1679cfcad3e38a447dd4584fa5280920f (diff) | |
parent | fee785645b57c519a31ed403e60e8f76dcc8abbb (diff) | |
download | packages_apps_Settings-eb372c93ee00fa9365206129136501497e6341c7.zip packages_apps_Settings-eb372c93ee00fa9365206129136501497e6341c7.tar.gz packages_apps_Settings-eb372c93ee00fa9365206129136501497e6341c7.tar.bz2 |
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
Diffstat (limited to 'src/com')
9 files changed, 23 insertions, 6 deletions
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index f606193..7b94d79 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -116,4 +116,6 @@ public class Settings extends SettingsActivity { public static class MemorySettingsActivity extends SettingsActivity { /* empty */ } public static class OverlaySettingsActivity extends SettingsActivity { /* empty */ } public static class WriteSettingsActivity extends SettingsActivity { /* empty */ } + public static class AppDrawOverlaySettingsActivity extends SettingsActivity { /* empty */ } + public static class AppWriteSettingsActivity extends SettingsActivity { /* empty */ } } diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index 442ce60..8edec09 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -70,12 +70,14 @@ import com.android.settings.accessibility.AccessibilitySettings; import com.android.settings.accessibility.CaptionPropertiesFragment; import com.android.settings.accounts.AccountSettings; import com.android.settings.accounts.AccountSyncSettings; +import com.android.settings.applications.DrawOverlayDetails; import com.android.settings.applications.InstalledAppDetails; import com.android.settings.applications.ManageApplications; import com.android.settings.applications.ManageAssist; import com.android.settings.applications.ProcessStatsSummary; import com.android.settings.applications.ProcessStatsUi; import com.android.settings.applications.UsageAccessDetails; +import com.android.settings.applications.WriteSettingsDetails; import com.android.settings.bluetooth.BluetoothSettings; import com.android.settings.dashboard.DashboardCategory; import com.android.settings.dashboard.DashboardSummary; @@ -350,6 +352,8 @@ public class SettingsActivity extends Activity ProcessStatsUi.class.getName(), PowerUsageDetail.class.getName(), ProcessStatsSummary.class.getName(), + DrawOverlayDetails.class.getName(), + WriteSettingsDetails.class.getName(), }; 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); |