move init sequence comments to javadoc comments

By putting these comments into javadoc, they are directly describing the
code where it is, and there are many tools in IDEs for searching, viewing,
sorting, etc. javadoc comments.  Plain comments do not have those tools.
This commit is contained in:
Hans-Christoph Steiner 2016-04-14 17:02:44 -04:00
parent 972ef3b078
commit 6c47ade379
4 changed files with 22 additions and 24 deletions

View File

@ -136,6 +136,9 @@ public class FDroidApp extends Application {
}
}
/**
* Initialize the settings needed to run a local swap repo.
*/
public static void initWifiSettings() {
port = 8888;
ipAddressString = null;
@ -182,26 +185,14 @@ public class FDroidApp extends Application {
updateLanguage();
ACRA.init(this);
// Needs to be setup before anything else tries to access it.
// Perhaps the constructor is a better place, but then again,
// it is more deterministic as to when this gets called...
Preferences.setup(this);
curTheme = Preferences.get().getTheme();
// Apply the Google PRNG fixes to properly seed SecureRandom
PRNGFixes.apply();
// Check that the installed app cache hasn't gotten out of sync somehow.
// e.g. if we crashed/ran out of battery half way through responding
// to a package installed intent. It doesn't really matter where
// we put this in the bootstrap process, because it runs on a different
// thread, which will be delayed by some seconds to avoid an error where
// the database is locked due to the database updater.
InstalledAppCacheUpdater.updateInBackground(getApplicationContext());
// make sure the current proxy stuff is configured
Preferences.setup(this);
curTheme = Preferences.get().getTheme();
Preferences.get().configureProxy();
InstalledAppCacheUpdater.updateInBackground(getApplicationContext());
// If the user changes the preference to do with filtering rooted apps,
// it is easier to just notify a change in the app provider,
// so that the newly updated list will correctly filter relevant apps.
@ -278,9 +269,6 @@ public class FDroidApp extends Application {
.build();
ImageLoader.getInstance().init(config);
// TODO reintroduce PinningTrustManager and MemorizingTrustManager
// initialized the local repo information
FDroidApp.initWifiSettings();
startService(new Intent(this, WifiStateChangeService.class));
// if the HTTPS pref changes, then update all affected things

View File

@ -347,6 +347,9 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
private static Preferences instance;
/**
* Needs to be setup before anything else tries to access it.
*/
public static void setup(Context context) {
if (instance != null) {
final String error = "Attempted to reinitialize preferences after it " +

View File

@ -101,9 +101,11 @@ public class UpdateService extends IntentService implements ProgressListener {
context.startService(intent);
}
// Schedule (or cancel schedule for) this service, according to the
// current preferences. Should be called a) at boot, b) if the preference
// is changed, or c) on startup, in case we get upgraded.
/**
* Schedule or cancel this service to update the app index, according to the
* current preferences. Should be called a) at boot, b) if the preference
* is changed, or c) on startup, in case we get upgraded.
*/
public static void schedule(Context ctx) {
SharedPreferences prefs = PreferenceManager

View File

@ -51,8 +51,13 @@ public final class InstalledAppCacheUpdater {
/**
* Ensure our database of installed apps is in sync with what the PackageManager tells us is installed.
* Once completed, the relevant ContentProviders will be notified of any changes to installed statuses.
* This method returns immediately, and will continue to work in an AsyncTask.
* The installed app cache hasn't gotten out of sync somehow, e.g. if we crashed/ran out of battery
* half way through responding to a package installed {@link android.content.Intent}. Once completed,
* the relevant {@link android.content.ContentProvider}s will be notified of any changes to installed
* statuses. This method returns immediately, and will continue to work in an AsyncTask. It doesn't
* really matter where we put this in the bootstrap process, because it runs on a different thread,
* which will be delayed by some seconds to avoid an error where the database is locked due to the
* database updater.
*/
public static void updateInBackground(Context context) {
InstalledAppCacheUpdater updater = new InstalledAppCacheUpdater(context);