PMD: Enable and obey PrematureDeclaration

This commit is contained in:
Daniel Martí 2016-04-23 16:06:41 +01:00
parent 32c67d05ec
commit 5d3d8786e2
3 changed files with 6 additions and 7 deletions

View File

@ -328,9 +328,6 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
* 3. Verify that install worked * 3. Verify that install worked
*/ */
private void postInstall() { 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 = int isInstalledCorrectly =
PrivilegedInstaller.isExtensionInstalledCorrectly(this); PrivilegedInstaller.isExtensionInstalledCorrectly(this);
@ -367,6 +364,9 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
throw new RuntimeException("unhandled return"); 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) AlertDialog.Builder builder = new AlertDialog.Builder(theme)
.setTitle(title) .setTitle(title)
.setMessage(message) .setMessage(message)

View File

@ -420,16 +420,14 @@ public class AppSecurityPermissions {
final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE; final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL; final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL;
final boolean isDangerous = base == PermissionInfo.PROTECTION_DANGEROUS; 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 // Dangerous and normal permissions are always shown to the user
if (isNormal || isDangerous) { if (isNormal || isDangerous) {
return true; return true;
} }
final boolean isDevelopment = final boolean isDevelopment = (pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0;
(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 // 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 // granted to the app -- if we are installing an app and they are not

View File

@ -15,4 +15,5 @@
<rule ref="rulesets/java/unnecessary.xml"> <rule ref="rulesets/java/unnecessary.xml">
<exclude name="UselessParentheses"/> <!--Too nitpicky--> <exclude name="UselessParentheses"/> <!--Too nitpicky-->
</rule> </rule>
<rule ref="rulesets/java/optimizations.xml/PrematureDeclaration"/>
</ruleset> </ruleset>