PMD: Enable java-android, fix issues

This commit is contained in:
Daniel Martí 2016-03-01 17:31:41 +00:00
parent 78d15dd4a8
commit fbeb6d140f
3 changed files with 3 additions and 2 deletions

View File

@ -217,6 +217,7 @@ task pmd(type: Pmd, dependsOn: assembleDebug) {
ruleSets = [ ruleSets = [
//'java-basic', //'java-basic',
//'java-unusedcode', //'java-unusedcode',
'java-android',
] ]
source 'src' source 'src'
include '**/org/fdroid/**/*.java' include '**/org/fdroid/**/*.java'

View File

@ -176,6 +176,7 @@ public class FDroidApp extends Application {
@TargetApi(9) @TargetApi(9)
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate();
if (Build.VERSION.SDK_INT >= 9 && BuildConfig.DEBUG) { if (Build.VERSION.SDK_INT >= 9 && BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll() .detectAll()
@ -187,7 +188,6 @@ public class FDroidApp extends Application {
.build()); .build());
} }
updateLanguage(); updateLanguage();
super.onCreate();
ACRA.init(this); ACRA.init(this);
// Needs to be setup before anything else tries to access it. // Needs to be setup before anything else tries to access it.

View File

@ -595,12 +595,12 @@ public class SwapService extends Service {
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy();
Utils.debugLog(TAG, "Destroying service, will disable swapping if required, and unregister listeners."); Utils.debugLog(TAG, "Destroying service, will disable swapping if required, and unregister listeners.");
disableAllSwapping(); disableAllSwapping();
Preferences.get().unregisterLocalRepoHttpsListeners(httpsEnabledListener); Preferences.get().unregisterLocalRepoHttpsListeners(httpsEnabledListener);
LocalBroadcastManager.getInstance(this).unregisterReceiver(onWifiChange); LocalBroadcastManager.getInstance(this).unregisterReceiver(onWifiChange);
LocalBroadcastManager.getInstance(this).unregisterReceiver(receiveSwapStatusChanged); LocalBroadcastManager.getInstance(this).unregisterReceiver(receiveSwapStatusChanged);
super.onDestroy();
} }
private Notification createNotification() { private Notification createNotification() {