Get closer to obeying PMD's unused code rules
This commit is contained in:
parent
0e76a2e1fe
commit
b4dd9c857e
@ -30,11 +30,9 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
|
|
||||||
private static final String TAG = "Preferences";
|
private static final String TAG = "Preferences";
|
||||||
|
|
||||||
private final Context context;
|
|
||||||
private final SharedPreferences preferences;
|
private final SharedPreferences preferences;
|
||||||
|
|
||||||
private Preferences(Context context) {
|
private Preferences(Context context) {
|
||||||
this.context = context;
|
|
||||||
preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
preferences.registerOnSharedPreferenceChangeListener(this);
|
preferences.registerOnSharedPreferenceChangeListener(this);
|
||||||
if (preferences.getString(PREF_LOCAL_REPO_NAME, null) == null) {
|
if (preferences.getString(PREF_LOCAL_REPO_NAME, null) == null) {
|
||||||
@ -72,10 +70,10 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
private static final boolean DEFAULT_ROOTED = true;
|
private static final boolean DEFAULT_ROOTED = true;
|
||||||
private static final int DEFAULT_UPD_HISTORY = 14;
|
private static final int DEFAULT_UPD_HISTORY = 14;
|
||||||
private static final boolean DEFAULT_PRIVILEGED_INSTALLER = false;
|
private static final boolean DEFAULT_PRIVILEGED_INSTALLER = false;
|
||||||
private static final boolean DEFAULT_LOCAL_REPO_BONJOUR = true;
|
//private static final boolean DEFAULT_LOCAL_REPO_BONJOUR = true;
|
||||||
private static final boolean DEFAULT_CACHE_APK = false;
|
private static final boolean DEFAULT_CACHE_APK = false;
|
||||||
private static final boolean DEFAULT_UNSTABLE_UPDATES = false;
|
private static final boolean DEFAULT_UNSTABLE_UPDATES = false;
|
||||||
private static final boolean DEFAULT_LOCAL_REPO_HTTPS = false;
|
//private static final boolean DEFAULT_LOCAL_REPO_HTTPS = false;
|
||||||
private static final boolean DEFAULT_INCOMP_VER = false;
|
private static final boolean DEFAULT_INCOMP_VER = false;
|
||||||
private static final boolean DEFAULT_EXPERT = false;
|
private static final boolean DEFAULT_EXPERT = false;
|
||||||
private static final boolean DEFAULT_ENABLE_PROXY = false;
|
private static final boolean DEFAULT_ENABLE_PROXY = false;
|
||||||
|
@ -9,7 +9,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public class ProgressBufferedInputStream extends BufferedInputStream {
|
public class ProgressBufferedInputStream extends BufferedInputStream {
|
||||||
private static final String TAG = "ProgressBufferedInputSt";
|
|
||||||
|
|
||||||
private final ProgressListener progressListener;
|
private final ProgressListener progressListener;
|
||||||
private final Bundle data;
|
private final Bundle data;
|
||||||
|
@ -404,9 +404,11 @@ public class SwapService extends Service {
|
|||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
private boolean wasBluetoothEnabled() {
|
private boolean wasBluetoothEnabled() {
|
||||||
return persistence().getBoolean(KEY_BLUETOOTH_ENABLED, false);
|
return persistence().getBoolean(KEY_BLUETOOTH_ENABLED, false);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private boolean wasWifiEnabled() {
|
private boolean wasWifiEnabled() {
|
||||||
return persistence().getBoolean(KEY_WIFI_ENABLED, false);
|
return persistence().getBoolean(KEY_WIFI_ENABLED, false);
|
||||||
@ -537,11 +539,12 @@ public class SwapService extends Service {
|
|||||||
filter.addAction(WIFI_STATE_CHANGE);
|
filter.addAction(WIFI_STATE_CHANGE);
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(receiveSwapStatusChanged, filter);
|
LocalBroadcastManager.getInstance(this).registerReceiver(receiveSwapStatusChanged, filter);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
if (wasBluetoothEnabled()) {
|
if (wasBluetoothEnabled()) {
|
||||||
Utils.debugLog(TAG, "Previously the user enabled Bluetooth swap, so enabling again automatically.");
|
Utils.debugLog(TAG, "Previously the user enabled Bluetooth swap, so enabling again automatically.");
|
||||||
bluetoothSwap.startInBackground();
|
bluetoothSwap.startInBackground();
|
||||||
}*/
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (wasWifiEnabled()) {
|
if (wasWifiEnabled()) {
|
||||||
Utils.debugLog(TAG, "Previously the user enabled WiFi swap, so enabling again automatically.");
|
Utils.debugLog(TAG, "Previously the user enabled WiFi swap, so enabling again automatically.");
|
||||||
|
@ -7,7 +7,6 @@ import org.fdroid.fdroid.R;
|
|||||||
import org.fdroid.fdroid.localrepo.type.BluetoothSwap;
|
import org.fdroid.fdroid.localrepo.type.BluetoothSwap;
|
||||||
|
|
||||||
public class BluetoothPeer implements Peer {
|
public class BluetoothPeer implements Peer {
|
||||||
private static final String TAG = "BluetoothPeer";
|
|
||||||
|
|
||||||
private final BluetoothDevice device;
|
private final BluetoothDevice device;
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import java.io.IOException;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
public class DownloaderFactory {
|
public class DownloaderFactory {
|
||||||
private static final String TAG = "DownloaderFactory";
|
|
||||||
|
|
||||||
private static LocalBroadcastManager localBroadcastManager;
|
private static LocalBroadcastManager localBroadcastManager;
|
||||||
|
|
||||||
@ -69,8 +68,4 @@ public class DownloaderFactory {
|
|||||||
URL url = new URL(urlString);
|
URL url = new URL(urlString);
|
||||||
return new AsyncDownloadWrapper(create(context, url, destFile, credentials), listener);
|
return new AsyncDownloadWrapper(create(context, url, destFile, credentials), listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isOnionAddress(URL url) {
|
|
||||||
return url.getHost().endsWith(".onion");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ public class LocalHTTPD extends NanoHTTPD {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Response response = serveFile(uri, headers, f, getMimeTypeForFile(uri));
|
Response response = serveFile(headers, f, getMimeTypeForFile(uri));
|
||||||
return response != null ? response :
|
return response != null ? response :
|
||||||
createResponse(Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
createResponse(Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
||||||
"Error 404, file not found.");
|
"Error 404, file not found.");
|
||||||
@ -216,7 +216,7 @@ public class LocalHTTPD extends NanoHTTPD {
|
|||||||
* Serves file from homeDir and its' subdirectories (only). Uses only URI,
|
* Serves file from homeDir and its' subdirectories (only). Uses only URI,
|
||||||
* ignores all headers and HTTP parameters.
|
* ignores all headers and HTTP parameters.
|
||||||
*/
|
*/
|
||||||
private Response serveFile(String uri, Map<String, String> header, File file, String mime) {
|
private Response serveFile(Map<String, String> header, File file, String mime) {
|
||||||
Response res;
|
Response res;
|
||||||
try {
|
try {
|
||||||
// Calculate etag
|
// Calculate etag
|
||||||
|
@ -122,11 +122,6 @@ public class AppSecurityPermissions {
|
|||||||
private static class MyPermissionInfo extends PermissionInfo {
|
private static class MyPermissionInfo extends PermissionInfo {
|
||||||
CharSequence mLabel;
|
CharSequence mLabel;
|
||||||
|
|
||||||
/**
|
|
||||||
* PackageInfo.requestedPermissionsFlags for the new package being installed.
|
|
||||||
*/
|
|
||||||
int mNewReqFlags;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PackageInfo.requestedPermissionsFlags for the currently installed
|
* PackageInfo.requestedPermissionsFlags for the currently installed
|
||||||
* package, if it is installed.
|
* package, if it is installed.
|
||||||
@ -298,7 +293,7 @@ public class AppSecurityPermissions {
|
|||||||
final int[] instFlagsList = getRequestedPermissionFlags(installedPkgInfo);
|
final int[] instFlagsList = getRequestedPermissionFlags(installedPkgInfo);
|
||||||
existingFlags = instFlagsList[existingIndex];
|
existingFlags = instFlagsList[existingIndex];
|
||||||
}
|
}
|
||||||
if (!isDisplayablePermission(tmpPermInfo, flagsList[i], existingFlags)) {
|
if (!isDisplayablePermission(tmpPermInfo, existingFlags)) {
|
||||||
// This is not a permission that is interesting for the user
|
// This is not a permission that is interesting for the user
|
||||||
// to see, so skip it.
|
// to see, so skip it.
|
||||||
continue;
|
continue;
|
||||||
@ -333,7 +328,6 @@ public class AppSecurityPermissions {
|
|||||||
final boolean newPerm = installedPkgInfo != null
|
final boolean newPerm = installedPkgInfo != null
|
||||||
&& (existingFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) == 0;
|
&& (existingFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) == 0;
|
||||||
MyPermissionInfo myPerm = new MyPermissionInfo(tmpPermInfo);
|
MyPermissionInfo myPerm = new MyPermissionInfo(tmpPermInfo);
|
||||||
myPerm.mNewReqFlags = flagsList[i];
|
|
||||||
myPerm.mExistingReqFlags = existingFlags;
|
myPerm.mExistingReqFlags = existingFlags;
|
||||||
// This is a new permission if the app is already installed and
|
// This is a new permission if the app is already installed and
|
||||||
// doesn't currently hold this permission.
|
// doesn't currently hold this permission.
|
||||||
@ -424,8 +418,7 @@ public class AppSecurityPermissions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
private boolean isDisplayablePermission(PermissionInfo pInfo, int newReqFlags,
|
private boolean isDisplayablePermission(PermissionInfo pInfo, int existingReqFlags) {
|
||||||
int existingReqFlags) {
|
|
||||||
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;
|
||||||
@ -492,7 +485,7 @@ public class AppSecurityPermissions {
|
|||||||
if (permList != null) {
|
if (permList != null) {
|
||||||
// First pass to group permissions
|
// First pass to group permissions
|
||||||
for (MyPermissionInfo pInfo : permList) {
|
for (MyPermissionInfo pInfo : permList) {
|
||||||
if (!isDisplayablePermission(pInfo, pInfo.mNewReqFlags, pInfo.mExistingReqFlags)) {
|
if (!isDisplayablePermission(pInfo, pInfo.mExistingReqFlags)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
MyPermissionGroupInfo group = mPermGroups.get(pInfo.group);
|
MyPermissionGroupInfo group = mPermGroups.get(pInfo.group);
|
||||||
|
@ -32,10 +32,6 @@ public class InitialLoadingView extends RelativeLayout implements SwapWorkflowAc
|
|||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SwapWorkflowActivity getActivity() {
|
|
||||||
return (SwapWorkflowActivity) getContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean buildMenu(Menu menu, @NonNull MenuInflater inflater) {
|
public boolean buildMenu(Menu menu, @NonNull MenuInflater inflater) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -211,9 +211,6 @@ public class SelectAppsView extends ListView implements
|
|||||||
|
|
||||||
private class AppListAdapter extends CursorAdapter {
|
private class AppListAdapter extends CursorAdapter {
|
||||||
|
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
|
||||||
private static final String TAG = "AppListAdapter";
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private LayoutInflater inflater;
|
private LayoutInflater inflater;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user