Code cleanup: remove TAG in Constants.java

This commit is contained in:
Jimmy Shih
2013-10-04 11:01:23 -07:00
parent 9c938b1260
commit 39d26febc1
16 changed files with 50 additions and 49 deletions
@@ -16,7 +16,6 @@
package com.google.android.apps.mytracks;
import static android.content.Intent.ACTION_BOOT_COMPLETED;
import static com.google.android.apps.mytracks.Constants.TAG;
import com.google.android.apps.mytracks.services.TrackRecordingService;
@@ -42,6 +41,8 @@ import android.util.Log;
*/
public class BootReceiver extends BroadcastReceiver {
private static final String TAG = BootReceiver.class.getSimpleName();
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "BootReceiver.onReceive: " + intent.getAction());
@@ -57,11 +57,6 @@ public class Constants {
*/
public static final String SETTINGS_NAME = "SettingsActivity";
/**
* The log tag.
*/
public static final String TAG = "MyTracks";
/**
* Target number of track points displayed by the map overlay. We may display
* more than this number of points.
@@ -16,8 +16,6 @@
package com.google.android.apps.mytracks;
import static com.google.android.apps.mytracks.Constants.TAG;
import com.google.android.apps.mytracks.content.Waypoint;
import com.google.android.apps.mytracks.content.Waypoint.WaypointType;
import com.google.android.apps.mytracks.maps.TrackPath;
@@ -53,6 +51,8 @@ public class MapOverlay {
public static final float WAYPOINT_X_ANCHOR = 13f / 48f;
private static final String TAG = MapOverlay.class.getSimpleName();
private static final float WAYPOINT_Y_ANCHOR = 43f / 48f;
private static final float MARKER_X_ANCHOR = 50f / 96f;
private static final float MARKER_Y_ANCHOR = 90f / 96f;
@@ -16,8 +16,6 @@
package com.google.android.apps.mytracks.content;
import static com.google.android.apps.mytracks.Constants.TAG;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.database.ContentObserver;
@@ -36,6 +34,8 @@ import java.util.Set;
*/
public class DataSourceManager {
private static final String TAG = DataSourceManager.class.getSimpleName();
/**
* Observer when the tracks table is updated.
*
@@ -16,8 +16,6 @@
package com.google.android.apps.mytracks.content;
import static com.google.android.apps.mytracks.Constants.TAG;
import android.util.Log;
import java.util.EnumMap;
@@ -35,6 +33,8 @@ import java.util.Set;
*/
public class TrackDataManager {
private static final String TAG = TrackDataManager.class.getSimpleName();
// Map of listener to its track data types
private final Map<TrackDataListener, EnumSet<TrackDataType>>
listenerToTypesMap = new HashMap<TrackDataListener, EnumSet<TrackDataType>>();
@@ -15,8 +15,6 @@
*/
package com.google.android.apps.mytracks.io.backup;
import static com.google.android.apps.mytracks.Constants.TAG;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.content.TrackPointsColumns;
import com.google.android.apps.mytracks.content.TracksColumns;
@@ -52,6 +50,9 @@ import java.util.zip.ZipOutputStream;
* @author Rodrigo Damazio
*/
class ExternalFileBackup {
private static final String TAG = ExternalFileBackup.class.getSimpleName();
// Filename format - in UTC
private static final SimpleDateFormat BACKUP_FILENAME_FORMAT = new SimpleDateFormat(
"'backup-'yyyy-MM-dd_HH-mm-ss'.zip'", Locale.US);
@@ -87,7 +88,7 @@ class ExternalFileBackup {
private File getBackupsDirectory(boolean create) {
String directoryPath = FileUtils.getDirectoryPath(FileUtils.BACKUPS_DIR);
final File dir = new File(directoryPath);
Log.d(Constants.TAG, "Dir: " + dir.getAbsolutePath());
Log.d(TAG, "Dir: " + dir.getAbsolutePath());
if (create) {
// Try to create - if that fails, return null
return FileUtils.ensureDirectoryExists(dir) ? dir : null;
@@ -146,8 +147,7 @@ class ExternalFileBackup {
* Synchronously writes a backup to the given file.
*/
private void writeToFile(File outputFile) throws IOException {
Log.d(Constants.TAG,
"Writing backup to file " + outputFile.getAbsolutePath());
Log.d(TAG, "Writing backup to file " + outputFile.getAbsolutePath());
// Create all the auxiliary classes that will do the writing
PreferenceBackupHelper preferencesHelper = new PreferenceBackupHelper(context);
@@ -234,8 +234,7 @@ class ExternalFileBackup {
* Synchronously restores the backup from the given file.
*/
private void restoreFromFile(File inputFile) throws IOException {
Log.d(Constants.TAG,
"Restoring from file " + inputFile.getAbsolutePath());
Log.d(TAG, "Restoring from file " + inputFile.getAbsolutePath());
PreferenceBackupHelper preferencesHelper = new PreferenceBackupHelper(context);
ContentResolver resolver = context.getContentResolver();
@@ -35,17 +35,20 @@ import java.io.IOException;
* @author Rodrigo Damazio
*/
public class MyTracksBackupAgent extends BackupAgent {
private static final String TAG = MyTracksBackupAgent.class.getSimpleName();
private static final String PREFERENCES_ENTITY = "prefs";
@Override
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data,
ParcelFileDescriptor newState) throws IOException {
Log.i(Constants.TAG, "Performing backup");
Log.i(TAG, "Performing backup");
SharedPreferences preferences = this.getSharedPreferences(
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
backupPreferences(data, preferences);
Log.i(Constants.TAG, "Backup complete");
Log.i(TAG, "Backup complete");
}
private void backupPreferences(BackupDataOutput data,
@@ -63,18 +66,18 @@ public class MyTracksBackupAgent extends BackupAgent {
@Override
public void onRestore(BackupDataInput data, int appVersionCode,
ParcelFileDescriptor newState) throws IOException {
Log.i(Constants.TAG, "Restoring from backup");
Log.i(TAG, "Restoring from backup");
while (data.readNextHeader()) {
String key = data.getKey();
Log.d(Constants.TAG, "Restoring entity " + key);
Log.d(TAG, "Restoring entity " + key);
if (key.equals(PREFERENCES_ENTITY)) {
restorePreferences(data);
} else {
Log.e(Constants.TAG, "Found unknown backup entity: " + key);
Log.e(TAG, "Found unknown backup entity: " + key);
data.skipEntityData();
}
}
Log.i(Constants.TAG, "Done restoring from backup");
Log.i(TAG, "Done restoring from backup");
}
/**
@@ -16,7 +16,6 @@
package com.google.android.apps.mytracks.io.file.importer;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.content.DescriptionGeneratorImpl;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
import com.google.android.apps.mytracks.content.Track;
@@ -173,7 +172,7 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
long start = System.currentTimeMillis();
saxParser.parse(inputStream, this);
Log.d(Constants.TAG, "Total import time: " + (System.currentTimeMillis() - start) + "ms");
Log.d(TAG, "Total import time: " + (System.currentTimeMillis() - start) + "ms");
if (trackIds.size() != 1) {
Log.d(TAG, trackIds.size() + " tracks imported");
cleanImport();
@@ -406,7 +405,7 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
// Check for negative time change
if (timeDifference <= 0) {
Log.w(Constants.TAG, "Time difference not postive.");
Log.w(TAG, "Time difference not postive.");
} else {
/*
@@ -15,7 +15,6 @@
*/
package com.google.android.apps.mytracks.io.gdata;
import com.google.android.apps.mytracks.Constants;
import com.google.wireless.gdata.client.GDataClient;
import android.content.Context;
@@ -28,6 +27,8 @@ import android.util.Log;
*/
public class GDataClientFactory {
private static final String TAG = GDataClientFactory.class.getSimpleName();
private GDataClientFactory() { }
/**
@@ -44,7 +45,7 @@ public class GDataClientFactory {
} catch (LinkageError e) {
// On all other platforms use the client implementation packaged in the
// apk.
Log.i(Constants.TAG, "Using mytracks AndroidGDataClient.", e);
Log.i(TAG, "Using mytracks AndroidGDataClient.", e);
return new com.google.android.apps.mytracks.io.gdata.AndroidGDataClient();
}
}
@@ -16,8 +16,6 @@
package com.google.android.apps.mytracks.services;
import static com.google.android.apps.mytracks.Constants.TAG;
import com.google.android.apps.mytracks.widgets.TrackWidgetProvider;
import com.google.android.maps.mytracks.R;
import com.google.common.annotations.VisibleForTesting;
@@ -42,6 +40,8 @@ import android.util.Log;
*/
public class ControlRecordingService extends IntentService implements ServiceConnection {
private static final String TAG = ControlRecordingService.class.getSimpleName();
private ITrackRecordingService trackRecordingService;
private boolean connected = false;
@@ -16,7 +16,6 @@
package com.google.android.apps.mytracks.stats;
import static com.google.android.apps.mytracks.Constants.TAG;
import static com.google.android.apps.mytracks.services.TrackRecordingService.MAX_NO_MOVEMENT_SPEED;
import static com.google.android.apps.mytracks.services.TrackRecordingService.PAUSE_LATITUDE;
@@ -38,6 +37,8 @@ import android.util.Log;
*/
public class TripStatisticsUpdater {
private static final String TAG = TripStatisticsUpdater.class.getSimpleName();
/**
* The number of elevation readings to smooth to get a somewhat accurate
* signal.
@@ -15,7 +15,6 @@
*/
package com.google.android.apps.mytracks.util;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.services.sensors.BluetoothConnectionManager;
import android.annotation.TargetApi;
@@ -33,13 +32,15 @@ import java.io.IOException;
@TargetApi(10)
public class Api10Adapter extends Api9Adapter {
private static final String TAG = Api10Adapter.class.getSimpleName();
@Override
public BluetoothSocket getBluetoothSocket(BluetoothDevice bluetoothDevice) throws IOException {
try {
return bluetoothDevice.createInsecureRfcommSocketToServiceRecord(
BluetoothConnectionManager.MY_TRACKS_UUID);
} catch (IOException e) {
Log.d(Constants.TAG, "Unable to create insecure connection", e);
Log.d(TAG, "Unable to create insecure connection", e);
}
return bluetoothDevice.createRfcommSocketToServiceRecord(BluetoothConnectionManager.MY_TRACKS_UUID);
};
@@ -15,7 +15,6 @@
*/
package com.google.android.apps.mytracks.util;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.ContextualActionModeCallback;
import com.google.android.apps.mytracks.TrackController;
import com.google.android.apps.mytracks.services.sensors.BluetoothConnectionManager;
@@ -49,6 +48,8 @@ import java.util.List;
*/
public class Api8Adapter implements ApiAdapter {
private static final String TAG = Api8Adapter.class.getSimpleName();
@Override
public void applyPreferenceChanges(Editor editor) {
editor.commit();
@@ -85,15 +86,15 @@ public class Api8Adapter implements ApiAdapter {
insecure.setAccessible(true);
return (BluetoothSocket) insecure.invoke(bluetoothDevice, 1);
} catch (SecurityException e) {
Log.d(Constants.TAG, "Unable to create insecure connection", e);
Log.d(TAG, "Unable to create insecure connection", e);
} catch (NoSuchMethodException e) {
Log.d(Constants.TAG, "Unable to create insecure connection", e);
Log.d(TAG, "Unable to create insecure connection", e);
} catch (IllegalArgumentException e) {
Log.d(Constants.TAG, "Unable to create insecure connection", e);
Log.d(TAG, "Unable to create insecure connection", e);
} catch (IllegalAccessException e) {
Log.d(Constants.TAG, "Unable to create insecure connection", e);
Log.d(TAG, "Unable to create insecure connection", e);
} catch (InvocationTargetException e) {
Log.d(Constants.TAG, "Unable to create insecure connection", e);
Log.d(TAG, "Unable to create insecure connection", e);
}
return bluetoothDevice.createRfcommSocketToServiceRecord(BluetoothConnectionManager.MY_TRACKS_UUID);
}
@@ -15,7 +15,6 @@
*/
package com.google.android.apps.mytracks.util;
import com.google.android.apps.mytracks.Constants;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
@@ -35,6 +34,8 @@ import java.util.Arrays;
@TargetApi(9)
public class Api9Adapter extends Api8Adapter {
private static final String TAG = Api9Adapter.class.getSimpleName();
@Override
public void applyPreferenceChanges(Editor editor) {
// Apply asynchronously
@@ -43,7 +44,7 @@ public class Api9Adapter extends Api8Adapter {
@Override
public void enableStrictMode() {
Log.d(Constants.TAG, "Enabling strict mode");
Log.d(TAG, "Enabling strict mode");
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
@@ -15,7 +15,6 @@
*/
package com.google.android.apps.mytracks.util;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.content.Track;
import android.location.Location;
@@ -31,6 +30,8 @@ import java.util.Stack;
*/
public class LocationUtils {
private static final String TAG = LocationUtils.class.getSimpleName();
private static final long MAX_LOCATION_AGE_MS = 60 * 1000; // 1 minute
private LocationUtils() {}
@@ -133,7 +134,7 @@ public class LocationUtils {
}
idx++;
}
Log.d(Constants.TAG, "Decimating " + n + " points to " + i + " w/ tolerance = " + tolerance);
Log.d(TAG, "Decimating " + n + " points to " + i + " w/ tolerance = " + tolerance);
}
/**
@@ -16,8 +16,6 @@
package com.google.android.apps.mytracks.util;
import com.google.android.apps.mytracks.Constants;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
@@ -49,7 +47,7 @@ public class SystemUtils {
.getPackageInfo("com.google.android.maps.mytracks", PackageManager.GET_META_DATA);
return pi.versionName;
} catch (NameNotFoundException e) {
Log.w(Constants.TAG, "Failed to get version info.", e);
Log.w(TAG, "Failed to get version info.", e);
return "";
}
}
@@ -75,7 +73,7 @@ public class SystemUtils {
return wakeLock;
}
if (wakeLock == null) {
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Constants.TAG);
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
if (wakeLock == null) {
Log.e(TAG, "Cannot create a new wake lock.");
}