Don't inline log tags, add missing TAG constants
This commit is contained in:
parent
fdfdb0935f
commit
82f4a975bb
@ -16,6 +16,8 @@ import java.util.*;
|
||||
// find reasons why an apk may be incompatible with the user's device.
|
||||
public class CompatibilityChecker extends Compatibility {
|
||||
|
||||
private static final String TAG = "fdroid.Compatibility";
|
||||
|
||||
private Context context;
|
||||
private Set<String> features;
|
||||
private String[] cpuAbis;
|
||||
@ -54,7 +56,7 @@ public class CompatibilityChecker extends Compatibility {
|
||||
}
|
||||
cpuAbisDesc = builder.toString();
|
||||
|
||||
Log.d("FDroid", logMsg.toString());
|
||||
Log.d(TAG, logMsg.toString());
|
||||
}
|
||||
|
||||
private boolean compatibleApi(Utils.CommaSeparatedList nativecode) {
|
||||
@ -85,7 +87,7 @@ public class CompatibilityChecker extends Compatibility {
|
||||
// Don't check it!
|
||||
} else if (!features.contains(feat)) {
|
||||
Collections.addAll(incompatibleReasons, feat.split(","));
|
||||
Log.d("FDroid", apk.id + " vercode " + apk.vercode
|
||||
Log.d(TAG, apk.id + " vercode " + apk.vercode
|
||||
+ " is incompatible based on lack of "
|
||||
+ feat);
|
||||
}
|
||||
@ -95,7 +97,7 @@ public class CompatibilityChecker extends Compatibility {
|
||||
for (String code : apk.nativecode) {
|
||||
incompatibleReasons.add(code);
|
||||
}
|
||||
Log.d("FDroid", apk.id + " vercode " + apk.vercode
|
||||
Log.d(TAG, apk.id + " vercode " + apk.vercode
|
||||
+ " only supports " + Utils.CommaSeparatedList.str(apk.nativecode)
|
||||
+ " while your architectures are " + cpuAbisDesc);
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ import org.fdroid.fdroid.views.swap.SwapActivity;
|
||||
|
||||
public class FDroid extends ActionBarActivity {
|
||||
|
||||
private static final String TAG = "fdroid.FDroid";
|
||||
|
||||
public static final int REQUEST_APPDETAILS = 0;
|
||||
public static final int REQUEST_MANAGEREPOS = 1;
|
||||
public static final int REQUEST_PREFS = 2;
|
||||
@ -321,12 +323,12 @@ public class FDroid extends ActionBarActivity {
|
||||
final String TRIED_EMPTY_UPDATE = "triedEmptyUpdate";
|
||||
boolean hasTriedEmptyUpdate = getPreferences(MODE_PRIVATE).getBoolean(TRIED_EMPTY_UPDATE, false);
|
||||
if (!hasTriedEmptyUpdate) {
|
||||
Log.d("FDroid", "Empty app list, and we haven't done an update yet. Forcing repo update.");
|
||||
Log.d(TAG, "Empty app list, and we haven't done an update yet. Forcing repo update.");
|
||||
getPreferences(MODE_PRIVATE).edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
||||
updateRepos();
|
||||
return true;
|
||||
} else {
|
||||
Log.d("FDroid", "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
||||
Log.d(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,12 @@ import org.fdroid.fdroid.data.InstalledAppProvider;
|
||||
|
||||
public class PackageAddedReceiver extends PackageReceiver {
|
||||
|
||||
private static final String TAG = "fdroid.PackageAddedReceiver";
|
||||
|
||||
@Override
|
||||
protected boolean toDiscard(Intent intent) {
|
||||
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
||||
Log.d("FDroid", "Discarding since this PACKAGE_ADDED is just a PACKAGE_REPLACED");
|
||||
Log.d(TAG, "Discarding since this PACKAGE_ADDED is just a PACKAGE_REPLACED");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -41,7 +43,7 @@ public class PackageAddedReceiver extends PackageReceiver {
|
||||
protected void handle(Context context, String appId) {
|
||||
PackageInfo info = getPackageInfo(context, appId);
|
||||
|
||||
Log.d("FDroid", "Inserting installed app info for '" + appId + "' (v" + info.versionCode + ")");
|
||||
Log.d(TAG, "Inserting installed app info for '" + appId + "' (v" + info.versionCode + ")");
|
||||
|
||||
Uri uri = InstalledAppProvider.getContentUri();
|
||||
ContentValues values = new ContentValues(4);
|
||||
|
@ -29,6 +29,8 @@ import org.fdroid.fdroid.data.AppProvider;
|
||||
|
||||
abstract class PackageReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "fdroid.PackageReceiver";
|
||||
|
||||
abstract protected boolean toDiscard(Intent intent);
|
||||
abstract protected void handle(Context context, String appId);
|
||||
|
||||
@ -43,7 +45,7 @@ abstract class PackageReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d("FDroid", "PackageReceiver received [action = '" + intent.getAction() + "', data = '" + intent.getData() + "']");
|
||||
Log.d(TAG, "PackageReceiver received [action = '" + intent.getAction() + "', data = '" + intent.getData() + "']");
|
||||
if (toDiscard(intent)) {
|
||||
return;
|
||||
}
|
||||
|
@ -26,10 +26,12 @@ import org.fdroid.fdroid.data.InstalledAppProvider;
|
||||
|
||||
public class PackageRemovedReceiver extends PackageReceiver {
|
||||
|
||||
private static final String TAG = "fdroid.PackageRemovedReceiver";
|
||||
|
||||
@Override
|
||||
protected boolean toDiscard(Intent intent) {
|
||||
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
||||
Log.d("FDroid", "Discarding since this PACKAGE_REMOVED is just a PACKAGE_REPLACED");
|
||||
Log.d(TAG, "Discarding since this PACKAGE_REMOVED is just a PACKAGE_REPLACED");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -38,7 +40,7 @@ public class PackageRemovedReceiver extends PackageReceiver {
|
||||
@Override
|
||||
protected void handle(Context context, String appId) {
|
||||
|
||||
Log.d("FDroid", "Removing installed app info for '" + appId + "'");
|
||||
Log.d(TAG, "Removing installed app info for '" + appId + "'");
|
||||
|
||||
Uri uri = InstalledAppProvider.getAppUri(appId);
|
||||
context.getContentResolver().delete(uri, null, null);
|
||||
|
@ -35,6 +35,8 @@ import org.fdroid.fdroid.data.InstalledAppProvider;
|
||||
*/
|
||||
public class PackageUpgradedReceiver extends PackageReceiver {
|
||||
|
||||
private static final String TAG = "fdroid.PackageUpgradedReceiver";
|
||||
|
||||
@Override
|
||||
protected boolean toDiscard(Intent intent) {
|
||||
return false;
|
||||
@ -44,7 +46,7 @@ public class PackageUpgradedReceiver extends PackageReceiver {
|
||||
protected void handle(Context context, String appId) {
|
||||
PackageInfo info = getPackageInfo(context, appId);
|
||||
|
||||
Log.d("FDroid", "Updating installed app info for '" + appId + "' to v" + info.versionCode + " (" + info.versionName + ")");
|
||||
Log.d(TAG, "Updating installed app info for '" + appId + "' to v" + info.versionCode + " (" + info.versionName + ")");
|
||||
|
||||
Uri uri = InstalledAppProvider.getContentUri();
|
||||
ContentValues values = new ContentValues(4);
|
||||
|
@ -23,6 +23,8 @@ import java.util.Random;
|
||||
*/
|
||||
public class Preferences implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private static final String TAG = "fdroid.Preferences";
|
||||
|
||||
private final SharedPreferences preferences;
|
||||
|
||||
private Preferences(Context context) {
|
||||
@ -221,7 +223,7 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
Log.d("FDroid", "Invalidating preference '" + key + "'.");
|
||||
Log.d(TAG, "Invalidating preference '" + key + "'.");
|
||||
uninitialize(key);
|
||||
|
||||
if (key.equals(PREF_COMPACT_LAYOUT)) {
|
||||
@ -293,7 +295,7 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
if (instance != null) {
|
||||
String error = "Attempted to reinitialize preferences after it " +
|
||||
"has already been initialized in FDroidApp";
|
||||
Log.e("FDroid", error);
|
||||
Log.e(TAG, error);
|
||||
throw new RuntimeException(error);
|
||||
}
|
||||
instance = new Preferences(context);
|
||||
@ -303,7 +305,7 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
if (instance == null) {
|
||||
String error = "Attempted to access preferences before it " +
|
||||
"has been initialized in FDroidApp";
|
||||
Log.e("FDroid", error);
|
||||
Log.e(TAG, error);
|
||||
throw new RuntimeException(error);
|
||||
}
|
||||
return instance;
|
||||
|
@ -64,6 +64,8 @@ import java.util.Map;
|
||||
|
||||
public class UpdateService extends IntentService implements ProgressListener {
|
||||
|
||||
private static final String TAG = "fdroid.UpdateService";
|
||||
|
||||
public static final String RESULT_MESSAGE = "msg";
|
||||
public static final String RESULT_EVENT = "event";
|
||||
public static final String RESULT_REPO_ERRORS = "repoErrors";
|
||||
@ -246,9 +248,9 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
alarm.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,
|
||||
SystemClock.elapsedRealtime() + 5000,
|
||||
AlarmManager.INTERVAL_HOUR, pending);
|
||||
Log.d("FDroid", "Update scheduler alarm set");
|
||||
Log.d(TAG, "Update scheduler alarm set");
|
||||
} else {
|
||||
Log.d("FDroid", "Update scheduler alarm not set");
|
||||
Log.d(TAG, "Update scheduler alarm not set");
|
||||
}
|
||||
|
||||
}
|
||||
@ -298,12 +300,12 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
String sint = prefs.getString(Preferences.PREF_UPD_INTERVAL, "0");
|
||||
int interval = Integer.parseInt(sint);
|
||||
if (interval == 0) {
|
||||
Log.d("FDroid", "Skipping update - disabled");
|
||||
Log.d(TAG, "Skipping update - disabled");
|
||||
return false;
|
||||
}
|
||||
long elapsed = System.currentTimeMillis() - lastUpdate;
|
||||
if (elapsed < interval * 60 * 60 * 1000) {
|
||||
Log.d("FDroid", "Skipping update - done " + elapsed
|
||||
Log.d(TAG, "Skipping update - done " + elapsed
|
||||
+ "ms ago, interval is " + interval + " hours");
|
||||
return false;
|
||||
}
|
||||
@ -315,7 +317,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
NetworkInfo.State wifi = conMan.getNetworkInfo(1).getState();
|
||||
if (wifi != NetworkInfo.State.CONNECTED &&
|
||||
wifi != NetworkInfo.State.CONNECTING) {
|
||||
Log.d("FDroid", "Skipping update - wifi not available");
|
||||
Log.d(TAG, "Skipping update - wifi not available");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -334,7 +336,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
|
||||
// See if it's time to actually do anything yet...
|
||||
if (!isScheduledRun()) {
|
||||
Log.d("FDroid", "Unscheduled (manually requested) update");
|
||||
Log.d(TAG, "Unscheduled (manually requested) update");
|
||||
} else if (!verifyIsTimeForScheduledRun()) {
|
||||
return;
|
||||
}
|
||||
@ -382,13 +384,13 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
} catch (RepoUpdater.UpdateException e) {
|
||||
errorRepos.add(repo.address);
|
||||
repoErrors.add(e.getMessage());
|
||||
Log.e("FDroid", "Error updating repository " + repo.address + ": " + e.getMessage());
|
||||
Log.e("FDroid", Log.getStackTraceString(e));
|
||||
Log.e(TAG, "Error updating repository " + repo.address + ": " + e.getMessage());
|
||||
Log.e(TAG, Log.getStackTraceString(e));
|
||||
}
|
||||
}
|
||||
|
||||
if (!changes) {
|
||||
Log.d("FDroid", "Not checking app details or compatibility, because all repos were up to date.");
|
||||
Log.d(TAG, "Not checking app details or compatibility, because all repos were up to date.");
|
||||
} else {
|
||||
sendStatus(STATUS_INFO, getString(R.string.status_checking_compatibility));
|
||||
|
||||
@ -444,12 +446,12 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("FDroid",
|
||||
Log.e(TAG,
|
||||
"Exception during update processing:\n"
|
||||
+ Log.getStackTraceString(e));
|
||||
sendStatus(STATUS_ERROR_GLOBAL, e.getMessage());
|
||||
} finally {
|
||||
Log.d("FDroid", "Update took "
|
||||
Log.d(TAG, "Update took "
|
||||
+ ((System.currentTimeMillis() - startTime) / 1000)
|
||||
+ " seconds.");
|
||||
receiver = null;
|
||||
@ -489,7 +491,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
}
|
||||
|
||||
private void showAppUpdatesNotification(int updates) {
|
||||
Log.d("FDroid", "Notifying " + updates + " updates.");
|
||||
Log.d(TAG, "Notifying " + updates + " updates.");
|
||||
NotificationCompat.Builder builder =
|
||||
new NotificationCompat.Builder(this)
|
||||
.setAutoCancel(true)
|
||||
@ -595,13 +597,13 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
}
|
||||
}
|
||||
|
||||
Log.d("FDroid", "Updating/inserting " + operations.size() + " apps.");
|
||||
Log.d(TAG, "Updating/inserting " + operations.size() + " apps.");
|
||||
try {
|
||||
executeBatchWithStatus(AppProvider.getAuthority(), operations, currentCount, totalUpdateCount);
|
||||
} catch (RemoteException e) {
|
||||
Log.e("FDroid", e.getMessage());
|
||||
Log.e(TAG, e.getMessage());
|
||||
} catch (OperationApplicationException e) {
|
||||
Log.e("FDroid", e.getMessage());
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,13 +663,13 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
}
|
||||
}
|
||||
|
||||
Log.d("FDroid", "Updating/inserting " + operations.size() + " apks.");
|
||||
Log.d(TAG, "Updating/inserting " + operations.size() + " apks.");
|
||||
try {
|
||||
executeBatchWithStatus(ApkProvider.getAuthority(), operations, currentCount, totalApksAppsCount);
|
||||
} catch (RemoteException e) {
|
||||
Log.e("FDroid", e.getMessage());
|
||||
Log.e(TAG, e.getMessage());
|
||||
} catch (OperationApplicationException e) {
|
||||
Log.e("FDroid", e.getMessage());
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -727,7 +729,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
}
|
||||
|
||||
long duration = System.currentTimeMillis() - startTime;
|
||||
Log.d("FDroid", "Found " + toRemove.size() + " apks no longer in the updated repos (took " + duration + "ms)");
|
||||
Log.d(TAG, "Found " + toRemove.size() + " apks no longer in the updated repos (took " + duration + "ms)");
|
||||
|
||||
if (toRemove.size() > 0) {
|
||||
ApkProvider.Helper.deleteApks(this, toRemove);
|
||||
@ -747,13 +749,13 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
for (final Repo repo : repos) {
|
||||
Uri uri = ApkProvider.getRepoUri(repo.getId());
|
||||
int numDeleted = getContentResolver().delete(uri, null, null);
|
||||
Log.d("FDroid", "Removing " + numDeleted + " apks from repo " + repo.address);
|
||||
Log.d(TAG, "Removing " + numDeleted + " apks from repo " + repo.address);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeAppsWithoutApks() {
|
||||
int numDeleted = getContentResolver().delete(AppProvider.getNoApksUri(), null, null);
|
||||
Log.d("FDroid", "Removing " + numDeleted + " apks that don't have any apks");
|
||||
Log.d(TAG, "Removing " + numDeleted + " apks that don't have any apks");
|
||||
}
|
||||
|
||||
|
||||
|
@ -319,7 +319,7 @@ public final class Utils {
|
||||
public static String calcFingerprint(String keyHexString) {
|
||||
if (TextUtils.isEmpty(keyHexString)
|
||||
|| keyHexString.matches(".*[^a-fA-F0-9].*")) {
|
||||
Log.e("FDroid", "Signing key certificate was blank or contained a non-hex-digit!");
|
||||
Log.e(TAG, "Signing key certificate was blank or contained a non-hex-digit!");
|
||||
return null;
|
||||
} else
|
||||
return calcFingerprint(Hasher.unhex(keyHexString));
|
||||
@ -336,7 +336,7 @@ public final class Utils {
|
||||
public static String calcFingerprint(byte[] key) {
|
||||
String ret = null;
|
||||
if (key.length < 256) {
|
||||
Log.e("FDroid", "key was shorter than 256 bytes (" + key.length + "), cannot be valid!");
|
||||
Log.e(TAG, "key was shorter than 256 bytes (" + key.length + "), cannot be valid!");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
@ -351,7 +351,7 @@ public final class Utils {
|
||||
ret = formatter.toString();
|
||||
formatter.close();
|
||||
} catch (Exception e) {
|
||||
Log.w("FDroid", "Unable to get certificate fingerprint.\n"
|
||||
Log.w(TAG, "Unable to get certificate fingerprint.\n"
|
||||
+ Log.getStackTraceString(e));
|
||||
}
|
||||
return ret;
|
||||
@ -425,7 +425,7 @@ public final class Utils {
|
||||
md.reset();
|
||||
return hash;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.e("FDroid", "Device does not support " + algo + " MessageDisgest algorithm");
|
||||
Log.e(TAG, "Device does not support " + algo + " MessageDisgest algorithm");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -447,11 +447,11 @@ public final class Utils {
|
||||
byte[] mdbytes = md.digest();
|
||||
return toHexString(mdbytes);
|
||||
} catch (IOException e) {
|
||||
Log.e("FDroid", "Error reading \"" + apk.getAbsolutePath()
|
||||
Log.e(TAG, "Error reading \"" + apk.getAbsolutePath()
|
||||
+ "\" to compute " + algo + " hash.");
|
||||
return null;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.e("FDroid", "Device does not support " + algo + " MessageDisgest algorithm");
|
||||
Log.e(TAG, "Device does not support " + algo + " MessageDisgest algorithm");
|
||||
return null;
|
||||
} finally {
|
||||
closeQuietly(fis);
|
||||
|
@ -8,12 +8,14 @@ import android.util.Log;
|
||||
|
||||
public class PackageManagerCompat extends Compatibility {
|
||||
|
||||
private static final String TAG = "fdroid.PackageManagerCompat";
|
||||
|
||||
@TargetApi(11)
|
||||
public static void setInstaller(PackageManager mPm, String packageName) {
|
||||
if (!hasApi(11)) return;
|
||||
try {
|
||||
mPm.setInstallerPackageName(packageName, "org.fdroid.fdroid");
|
||||
Log.d("FDroid", "Installer package name for " +
|
||||
Log.d(TAG, "Installer package name for " +
|
||||
packageName + " set successfully");
|
||||
} catch (Exception e) {
|
||||
// Many problems can occur:
|
||||
@ -22,7 +24,7 @@ public class PackageManagerCompat extends Compatibility {
|
||||
// * Another app interfered in the process
|
||||
// * Another app already set the target's installer package
|
||||
// * ...
|
||||
Log.e("FDroid", "Could not set installer package name for " +
|
||||
Log.e(TAG, "Could not set installer package name for " +
|
||||
packageName, e);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ import java.util.*;
|
||||
|
||||
public class ApkProvider extends FDroidProvider {
|
||||
|
||||
private static final String TAG = "fdroid.ApkProvider";
|
||||
|
||||
/**
|
||||
* SQLite has a maximum of 999 parameters in a query. Each apk we add
|
||||
* requires two (id and vercode) so we can only query half of that. Then,
|
||||
@ -369,7 +371,7 @@ public class ApkProvider extends FDroidProvider {
|
||||
break;
|
||||
|
||||
default:
|
||||
Log.e("FDroid", "Invalid URI for apk content provider: " + uri);
|
||||
Log.e(TAG, "Invalid URI for apk content provider: " + uri);
|
||||
throw new UnsupportedOperationException("Invalid URI for apk content provider: " + uri);
|
||||
}
|
||||
|
||||
@ -389,7 +391,7 @@ public class ApkProvider extends FDroidProvider {
|
||||
for (Map.Entry<String,String> repoField : REPO_FIELDS.entrySet()) {
|
||||
String field = repoField.getKey();
|
||||
if (values.containsKey(field)) {
|
||||
Log.i("FDroid", "Cannot insert/update '" + field + "' field " +
|
||||
Log.i(TAG, "Cannot insert/update '" + field + "' field " +
|
||||
"on apk table, as it belongs to the repo table. " +
|
||||
"This field will be ignored.");
|
||||
values.remove(field);
|
||||
@ -437,7 +439,7 @@ public class ApkProvider extends FDroidProvider {
|
||||
throw new UnsupportedOperationException("Can't delete individual apks.");
|
||||
|
||||
default:
|
||||
Log.e("FDroid", "Invalid URI for apk content provider: " + uri);
|
||||
Log.e(TAG, "Invalid URI for apk content provider: " + uri);
|
||||
throw new UnsupportedOperationException("Invalid URI for apk content provider: " + uri);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,8 @@ import java.util.*;
|
||||
|
||||
public class AppProvider extends FDroidProvider {
|
||||
|
||||
private static final String TAG = "fdroid.AppProvider";
|
||||
|
||||
public static final int MAX_APPS_TO_QUERY = 900;
|
||||
|
||||
public static final class Helper {
|
||||
@ -610,7 +612,7 @@ public class AppProvider extends FDroidProvider {
|
||||
break;
|
||||
|
||||
default:
|
||||
Log.e("FDroid", "Invalid URI for app content provider: " + uri);
|
||||
Log.e(TAG, "Invalid URI for app content provider: " + uri);
|
||||
throw new UnsupportedOperationException("Invalid URI for app content provider: " + uri);
|
||||
}
|
||||
|
||||
@ -722,7 +724,7 @@ public class AppProvider extends FDroidProvider {
|
||||
*/
|
||||
private void updateSuggestedFromUpstream() {
|
||||
|
||||
Log.d("FDroid", "Calculating suggested versions for all apps which specify an upstream version code.");
|
||||
Log.d(TAG, "Calculating suggested versions for all apps which specify an upstream version code.");
|
||||
|
||||
final String apk = DBHelper.TABLE_APK;
|
||||
final String app = DBHelper.TABLE_APP;
|
||||
@ -754,7 +756,7 @@ public class AppProvider extends FDroidProvider {
|
||||
*/
|
||||
private void updateCompatibleFlags() {
|
||||
|
||||
Log.d("FDroid", "Calculating whether apps are compatible, based on whether any of their apks are compatible");
|
||||
Log.d(TAG, "Calculating whether apps are compatible, based on whether any of their apks are compatible");
|
||||
|
||||
final String apk = DBHelper.TABLE_APK;
|
||||
final String app = DBHelper.TABLE_APP;
|
||||
@ -798,7 +800,7 @@ public class AppProvider extends FDroidProvider {
|
||||
*/
|
||||
private void updateSuggestedFromLatest() {
|
||||
|
||||
Log.d("FDroid", "Calculating suggested versions for all apps which don't specify an upstream version code.");
|
||||
Log.d(TAG, "Calculating suggested versions for all apps which don't specify an upstream version code.");
|
||||
|
||||
final String apk = DBHelper.TABLE_APK;
|
||||
final String app = DBHelper.TABLE_APP;
|
||||
@ -818,9 +820,9 @@ public class AppProvider extends FDroidProvider {
|
||||
|
||||
private void updateIconUrls() {
|
||||
|
||||
Log.d("FDroid", "Updating icon paths for apps belonging to repos with version >= " + Repo.VERSION_DENSITY_SPECIFIC_ICONS);
|
||||
Log.d(TAG, "Updating icon paths for apps belonging to repos with version >= " + Repo.VERSION_DENSITY_SPECIFIC_ICONS);
|
||||
String iconsDir = Utils.getIconsDir(getContext());
|
||||
Log.d("FDroid", "Using icon dir '"+iconsDir+"'");
|
||||
Log.d(TAG, "Using icon dir '"+iconsDir+"'");
|
||||
String repoVersion = Integer.toString(Repo.VERSION_DENSITY_SPECIFIC_ICONS);
|
||||
String query = getIconUpdateQuery();
|
||||
String[] params = { repoVersion, iconsDir };
|
||||
|
@ -109,7 +109,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
|
||||
private void populateRepoNames(SQLiteDatabase db, int oldVersion) {
|
||||
if (oldVersion < 37) {
|
||||
Log.i("FDroid", "Populating repo names from the url");
|
||||
Log.i(TAG, "Populating repo names from the url");
|
||||
String[] columns = { "address", "_id" };
|
||||
Cursor cursor = db.query(TABLE_REPO, columns,
|
||||
"name IS NULL OR name = ''", null, null, null, null);
|
||||
@ -123,7 +123,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
String name = Repo.addressToName(address);
|
||||
values.put("name", name);
|
||||
String[] args = { Long.toString(id) };
|
||||
Log.i("FDroid", "Setting repo name to '" + name + "' for repo " + address);
|
||||
Log.i(TAG, "Setting repo name to '" + name + "' for repo " + address);
|
||||
db.update(TABLE_REPO, values, "_id = ?", args);
|
||||
cursor.moveToNext();
|
||||
}
|
||||
@ -136,7 +136,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
private void renameRepoId(SQLiteDatabase db, int oldVersion) {
|
||||
if (oldVersion < 36 && !columnExists(db, TABLE_REPO, "_id")) {
|
||||
|
||||
Log.d("FDroid", "Renaming " + TABLE_REPO + ".id to _id");
|
||||
Log.d(TAG, "Renaming " + TABLE_REPO + ".id to _id");
|
||||
db.beginTransaction();
|
||||
|
||||
try {
|
||||
@ -178,7 +178,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
db.execSQL("DROP TABLE " + tempTableName + ";");
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("FDroid", "Error renaming id to _id: " + e.getMessage());
|
||||
Log.e(TAG, "Error renaming id to _id: " + e.getMessage());
|
||||
}
|
||||
db.endTransaction();
|
||||
}
|
||||
@ -247,14 +247,14 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
values.put(RepoProvider.DataColumns.PRIORITY, priority);
|
||||
values.put(RepoProvider.DataColumns.LAST_ETAG, (String)null);
|
||||
|
||||
Log.i("FDroid", "Adding repository " + name);
|
||||
Log.i(TAG, "Adding repository " + name);
|
||||
db.insert(TABLE_REPO, null, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
|
||||
Log.i("FDroid", "Upgrading database from v" + oldVersion + " v"
|
||||
Log.i(TAG, "Upgrading database from v" + oldVersion + " v"
|
||||
+ newVersion);
|
||||
|
||||
migrateRepoTable(db, oldVersion);
|
||||
@ -395,7 +395,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
|
||||
private void addLastUpdatedToRepo(SQLiteDatabase db, int oldVersion) {
|
||||
if (oldVersion < 35 && !columnExists(db, TABLE_REPO, "lastUpdated")) {
|
||||
Log.i("FDroid", "Adding lastUpdated column to " + TABLE_REPO);
|
||||
Log.i(TAG, "Adding lastUpdated column to " + TABLE_REPO);
|
||||
db.execSQL("Alter table " + TABLE_REPO + " add column lastUpdated string");
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ import java.util.Map;
|
||||
|
||||
public class InstalledAppProvider extends FDroidProvider {
|
||||
|
||||
private static final String TAG = "fdroid.InstalledAppProvider";
|
||||
|
||||
public static class Helper {
|
||||
|
||||
/**
|
||||
@ -99,7 +101,7 @@ public class InstalledAppProvider extends FDroidProvider {
|
||||
} catch (NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NotFoundException e) {
|
||||
Log.d("InstalledAppProvider", "getApplicationLabel: " + e.getMessage());
|
||||
Log.d(TAG, "getApplicationLabel: " + e.getMessage());
|
||||
}
|
||||
return packageName; // all else fails, return id
|
||||
}
|
||||
@ -154,7 +156,7 @@ public class InstalledAppProvider extends FDroidProvider {
|
||||
|
||||
default:
|
||||
String message = "Invalid URI for installed app content provider: " + uri;
|
||||
Log.e("FDroid", message);
|
||||
Log.e(TAG, message);
|
||||
throw new UnsupportedOperationException(message);
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@ import java.util.Date;
|
||||
|
||||
public class Repo extends ValueObject {
|
||||
|
||||
private static final String TAG = "fdroid.Repo";
|
||||
|
||||
public static final int VERSION_DENSITY_SPECIFIC_ICONS = 11;
|
||||
|
||||
protected long id;
|
||||
@ -147,7 +149,7 @@ public class Repo extends ValueObject {
|
||||
try {
|
||||
lastUpdated = Utils.DATE_FORMAT.parse(dateString);
|
||||
} catch (ParseException e) {
|
||||
Log.e("FDroid", "Error parsing date " + dateString);
|
||||
Log.e(TAG, "Error parsing date " + dateString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ import java.util.List;
|
||||
|
||||
public class RepoProvider extends FDroidProvider {
|
||||
|
||||
private static final String TAG = "fdroid.RepoProvider";
|
||||
|
||||
public static final class Helper {
|
||||
|
||||
public static final String TAG = "fdroid.RepoProvider.Helper";
|
||||
@ -179,11 +181,11 @@ public class RepoProvider extends FDroidProvider {
|
||||
Uri apkUri = ApkProvider.getRepoUri(repo.getId());
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
int apkCount = resolver.delete(apkUri, null, null);
|
||||
Log.d("FDroid", "Removed " + apkCount + " apks from repo " + repo.name);
|
||||
Log.d(TAG, "Removed " + apkCount + " apks from repo " + repo.name);
|
||||
|
||||
Uri appUri = AppProvider.getNoApksUri();
|
||||
int appCount = resolver.delete(appUri, null, null);
|
||||
Log.d("Log", "Removed " + appCount + " apps with no apks.");
|
||||
Log.d(TAG, "Removed " + appCount + " apps with no apks.");
|
||||
}
|
||||
|
||||
public static int countAppsForRepo(Context context, long repoId) {
|
||||
@ -271,7 +273,7 @@ public class RepoProvider extends FDroidProvider {
|
||||
break;
|
||||
|
||||
default:
|
||||
Log.e("FDroid", "Invalid URI for repo content provider: " + uri);
|
||||
Log.e(TAG, "Invalid URI for repo content provider: " + uri);
|
||||
throw new UnsupportedOperationException("Invalid URI for repo content provider: " + uri);
|
||||
}
|
||||
|
||||
@ -313,7 +315,7 @@ public class RepoProvider extends FDroidProvider {
|
||||
}
|
||||
|
||||
long id = write().insertOrThrow(getTableName(), null, values);
|
||||
Log.i("FDroid", "Inserted repo. Notifying provider change: '" + uri + "'.");
|
||||
Log.i(TAG, "Inserted repo. Notifying provider change: '" + uri + "'.");
|
||||
getContext().getContentResolver().notifyChange(uri, null);
|
||||
return getContentUri(id);
|
||||
}
|
||||
@ -332,12 +334,12 @@ public class RepoProvider extends FDroidProvider {
|
||||
break;
|
||||
|
||||
default:
|
||||
Log.e("FDroid", "Invalid URI for repo content provider: " + uri);
|
||||
Log.e(TAG, "Invalid URI for repo content provider: " + uri);
|
||||
throw new UnsupportedOperationException("Invalid URI for repo content provider: " + uri);
|
||||
}
|
||||
|
||||
int rowsAffected = write().delete(getTableName(), where, whereArgs);
|
||||
Log.i("FDroid", "Deleted repos. Notifying provider change: '" + uri + "'.");
|
||||
Log.i(TAG, "Deleted repos. Notifying provider change: '" + uri + "'.");
|
||||
getContext().getContentResolver().notifyChange(uri, null);
|
||||
return rowsAffected;
|
||||
}
|
||||
@ -345,7 +347,7 @@ public class RepoProvider extends FDroidProvider {
|
||||
@Override
|
||||
public int update(Uri uri, ContentValues values, String where, String[] whereArgs) {
|
||||
int numRows = write().update(getTableName(), values, where, whereArgs);
|
||||
Log.i("FDroid", "Updated repo. Notifying provider change: '" + uri + "'.");
|
||||
Log.i(TAG, "Updated repo. Notifying provider change: '" + uri + "'.");
|
||||
getContext().getContentResolver().notifyChange(uri, null);
|
||||
return numRows;
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import java.util.Date;
|
||||
|
||||
abstract class ValueObject {
|
||||
|
||||
private static final String TAG = "fdroid.ValueObject";
|
||||
|
||||
protected void checkCursorPosition(Cursor cursor) throws IllegalArgumentException {
|
||||
if (cursor.getPosition() == -1) {
|
||||
throw new IllegalArgumentException(
|
||||
@ -23,7 +25,7 @@ abstract class ValueObject {
|
||||
try {
|
||||
date = Utils.DATE_FORMAT.parse(string);
|
||||
} catch (ParseException e) {
|
||||
Log.e("FDroid", "Error parsing date " + string);
|
||||
Log.e(TAG, "Error parsing date " + string);
|
||||
}
|
||||
}
|
||||
return date;
|
||||
|
@ -112,7 +112,7 @@ public class LocalRepoService extends Service {
|
||||
private ChangeListener localRepoHttpsChangeListener = new ChangeListener() {
|
||||
@Override
|
||||
public void onPreferenceChange() {
|
||||
Log.i("localRepoHttpsChangeListener", "onPreferenceChange");
|
||||
Log.i(TAG, "onPreferenceChange");
|
||||
if (localHttpd.isAlive()) {
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
|
@ -110,7 +110,7 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
||||
try {
|
||||
hasher = new Hasher(curApk.hashType, localFile);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.e("FDroid", "Error verifying hash of cached apk at " + localFile + ". " +
|
||||
Log.e(TAG, "Error verifying hash of cached apk at " + localFile + ". " +
|
||||
"I don't understand what the " + curApk.hashType + " hash algorithm is :(");
|
||||
hasher = null;
|
||||
}
|
||||
@ -133,10 +133,10 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
||||
private boolean verifyOrDeleteCachedVersion() {
|
||||
if (localFile.exists()) {
|
||||
if (hashMatches()) {
|
||||
Log.d("FDroid", "Using cached apk at " + localFile);
|
||||
Log.d(TAG, "Using cached apk at " + localFile);
|
||||
return true;
|
||||
} else {
|
||||
Log.d("FDroid", "Not using cached apk at " + localFile);
|
||||
Log.d(TAG, "Not using cached apk at " + localFile);
|
||||
deleteLocalFile();
|
||||
}
|
||||
}
|
||||
@ -228,7 +228,7 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
||||
|
||||
@Override
|
||||
public void onErrorDownloading(String localisedExceptionDetails) {
|
||||
Log.e("FDroid", "Download failed: " + localisedExceptionDetails);
|
||||
Log.e(TAG, "Download failed: " + localisedExceptionDetails);
|
||||
sendError(ERROR_DOWNLOAD_FAILED);
|
||||
deleteLocalFile();
|
||||
}
|
||||
@ -248,7 +248,7 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
||||
// the installer actually installing it.
|
||||
FileCompat.setReadable(localFile, true, false);
|
||||
|
||||
Log.d("FDroid", "Download finished: " + localFile);
|
||||
Log.d(TAG, "Download finished: " + localFile);
|
||||
sendCompleteMessage();
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,8 @@ import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
abstract public class RepoUpdater {
|
||||
|
||||
private static final String TAG = "fdroid.RepoUpdater";
|
||||
|
||||
public static final String PROGRESS_TYPE_PROCESS_XML = "processingXml";
|
||||
|
||||
public static final String PROGRESS_DATA_REPO_ADDRESS = "repoAddress";
|
||||
@ -103,7 +105,7 @@ abstract public class RepoUpdater {
|
||||
if (downloader.isCached()) {
|
||||
// The index is unchanged since we last read it. We just mark
|
||||
// everything that came from this repo as being updated.
|
||||
Log.d("FDroid", "Repo index for " + getIndexAddress() + " is up to date (by etag)");
|
||||
Log.d(TAG, "Repo index for " + getIndexAddress() + " is up to date (by etag)");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
@ -207,20 +209,20 @@ abstract public class RepoUpdater {
|
||||
// next time we update, we have to download the signed index
|
||||
// in its entirety, regardless of if it contains the same
|
||||
// information as the unsigned one does not...
|
||||
Log.d("FDroid",
|
||||
Log.d(TAG,
|
||||
"Public key found - switching to signed repo for future updates");
|
||||
values.put(RepoProvider.DataColumns.PUBLIC_KEY, handler.getPubKey());
|
||||
usePubkeyInJar = false;
|
||||
}
|
||||
|
||||
if (handler.getVersion() != -1 && handler.getVersion() != repo.version) {
|
||||
Log.d("FDroid", "Repo specified a new version: from "
|
||||
Log.d(TAG, "Repo specified a new version: from "
|
||||
+ repo.version + " to " + handler.getVersion());
|
||||
values.put(RepoProvider.DataColumns.VERSION, handler.getVersion());
|
||||
}
|
||||
|
||||
if (handler.getMaxAge() != -1 && handler.getMaxAge() != repo.maxage) {
|
||||
Log.d("FDroid",
|
||||
Log.d(TAG,
|
||||
"Repo specified a new maximum age - updated");
|
||||
values.put(RepoProvider.DataColumns.MAX_AGE, handler.getMaxAge());
|
||||
}
|
||||
|
@ -8,13 +8,15 @@ import java.io.File;
|
||||
|
||||
public class UnsignedRepoUpdater extends RepoUpdater {
|
||||
|
||||
private static final String TAG = "fdroid.UnsignedRepoUpdater";
|
||||
|
||||
public UnsignedRepoUpdater(Context ctx, Repo repo) {
|
||||
super(ctx, repo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File getIndexFromFile(File file) throws UpdateException {
|
||||
Log.d("FDroid", "Getting unsigned index from " + getIndexAddress());
|
||||
Log.d(TAG, "Getting unsigned index from " + getIndexAddress());
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
||||
|
||||
private void markChangedIfRequired(Intent intent) {
|
||||
if (hasChanged()) {
|
||||
Log.i("FDroid", "Repo details have changed, prompting for update.");
|
||||
Log.i(TAG, "Repo details have changed, prompting for update.");
|
||||
intent.putExtra(REQUEST_UPDATE, true);
|
||||
}
|
||||
}
|
||||
@ -612,7 +612,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
||||
Uri uri = RepoProvider.getContentUri();
|
||||
Log.i("FDroid", "Creating repo loader '" + uri + "'.");
|
||||
Log.i(TAG, "Creating repo loader '" + uri + "'.");
|
||||
String[] projection = new String[] {
|
||||
RepoProvider.DataColumns._ID,
|
||||
RepoProvider.DataColumns.NAME,
|
||||
|
@ -30,6 +30,8 @@ abstract public class AppListFragment extends ThemeableListFragment implements
|
||||
Preferences.ChangeListener,
|
||||
LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
||||
private static final String TAG = "fdroid.AppListFragment";
|
||||
|
||||
public static final String[] APP_PROJECTION = {
|
||||
AppProvider.DataColumns._ID, // Required for cursor loader to work.
|
||||
AppProvider.DataColumns.APP_ID,
|
||||
@ -122,12 +124,12 @@ abstract public class AppListFragment extends ThemeableListFragment implements
|
||||
SharedPreferences prefs = getActivity().getPreferences(Context.MODE_PRIVATE);
|
||||
boolean hasTriedEmptyUpdate = prefs.getBoolean(TRIED_EMPTY_UPDATE, false);
|
||||
if (!hasTriedEmptyUpdate) {
|
||||
Log.d("FDroid", "Empty app list, and we haven't done an update yet. Forcing repo update.");
|
||||
Log.d(TAG, "Empty app list, and we haven't done an update yet. Forcing repo update.");
|
||||
prefs.edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
||||
UpdateService.updateNow(getActivity());
|
||||
return true;
|
||||
} else {
|
||||
Log.d("FDroid", "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
||||
Log.d(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,9 @@ import java.util.List;
|
||||
|
||||
public class AvailableAppsFragment extends AppListFragment implements
|
||||
LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
||||
private static final String TAG = "fdroid.AvailableAppsFragment";
|
||||
|
||||
public static final String PREFERENCES_FILE = "CategorySpinnerPosition";
|
||||
public static final String CATEGORY_KEY = "Selection";
|
||||
public static String DEFAULT_CATEGORY;
|
||||
@ -194,7 +197,7 @@ public class AvailableAppsFragment extends AppListFragment implements
|
||||
|
||||
private void setCurrentCategory(String category) {
|
||||
currentCategory = category;
|
||||
Log.d("FDroid", "Category '" + currentCategory + "' selected.");
|
||||
Log.d(TAG, "Category '" + currentCategory + "' selected.");
|
||||
getLoaderManager().restartLoader(0, null, AvailableAppsFragment.this);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class RepoDetailsFragment extends Fragment {
|
||||
repo = loadRepoDetails();
|
||||
|
||||
if (repo == null) {
|
||||
Log.e("FDroid", "Error showing details for repo '" + getRepoId() + "'");
|
||||
Log.e(TAG, "Error showing details for repo '" + getRepoId() + "'");
|
||||
return new LinearLayout(container.getContext());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user