Move some Log.i to debug logs

These don't look like they will be useful to users at all.
This commit is contained in:
Daniel Martí 2015-08-20 19:09:27 -07:00
parent c9cdc1a5dc
commit ce8c928337
17 changed files with 46 additions and 45 deletions

View File

@ -52,7 +52,7 @@ public class QrGenAsyncTask extends AsyncTask<String, Void, Void> {
qrCodeDimension = x;
else
qrCodeDimension = y;
Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
Utils.DebugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

View File

@ -616,18 +616,18 @@ public final class Utils {
}
if (startsWith != null) {
Log.i(TAG, "Cleaning up files in " + directory + " that start with \"" + startsWith + "\"");
DebugLog(TAG, "Cleaning up files in " + directory + " that start with \"" + startsWith + "\"");
}
if (endsWith != null) {
Log.i(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) {
if ((startsWith != null && f.getName().startsWith(startsWith))
|| (endsWith != null && f.getName().endsWith(endsWith))) {
if (!f.delete()) {
Log.i(TAG, "Couldn't delete cache file " + f);
Log.w(TAG, "Couldn't delete cache file " + f);
}
}
}

View File

@ -14,6 +14,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.fdroid.fdroid.Utils;
public class ApkProvider extends FDroidProvider {
private static final String TAG = "ApkProvider";
@ -427,7 +429,7 @@ public class ApkProvider extends FDroidProvider {
for (Map.Entry<String, String> repoField : REPO_FIELDS.entrySet()) {
final String field = repoField.getKey();
if (values.containsKey(field)) {
Log.i(TAG, "Cannot insert/update '" + field + "' field " +
Utils.DebugLog(TAG, "Cannot insert/update '" + field + "' field " +
"on apk table, as it belongs to the repo table. " +
"This field will be ignored.");
values.remove(field);

View File

@ -112,7 +112,7 @@ public class DBHelper extends SQLiteOpenHelper {
private void populateRepoNames(SQLiteDatabase db, int oldVersion) {
if (oldVersion < 37) {
Log.i(TAG, "Populating repo names from the url");
Utils.DebugLog(TAG, "Populating repo names from the url");
final String[] columns = { "address", "_id" };
Cursor cursor = db.query(TABLE_REPO, columns,
"name IS NULL OR name = ''", null, null, null, null);
@ -126,7 +126,7 @@ public class DBHelper extends SQLiteOpenHelper {
String name = Repo.addressToName(address);
values.put("name", name);
final String[] args = { Long.toString(id) };
Log.i(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);
cursor.moveToNext();
}
@ -255,15 +255,14 @@ public class DBHelper extends SQLiteOpenHelper {
values.put(RepoProvider.DataColumns.PRIORITY, priority);
values.put(RepoProvider.DataColumns.LAST_ETAG, (String) null);
Log.i(TAG, "Adding repository " + name);
Utils.DebugLog(TAG, "Adding repository " + name);
db.insert(TABLE_REPO, null, values);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.i(TAG, "Upgrading database from v" + oldVersion + " v"
+ newVersion);
Utils.DebugLog(TAG, "Upgrading database from v" + oldVersion + " v" + newVersion);
migrateRepoTable(db, oldVersion);
@ -407,35 +406,35 @@ public class DBHelper extends SQLiteOpenHelper {
private void addLastUpdatedToRepo(SQLiteDatabase db, int oldVersion) {
if (oldVersion < 35 && !columnExists(db, TABLE_REPO, "lastUpdated")) {
Log.i(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");
}
}
private void addIsSwapToRepo(SQLiteDatabase db, int oldVersion) {
if (oldVersion < 47 && !columnExists(db, TABLE_REPO, "isSwap")) {
Log.i(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;");
}
}
private void addChangelogToApp(SQLiteDatabase db, int oldVersion) {
if (oldVersion < 48 && !columnExists(db, TABLE_APP, "changelogURL")) {
Log.i(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");
}
}
private void addIconUrlLargeToApp(SQLiteDatabase db, int oldVersion) {
if (oldVersion < 49 && !columnExists(db, TABLE_APP, "iconUrlLarge")) {
Log.i(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");
}
}
private void updateIconUrlLarge(SQLiteDatabase db, int oldVersion) {
if (oldVersion < 50) {
Log.i(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);
clearRepoEtags(db);
}
@ -447,7 +446,7 @@ public class DBHelper extends SQLiteOpenHelper {
* they have changed since last update or not.
*/
private void clearRepoEtags(SQLiteDatabase db) {
Log.i(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");
}
@ -482,7 +481,7 @@ public class DBHelper extends SQLiteOpenHelper {
private void addAppLabelToInstalledCache(SQLiteDatabase db, int oldVersion) {
if (oldVersion < 45) {
Log.i(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, " +
"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.");

View File

@ -72,7 +72,7 @@ public class InstalledAppCacheUpdater {
}
protected void notifyProviders() {
Log.i(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(ApkProvider.getContentUri(), null);
}

View File

@ -337,7 +337,7 @@ public class RepoProvider extends FDroidProvider {
}
long id = write().insertOrThrow(getTableName(), null, values);
Log.i(TAG, "Inserted repo. Notifying provider change: '" + uri + "'.");
Utils.DebugLog(TAG, "Inserted repo. Notifying provider change: '" + uri + "'.");
getContext().getContentResolver().notifyChange(uri, null);
return getContentUri(id);
}
@ -361,7 +361,7 @@ public class RepoProvider extends FDroidProvider {
}
int rowsAffected = write().delete(getTableName(), where, whereArgs);
Log.i(TAG, "Deleted repos. Notifying provider change: '" + uri + "'.");
Utils.DebugLog(TAG, "Deleted repos. Notifying provider change: '" + uri + "'.");
getContext().getContentResolver().notifyChange(uri, null);
return rowsAffected;
}
@ -369,7 +369,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(TAG, "Updated repo. Notifying provider change: '" + uri + "'.");
Utils.DebugLog(TAG, "Updated repo. Notifying provider change: '" + uri + "'.");
getContext().getContentResolver().notifyChange(uri, null);
return numRows;
}

View File

@ -345,7 +345,7 @@ public class AppSecurityPermissions {
myPerm.mNew = newPerm;
permSet.add(myPerm);
} catch (NameNotFoundException e) {
Log.i(TAG, "Ignoring unknown permission:"+permName);
Log.i(TAG, "Ignoring unknown permission:" + permName);
}
}
}

View File

@ -260,7 +260,7 @@ public class LocalRepoManager {
Log.e(TAG, Log.getStackTraceString(e));
return;
}
Log.i(TAG, "apps.put: " + packageName);
Utils.DebugLog(TAG, "apps.put: " + packageName);
apps.put(packageName, app);
}

View File

@ -118,7 +118,7 @@ public class LocalRepoService extends Service {
private final ChangeListener localRepoHttpsChangeListener = new ChangeListener() {
@Override
public void onPreferenceChange() {
Log.i(TAG, "onPreferenceChange");
Utils.DebugLog(TAG, "onPreferenceChange");
if (localHttpd.isAlive()) {
new AsyncTask<Void, Void, Void>() {
@Override
@ -216,7 +216,7 @@ public class LocalRepoService extends Service {
webServerThreadHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
Log.i(TAG, "we've been asked to stop the webserver: " + msg.obj);
Utils.DebugLog(TAG, "we've been asked to stop the webserver: " + msg.obj);
localHttpd.stop();
}
};
@ -242,7 +242,7 @@ public class LocalRepoService extends Service {
private void stopWebServer() {
if (webServerThreadHandler == null) {
Log.i(TAG, "null handler in stopWebServer");
Utils.DebugLog(TAG, "null handler in stopWebServer");
return;
}
Message msg = webServerThreadHandler.obtainMessage();

View File

@ -230,7 +230,7 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
private void cacheIfRequired() {
if (Preferences.get().shouldCacheApks()) {
Log.i(TAG, "Copying .apk file to cache at " + potentiallyCachedFile.getAbsolutePath());
Utils.DebugLog(TAG, "Copying .apk file to cache at " + potentiallyCachedFile.getAbsolutePath());
Utils.copy(localFile, potentiallyCachedFile);
}
}

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.util.Log;
import org.fdroid.fdroid.Preferences;
import org.fdroid.fdroid.Utils;
import java.io.File;
import java.io.FileNotFoundException;
@ -78,14 +79,14 @@ public class HttpDownloader extends Downloader {
protected void doDownload() throws IOException, InterruptedException {
if (wantToCheckCache()) {
setupCacheCheck();
Log.i(TAG, "Checking cached status of " + sourceUrl);
Utils.DebugLog(TAG, "Checking cached status of " + sourceUrl);
statusCode = connection.getResponseCode();
}
if (isCached()) {
Log.i(TAG, sourceUrl + " is cached, so not downloading (HTTP " + statusCode + ")");
Utils.DebugLog(TAG, sourceUrl + " is cached, so not downloading (HTTP " + statusCode + ")");
} else {
Log.i(TAG, "Downloading from " + sourceUrl);
Utils.DebugLog(TAG, "Downloading from " + sourceUrl);
downloadFromStream();
updateCacheCheck();
}

View File

@ -6,6 +6,7 @@ import android.net.Uri;
import android.util.Log;
import android.webkit.MimeTypeMap;
import org.fdroid.fdroid.BuildConfig;
import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.Utils;
import org.fdroid.fdroid.localrepo.LocalRepoKeyStore;
@ -35,11 +36,9 @@ public class LocalHTTPD extends NanoHTTPD {
private final Context context;
private final File webRoot;
private final boolean logRequests;
public LocalHTTPD(Context context, File webRoot, boolean useHttps) {
super(FDroidApp.ipAddressString, FDroidApp.port);
this.logRequests = false;
this.webRoot = webRoot;
this.context = context.getApplicationContext();
if (useHttps)
@ -123,18 +122,18 @@ public class LocalHTTPD extends NanoHTTPD {
Map<String, String> parms = session.getParms();
String uri = session.getUri();
if (logRequests) {
Log.i(TAG, session.getMethod() + " '" + uri + "' ");
if (BuildConfig.DEBUG) {
Utils.DebugLog(TAG, session.getMethod() + " '" + uri + "' ");
Iterator<String> e = header.keySet().iterator();
while (e.hasNext()) {
String value = e.next();
Log.i(TAG, " HDR: '" + value + "' = '" + header.get(value) + "'");
Utils.DebugLog(TAG, " HDR: '" + value + "' = '" + header.get(value) + "'");
}
e = parms.keySet().iterator();
while (e.hasNext()) {
String value = e.next();
Log.i(TAG, " PRM: '" + value + "' = '" + parms.get(value) + "'");
Utils.DebugLog(TAG, " PRM: '" + value + "' = '" + parms.get(value) + "'");
}
}

View File

@ -44,7 +44,7 @@ public class WifiStateChangeService extends Service {
if (ni == null || ni.isConnected()) {
/* started on app start or from WifiStateChangeReceiver,
NetworkInfo is only passed via WifiStateChangeReceiver */
Log.i(TAG, "ni == " + ni + " wifiState == " + printWifiState(wifiState));
Utils.DebugLog(TAG, "ni == " + ni + " wifiState == " + printWifiState(wifiState));
if (wifiState == WifiManager.WIFI_STATE_ENABLED
|| wifiState == WifiManager.WIFI_STATE_DISABLING // might be switching to hotspot
|| wifiState == WifiManager.WIFI_STATE_DISABLED // might be hotspot

View File

@ -343,13 +343,13 @@ public class ManageReposActivity extends ActionBarActivity {
return;
}
switch(addRepoState) {
switch (addRepoState) {
case DOESNT_EXIST:
prepareToCreateNewRepo(url, fp);
break;
case IS_SWAP:
Log.i(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);
RepoProvider.Helper.remove(context, repo.getId());
prepareToCreateNewRepo(url, fp);
@ -529,7 +529,7 @@ public class ManageReposActivity extends ActionBarActivity {
try {
if (checkForRepository(uri)) {
Log.i(TAG, "Found F-Droid repo at " + addressWithoutIndex);
Utils.DebugLog(TAG, "Found F-Droid repo at " + addressWithoutIndex);
return addressWithoutIndex;
}
} catch (IOException e) {
@ -704,7 +704,7 @@ public class ManageReposActivity extends ActionBarActivity {
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
Uri uri = RepoProvider.allExceptSwapUri();
Log.i(TAG, "Creating repo loader '" + uri + "'.");
Utils.DebugLog(TAG, "Creating repo loader '" + uri + "'.");
final String[] projection = {
RepoProvider.DataColumns._ID,
RepoProvider.DataColumns.NAME,

View File

@ -172,7 +172,7 @@ public class RepoDetailsActivity extends ActionBarActivity {
i.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
NdefMessage msg = (NdefMessage) rawMsgs[0];
String url = new String(msg.getRecords()[0].getPayload());
Log.i(TAG, "Got this URL: " + url);
Utils.DebugLog(TAG, "Got this URL: " + url);
Toast.makeText(this, "Got this URL: " + url, Toast.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setClass(this, ManageReposActivity.class);

View File

@ -114,9 +114,9 @@ public class ConnectSwapActivity extends ActionBarActivity {
switch (statusCode) {
case UpdateService.STATUS_COMPLETE_AND_SAME:
Log.i(TAG, "STATUS_COMPLETE_AND_SAME");
Utils.DebugLog(TAG, "STATUS_COMPLETE_AND_SAME");
case UpdateService.STATUS_COMPLETE_WITH_CHANGES:
Log.i(TAG, "STATUS_COMPLETE_WITH_CHANGES");
Utils.DebugLog(TAG, "STATUS_COMPLETE_WITH_CHANGES");
Intent salIntent = new Intent(getBaseContext(), SwapAppListActivity.class);
salIntent.putExtra(SwapAppListActivity.EXTRA_REPO_ID, repo.getId());
startActivity(salIntent);

View File

@ -155,7 +155,7 @@ public class WifiQrFragment extends Fragment {
}
}
Log.i(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);