From 9c86655af008b14342b963debcda482aeab22e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sun, 28 Feb 2016 14:19:02 +0000 Subject: [PATCH] Make some declaration accesses weaker As suggested by Android Studio. --- F-Droid/src/org/fdroid/fdroid/AppDetails.java | 16 ++++++++-------- F-Droid/src/org/fdroid/fdroid/FDroidApp.java | 2 +- .../src/org/fdroid/fdroid/FDroidCertPins.java | 2 +- F-Droid/src/org/fdroid/fdroid/Preferences.java | 2 +- F-Droid/src/org/fdroid/fdroid/RepoUpdater.java | 15 +++++++++------ .../src/org/fdroid/fdroid/compat/TabManager.java | 4 ++-- F-Droid/src/org/fdroid/fdroid/data/DBHelper.java | 2 +- .../fdroid/data/InstalledAppCacheUpdater.java | 8 ++++---- .../src/org/fdroid/fdroid/data/ValueObject.java | 2 +- .../org/fdroid/fdroid/installer/Installer.java | 8 ++++---- .../fdroid/localrepo/peers/BluetoothFinder.java | 2 +- .../fdroid/localrepo/peers/BonjourPeer.java | 2 +- .../fdroid/localrepo/type/BonjourBroadcast.java | 2 +- .../fdroid/net/AsyncDownloaderFromAndroid.java | 4 ++-- .../src/org/fdroid/fdroid/net/Downloader.java | 10 +++++----- .../src/org/fdroid/fdroid/net/LocalHTTPD.java | 4 ++-- .../fdroid/net/WifiStateChangeService.java | 2 +- .../privileged/install/InstallExtension.java | 14 +++++++------- .../install/InstallExtensionDialogActivity.java | 12 ++++++------ .../fdroid/fdroid/views/swap/StartSwapView.java | 6 +++--- 20 files changed, 61 insertions(+), 58 deletions(-) diff --git a/F-Droid/src/org/fdroid/fdroid/AppDetails.java b/F-Droid/src/org/fdroid/fdroid/AppDetails.java index 8a9cb29e0..3770a235b 100644 --- a/F-Droid/src/org/fdroid/fdroid/AppDetails.java +++ b/F-Droid/src/org/fdroid/fdroid/AppDetails.java @@ -1043,7 +1043,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A public static class AppDetailsSummaryFragment extends Fragment { - protected final Preferences prefs; + final Preferences prefs; private AppDetailsData data; private static final int MAX_LINES = 5; private static boolean viewAllDescription; @@ -1076,11 +1076,11 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A data = (AppDetailsData) activity; } - protected App getApp() { + App getApp() { return data.getApp(); } - protected ApkListAdapter getApks() { + ApkListAdapter getApks() { return data.getApks(); } @@ -1436,7 +1436,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A private TextView progressSize; private TextView progressPercent; private ImageButton cancelButton; - protected final DisplayImageOptions displayImageOptions; + final DisplayImageOptions displayImageOptions; public static boolean installed; public static boolean updateWanted; @@ -1678,19 +1678,19 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A installListener = (AppInstallListener) activity; } - protected void install(final Apk apk) { + void install(final Apk apk) { installListener.install(apk); } - protected void remove() { + void remove() { installListener.removeApk(getApp().packageName); } - protected App getApp() { + App getApp() { return data.getApp(); } - protected ApkListAdapter getApks() { + ApkListAdapter getApks() { return data.getApks(); } diff --git a/F-Droid/src/org/fdroid/fdroid/FDroidApp.java b/F-Droid/src/org/fdroid/fdroid/FDroidApp.java index f90207aa1..37dc218cd 100644 --- a/F-Droid/src/org/fdroid/fdroid/FDroidApp.java +++ b/F-Droid/src/org/fdroid/fdroid/FDroidApp.java @@ -362,7 +362,7 @@ public class FDroidApp extends Application { /** * Set the proxy settings based on whether Tor should be enabled or not. */ - public static void configureTor(boolean enabled) { + private static void configureTor(boolean enabled) { useTor = enabled; if (useTor) { NetCipher.useTor(); diff --git a/F-Droid/src/org/fdroid/fdroid/FDroidCertPins.java b/F-Droid/src/org/fdroid/fdroid/FDroidCertPins.java index 79da8429c..9fe89f31b 100644 --- a/F-Droid/src/org/fdroid/fdroid/FDroidCertPins.java +++ b/F-Droid/src/org/fdroid/fdroid/FDroidCertPins.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class FDroidCertPins { +class FDroidCertPins { private static final String[] DEFAULT_PINS = { // OU=PositiveSSL, CN=f-droid.org diff --git a/F-Droid/src/org/fdroid/fdroid/Preferences.java b/F-Droid/src/org/fdroid/fdroid/Preferences.java index c8570e6d4..ed9bc4df1 100644 --- a/F-Droid/src/org/fdroid/fdroid/Preferences.java +++ b/F-Droid/src/org/fdroid/fdroid/Preferences.java @@ -77,7 +77,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh public static final String DEFAULT_THEME = "light"; public static final String DEFAULT_PROXY_HOST = "127.0.0.1"; public static final int DEFAULT_PROXY_PORT = 8118; - public static final boolean DEFAULT_SHOW_NFC_DURING_SWAP = true; + private static final boolean DEFAULT_SHOW_NFC_DURING_SWAP = true; private static final boolean DEFAULT_FIRST_TIME = true; private static final boolean DEFAULT_POST_PRIVILEGED_INSTALL = false; diff --git a/F-Droid/src/org/fdroid/fdroid/RepoUpdater.java b/F-Droid/src/org/fdroid/fdroid/RepoUpdater.java index cdb55020f..e1fd27d9c 100644 --- a/F-Droid/src/org/fdroid/fdroid/RepoUpdater.java +++ b/F-Droid/src/org/fdroid/fdroid/RepoUpdater.java @@ -54,10 +54,13 @@ public class RepoUpdater { public static final String PROGRESS_COMMITTING = "committing"; public static final String PROGRESS_DATA_REPO_ADDRESS = "repoAddress"; - @NonNull protected final Context context; - @NonNull protected final Repo repo; - protected boolean hasChanged; - @Nullable protected ProgressListener progressListener; + @NonNull + private final Context context; + @NonNull + private final Repo repo; + private boolean hasChanged; + @Nullable + private ProgressListener progressListener; private String cacheTag; private X509Certificate signingCertFromJar; @@ -82,7 +85,7 @@ public class RepoUpdater { return hasChanged; } - protected URL getIndexAddress() throws MalformedURLException { + private URL getIndexAddress() throws MalformedURLException { String urlString = repo.address + "/index.jar"; String versionName = Utils.getVersionName(context); if (versionName != null) { @@ -91,7 +94,7 @@ public class RepoUpdater { return new URL(urlString); } - Downloader downloadIndex() throws UpdateException { + private Downloader downloadIndex() throws UpdateException { Downloader downloader = null; try { downloader = DownloaderFactory.create(context, diff --git a/F-Droid/src/org/fdroid/fdroid/compat/TabManager.java b/F-Droid/src/org/fdroid/fdroid/compat/TabManager.java index cda6801c8..dc467c951 100644 --- a/F-Droid/src/org/fdroid/fdroid/compat/TabManager.java +++ b/F-Droid/src/org/fdroid/fdroid/compat/TabManager.java @@ -35,11 +35,11 @@ public class TabManager { this.pager = pager; } - protected CharSequence getLabel(int index) { + private CharSequence getLabel(int index) { return pager.getAdapter().getPageTitle(index); } - public void removeNotification(int id) { + private void removeNotification(int id) { parent.removeNotification(id); } diff --git a/F-Droid/src/org/fdroid/fdroid/data/DBHelper.java b/F-Droid/src/org/fdroid/fdroid/data/DBHelper.java index 083abe138..f7d293b40 100644 --- a/F-Droid/src/org/fdroid/fdroid/data/DBHelper.java +++ b/F-Droid/src/org/fdroid/fdroid/data/DBHelper.java @@ -13,7 +13,7 @@ import org.fdroid.fdroid.Utils; import java.util.ArrayList; import java.util.List; -public class DBHelper extends SQLiteOpenHelper { +class DBHelper extends SQLiteOpenHelper { private static final String TAG = "DBHelper"; diff --git a/F-Droid/src/org/fdroid/fdroid/data/InstalledAppCacheUpdater.java b/F-Droid/src/org/fdroid/fdroid/data/InstalledAppCacheUpdater.java index 9469b472e..6406fe961 100644 --- a/F-Droid/src/org/fdroid/fdroid/data/InstalledAppCacheUpdater.java +++ b/F-Droid/src/org/fdroid/fdroid/data/InstalledAppCacheUpdater.java @@ -32,7 +32,7 @@ public class InstalledAppCacheUpdater { private final List toInsert = new ArrayList<>(); private final List toDelete = new ArrayList<>(); - protected InstalledAppCacheUpdater(Context context) { + private InstalledAppCacheUpdater(Context context) { this.context = context; } @@ -59,7 +59,7 @@ public class InstalledAppCacheUpdater { updater.startBackgroundWorker(); } - protected boolean update() { + private boolean update() { long startTime = System.currentTimeMillis(); @@ -72,13 +72,13 @@ public class InstalledAppCacheUpdater { return hasChanged(); } - protected void notifyProviders() { + private void notifyProviders() { Utils.debugLog(TAG, "Installed app cache has changed, notifying content providers (so they can update the relevant views)."); context.getContentResolver().notifyChange(AppProvider.getContentUri(), null); context.getContentResolver().notifyChange(ApkProvider.getContentUri(), null); } - protected void startBackgroundWorker() { + private void startBackgroundWorker() { new PostponedWorker().execute(); } diff --git a/F-Droid/src/org/fdroid/fdroid/data/ValueObject.java b/F-Droid/src/org/fdroid/fdroid/data/ValueObject.java index 04f4e1fee..dca9e0a40 100644 --- a/F-Droid/src/org/fdroid/fdroid/data/ValueObject.java +++ b/F-Droid/src/org/fdroid/fdroid/data/ValueObject.java @@ -4,7 +4,7 @@ import android.database.Cursor; class ValueObject { - protected void checkCursorPosition(Cursor cursor) throws IllegalArgumentException { + void checkCursorPosition(Cursor cursor) throws IllegalArgumentException { if (cursor.getPosition() == -1) { throw new IllegalArgumentException( "Cursor position is -1. " + diff --git a/F-Droid/src/org/fdroid/fdroid/installer/Installer.java b/F-Droid/src/org/fdroid/fdroid/installer/Installer.java index 5b123a3f1..486d71144 100644 --- a/F-Droid/src/org/fdroid/fdroid/installer/Installer.java +++ b/F-Droid/src/org/fdroid/fdroid/installer/Installer.java @@ -37,9 +37,9 @@ import java.util.List; * instantiate a working Installer based on F-Droids granted permissions. */ public abstract class Installer { - protected final Context mContext; - protected final PackageManager mPm; - protected final InstallerCallback mCallback; + final Context mContext; + final PackageManager mPm; + final InstallerCallback mCallback; private static final String TAG = "Installer"; @@ -88,7 +88,7 @@ public abstract class Installer { void onError(int operation, int errorCode); } - public Installer(Context context, PackageManager pm, InstallerCallback callback) + Installer(Context context, PackageManager pm, InstallerCallback callback) throws AndroidNotCompatibleException { this.mContext = context; this.mPm = pm; diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BluetoothFinder.java b/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BluetoothFinder.java index a9a002070..89791a915 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BluetoothFinder.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BluetoothFinder.java @@ -104,7 +104,7 @@ class BluetoothFinder extends PeerFinder { } - public void cancel() { + private void cancel() { if (adapter != null) { Utils.debugLog(TAG, "Stopping bluetooth discovery."); adapter.cancelDiscovery(); diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BonjourPeer.java b/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BonjourPeer.java index 1fd579d9a..1f3e5fc51 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BonjourPeer.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/peers/BonjourPeer.java @@ -59,7 +59,7 @@ public class BonjourPeer extends WifiPeer { dest.writeParcelable(serviceInfo, flags); } - protected BonjourPeer(Parcel in) { + private BonjourPeer(Parcel in) { this((ServiceInfo) in.readParcelable(FDroidServiceInfo.class.getClassLoader())); } diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/type/BonjourBroadcast.java b/F-Droid/src/org/fdroid/fdroid/localrepo/type/BonjourBroadcast.java index 11711ee49..d5e28c1c8 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/type/BonjourBroadcast.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/type/BonjourBroadcast.java @@ -103,7 +103,7 @@ public class BonjourBroadcast extends SwapType { if (FDroidApp.ipAddressString != null) { try { return InetAddress.getByName(FDroidApp.ipAddressString); - } catch (UnknownHostException e) { } + } catch (UnknownHostException ignored) { } } return null; diff --git a/F-Droid/src/org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java b/F-Droid/src/org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java index 5a77f547b..409e56e6f 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java +++ b/F-Droid/src/org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java @@ -191,7 +191,7 @@ public class AsyncDownloaderFromAndroid implements AsyncDownloader { return 0; } - protected void sendProgress(int bytesRead, int totalBytes) { + private void sendProgress(int bytesRead, int totalBytes) { Intent intent = new Intent(Downloader.LOCAL_ACTION_PROGRESS); intent.putExtra(Downloader.EXTRA_ADDRESS, remoteAddress); intent.putExtra(Downloader.EXTRA_BYTES_READ, bytesRead); @@ -321,7 +321,7 @@ public class AsyncDownloaderFromAndroid implements AsyncDownloader { * Check if a specific download is complete. * @return -1 if download is not complete, otherwise the download id */ - public static long isDownloadComplete(Context context, String uniqueDownloadId) { + private static long isDownloadComplete(Context context, String uniqueDownloadId) { DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Query query = new DownloadManager.Query(); query.setFilterByStatus(DownloadManager.STATUS_SUCCESSFUL); diff --git a/F-Droid/src/org/fdroid/fdroid/net/Downloader.java b/F-Droid/src/org/fdroid/fdroid/net/Downloader.java index 201697b97..24e96af71 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/Downloader.java +++ b/F-Droid/src/org/fdroid/fdroid/net/Downloader.java @@ -33,8 +33,8 @@ public abstract class Downloader { protected final URL sourceUrl; protected String cacheTag; - protected int bytesRead; - protected int totalBytes; + private int bytesRead; + private int totalBytes; protected abstract InputStream getDownloadersInputStream() throws IOException; @@ -84,7 +84,7 @@ public abstract class Downloader { public abstract boolean hasChanged(); - public abstract int totalDownloadSize(); + protected abstract int totalDownloadSize(); /** * Helper function for synchronous downloads (i.e. those *not* using AsyncDownloadWrapper), @@ -149,7 +149,7 @@ public abstract class Downloader { * keeping track of the number of bytes that have flowed through for the * progress counter. */ - protected void copyInputToOutputStream(InputStream input, int bufferSize) throws IOException, InterruptedException { + private void copyInputToOutputStream(InputStream input, int bufferSize) throws IOException, InterruptedException { int bytesRead = 0; this.totalBytes = totalDownloadSize(); @@ -186,7 +186,7 @@ public abstract class Downloader { outputStream.close(); } - protected void sendProgress(int bytesRead, int totalBytes) { + private void sendProgress(int bytesRead, int totalBytes) { this.bytesRead = bytesRead; Intent intent = new Intent(LOCAL_ACTION_PROGRESS); intent.putExtra(EXTRA_ADDRESS, sourceUrl.toString()); diff --git a/F-Droid/src/org/fdroid/fdroid/net/LocalHTTPD.java b/F-Droid/src/org/fdroid/fdroid/net/LocalHTTPD.java index dcb318d1f..8517e1189 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/LocalHTTPD.java +++ b/F-Droid/src/org/fdroid/fdroid/net/LocalHTTPD.java @@ -216,7 +216,7 @@ public class LocalHTTPD extends NanoHTTPD { * Serves file from homeDir and its' subdirectories (only). Uses only URI, * ignores all headers and HTTP parameters. */ - Response serveFile(String uri, Map header, File file, String mime) { + private Response serveFile(String uri, Map header, File file, String mime) { Response res; try { // Calculate etag @@ -306,7 +306,7 @@ public class LocalHTTPD extends NanoHTTPD { return res; } - public static String getMimeTypeForFile(String uri) { + private static String getMimeTypeForFile(String uri) { String type = null; String extension = MimeTypeMap.getFileExtensionFromUrl(uri); if (extension != null) { diff --git a/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java b/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java index 8c3e3ef69..3dd1e134b 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java +++ b/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java @@ -197,7 +197,7 @@ public class WifiStateChangeService extends Service { } @TargetApi(9) - public void setIpInfoFromNetworkInterface() { + private void setIpInfoFromNetworkInterface() { try { for (Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces(); networkInterfaces.hasMoreElements();) { NetworkInterface netIf = networkInterfaces.nextElement(); diff --git a/F-Droid/src/org/fdroid/fdroid/privileged/install/InstallExtension.java b/F-Droid/src/org/fdroid/fdroid/privileged/install/InstallExtension.java index 0241c9251..80ce7ac21 100644 --- a/F-Droid/src/org/fdroid/fdroid/privileged/install/InstallExtension.java +++ b/F-Droid/src/org/fdroid/fdroid/privileged/install/InstallExtension.java @@ -38,7 +38,7 @@ import eu.chainfire.libsuperuser.Shell; */ abstract class InstallExtension { - protected final Context context; + final Context context; private static final String APK_FILE_NAME = "FDroidPrivileged.apk"; @@ -67,7 +67,7 @@ abstract class InstallExtension { protected abstract String getSystemFolder(); - protected void onPreInstall() { + void onPreInstall() { // To be overridden by relevant base class[es] } @@ -79,7 +79,7 @@ abstract class InstallExtension { return context.getString(R.string.system_install_installing); } - protected String getInstallPath() { + String getInstallPath() { return getSystemFolder() + APK_FILE_NAME; } @@ -95,14 +95,14 @@ abstract class InstallExtension { return commands; } - protected List getCopyToSystemCommands(String apkPath) { + List getCopyToSystemCommands(String apkPath) { final List commands = new ArrayList<>(2); commands.add("cat " + apkPath + " > " + getInstallPath() + ".tmp"); commands.add("chmod 644 " + getInstallPath() + ".tmp"); return commands; } - protected List getPostInstallCommands() { + List getPostInstallCommands() { final List commands = new ArrayList<>(1); commands.add("am start -n org.fdroid.fdroid/.privileged.install.InstallExtensionDialogActivity --ez " + InstallExtensionDialogActivity.ACTION_POST_INSTALL + " true"); @@ -121,13 +121,13 @@ abstract class InstallExtension { return commands; } - protected List getCleanUninstallCommands() { + List getCleanUninstallCommands() { final List commands = new ArrayList<>(1); commands.add("rm -f " + getInstallPath()); return commands; } - protected List getPostUninstallCommands() { + List getPostUninstallCommands() { return new ArrayList<>(0); } diff --git a/F-Droid/src/org/fdroid/fdroid/privileged/install/InstallExtensionDialogActivity.java b/F-Droid/src/org/fdroid/fdroid/privileged/install/InstallExtensionDialogActivity.java index 9d516d086..26bb0c299 100644 --- a/F-Droid/src/org/fdroid/fdroid/privileged/install/InstallExtensionDialogActivity.java +++ b/F-Droid/src/org/fdroid/fdroid/privileged/install/InstallExtensionDialogActivity.java @@ -59,7 +59,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity { public static final String ACTION_POST_INSTALL = "post_install"; public static final String ACTION_FIRST_TIME = "first_time"; - String apkFile; + private String apkFile; @Override protected void onCreate(Bundle savedInstanceState) { @@ -113,7 +113,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity { } } - public static void runFirstTime(final Context context) { + private static void runFirstTime(final Context context) { // don't do a "real" root access, just look up if "su" is present and has a version! // a real check would annoy the user AsyncTask checkRoot = new AsyncTask() { @@ -202,7 +202,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity { builder.create().show(); } - public void askBeforeInstall() { + private void askBeforeInstall() { // hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay ContextThemeWrapper theme = new ContextThemeWrapper(this, FDroidApp.getCurThemeResId()); @@ -229,7 +229,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity { /** * 1. Check for root access */ - public final AsyncTask checkRootTask = new AsyncTask() { + private final AsyncTask checkRootTask = new AsyncTask() { ProgressDialog mProgressDialog; @Override @@ -299,7 +299,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity { /** * 2. Install into system */ - final AsyncTask installTask = new AsyncTask() { + private final AsyncTask installTask = new AsyncTask() { ProgressDialog mProgressDialog; @Override @@ -413,7 +413,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity { } } - final AsyncTask uninstallTask = new AsyncTask() { + private final AsyncTask uninstallTask = new AsyncTask() { ProgressDialog mProgressDialog; @Override diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java b/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java index 64e2004e7..507e03fc7 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java +++ b/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java @@ -119,7 +119,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In * When peers are emitted by the peer finder, add them to the adapter * so that they will show up in the list of peers. */ - private Subscriber onPeerFound = new Subscriber() { + private final Subscriber onPeerFound = new Subscriber() { @Override public void onCompleted() { @@ -185,7 +185,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In onWifiNetworkChanged, new IntentFilter(WifiStateChangeService.BROADCAST)); } - private BroadcastReceiver onWifiNetworkChanged = new BroadcastReceiver() { + private final BroadcastReceiver onWifiNetworkChanged = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { uiUpdateWifiNetwork(); @@ -271,7 +271,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In /** * @see StartSwapView#onWifiSwapStateChanged */ - private BroadcastReceiver onBluetoothSwapStateChanged = new BroadcastReceiver() { + private final BroadcastReceiver onBluetoothSwapStateChanged = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.hasExtra(SwapService.EXTRA_STARTING)) {