Logging fixes
* Make expensive Log.d calls (inside loops) only in DEBUG * Always make TAG private to make sure it doesn't use a parent's TAG
This commit is contained in:
parent
8f0488aa6a
commit
3e9aca4137
@ -37,17 +37,22 @@ public class CompatibilityChecker extends Compatibility {
|
||||
ignoreTouchscreen = prefs.getBoolean(Preferences.PREF_IGN_TOUCH, false);
|
||||
|
||||
PackageManager pm = ctx.getPackageManager();
|
||||
StringBuilder logMsg = new StringBuilder();
|
||||
logMsg.append("Available device features:");
|
||||
|
||||
features = new HashSet<>();
|
||||
if (pm != null) {
|
||||
final FeatureInfo[] featureArray = pm.getSystemAvailableFeatures();
|
||||
if (featureArray != null)
|
||||
if (featureArray != null) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
StringBuilder logMsg = new StringBuilder("Available device features:");
|
||||
for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
|
||||
logMsg.append('\n').append(fi.name);
|
||||
}
|
||||
Log.d(TAG, logMsg.toString());
|
||||
}
|
||||
for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
|
||||
features.add(fi.name);
|
||||
logMsg.append('\n');
|
||||
logMsg.append(fi.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cpuAbis = SupportedArchitectures.getAbis();
|
||||
@ -62,8 +67,6 @@ public class CompatibilityChecker extends Compatibility {
|
||||
builder.append(abi);
|
||||
}
|
||||
cpuAbisDesc = builder.toString();
|
||||
|
||||
Log.d(TAG, logMsg.toString());
|
||||
}
|
||||
|
||||
private boolean compatibleApi(Utils.CommaSeparatedList nativecode) {
|
||||
@ -96,9 +99,10 @@ public class CompatibilityChecker extends Compatibility {
|
||||
// Don't check it!
|
||||
} else if (!features.contains(feat)) {
|
||||
Collections.addAll(incompatibleReasons, feat.split(","));
|
||||
Log.d(TAG, apk.id + " vercode " + apk.vercode
|
||||
+ " is incompatible based on lack of "
|
||||
+ feat);
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, apk.id + " vercode " + apk.vercode
|
||||
+ " is incompatible based on lack of " + feat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -106,9 +110,11 @@ public class CompatibilityChecker extends Compatibility {
|
||||
for (final String code : apk.nativecode) {
|
||||
incompatibleReasons.add(code);
|
||||
}
|
||||
Log.d(TAG, apk.id + " vercode " + apk.vercode
|
||||
+ " only supports " + Utils.CommaSeparatedList.str(apk.nativecode)
|
||||
+ " while your architectures are " + cpuAbisDesc);
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, apk.id + " vercode " + apk.vercode
|
||||
+ " only supports " + Utils.CommaSeparatedList.str(apk.nativecode)
|
||||
+ " while your architectures are " + cpuAbisDesc);
|
||||
}
|
||||
}
|
||||
|
||||
return incompatibleReasons;
|
||||
|
@ -167,6 +167,8 @@ public final class PRNGFixes extends Compatibility {
|
||||
@SuppressWarnings("serial")
|
||||
public static class LinuxPRNGSecureRandom extends SecureRandomSpi {
|
||||
|
||||
private static final String TAG = "fdroid.PRNGFixes.LinuxPRNGSecureRandom";
|
||||
|
||||
/*
|
||||
* IMPLEMENTATION NOTE: Requests to generate bytes and to mix in a seed
|
||||
* are passed through to the Linux PRNG (/dev/urandom). Instances of
|
||||
@ -218,8 +220,7 @@ public final class PRNGFixes extends Compatibility {
|
||||
} catch (IOException e) {
|
||||
// On a small fraction of devices /dev/urandom is not writable.
|
||||
// Log and ignore.
|
||||
Log.w(PRNGFixes.class.getSimpleName(),
|
||||
"Failed to mix seed into " + URANDOM_FILE);
|
||||
Log.w(TAG, "Failed to mix seed into " + URANDOM_FILE);
|
||||
} finally {
|
||||
mSeeded = true;
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ import java.util.jar.JarFile;
|
||||
|
||||
public class App extends ValueObject implements Comparable<App> {
|
||||
|
||||
private static final String TAG = "fdroid.App";
|
||||
|
||||
// True if compatible with the device (i.e. if at least one apk is)
|
||||
public boolean compatible;
|
||||
public boolean includeInRepo = false;
|
||||
@ -228,7 +230,7 @@ public class App extends ValueObject implements Comparable<App> {
|
||||
PackageManager.GET_META_DATA);
|
||||
installerPackageLabel = installerAppInfo.loadLabel(pm);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.d(getClass().getCanonicalName(), e.getMessage());
|
||||
Log.d(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
if (TextUtils.isEmpty(installerPackageLabel))
|
||||
|
@ -23,7 +23,7 @@ public class RepoProvider extends FDroidProvider {
|
||||
|
||||
public static final class Helper {
|
||||
|
||||
public static final String TAG = "fdroid.RepoProvider.Helper";
|
||||
private static final String TAG = "fdroid.RepoProvider.Helper";
|
||||
|
||||
private Helper() {}
|
||||
|
||||
|
@ -40,7 +40,7 @@ abstract public class Installer {
|
||||
protected final PackageManager mPm;
|
||||
protected final InstallerCallback mCallback;
|
||||
|
||||
public static final String TAG = "fdroid.Installer";
|
||||
private static final String TAG = "fdroid.Installer";
|
||||
|
||||
/**
|
||||
* This is thrown when an Installer is not compatible with the Android OS it
|
||||
|
@ -37,6 +37,8 @@ import eu.chainfire.libsuperuser.Shell;
|
||||
*/
|
||||
public class RootInstaller extends Installer {
|
||||
|
||||
private static final String TAG = "fdroid.RootInstaller";
|
||||
|
||||
Shell.Interactive rootSession;
|
||||
|
||||
public RootInstaller(Context context, PackageManager pm, InstallerCallback callback)
|
||||
|
@ -58,6 +58,8 @@ import java.util.List;
|
||||
*/
|
||||
public class SystemInstaller extends Installer {
|
||||
|
||||
private static final String TAG = "fdroid.SystemInstaller";
|
||||
|
||||
private PackageInstallObserver mInstallObserver;
|
||||
private PackageDeleteObserver mDeleteObserver;
|
||||
private Method mInstallMethod;
|
||||
|
@ -28,7 +28,7 @@ import javax.jmdns.ServiceListener;
|
||||
|
||||
public class MDnsHelper implements ServiceListener {
|
||||
|
||||
public static final String TAG = "fdroid.MDnsHelper";
|
||||
private static final String TAG = "fdroid.MDnsHelper";
|
||||
public static final String HTTP_SERVICE_TYPE = "_http._tcp.local.";
|
||||
public static final String HTTPS_SERVICE_TYPE = "_https._tcp.local.";
|
||||
|
||||
|
@ -23,7 +23,7 @@ import org.fdroid.fdroid.data.RepoProvider;
|
||||
import org.fdroid.fdroid.views.fragments.RepoDetailsFragment;
|
||||
|
||||
public class RepoDetailsActivity extends ActionBarActivity {
|
||||
public static final String TAG = "fdroid.RepoDetailsActivity";
|
||||
private static final String TAG = "fdroid.RepoDetailsActivity";
|
||||
|
||||
private Repo repo;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user