Utils: don't capitalize method names
This commit is contained in:
parent
132eeda4a0
commit
90822e9258
@ -393,10 +393,10 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// Get the preferences we're going to use in this Activity...
|
// Get the preferences we're going to use in this Activity...
|
||||||
ConfigurationChangeHelper previousData = (ConfigurationChangeHelper)getLastCustomNonConfigurationInstance();
|
ConfigurationChangeHelper previousData = (ConfigurationChangeHelper)getLastCustomNonConfigurationInstance();
|
||||||
if (previousData != null) {
|
if (previousData != null) {
|
||||||
Utils.DebugLog(TAG, "Recreating view after configuration change.");
|
Utils.debugLog(TAG, "Recreating view after configuration change.");
|
||||||
downloadHandler = previousData.downloader;
|
downloadHandler = previousData.downloader;
|
||||||
if (downloadHandler != null) {
|
if (downloadHandler != null) {
|
||||||
Utils.DebugLog(TAG, "Download was in progress before the configuration change, so we will start to listen to its events again.");
|
Utils.debugLog(TAG, "Download was in progress before the configuration change, so we will start to listen to its events again.");
|
||||||
}
|
}
|
||||||
app = previousData.app;
|
app = previousData.app;
|
||||||
setApp(app);
|
setApp(app);
|
||||||
@ -515,7 +515,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
super.onPause();
|
super.onPause();
|
||||||
if (app != null && (app.ignoreAllUpdates != startingIgnoreAll
|
if (app != null && (app.ignoreAllUpdates != startingIgnoreAll
|
||||||
|| app.ignoreThisUpdate != startingIgnoreThis)) {
|
|| app.ignoreThisUpdate != startingIgnoreThis)) {
|
||||||
Utils.DebugLog(TAG, "Updating 'ignore updates', as it has changed since we started the activity...");
|
Utils.debugLog(TAG, "Updating 'ignore updates', as it has changed since we started the activity...");
|
||||||
setIgnoreUpdates(app.id, app.ignoreAllUpdates, app.ignoreThisUpdate);
|
setIgnoreUpdates(app.id, app.ignoreAllUpdates, app.ignoreThisUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,7 +583,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// Return true if the app was found, false otherwise.
|
// Return true if the app was found, false otherwise.
|
||||||
private boolean reset(String appId) {
|
private boolean reset(String appId) {
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Getting application details for " + appId);
|
Utils.debugLog(TAG, "Getting application details for " + appId);
|
||||||
App newApp = null;
|
App newApp = null;
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(appId)) {
|
if (!TextUtils.isEmpty(appId)) {
|
||||||
@ -989,7 +989,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// the download thread to make sure that we check for cancellations before
|
// the download thread to make sure that we check for cancellations before
|
||||||
// sending events, but it is not possible to be perfect, because the interruption
|
// sending events, but it is not possible to be perfect, because the interruption
|
||||||
// which triggers the download can happen after the check to see if
|
// which triggers the download can happen after the check to see if
|
||||||
Utils.DebugLog(TAG, "Discarding downloader event \"" + event.type + "\" as it is from an old (probably cancelled) downloader.");
|
Utils.debugLog(TAG, "Discarding downloader event \"" + event.type + "\" as it is from an old (probably cancelled) downloader.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class CompatibilityChecker extends Compatibility {
|
|||||||
for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
|
for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
|
||||||
logMsg.append('\n').append(fi.name);
|
logMsg.append('\n').append(fi.name);
|
||||||
}
|
}
|
||||||
Utils.DebugLog(TAG, logMsg.toString());
|
Utils.debugLog(TAG, logMsg.toString());
|
||||||
}
|
}
|
||||||
for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
|
for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
|
||||||
features.add(fi.name);
|
features.add(fi.name);
|
||||||
@ -101,7 +101,7 @@ public class CompatibilityChecker extends Compatibility {
|
|||||||
}
|
}
|
||||||
if (!features.contains(feat)) {
|
if (!features.contains(feat)) {
|
||||||
Collections.addAll(incompatibleReasons, feat.split(","));
|
Collections.addAll(incompatibleReasons, feat.split(","));
|
||||||
Utils.DebugLog(TAG, apk.id + " vercode " + apk.vercode
|
Utils.debugLog(TAG, apk.id + " vercode " + apk.vercode
|
||||||
+ " is incompatible based on lack of " + feat);
|
+ " is incompatible based on lack of " + feat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ public class CompatibilityChecker extends Compatibility {
|
|||||||
for (final String code : apk.nativecode) {
|
for (final String code : apk.nativecode) {
|
||||||
incompatibleReasons.add(code);
|
incompatibleReasons.add(code);
|
||||||
}
|
}
|
||||||
Utils.DebugLog(TAG, apk.id + " vercode " + apk.vercode
|
Utils.debugLog(TAG, apk.id + " vercode " + apk.vercode
|
||||||
+ " only supports " + Utils.CommaSeparatedList.str(apk.nativecode)
|
+ " only supports " + Utils.CommaSeparatedList.str(apk.nativecode)
|
||||||
+ " while your architectures are " + cpuAbisDesc);
|
+ " while your architectures are " + cpuAbisDesc);
|
||||||
}
|
}
|
||||||
|
@ -186,11 +186,11 @@ public class FDroid extends ActionBarActivity {
|
|||||||
|
|
||||||
Intent call = null;
|
Intent call = null;
|
||||||
if (!TextUtils.isEmpty(appId)) {
|
if (!TextUtils.isEmpty(appId)) {
|
||||||
Utils.DebugLog(TAG, "FDroid launched via app link for '" + appId + "'");
|
Utils.debugLog(TAG, "FDroid launched via app link for '" + appId + "'");
|
||||||
call = new Intent(this, AppDetails.class);
|
call = new Intent(this, AppDetails.class);
|
||||||
call.putExtra(AppDetails.EXTRA_APPID, appId);
|
call.putExtra(AppDetails.EXTRA_APPID, appId);
|
||||||
} else if (!TextUtils.isEmpty(query)) {
|
} else if (!TextUtils.isEmpty(query)) {
|
||||||
Utils.DebugLog(TAG, "FDroid launched via search link for '" + query + "'");
|
Utils.debugLog(TAG, "FDroid launched via search link for '" + query + "'");
|
||||||
call = new Intent(this, SearchResults.class);
|
call = new Intent(this, SearchResults.class);
|
||||||
call.setAction(Intent.ACTION_SEARCH);
|
call.setAction(Intent.ACTION_SEARCH);
|
||||||
call.putExtra(SearchManager.QUERY, query);
|
call.putExtra(SearchManager.QUERY, query);
|
||||||
|
@ -237,7 +237,7 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
Utils.DebugLog(TAG, "Invalidating preference '" + key + "'.");
|
Utils.debugLog(TAG, "Invalidating preference '" + key + "'.");
|
||||||
uninitialize(key);
|
uninitialize(key);
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -52,7 +52,7 @@ public class QrGenAsyncTask extends AsyncTask<String, Void, Void> {
|
|||||||
qrCodeDimension = x;
|
qrCodeDimension = x;
|
||||||
else
|
else
|
||||||
qrCodeDimension = y;
|
qrCodeDimension = y;
|
||||||
Utils.DebugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
|
Utils.debugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
|
||||||
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
|
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
|
||||||
Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);
|
Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public class RepoUpdater {
|
|||||||
if (downloader.isCached()) {
|
if (downloader.isCached()) {
|
||||||
// The index is unchanged since we last read it. We just mark
|
// The index is unchanged since we last read it. We just mark
|
||||||
// everything that came from this repo as being updated.
|
// everything that came from this repo as being updated.
|
||||||
Utils.DebugLog(TAG, "Repo index for " + getIndexAddress() + " is up to date (by etag)");
|
Utils.debugLog(TAG, "Repo index for " + getIndexAddress() + " is up to date (by etag)");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -194,13 +194,13 @@ public class RepoUpdater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (handler.getVersion() != -1 && handler.getVersion() != repo.version) {
|
if (handler.getVersion() != -1 && handler.getVersion() != repo.version) {
|
||||||
Utils.DebugLog(TAG, "Repo specified a new version: from "
|
Utils.debugLog(TAG, "Repo specified a new version: from "
|
||||||
+ repo.version + " to " + handler.getVersion());
|
+ repo.version + " to " + handler.getVersion());
|
||||||
values.put(RepoProvider.DataColumns.VERSION, handler.getVersion());
|
values.put(RepoProvider.DataColumns.VERSION, handler.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler.getMaxAge() != -1 && handler.getMaxAge() != repo.maxage) {
|
if (handler.getMaxAge() != -1 && handler.getMaxAge() != repo.maxage) {
|
||||||
Utils.DebugLog(TAG, "Repo specified a new maximum age - updated");
|
Utils.debugLog(TAG, "Repo specified a new maximum age - updated");
|
||||||
values.put(RepoProvider.DataColumns.MAX_AGE, handler.getMaxAge());
|
values.put(RepoProvider.DataColumns.MAX_AGE, handler.getMaxAge());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ public class RepoUpdater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (trustNewSigningCertificate) {
|
if (trustNewSigningCertificate) {
|
||||||
Utils.DebugLog(TAG, "Saving new signing certificate in the database for " + repo.address);
|
Utils.debugLog(TAG, "Saving new signing certificate in the database for " + repo.address);
|
||||||
ContentValues values = new ContentValues(2);
|
ContentValues values = new ContentValues(2);
|
||||||
values.put(RepoProvider.DataColumns.LAST_UPDATED, Utils.formatDate(new Date(), ""));
|
values.put(RepoProvider.DataColumns.LAST_UPDATED, Utils.formatDate(new Date(), ""));
|
||||||
values.put(RepoProvider.DataColumns.PUBLIC_KEY, Hasher.hex(rawCertFromJar));
|
values.put(RepoProvider.DataColumns.PUBLIC_KEY, Hasher.hex(rawCertFromJar));
|
||||||
|
@ -136,9 +136,9 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
alarm.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,
|
alarm.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,
|
||||||
SystemClock.elapsedRealtime() + 5000,
|
SystemClock.elapsedRealtime() + 5000,
|
||||||
AlarmManager.INTERVAL_HOUR, pending);
|
AlarmManager.INTERVAL_HOUR, pending);
|
||||||
Utils.DebugLog(TAG, "Update scheduler alarm set");
|
Utils.debugLog(TAG, "Update scheduler alarm set");
|
||||||
} else {
|
} else {
|
||||||
Utils.DebugLog(TAG, "Update scheduler alarm not set");
|
Utils.debugLog(TAG, "Update scheduler alarm not set");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -340,7 +340,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
|
|
||||||
// See if it's time to actually do anything yet...
|
// See if it's time to actually do anything yet...
|
||||||
if (manualUpdate) {
|
if (manualUpdate) {
|
||||||
Utils.DebugLog(TAG, "Unscheduled (manually requested) update");
|
Utils.debugLog(TAG, "Unscheduled (manually requested) update");
|
||||||
} else if (!verifyIsTimeForScheduledRun()) {
|
} else if (!verifyIsTimeForScheduledRun()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!changes) {
|
if (!changes) {
|
||||||
Utils.DebugLog(TAG, "Not checking app details or compatibility, because all repos were up to date.");
|
Utils.debugLog(TAG, "Not checking app details or compatibility, because all repos were up to date.");
|
||||||
} else {
|
} else {
|
||||||
sendStatus(STATUS_INFO, getString(R.string.status_checking_compatibility));
|
sendStatus(STATUS_INFO, getString(R.string.status_checking_compatibility));
|
||||||
|
|
||||||
@ -531,7 +531,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showAppUpdatesNotification(Cursor hasUpdates) {
|
private void showAppUpdatesNotification(Cursor hasUpdates) {
|
||||||
Utils.DebugLog(TAG, "Notifying " + hasUpdates.getCount() + " updates.");
|
Utils.debugLog(TAG, "Notifying " + hasUpdates.getCount() + " updates.");
|
||||||
|
|
||||||
final int icon = Build.VERSION.SDK_INT >= 11 ? R.drawable.ic_stat_notify_updates : R.drawable.ic_launcher;
|
final int icon = Build.VERSION.SDK_INT >= 11 ? R.drawable.ic_stat_notify_updates : R.drawable.ic_launcher;
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Updating/inserting " + operations.size() + " apps.");
|
Utils.debugLog(TAG, "Updating/inserting " + operations.size() + " apps.");
|
||||||
try {
|
try {
|
||||||
executeBatchWithStatus(AppProvider.getAuthority(), operations, currentCount, totalUpdateCount);
|
executeBatchWithStatus(AppProvider.getAuthority(), operations, currentCount, totalUpdateCount);
|
||||||
} catch (RemoteException | OperationApplicationException e) {
|
} catch (RemoteException | OperationApplicationException e) {
|
||||||
@ -666,7 +666,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Updating/inserting " + operations.size() + " apks.");
|
Utils.debugLog(TAG, "Updating/inserting " + operations.size() + " apks.");
|
||||||
try {
|
try {
|
||||||
executeBatchWithStatus(ApkProvider.getAuthority(), operations, currentCount, totalApksAppsCount);
|
executeBatchWithStatus(ApkProvider.getAuthority(), operations, currentCount, totalApksAppsCount);
|
||||||
} catch (RemoteException | OperationApplicationException e) {
|
} catch (RemoteException | OperationApplicationException e) {
|
||||||
@ -730,7 +730,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long duration = System.currentTimeMillis() - startTime;
|
long duration = System.currentTimeMillis() - startTime;
|
||||||
Utils.DebugLog(TAG, "Found " + toRemove.size() + " apks no longer in the updated repos (took " + duration + "ms)");
|
Utils.debugLog(TAG, "Found " + toRemove.size() + " apks no longer in the updated repos (took " + duration + "ms)");
|
||||||
|
|
||||||
if (toRemove.size() > 0) {
|
if (toRemove.size() > 0) {
|
||||||
ApkProvider.Helper.deleteApks(this, toRemove);
|
ApkProvider.Helper.deleteApks(this, toRemove);
|
||||||
@ -750,13 +750,13 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
for (final Repo repo : repos) {
|
for (final Repo repo : repos) {
|
||||||
Uri uri = ApkProvider.getRepoUri(repo.getId());
|
Uri uri = ApkProvider.getRepoUri(repo.getId());
|
||||||
int numDeleted = getContentResolver().delete(uri, null, null);
|
int numDeleted = getContentResolver().delete(uri, null, null);
|
||||||
Utils.DebugLog(TAG, "Removing " + numDeleted + " apks from repo " + repo.address);
|
Utils.debugLog(TAG, "Removing " + numDeleted + " apks from repo " + repo.address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeAppsWithoutApks() {
|
private void removeAppsWithoutApks() {
|
||||||
int numDeleted = getContentResolver().delete(AppProvider.getNoApksUri(), null, null);
|
int numDeleted = getContentResolver().delete(AppProvider.getNoApksUri(), null, null);
|
||||||
Utils.DebugLog(TAG, "Removing " + numDeleted + " apks that don't have any apks");
|
Utils.debugLog(TAG, "Removing " + numDeleted + " apks that don't have any apks");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -646,11 +646,11 @@ public final class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith != null) {
|
if (startsWith != null) {
|
||||||
DebugLog(TAG, "Cleaning up files in " + directory + " that start with \"" + startsWith + "\"");
|
debugLog(TAG, "Cleaning up files in " + directory + " that start with \"" + startsWith + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endsWith != null) {
|
if (endsWith != null) {
|
||||||
DebugLog(TAG, "Cleaning up files in " + directory + " that end with \"" + endsWith + "\"");
|
debugLog(TAG, "Cleaning up files in " + directory + " that end with \"" + endsWith + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (File f : files) {
|
for (File f : files) {
|
||||||
@ -663,13 +663,13 @@ public final class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DebugLog(String tag, String msg) {
|
public static void debugLog(String tag, String msg) {
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Log.d(tag, msg);
|
Log.d(tag, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DebugLog(String tag, String msg, Throwable tr) {
|
public static void debugLog(String tag, String msg, Throwable tr) {
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Log.d(tag, msg, tr);
|
Log.d(tag, msg, tr);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class FileCompat extends Compatibility {
|
|||||||
dest.getAbsolutePath()
|
dest.getAbsolutePath()
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
Utils.DebugLog(TAG, "Executing command: " + commands[0] + " " + commands[1] + " " + commands[2]);
|
Utils.debugLog(TAG, "Executing command: " + commands[0] + " " + commands[1] + " " + commands[2]);
|
||||||
Process proc = Runtime.getRuntime().exec(commands);
|
Process proc = Runtime.getRuntime().exec(commands);
|
||||||
Utils.consumeStream(proc.getInputStream());
|
Utils.consumeStream(proc.getInputStream());
|
||||||
Utils.consumeStream(proc.getErrorStream());
|
Utils.consumeStream(proc.getErrorStream());
|
||||||
@ -106,7 +106,7 @@ public class FileCompat extends Compatibility {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Utils.DebugLog(TAG, "Executing following command: " + args[0] + " " + args[1] + " " + args[2]);
|
Utils.debugLog(TAG, "Executing following command: " + args[0] + " " + args[1] + " " + args[2]);
|
||||||
Process proc = Runtime.getRuntime().exec(args);
|
Process proc = Runtime.getRuntime().exec(args);
|
||||||
Utils.consumeStream(proc.getInputStream());
|
Utils.consumeStream(proc.getInputStream());
|
||||||
Utils.consumeStream(proc.getErrorStream());
|
Utils.consumeStream(proc.getErrorStream());
|
||||||
|
@ -15,7 +15,7 @@ public class PackageManagerCompat extends Compatibility {
|
|||||||
if (!hasApi(11)) return;
|
if (!hasApi(11)) return;
|
||||||
try {
|
try {
|
||||||
mPm.setInstallerPackageName(packageName, "org.fdroid.fdroid");
|
mPm.setInstallerPackageName(packageName, "org.fdroid.fdroid");
|
||||||
Utils.DebugLog(TAG, "Installer package name for " + packageName + " set successfully");
|
Utils.debugLog(TAG, "Installer package name for " + packageName + " set successfully");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Many problems can occur:
|
// Many problems can occur:
|
||||||
// * App wasn't installed due to incompatibility
|
// * App wasn't installed due to incompatibility
|
||||||
|
@ -429,7 +429,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
for (Map.Entry<String, String> repoField : REPO_FIELDS.entrySet()) {
|
for (Map.Entry<String, String> repoField : REPO_FIELDS.entrySet()) {
|
||||||
final String field = repoField.getKey();
|
final String field = repoField.getKey();
|
||||||
if (values.containsKey(field)) {
|
if (values.containsKey(field)) {
|
||||||
Utils.DebugLog(TAG, "Cannot insert/update '" + field + "' field " +
|
Utils.debugLog(TAG, "Cannot insert/update '" + field + "' field " +
|
||||||
"on apk table, as it belongs to the repo table. " +
|
"on apk table, as it belongs to the repo table. " +
|
||||||
"This field will be ignored.");
|
"This field will be ignored.");
|
||||||
values.remove(field);
|
values.remove(field);
|
||||||
|
@ -862,7 +862,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
*/
|
*/
|
||||||
private void updateSuggestedFromUpstream() {
|
private void updateSuggestedFromUpstream() {
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Calculating suggested versions for all apps which specify an upstream version code.");
|
Utils.debugLog(TAG, "Calculating suggested versions for all apps which specify an upstream version code.");
|
||||||
|
|
||||||
final String apk = DBHelper.TABLE_APK;
|
final String apk = DBHelper.TABLE_APK;
|
||||||
final String app = DBHelper.TABLE_APP;
|
final String app = DBHelper.TABLE_APP;
|
||||||
@ -894,7 +894,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
*/
|
*/
|
||||||
private void updateCompatibleFlags() {
|
private void updateCompatibleFlags() {
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Calculating whether apps are compatible, based on whether any of their apks are compatible");
|
Utils.debugLog(TAG, "Calculating whether apps are compatible, based on whether any of their apks are compatible");
|
||||||
|
|
||||||
final String apk = DBHelper.TABLE_APK;
|
final String apk = DBHelper.TABLE_APK;
|
||||||
final String app = DBHelper.TABLE_APP;
|
final String app = DBHelper.TABLE_APP;
|
||||||
@ -938,7 +938,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
*/
|
*/
|
||||||
private void updateSuggestedFromLatest() {
|
private void updateSuggestedFromLatest() {
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Calculating suggested versions for all apps which don't specify an upstream version code.");
|
Utils.debugLog(TAG, "Calculating suggested versions for all apps which don't specify an upstream version code.");
|
||||||
|
|
||||||
final String apk = DBHelper.TABLE_APK;
|
final String apk = DBHelper.TABLE_APK;
|
||||||
final String app = DBHelper.TABLE_APP;
|
final String app = DBHelper.TABLE_APP;
|
||||||
@ -965,10 +965,10 @@ public class AppProvider extends FDroidProvider {
|
|||||||
final String iconsDir = Utils.getIconsDir(context, 1.0);
|
final String iconsDir = Utils.getIconsDir(context, 1.0);
|
||||||
final String iconsDirLarge = Utils.getIconsDir(context, 1.5);
|
final String iconsDirLarge = Utils.getIconsDir(context, 1.5);
|
||||||
String repoVersion = Integer.toString(Repo.VERSION_DENSITY_SPECIFIC_ICONS);
|
String repoVersion = Integer.toString(Repo.VERSION_DENSITY_SPECIFIC_ICONS);
|
||||||
Utils.DebugLog(TAG, "Updating icon paths for apps belonging to repos with version >= "
|
Utils.debugLog(TAG, "Updating icon paths for apps belonging to repos with version >= "
|
||||||
+ repoVersion);
|
+ repoVersion);
|
||||||
Utils.DebugLog(TAG, "Using icons dir '" + iconsDir + "'");
|
Utils.debugLog(TAG, "Using icons dir '" + iconsDir + "'");
|
||||||
Utils.DebugLog(TAG, "Using large icons dir '" + iconsDirLarge + "'");
|
Utils.debugLog(TAG, "Using large icons dir '" + iconsDirLarge + "'");
|
||||||
String query = getIconUpdateQuery();
|
String query = getIconUpdateQuery();
|
||||||
final String[] params = {
|
final String[] params = {
|
||||||
repoVersion, iconsDir, Utils.FALLBACK_ICONS_DIR,
|
repoVersion, iconsDir, Utils.FALLBACK_ICONS_DIR,
|
||||||
|
@ -112,7 +112,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
private void populateRepoNames(SQLiteDatabase db, int oldVersion) {
|
private void populateRepoNames(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 37) {
|
if (oldVersion < 37) {
|
||||||
Utils.DebugLog(TAG, "Populating repo names from the url");
|
Utils.debugLog(TAG, "Populating repo names from the url");
|
||||||
final String[] columns = { "address", "_id" };
|
final String[] columns = { "address", "_id" };
|
||||||
Cursor cursor = db.query(TABLE_REPO, columns,
|
Cursor cursor = db.query(TABLE_REPO, columns,
|
||||||
"name IS NULL OR name = ''", null, null, null, null);
|
"name IS NULL OR name = ''", null, null, null, null);
|
||||||
@ -126,7 +126,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
String name = Repo.addressToName(address);
|
String name = Repo.addressToName(address);
|
||||||
values.put("name", name);
|
values.put("name", name);
|
||||||
final String[] args = { Long.toString(id) };
|
final String[] args = { Long.toString(id) };
|
||||||
Utils.DebugLog(TAG, "Setting repo name to '" + name + "' for repo " + address);
|
Utils.debugLog(TAG, "Setting repo name to '" + name + "' for repo " + address);
|
||||||
db.update(TABLE_REPO, values, "_id = ?", args);
|
db.update(TABLE_REPO, values, "_id = ?", args);
|
||||||
cursor.moveToNext();
|
cursor.moveToNext();
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
private void renameRepoId(SQLiteDatabase db, int oldVersion) {
|
private void renameRepoId(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 36 && !columnExists(db, TABLE_REPO, "_id")) {
|
if (oldVersion < 36 && !columnExists(db, TABLE_REPO, "_id")) {
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Renaming " + TABLE_REPO + ".id to _id");
|
Utils.debugLog(TAG, "Renaming " + TABLE_REPO + ".id to _id");
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -255,14 +255,14 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
values.put(RepoProvider.DataColumns.PRIORITY, priority);
|
values.put(RepoProvider.DataColumns.PRIORITY, priority);
|
||||||
values.put(RepoProvider.DataColumns.LAST_ETAG, (String) null);
|
values.put(RepoProvider.DataColumns.LAST_ETAG, (String) null);
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Adding repository " + name);
|
Utils.debugLog(TAG, "Adding repository " + name);
|
||||||
db.insert(TABLE_REPO, null, values);
|
db.insert(TABLE_REPO, null, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Upgrading database from v" + oldVersion + " v" + newVersion);
|
Utils.debugLog(TAG, "Upgrading database from v" + oldVersion + " v" + newVersion);
|
||||||
|
|
||||||
migrateRepoTable(db, oldVersion);
|
migrateRepoTable(db, oldVersion);
|
||||||
|
|
||||||
@ -406,35 +406,35 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
private void addLastUpdatedToRepo(SQLiteDatabase db, int oldVersion) {
|
private void addLastUpdatedToRepo(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 35 && !columnExists(db, TABLE_REPO, "lastUpdated")) {
|
if (oldVersion < 35 && !columnExists(db, TABLE_REPO, "lastUpdated")) {
|
||||||
Utils.DebugLog(TAG, "Adding lastUpdated column to " + TABLE_REPO);
|
Utils.debugLog(TAG, "Adding lastUpdated column to " + TABLE_REPO);
|
||||||
db.execSQL("Alter table " + TABLE_REPO + " add column lastUpdated string");
|
db.execSQL("Alter table " + TABLE_REPO + " add column lastUpdated string");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addIsSwapToRepo(SQLiteDatabase db, int oldVersion) {
|
private void addIsSwapToRepo(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 47 && !columnExists(db, TABLE_REPO, "isSwap")) {
|
if (oldVersion < 47 && !columnExists(db, TABLE_REPO, "isSwap")) {
|
||||||
Utils.DebugLog(TAG, "Adding isSwap field to " + TABLE_REPO + " table in db.");
|
Utils.debugLog(TAG, "Adding isSwap field to " + TABLE_REPO + " table in db.");
|
||||||
db.execSQL("alter table " + TABLE_REPO + " add column isSwap boolean default 0;");
|
db.execSQL("alter table " + TABLE_REPO + " add column isSwap boolean default 0;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addChangelogToApp(SQLiteDatabase db, int oldVersion) {
|
private void addChangelogToApp(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 48 && !columnExists(db, TABLE_APP, "changelogURL")) {
|
if (oldVersion < 48 && !columnExists(db, TABLE_APP, "changelogURL")) {
|
||||||
Utils.DebugLog(TAG, "Adding changelogURL column to " + TABLE_APP);
|
Utils.debugLog(TAG, "Adding changelogURL column to " + TABLE_APP);
|
||||||
db.execSQL("alter table " + TABLE_APP + " add column changelogURL text");
|
db.execSQL("alter table " + TABLE_APP + " add column changelogURL text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addIconUrlLargeToApp(SQLiteDatabase db, int oldVersion) {
|
private void addIconUrlLargeToApp(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 49 && !columnExists(db, TABLE_APP, "iconUrlLarge")) {
|
if (oldVersion < 49 && !columnExists(db, TABLE_APP, "iconUrlLarge")) {
|
||||||
Utils.DebugLog(TAG, "Adding iconUrlLarge columns to " + TABLE_APP);
|
Utils.debugLog(TAG, "Adding iconUrlLarge columns to " + TABLE_APP);
|
||||||
db.execSQL("alter table " + TABLE_APP + " add column iconUrlLarge text");
|
db.execSQL("alter table " + TABLE_APP + " add column iconUrlLarge text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateIconUrlLarge(SQLiteDatabase db, int oldVersion) {
|
private void updateIconUrlLarge(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 50) {
|
if (oldVersion < 50) {
|
||||||
Utils.DebugLog(TAG, "Recalculating app icon URLs so that the newly added large icons will get updated.");
|
Utils.debugLog(TAG, "Recalculating app icon URLs so that the newly added large icons will get updated.");
|
||||||
AppProvider.UpgradeHelper.updateIconUrls(context, db);
|
AppProvider.UpgradeHelper.updateIconUrls(context, db);
|
||||||
clearRepoEtags(db);
|
clearRepoEtags(db);
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
* they have changed since last update or not.
|
* they have changed since last update or not.
|
||||||
*/
|
*/
|
||||||
private void clearRepoEtags(SQLiteDatabase db) {
|
private void clearRepoEtags(SQLiteDatabase db) {
|
||||||
Utils.DebugLog(TAG, "Clearing repo etags, so next update will not be skipped with \"Repos up to date\".");
|
Utils.debugLog(TAG, "Clearing repo etags, so next update will not be skipped with \"Repos up to date\".");
|
||||||
db.execSQL("update " + TABLE_REPO + " set lastetag = NULL");
|
db.execSQL("update " + TABLE_REPO + " set lastetag = NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,13 +475,13 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createInstalledApp(SQLiteDatabase db) {
|
private void createInstalledApp(SQLiteDatabase db) {
|
||||||
Utils.DebugLog(TAG, "Creating 'installed app' database table.");
|
Utils.debugLog(TAG, "Creating 'installed app' database table.");
|
||||||
db.execSQL(CREATE_TABLE_INSTALLED_APP);
|
db.execSQL(CREATE_TABLE_INSTALLED_APP);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAppLabelToInstalledCache(SQLiteDatabase db, int oldVersion) {
|
private void addAppLabelToInstalledCache(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 45) {
|
if (oldVersion < 45) {
|
||||||
Utils.DebugLog(TAG, "Adding applicationLabel to installed app table. " +
|
Utils.debugLog(TAG, "Adding applicationLabel to installed app table. " +
|
||||||
"Turns out we will need to repopulate the cache after doing this, " +
|
"Turns out we will need to repopulate the cache after doing this, " +
|
||||||
"so just dropping and recreating the table (instead of altering and adding a column). " +
|
"so just dropping and recreating the table (instead of altering and adding a column). " +
|
||||||
"This will force the entire cache to be rebuilt, including app names.");
|
"This will force the entire cache to be rebuilt, including app names.");
|
||||||
|
@ -66,13 +66,13 @@ public class InstalledAppCacheUpdater {
|
|||||||
updateCache();
|
updateCache();
|
||||||
|
|
||||||
long duration = System.currentTimeMillis() - startTime;
|
long duration = System.currentTimeMillis() - startTime;
|
||||||
Utils.DebugLog(TAG, "Took " + duration + "ms to compare the installed app cache with PackageManager.");
|
Utils.debugLog(TAG, "Took " + duration + "ms to compare the installed app cache with PackageManager.");
|
||||||
|
|
||||||
return hasChanged();
|
return hasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void notifyProviders() {
|
protected void notifyProviders() {
|
||||||
Utils.DebugLog(TAG, "Installed app cache has changed, notifying content providers (so they can update the relevant views).");
|
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(AppProvider.getContentUri(), null);
|
||||||
context.getContentResolver().notifyChange(ApkProvider.getContentUri(), null);
|
context.getContentResolver().notifyChange(ApkProvider.getContentUri(), null);
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ public class InstalledAppCacheUpdater {
|
|||||||
if (ops.size() > 0) {
|
if (ops.size() > 0) {
|
||||||
try {
|
try {
|
||||||
context.getContentResolver().applyBatch(InstalledAppProvider.getAuthority(), ops);
|
context.getContentResolver().applyBatch(InstalledAppProvider.getAuthority(), ops);
|
||||||
Utils.DebugLog(TAG, "Finished executing " + ops.size() + " CRUD operations on installed app cache.");
|
Utils.debugLog(TAG, "Finished executing " + ops.size() + " CRUD operations on installed app cache.");
|
||||||
} catch (RemoteException | OperationApplicationException e) {
|
} catch (RemoteException | OperationApplicationException e) {
|
||||||
Log.e(TAG, "Error updating installed app cache: " + e);
|
Log.e(TAG, "Error updating installed app cache: " + e);
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ public class InstalledAppCacheUpdater {
|
|||||||
private List<ContentProviderOperation> insertIntoCache(List<PackageInfo> appsToInsert) {
|
private List<ContentProviderOperation> insertIntoCache(List<PackageInfo> appsToInsert) {
|
||||||
List<ContentProviderOperation> ops = new ArrayList<>(appsToInsert.size());
|
List<ContentProviderOperation> ops = new ArrayList<>(appsToInsert.size());
|
||||||
if (appsToInsert.size() > 0) {
|
if (appsToInsert.size() > 0) {
|
||||||
Utils.DebugLog(TAG, "Preparing to cache installed info for " + appsToInsert.size() + " new apps.");
|
Utils.debugLog(TAG, "Preparing to cache installed info for " + appsToInsert.size() + " new apps.");
|
||||||
Uri uri = InstalledAppProvider.getContentUri();
|
Uri uri = InstalledAppProvider.getContentUri();
|
||||||
for (PackageInfo info : appsToInsert) {
|
for (PackageInfo info : appsToInsert) {
|
||||||
ContentProviderOperation op = ContentProviderOperation.newInsert(uri)
|
ContentProviderOperation op = ContentProviderOperation.newInsert(uri)
|
||||||
@ -147,7 +147,7 @@ public class InstalledAppCacheUpdater {
|
|||||||
private List<ContentProviderOperation> deleteFromCache(List<String> appIds) {
|
private List<ContentProviderOperation> deleteFromCache(List<String> appIds) {
|
||||||
List<ContentProviderOperation> ops = new ArrayList<>(appIds.size());
|
List<ContentProviderOperation> ops = new ArrayList<>(appIds.size());
|
||||||
if (appIds.size() > 0) {
|
if (appIds.size() > 0) {
|
||||||
Utils.DebugLog(TAG, "Preparing to remove " + appIds.size() + " apps from the installed app cache.");
|
Utils.debugLog(TAG, "Preparing to remove " + appIds.size() + " apps from the installed app cache.");
|
||||||
for (final String appId : appIds) {
|
for (final String appId : appIds) {
|
||||||
Uri uri = InstalledAppProvider.getAppUri(appId);
|
Uri uri = InstalledAppProvider.getAppUri(appId);
|
||||||
ops.add(ContentProviderOperation.newDelete(uri).build());
|
ops.add(ContentProviderOperation.newDelete(uri).build());
|
||||||
|
@ -101,7 +101,7 @@ public class InstalledAppProvider extends FDroidProvider {
|
|||||||
appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
|
appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
|
||||||
return appInfo.loadLabel(pm).toString();
|
return appInfo.loadLabel(pm).toString();
|
||||||
} catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) {
|
} catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) {
|
||||||
Utils.DebugLog(TAG, "Could not get application label", e);
|
Utils.debugLog(TAG, "Could not get application label", e);
|
||||||
}
|
}
|
||||||
return packageName; // all else fails, return id
|
return packageName; // all else fails, return id
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class NewRepoConfig {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Parsing incoming intent looking for repo: " + incomingUri);
|
Utils.debugLog(TAG, "Parsing incoming intent looking for repo: " + incomingUri);
|
||||||
|
|
||||||
// scheme and host should only ever be pure ASCII aka Locale.ENGLISH
|
// scheme and host should only ever be pure ASCII aka Locale.ENGLISH
|
||||||
String scheme = uri.getScheme();
|
String scheme = uri.getScheme();
|
||||||
|
@ -186,11 +186,11 @@ public class RepoProvider extends FDroidProvider {
|
|||||||
Uri apkUri = ApkProvider.getRepoUri(repo.getId());
|
Uri apkUri = ApkProvider.getRepoUri(repo.getId());
|
||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
int apkCount = resolver.delete(apkUri, null, null);
|
int apkCount = resolver.delete(apkUri, null, null);
|
||||||
Utils.DebugLog(TAG, "Removed " + apkCount + " apks from repo " + repo.name);
|
Utils.debugLog(TAG, "Removed " + apkCount + " apks from repo " + repo.name);
|
||||||
|
|
||||||
Uri appUri = AppProvider.getNoApksUri();
|
Uri appUri = AppProvider.getNoApksUri();
|
||||||
int appCount = resolver.delete(appUri, null, null);
|
int appCount = resolver.delete(appUri, null, null);
|
||||||
Utils.DebugLog(TAG, "Removed " + appCount + " apps with no apks.");
|
Utils.debugLog(TAG, "Removed " + appCount + " apps with no apks.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int countAppsForRepo(Context context, long repoId) {
|
public static int countAppsForRepo(Context context, long repoId) {
|
||||||
@ -337,7 +337,7 @@ public class RepoProvider extends FDroidProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long id = write().insertOrThrow(getTableName(), null, values);
|
long id = write().insertOrThrow(getTableName(), null, values);
|
||||||
Utils.DebugLog(TAG, "Inserted repo. Notifying provider change: '" + uri + "'.");
|
Utils.debugLog(TAG, "Inserted repo. Notifying provider change: '" + uri + "'.");
|
||||||
getContext().getContentResolver().notifyChange(uri, null);
|
getContext().getContentResolver().notifyChange(uri, null);
|
||||||
return getContentUri(id);
|
return getContentUri(id);
|
||||||
}
|
}
|
||||||
@ -361,7 +361,7 @@ public class RepoProvider extends FDroidProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int rowsAffected = write().delete(getTableName(), where, whereArgs);
|
int rowsAffected = write().delete(getTableName(), where, whereArgs);
|
||||||
Utils.DebugLog(TAG, "Deleted repos. Notifying provider change: '" + uri + "'.");
|
Utils.debugLog(TAG, "Deleted repos. Notifying provider change: '" + uri + "'.");
|
||||||
getContext().getContentResolver().notifyChange(uri, null);
|
getContext().getContentResolver().notifyChange(uri, null);
|
||||||
return rowsAffected;
|
return rowsAffected;
|
||||||
}
|
}
|
||||||
@ -369,7 +369,7 @@ public class RepoProvider extends FDroidProvider {
|
|||||||
@Override
|
@Override
|
||||||
public int update(Uri uri, ContentValues values, String where, String[] whereArgs) {
|
public int update(Uri uri, ContentValues values, String where, String[] whereArgs) {
|
||||||
int numRows = write().update(getTableName(), values, where, whereArgs);
|
int numRows = write().update(getTableName(), values, where, whereArgs);
|
||||||
Utils.DebugLog(TAG, "Updated repo. Notifying provider change: '" + uri + "'.");
|
Utils.debugLog(TAG, "Updated repo. Notifying provider change: '" + uri + "'.");
|
||||||
getContext().getContentResolver().notifyChange(uri, null);
|
getContext().getContentResolver().notifyChange(uri, null);
|
||||||
return numRows;
|
return numRows;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ abstract public class Installer {
|
|||||||
boolean isSystemInstallerEnabled = Preferences.get().isPrivilegedInstallerEnabled();
|
boolean isSystemInstallerEnabled = Preferences.get().isPrivilegedInstallerEnabled();
|
||||||
if (isSystemInstallerEnabled) {
|
if (isSystemInstallerEnabled) {
|
||||||
if (PrivilegedInstaller.isAvailable(activity)) {
|
if (PrivilegedInstaller.isAvailable(activity)) {
|
||||||
Utils.DebugLog(TAG, "system permissions -> SystemInstaller");
|
Utils.debugLog(TAG, "system permissions -> SystemInstaller");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new PrivilegedInstaller(activity, pm, callback);
|
return new PrivilegedInstaller(activity, pm, callback);
|
||||||
@ -126,7 +126,7 @@ abstract public class Installer {
|
|||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
// Default installer on Android >= 4.0
|
// Default installer on Android >= 4.0
|
||||||
try {
|
try {
|
||||||
Utils.DebugLog(TAG, "try default installer for Android >= 4");
|
Utils.debugLog(TAG, "try default installer for Android >= 4");
|
||||||
|
|
||||||
return new DefaultSdk14Installer(activity, pm, callback);
|
return new DefaultSdk14Installer(activity, pm, callback);
|
||||||
} catch (AndroidNotCompatibleException e) {
|
} catch (AndroidNotCompatibleException e) {
|
||||||
@ -135,7 +135,7 @@ abstract public class Installer {
|
|||||||
} else {
|
} else {
|
||||||
// Default installer on Android < 4.0
|
// Default installer on Android < 4.0
|
||||||
try {
|
try {
|
||||||
Utils.DebugLog(TAG, "try default installer for Android < 4");
|
Utils.debugLog(TAG, "try default installer for Android < 4");
|
||||||
|
|
||||||
return new DefaultInstaller(activity, pm, callback);
|
return new DefaultInstaller(activity, pm, callback);
|
||||||
} catch (AndroidNotCompatibleException e) {
|
} catch (AndroidNotCompatibleException e) {
|
||||||
|
@ -184,7 +184,7 @@ public class PrivilegedInstaller extends Installer {
|
|||||||
public void handleResult(String packageName, int returnCode) throws RemoteException {
|
public void handleResult(String packageName, int returnCode) throws RemoteException {
|
||||||
// TODO: propagate other return codes?
|
// TODO: propagate other return codes?
|
||||||
if (returnCode == INSTALL_SUCCEEDED) {
|
if (returnCode == INSTALL_SUCCEEDED) {
|
||||||
Utils.DebugLog(TAG, "Install succeeded");
|
Utils.debugLog(TAG, "Install succeeded");
|
||||||
mCallback.onSuccess(InstallerCallback.OPERATION_INSTALL);
|
mCallback.onSuccess(InstallerCallback.OPERATION_INSTALL);
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Install failed with returnCode " + returnCode);
|
Log.e(TAG, "Install failed with returnCode " + returnCode);
|
||||||
@ -289,7 +289,7 @@ public class PrivilegedInstaller extends Installer {
|
|||||||
public void handleResult(String packageName, int returnCode) throws RemoteException {
|
public void handleResult(String packageName, int returnCode) throws RemoteException {
|
||||||
// TODO: propagate other return codes?
|
// TODO: propagate other return codes?
|
||||||
if (returnCode == DELETE_SUCCEEDED) {
|
if (returnCode == DELETE_SUCCEEDED) {
|
||||||
Utils.DebugLog(TAG, "Delete succeeded");
|
Utils.debugLog(TAG, "Delete succeeded");
|
||||||
|
|
||||||
mCallback.onSuccess(InstallerCallback.OPERATION_DELETE);
|
mCallback.onSuccess(InstallerCallback.OPERATION_DELETE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,16 +89,16 @@ public class LocalRepoKeyStore {
|
|||||||
try {
|
try {
|
||||||
File appKeyStoreDir = context.getDir("keystore", Context.MODE_PRIVATE);
|
File appKeyStoreDir = context.getDir("keystore", Context.MODE_PRIVATE);
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Generating LocalRepoKeyStore instance: " + appKeyStoreDir.getAbsolutePath());
|
Utils.debugLog(TAG, "Generating LocalRepoKeyStore instance: " + appKeyStoreDir.getAbsolutePath());
|
||||||
this.keyStoreFile = new File(appKeyStoreDir, "kerplapp.bks");
|
this.keyStoreFile = new File(appKeyStoreDir, "kerplapp.bks");
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Using default KeyStore type: " + KeyStore.getDefaultType());
|
Utils.debugLog(TAG, "Using default KeyStore type: " + KeyStore.getDefaultType());
|
||||||
this.keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
this.keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
|
|
||||||
if (keyStoreFile.exists()) {
|
if (keyStoreFile.exists()) {
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
try {
|
try {
|
||||||
Utils.DebugLog(TAG, "Keystore already exists, loading...");
|
Utils.debugLog(TAG, "Keystore already exists, loading...");
|
||||||
in = new FileInputStream(keyStoreFile);
|
in = new FileInputStream(keyStoreFile);
|
||||||
keyStore.load(in, "".toCharArray());
|
keyStore.load(in, "".toCharArray());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -118,7 +118,7 @@ public class LocalRepoKeyStore {
|
|||||||
// If there isn't a persisted BKS keystore on disk we need to
|
// If there isn't a persisted BKS keystore on disk we need to
|
||||||
// create a new empty keystore
|
// create a new empty keystore
|
||||||
// Init a new keystore with a blank passphrase
|
// Init a new keystore with a blank passphrase
|
||||||
Utils.DebugLog(TAG, "Keystore doesn't exist, creating...");
|
Utils.debugLog(TAG, "Keystore doesn't exist, creating...");
|
||||||
keyStore.load(null, "".toCharArray());
|
keyStore.load(null, "".toCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ public class LocalRepoManager {
|
|||||||
Log.e(TAG, "Error adding app to local repo", e);
|
Log.e(TAG, "Error adding app to local repo", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Utils.DebugLog(TAG, "apps.put: " + packageName);
|
Utils.debugLog(TAG, "apps.put: " + packageName);
|
||||||
apps.put(packageName, app);
|
apps.put(packageName, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,10 +142,10 @@ public class ApkDownloader implements AsyncDownloader.Listener {
|
|||||||
private boolean verifyOrDelete(@NonNull final File apkFile) {
|
private boolean verifyOrDelete(@NonNull final File apkFile) {
|
||||||
if (apkFile.exists()) {
|
if (apkFile.exists()) {
|
||||||
if (hashMatches(apkFile)) {
|
if (hashMatches(apkFile)) {
|
||||||
Utils.DebugLog(TAG, "Using cached apk at " + apkFile);
|
Utils.debugLog(TAG, "Using cached apk at " + apkFile);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Utils.DebugLog(TAG, "Not using cached apk at " + apkFile + "(hash doesn't match, will delete file)");
|
Utils.debugLog(TAG, "Not using cached apk at " + apkFile + "(hash doesn't match, will delete file)");
|
||||||
delete(apkFile);
|
delete(apkFile);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -192,7 +192,7 @@ public class ApkDownloader implements AsyncDownloader.Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String remoteAddress = Utils.getApkUrl(repoAddress, curApk);
|
String remoteAddress = Utils.getApkUrl(repoAddress, curApk);
|
||||||
Utils.DebugLog(TAG, "Downloading apk from " + remoteAddress + " to " + localFile);
|
Utils.debugLog(TAG, "Downloading apk from " + remoteAddress + " to " + localFile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dlWrapper = DownloaderFactory.createAsync(context, remoteAddress, localFile, app.name + " " + curApk.version, curApk.id, this);
|
dlWrapper = DownloaderFactory.createAsync(context, remoteAddress, localFile, app.name + " " + curApk.version, curApk.id, this);
|
||||||
@ -240,7 +240,7 @@ public class ApkDownloader implements AsyncDownloader.Listener {
|
|||||||
|
|
||||||
private void cacheIfRequired() {
|
private void cacheIfRequired() {
|
||||||
if (Preferences.get().shouldCacheApks()) {
|
if (Preferences.get().shouldCacheApks()) {
|
||||||
Utils.DebugLog(TAG, "Copying .apk file to cache at " + potentiallyCachedFile.getAbsolutePath());
|
Utils.debugLog(TAG, "Copying .apk file to cache at " + potentiallyCachedFile.getAbsolutePath());
|
||||||
Utils.copyQuietly(localFile, potentiallyCachedFile);
|
Utils.copyQuietly(localFile, potentiallyCachedFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ public class ApkDownloader implements AsyncDownloader.Listener {
|
|||||||
|
|
||||||
cacheIfRequired();
|
cacheIfRequired();
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Download finished: " + localFile);
|
Utils.debugLog(TAG, "Download finished: " + localFile);
|
||||||
prepareApkFileAndSendCompleteMessage();
|
prepareApkFileAndSendCompleteMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public abstract class Downloader {
|
|||||||
public abstract boolean isCached();
|
public abstract boolean isCached();
|
||||||
|
|
||||||
protected void downloadFromStream(int bufferSize) throws IOException, InterruptedException {
|
protected void downloadFromStream(int bufferSize) throws IOException, InterruptedException {
|
||||||
Utils.DebugLog(TAG, "Downloading from stream");
|
Utils.debugLog(TAG, "Downloading from stream");
|
||||||
InputStream input = null;
|
InputStream input = null;
|
||||||
try {
|
try {
|
||||||
input = getInputStream();
|
input = getInputStream();
|
||||||
@ -133,7 +133,7 @@ public abstract class Downloader {
|
|||||||
*/
|
*/
|
||||||
private void throwExceptionIfInterrupted() throws InterruptedException {
|
private void throwExceptionIfInterrupted() throws InterruptedException {
|
||||||
if (Thread.interrupted()) {
|
if (Thread.interrupted()) {
|
||||||
Utils.DebugLog(TAG, "Received interrupt, cancelling download");
|
Utils.debugLog(TAG, "Received interrupt, cancelling download");
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ public abstract class Downloader {
|
|||||||
throwExceptionIfInterrupted();
|
throwExceptionIfInterrupted();
|
||||||
|
|
||||||
if (count == -1) {
|
if (count == -1) {
|
||||||
Utils.DebugLog(TAG, "Finished downloading from stream");
|
Utils.debugLog(TAG, "Finished downloading from stream");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,14 +116,14 @@ public class HttpDownloader extends Downloader {
|
|||||||
protected void doDownload() throws IOException, InterruptedException {
|
protected void doDownload() throws IOException, InterruptedException {
|
||||||
if (wantToCheckCache()) {
|
if (wantToCheckCache()) {
|
||||||
setupCacheCheck();
|
setupCacheCheck();
|
||||||
Utils.DebugLog(TAG, "Checking cached status of " + sourceUrl);
|
Utils.debugLog(TAG, "Checking cached status of " + sourceUrl);
|
||||||
statusCode = connection.getResponseCode();
|
statusCode = connection.getResponseCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCached()) {
|
if (isCached()) {
|
||||||
Utils.DebugLog(TAG, sourceUrl + " is cached, so not downloading (HTTP " + statusCode + ")");
|
Utils.debugLog(TAG, sourceUrl + " is cached, so not downloading (HTTP " + statusCode + ")");
|
||||||
} else {
|
} else {
|
||||||
Utils.DebugLog(TAG, "Downloading from " + sourceUrl);
|
Utils.debugLog(TAG, "Downloading from " + sourceUrl);
|
||||||
downloadFromStream(4096);
|
downloadFromStream(4096);
|
||||||
updateCacheCheck();
|
updateCacheCheck();
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,8 @@ public class LocalHTTPD extends NanoHTTPD {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void requestSwap(String repo) {
|
private void requestSwap(String repo) {
|
||||||
Utils.DebugLog(TAG, "Received request to swap with " + repo);
|
Utils.debugLog(TAG, "Received request to swap with " + repo);
|
||||||
Utils.DebugLog(TAG, "Showing confirm screen to check whether that is okay with the user.");
|
Utils.debugLog(TAG, "Showing confirm screen to check whether that is okay with the user.");
|
||||||
|
|
||||||
Uri repoUri = Uri.parse(repo);
|
Uri repoUri = Uri.parse(repo);
|
||||||
Intent intent = new Intent(context, SwapWorkflowActivity.class);
|
Intent intent = new Intent(context, SwapWorkflowActivity.class);
|
||||||
@ -123,17 +123,17 @@ public class LocalHTTPD extends NanoHTTPD {
|
|||||||
String uri = session.getUri();
|
String uri = session.getUri();
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Utils.DebugLog(TAG, session.getMethod() + " '" + uri + "' ");
|
Utils.debugLog(TAG, session.getMethod() + " '" + uri + "' ");
|
||||||
|
|
||||||
Iterator<String> e = header.keySet().iterator();
|
Iterator<String> e = header.keySet().iterator();
|
||||||
while (e.hasNext()) {
|
while (e.hasNext()) {
|
||||||
String value = e.next();
|
String value = e.next();
|
||||||
Utils.DebugLog(TAG, " HDR: '" + value + "' = '" + header.get(value) + "'");
|
Utils.debugLog(TAG, " HDR: '" + value + "' = '" + header.get(value) + "'");
|
||||||
}
|
}
|
||||||
e = parms.keySet().iterator();
|
e = parms.keySet().iterator();
|
||||||
while (e.hasNext()) {
|
while (e.hasNext()) {
|
||||||
String value = e.next();
|
String value = e.next();
|
||||||
Utils.DebugLog(TAG, " PRM: '" + value + "' = '" + parms.get(value) + "'");
|
Utils.debugLog(TAG, " PRM: '" + value + "' = '" + parms.get(value) + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class WifiStateChangeService extends Service {
|
|||||||
if (ni == null || ni.isConnected()) {
|
if (ni == null || ni.isConnected()) {
|
||||||
/* started on app start or from WifiStateChangeReceiver,
|
/* started on app start or from WifiStateChangeReceiver,
|
||||||
NetworkInfo is only passed via WifiStateChangeReceiver */
|
NetworkInfo is only passed via WifiStateChangeReceiver */
|
||||||
Utils.DebugLog(TAG, "ni == " + ni + " wifiState == " + printWifiState(wifiState));
|
Utils.debugLog(TAG, "ni == " + ni + " wifiState == " + printWifiState(wifiState));
|
||||||
if (wifiState == WifiManager.WIFI_STATE_ENABLED
|
if (wifiState == WifiManager.WIFI_STATE_ENABLED
|
||||||
|| wifiState == WifiManager.WIFI_STATE_DISABLING // might be switching to hotspot
|
|| wifiState == WifiManager.WIFI_STATE_DISABLING // might be switching to hotspot
|
||||||
|| wifiState == WifiManager.WIFI_STATE_DISABLED // might be hotspot
|
|| wifiState == WifiManager.WIFI_STATE_DISABLED // might be hotspot
|
||||||
@ -101,7 +101,7 @@ public class WifiStateChangeService extends Service {
|
|||||||
if (FDroidApp.ipAddressString == null) {
|
if (FDroidApp.ipAddressString == null) {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Utils.DebugLog(TAG, "waiting for an IP address...");
|
Utils.debugLog(TAG, "waiting for an IP address...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class PackageAddedReceiver extends PackageReceiver {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean toDiscard(Intent intent) {
|
protected boolean toDiscard(Intent intent) {
|
||||||
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
||||||
Utils.DebugLog(TAG, "Discarding since this PACKAGE_ADDED is just a PACKAGE_REPLACED");
|
Utils.debugLog(TAG, "Discarding since this PACKAGE_ADDED is just a PACKAGE_REPLACED");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -44,11 +44,11 @@ public class PackageAddedReceiver extends PackageReceiver {
|
|||||||
protected void handle(Context context, String appId) {
|
protected void handle(Context context, String appId) {
|
||||||
PackageInfo info = getPackageInfo(context, appId);
|
PackageInfo info = getPackageInfo(context, appId);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
Utils.DebugLog(TAG, "Could not get package info on '" + appId + "' - skipping.");
|
Utils.debugLog(TAG, "Could not get package info on '" + appId + "' - skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Inserting installed app info for '" + appId + "' (v" + info.versionCode + ")");
|
Utils.debugLog(TAG, "Inserting installed app info for '" + appId + "' (v" + info.versionCode + ")");
|
||||||
|
|
||||||
Uri uri = InstalledAppProvider.getContentUri();
|
Uri uri = InstalledAppProvider.getContentUri();
|
||||||
ContentValues values = new ContentValues(4);
|
ContentValues values = new ContentValues(4);
|
||||||
|
@ -46,7 +46,7 @@ abstract class PackageReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Utils.DebugLog(TAG, "PackageReceiver received [action = '" + intent.getAction() + "', data = '" + intent.getData() + "']");
|
Utils.debugLog(TAG, "PackageReceiver received [action = '" + intent.getAction() + "', data = '" + intent.getData() + "']");
|
||||||
if (toDiscard(intent)) {
|
if (toDiscard(intent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class PackageRemovedReceiver extends PackageReceiver {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean toDiscard(Intent intent) {
|
protected boolean toDiscard(Intent intent) {
|
||||||
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
||||||
Utils.DebugLog(TAG, "Discarding since this PACKAGE_REMOVED is just a PACKAGE_REPLACED");
|
Utils.debugLog(TAG, "Discarding since this PACKAGE_REMOVED is just a PACKAGE_REPLACED");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -41,7 +41,7 @@ public class PackageRemovedReceiver extends PackageReceiver {
|
|||||||
@Override
|
@Override
|
||||||
protected void handle(Context context, String appId) {
|
protected void handle(Context context, String appId) {
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Removing installed app info for '" + appId + "'");
|
Utils.debugLog(TAG, "Removing installed app info for '" + appId + "'");
|
||||||
|
|
||||||
Uri uri = InstalledAppProvider.getAppUri(appId);
|
Uri uri = InstalledAppProvider.getAppUri(appId);
|
||||||
context.getContentResolver().delete(uri, null, null);
|
context.getContentResolver().delete(uri, null, null);
|
||||||
|
@ -46,11 +46,11 @@ public class PackageUpgradedReceiver extends PackageReceiver {
|
|||||||
protected void handle(Context context, String appId) {
|
protected void handle(Context context, String appId) {
|
||||||
PackageInfo info = getPackageInfo(context, appId);
|
PackageInfo info = getPackageInfo(context, appId);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
Utils.DebugLog(TAG, "Could not get package info on '" + appId + "' - skipping.");
|
Utils.debugLog(TAG, "Could not get package info on '" + appId + "' - skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Updating installed app info for '" + appId + "' to v" + info.versionCode + " (" + info.versionName + ")");
|
Utils.debugLog(TAG, "Updating installed app info for '" + appId + "' to v" + info.versionCode + " (" + info.versionName + ")");
|
||||||
|
|
||||||
Uri uri = InstalledAppProvider.getContentUri();
|
Uri uri = InstalledAppProvider.getContentUri();
|
||||||
ContentValues values = new ContentValues(4);
|
ContentValues values = new ContentValues(4);
|
||||||
|
@ -291,7 +291,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IS_SWAP:
|
case IS_SWAP:
|
||||||
Utils.DebugLog(TAG, "Removing existing swap repo " + url + " before adding new repo.");
|
Utils.debugLog(TAG, "Removing existing swap repo " + url + " before adding new repo.");
|
||||||
Repo repo = RepoProvider.Helper.findByAddress(context, url);
|
Repo repo = RepoProvider.Helper.findByAddress(context, url);
|
||||||
RepoProvider.Helper.remove(context, repo.getId());
|
RepoProvider.Helper.remove(context, repo.getId());
|
||||||
prepareToCreateNewRepo(url, fp);
|
prepareToCreateNewRepo(url, fp);
|
||||||
@ -462,7 +462,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
final String[] pathsToCheck = {"", "fdroid/repo", "repo"};
|
final String[] pathsToCheck = {"", "fdroid/repo", "repo"};
|
||||||
for (final String path : pathsToCheck) {
|
for (final String path : pathsToCheck) {
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Checking for repo at " + originalAddress + " with suffix \"" + path + "\".");
|
Utils.debugLog(TAG, "Checking for repo at " + originalAddress + " with suffix \"" + path + "\".");
|
||||||
Uri.Builder builder = Uri.parse(originalAddress).buildUpon().appendEncodedPath(path);
|
Uri.Builder builder = Uri.parse(originalAddress).buildUpon().appendEncodedPath(path);
|
||||||
final String addressWithoutIndex = builder.build().toString();
|
final String addressWithoutIndex = builder.build().toString();
|
||||||
publishProgress(addressWithoutIndex);
|
publishProgress(addressWithoutIndex);
|
||||||
@ -471,7 +471,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (checkForRepository(uri)) {
|
if (checkForRepository(uri)) {
|
||||||
Utils.DebugLog(TAG, "Found F-Droid repo at " + addressWithoutIndex);
|
Utils.debugLog(TAG, "Found F-Droid repo at " + addressWithoutIndex);
|
||||||
return addressWithoutIndex;
|
return addressWithoutIndex;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -480,7 +480,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
Utils.DebugLog(TAG, "Not checking any more repo addresses, because process was skipped.");
|
Utils.debugLog(TAG, "Not checking any more repo addresses, because process was skipped.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -581,7 +581,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Enabling existing repo: " + url);
|
Utils.debugLog(TAG, "Enabling existing repo: " + url);
|
||||||
Repo repo = RepoProvider.Helper.findByAddress(context, url);
|
Repo repo = RepoProvider.Helper.findByAddress(context, url);
|
||||||
ContentValues values = new ContentValues(2);
|
ContentValues values = new ContentValues(2);
|
||||||
values.put(RepoProvider.DataColumns.IN_USE, 1);
|
values.put(RepoProvider.DataColumns.IN_USE, 1);
|
||||||
@ -646,7 +646,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
@Override
|
@Override
|
||||||
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
||||||
Uri uri = RepoProvider.allExceptSwapUri();
|
Uri uri = RepoProvider.allExceptSwapUri();
|
||||||
Utils.DebugLog(TAG, "Creating repo loader '" + uri + "'.");
|
Utils.debugLog(TAG, "Creating repo loader '" + uri + "'.");
|
||||||
final String[] projection = {
|
final String[] projection = {
|
||||||
RepoProvider.DataColumns._ID,
|
RepoProvider.DataColumns._ID,
|
||||||
RepoProvider.DataColumns.NAME,
|
RepoProvider.DataColumns.NAME,
|
||||||
|
@ -171,7 +171,7 @@ public class RepoDetailsActivity extends ActionBarActivity {
|
|||||||
i.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
|
i.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
|
||||||
NdefMessage msg = (NdefMessage) rawMsgs[0];
|
NdefMessage msg = (NdefMessage) rawMsgs[0];
|
||||||
String url = new String(msg.getRecords()[0].getPayload());
|
String url = new String(msg.getRecords()[0].getPayload());
|
||||||
Utils.DebugLog(TAG, "Got this URL: " + url);
|
Utils.debugLog(TAG, "Got this URL: " + url);
|
||||||
Toast.makeText(this, "Got this URL: " + url, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "Got this URL: " + url, Toast.LENGTH_LONG).show();
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
intent.setClass(this, ManageReposActivity.class);
|
intent.setClass(this, ManageReposActivity.class);
|
||||||
|
@ -125,12 +125,12 @@ abstract public class AppListFragment extends ThemeableListFragment implements
|
|||||||
SharedPreferences prefs = getActivity().getPreferences(Context.MODE_PRIVATE);
|
SharedPreferences prefs = getActivity().getPreferences(Context.MODE_PRIVATE);
|
||||||
boolean hasTriedEmptyUpdate = prefs.getBoolean(TRIED_EMPTY_UPDATE, false);
|
boolean hasTriedEmptyUpdate = prefs.getBoolean(TRIED_EMPTY_UPDATE, false);
|
||||||
if (!hasTriedEmptyUpdate) {
|
if (!hasTriedEmptyUpdate) {
|
||||||
Utils.DebugLog(TAG, "Empty app list, and we haven't done an update yet. Forcing repo update.");
|
Utils.debugLog(TAG, "Empty app list, and we haven't done an update yet. Forcing repo update.");
|
||||||
prefs.edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
prefs.edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
||||||
UpdateService.updateNow(getActivity());
|
UpdateService.updateNow(getActivity());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Utils.DebugLog(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
Utils.debugLog(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ public class AvailableAppsFragment extends AppListFragment implements
|
|||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
||||||
getListView().setSelection(0);
|
getListView().setSelection(0);
|
||||||
Utils.DebugLog(TAG, "Selected category: " + categories.get(pos));
|
Utils.debugLog(TAG, "Selected category: " + categories.get(pos));
|
||||||
setCurrentCategory(categories.get(pos));
|
setCurrentCategory(categories.get(pos));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@ -194,7 +194,7 @@ public class AvailableAppsFragment extends AppListFragment implements
|
|||||||
|
|
||||||
private void setCurrentCategory(String category) {
|
private void setCurrentCategory(String category) {
|
||||||
currentCategory = category;
|
currentCategory = category;
|
||||||
Utils.DebugLog(TAG, "Category '" + currentCategory + "' selected.");
|
Utils.debugLog(TAG, "Category '" + currentCategory + "' selected.");
|
||||||
getLoaderManager().restartLoader(0, null, AvailableAppsFragment.this);
|
getLoaderManager().restartLoader(0, null, AvailableAppsFragment.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class SearchResultsFragment extends ListFragment implements LoaderManager
|
|||||||
headerText = getString(R.string.searchres_napps, count, query);
|
headerText = getString(R.string.searchres_napps, count, query);
|
||||||
}
|
}
|
||||||
tv.setText(headerText);
|
tv.setText(headerText);
|
||||||
Utils.DebugLog(TAG, "Search for '" + query + "' returned " + count + " results");
|
Utils.debugLog(TAG, "Search for '" + query + "' returned " + count + " results");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -160,7 +160,7 @@ public class WifiQrView extends ScrollView implements SwapWorkflowActivity.Inner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.DebugLog(TAG, "Encoded swap URI in QR Code: " + qrUriString);
|
Utils.debugLog(TAG, "Encoded swap URI in QR Code: " + qrUriString);
|
||||||
|
|
||||||
new QrGenAsyncTask(getActivity(), R.id.wifi_qr_code).execute(qrUriString);
|
new QrGenAsyncTask(getActivity(), R.id.wifi_qr_code).execute(qrUriString);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user