From 5d3d8786e2f8cb810ed9ad4fe561d332c212f96d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 23 Apr 2016 16:06:41 +0100 Subject: [PATCH] PMD: Enable and obey PrematureDeclaration --- .../privileged/install/InstallExtensionDialogActivity.java | 6 +++--- .../fdroid/privileged/views/AppSecurityPermissions.java | 6 ++---- config/pmd/rules.xml | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/privileged/install/InstallExtensionDialogActivity.java b/app/src/main/java/org/fdroid/fdroid/privileged/install/InstallExtensionDialogActivity.java index 26bb0c299..221cfb3b5 100644 --- a/app/src/main/java/org/fdroid/fdroid/privileged/install/InstallExtensionDialogActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/privileged/install/InstallExtensionDialogActivity.java @@ -328,9 +328,6 @@ public class InstallExtensionDialogActivity extends FragmentActivity { * 3. Verify that install worked */ private void postInstall() { - // hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay - ContextThemeWrapper theme = new ContextThemeWrapper(this, FDroidApp.getCurThemeResId()); - int isInstalledCorrectly = PrivilegedInstaller.isExtensionInstalledCorrectly(this); @@ -367,6 +364,9 @@ public class InstallExtensionDialogActivity extends FragmentActivity { throw new RuntimeException("unhandled return"); } + // hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay + ContextThemeWrapper theme = new ContextThemeWrapper(this, FDroidApp.getCurThemeResId()); + AlertDialog.Builder builder = new AlertDialog.Builder(theme) .setTitle(title) .setMessage(message) diff --git a/app/src/main/java/org/fdroid/fdroid/privileged/views/AppSecurityPermissions.java b/app/src/main/java/org/fdroid/fdroid/privileged/views/AppSecurityPermissions.java index e16a42efa..23afc1e91 100644 --- a/app/src/main/java/org/fdroid/fdroid/privileged/views/AppSecurityPermissions.java +++ b/app/src/main/java/org/fdroid/fdroid/privileged/views/AppSecurityPermissions.java @@ -420,16 +420,14 @@ public class AppSecurityPermissions { final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE; final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL; final boolean isDangerous = base == PermissionInfo.PROTECTION_DANGEROUS; - final boolean wasGranted = - (existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0; // Dangerous and normal permissions are always shown to the user if (isNormal || isDangerous) { return true; } - final boolean isDevelopment = - (pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0; + final boolean isDevelopment = (pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0; + final boolean wasGranted = (existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0; // Development permissions are only shown to the user if they are already // granted to the app -- if we are installing an app and they are not diff --git a/config/pmd/rules.xml b/config/pmd/rules.xml index 1cf4ca4a9..314281ed0 100644 --- a/config/pmd/rules.xml +++ b/config/pmd/rules.xml @@ -15,4 +15,5 @@ +