Clean up logging

This commit is contained in:
Inhishonor
2025-12-20 15:57:29 -08:00
parent b4bce2c1a9
commit 096c7e3c68
63 changed files with 174 additions and 272 deletions
@@ -31,7 +31,6 @@ import android.widget.Toast;
*/
public final class SqliteWrapper {
private static final String TAG = "SqliteWrapper";
private static final String SQLITE_EXCEPTION_DETAIL_MESSAGE
= "unable to open database file";
@@ -58,7 +57,7 @@ public final class SqliteWrapper {
try {
return resolver.query(uri, projection, selection, selectionArgs, sortOrder);
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when query: ", e);
Timber.e(e, "Catch a SQLiteException when query: ");
checkSQLiteException(context, e);
return null;
}
@@ -69,7 +68,7 @@ public final class SqliteWrapper {
try {
return cursor.requery();
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when requery: ", e);
Timber.e(e, "Catch a SQLiteException when requery: ");
checkSQLiteException(context, e);
return false;
}
@@ -80,7 +79,7 @@ public final class SqliteWrapper {
try {
return resolver.update(uri, values, where, selectionArgs);
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when update: ", e);
Timber.e(e, "Catch a SQLiteException when update: ");
checkSQLiteException(context, e);
return -1;
}
@@ -91,7 +90,7 @@ public final class SqliteWrapper {
try {
return resolver.delete(uri, where, selectionArgs);
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when delete: ", e);
Timber.e(e, "Catch a SQLiteException when delete: ");
checkSQLiteException(context, e);
return -1;
}
@@ -102,7 +101,7 @@ public final class SqliteWrapper {
try {
return resolver.insert(uri, values);
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when insert: ", e);
Timber.e(e, "Catch a SQLiteException when insert: ");
checkSQLiteException(context, e);
return null;
}
@@ -32,7 +32,6 @@ import java.util.Set;
* @hide
*/
public class LinkCapabilities implements Parcelable {
private static final String TAG = "LinkCapabilities";
private static final boolean DBG = false;
/**
@@ -30,9 +30,6 @@ import java.util.Collection;
* {@hide}
*/
public class NetworkUtilsHelper {
private static final String TAG = "NetworkUtils";
/**
* Bring the named network interface up.
*/
@@ -29,7 +29,6 @@ import timber.log.Timber;
* @hide
*/
public class LegacyVpnInfo implements Parcelable {
private static final String TAG = "LegacyVpnInfo";
public static final int STATE_DISCONNECTED = 0;
public static final int STATE_INITIALIZING = 1;
@@ -32,8 +32,6 @@ import java.nio.charset.Charset;
* @hide
*/
public class VpnProfile implements Cloneable, Parcelable {
private static final String TAG = "VpnProfile";
// Match these constants with R.array.vpn_types.
public static final int TYPE_PPTP = 0;
public static final int TYPE_L2TP_IPSEC_PSK = 1;
@@ -178,7 +176,7 @@ public class VpnProfile implements Cloneable, Parcelable {
return true;
} catch (IllegalArgumentException e) {
Timber.w("Invalid address", e);
Timber.w(e, "Invalid address");
return false;
}
}
@@ -34,8 +34,6 @@ import java.util.List;
* {@hide}
*/
public class GsmAlphabet {
private static final String TAG = "GSM";
private GsmAlphabet() {
}
@@ -27,7 +27,6 @@ import android.content.res.XmlResourceParser;
import timber.log.Timber;
public class MmsConfig {
private static final String TAG = "MmsConfig";
private static final boolean DEBUG = true;
private static final boolean LOCAL_LOGV = true;
@@ -302,11 +301,11 @@ public class MmsConfig {
}
}
} catch (XmlPullParserException e) {
Timber.e("loadMmsSettings caught ", e);
Timber.e(e, "loadMmsSettings caught ");
} catch (NumberFormatException e) {
Timber.e("loadMmsSettings caught ", e);
Timber.e(e, "loadMmsSettings caught ");
} catch (IOException e) {
Timber.e("loadMmsSettings caught ", e);
Timber.e(e, "loadMmsSettings caught ");
} finally {
parser.close();
}
@@ -28,7 +28,6 @@ import org.w3c.dom.events.EventTarget;
import timber.log.Timber;
public class EventTargetImpl implements EventTarget {
private static final String TAG = LogTag.TAG;
private ArrayList<EventListenerEntry> mListenerEntries;
private EventTarget mNodeTarget;
@@ -100,7 +99,7 @@ public class EventTargetImpl implements EventTarget {
catch (Exception e) {
// Any exceptions thrown inside an EventListener will
// not stop propagation of the event
Timber.w("Catched EventListener exception", e);
Timber.w(e, "Catched EventListener exception");
}
}
}
@@ -29,8 +29,6 @@ import org.w3c.dom.smil.TimeList;
import timber.log.Timber;
public abstract class ElementTimeImpl implements ElementTime {
private static final String TAG = LogTag.TAG;
private static final String FILL_REMOVE_ATTRIBUTE = "remove";
private static final String FILL_FREEZE_ATTRIBUTE = "freeze";
private static final String FILL_HOLD_ATTRIBUTE = "hold";
@@ -133,7 +131,7 @@ public abstract class ElementTimeImpl implements ElementTime {
getEndConstraints()));
} catch (IllegalArgumentException e) {
// Ignore badly formatted times
Timber.e("Malformed time value.", e);
Timber.e(e, "Malformed time value.");
}
}
}
@@ -41,8 +41,6 @@ import timber.log.Timber;
* <li>The player runs in a different thread which intends not to block the main thread.</li>
*/
public class SmilPlayer implements Runnable {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private static final int TIMESLICE = 200;
@@ -509,7 +507,7 @@ public class SmilPlayer implements Runnable {
mState = SmilPlayerState.PLAYING;
}
} catch (InterruptedException e) {
Timber.e("Unexpected InterruptedException.", e);
Timber.e(e, "Unexpected InterruptedException.");
}
}
@@ -660,7 +658,7 @@ public class SmilPlayer implements Runnable {
try {
waitForEntry(offset - mCurrentTime);
} catch (InterruptedException e) {
Timber.e("Unexpected InterruptedException.", e);
Timber.e(e, "Unexpected InterruptedException.");
}
while (isPauseAction() || isStopAction() || isReloadAction() || isNextAction() ||
@@ -47,8 +47,6 @@ public class SmilRegionElementImpl extends SmilElementImpl implements
private static final String RIGHT_ATTRIBUTE_NAME = "right";
private static final String BOTTOM_ATTRIBUTE_NAME = "bottom";
private static final String FIT_ATTRIBUTE_NAME = "fit";
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
SmilRegionElementImpl(SmilDocumentImpl owner, String tagName) {
@@ -28,7 +28,6 @@ import com.android.mms.logs.LogTag;
import com.android.mms.dom.smil.SmilDocumentImpl;
public class SmilContentHandler extends DefaultHandler {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
@@ -32,7 +32,6 @@ import org.w3c.dom.smil.SMILDocument;
import org.w3c.dom.smil.SMILElement;
public class SmilXmlSerializer {
private static final String TAG = "SmilXmlSerializer";
public static void serialize(SMILDocument smilDoc, OutputStream out) {
try {
@@ -41,9 +40,9 @@ public class SmilXmlSerializer {
writeElement(writer, smilDoc.getDocumentElement());
writer.flush();
} catch (UnsupportedEncodingException e) {
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
} catch (IOException e) {
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
}
}
@@ -22,8 +22,6 @@ import android.content.Context;
import timber.log.Timber;
public class HVGALayoutParameters implements LayoutParameters {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private int mType = -1;
@@ -26,8 +26,6 @@ import timber.log.Timber;
* MMS presentation layout management.
*/
public class LayoutManager {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private final Context mContext;
@@ -36,8 +36,6 @@ import java.net.URISyntaxException;
* APN settings used for MMS transactions
*/
public class ApnSettings {
private static final String TAG = "ApnSettings";
// MMSC URL
private final String mServiceCenter;
// MMSC proxy address
@@ -44,8 +44,6 @@ import com.klinker.android.send_message.Transaction;
* Request to download an MMS
*/
public class DownloadRequest extends MmsRequest {
private static final String TAG = "DownloadRequest";
private static final String LOCATION_SELECTION =
Telephony.Mms.MESSAGE_TYPE + "=? AND " + Telephony.Mms.CONTENT_LOCATION + " =?";
@@ -235,11 +233,11 @@ public class DownloadRequest extends MmsRequest {
return messageUri;
} catch (MmsException e) {
Timber.e("DownloadRequest.persistIfRequired: can not persist message", e);
Timber.e(e, "DownloadRequest.persistIfRequired: can not persist message");
} catch (SQLiteException e) {
Timber.e("DownloadRequest.persistIfRequired: can not update message", e);
Timber.e(e, "DownloadRequest.persistIfRequired: can not update message");
} catch (RuntimeException e) {
Timber.e("DownloadRequest.persistIfRequired: can not parse response", e);
Timber.e(e, "DownloadRequest.persistIfRequired: can not parse response");
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -37,8 +37,6 @@ import java.util.Map;
*
*/
public class MmsConfigManager {
private static final String TAG = "MmsConfigManager";
private static volatile MmsConfigManager sInstance = new MmsConfigManager();
public static MmsConfigManager getInstance() {
@@ -28,8 +28,6 @@ import java.io.IOException;
* XML processor for mms_config.xml
*/
public class MmsConfigXmlProcessor {
private static final String TAG = "MmsConfigXmlProcessor";
public interface MmsConfigHandler {
public void process(String key, String value, String type);
}
@@ -93,9 +91,9 @@ public class MmsConfigXmlProcessor {
processMmsConfig();
}
} catch (IOException e) {
Timber.e("MmsConfigXmlProcessor: I/O failure " + e, e);
Timber.e(e, "MmsConfigXmlProcessor: I/O failure ");
} catch (XmlPullParserException e) {
Timber.e("MmsConfigXmlProcessor: parsing failure " + e, e);
Timber.e(e, "MmsConfigXmlProcessor: parsing failure");
}
}
@@ -133,7 +131,7 @@ public class MmsConfigXmlProcessor {
}
return mLogStringBuilder.toString();
} catch (XmlPullParserException e) {
Timber.e("xmlParserDebugContext: " + e, e);
Timber.e(e, "xmlParserDebugContext: ");
}
}
return "Unknown";
@@ -207,14 +207,14 @@ public class MmsHttpClient {
return responseBody;
} catch (MalformedURLException e) {
final String redactedUrl = redactUrlForNonVerbose(urlString);
Timber.e("HTTP: invalid URL " + redactedUrl, e);
Timber.e(e, "HTTP: invalid URL %s", redactedUrl);
throw new MmsHttpException(0/*statusCode*/, "Invalid URL " + redactedUrl, e);
} catch (ProtocolException e) {
final String redactedUrl = redactUrlForNonVerbose(urlString);
Timber.e("HTTP: invalid URL protocol " + redactedUrl, e);
Timber.e(e, "HTTP: invalid URL protocol %s", redactedUrl);
throw new MmsHttpException(0/*statusCode*/, "Invalid URL protocol " + redactedUrl, e);
} catch (IOException e) {
Timber.e("HTTP: IO failure", e);
Timber.e(e, "HTTP: IO failure");
throw new MmsHttpException(0/*statusCode*/, e);
} finally {
if (connection != null) {
@@ -35,7 +35,6 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
public class MmsNetworkManager implements com.squareup.okhttp.internal.Network {
private static final String TAG = "MmsNetworkManager";
// Timeout used to call ConnectivityManager.requestNetwork
private static final int NETWORK_REQUEST_TIMEOUT_MILLIS = 60 * 1000;
// Wait timeout for this class, a little bit longer than the above timeout
@@ -155,7 +154,7 @@ public class MmsNetworkManager implements com.squareup.okhttp.internal.Network {
synchronized (this) {
if (mMmsRequestCount > 0) {
mMmsRequestCount -= 1;
Timber.d("MmsNetworkManager: release, count=" + mMmsRequestCount);
Timber.d("MmsNetworkManager: release, count=%s", mMmsRequestCount);
if (mMmsRequestCount < 1) {
releaseRequestLocked(mNetworkCallback);
}
@@ -173,7 +172,7 @@ public class MmsNetworkManager implements com.squareup.okhttp.internal.Network {
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
Timber.d("NetworkCallbackListener.onAvailable: network=" + network);
Timber.d("NetworkCallbackListener.onAvailable: network=%s", network);
synchronized (MmsNetworkManager.this) {
mNetwork = network;
MmsNetworkManager.this.notifyAll();
@@ -183,7 +182,7 @@ public class MmsNetworkManager implements com.squareup.okhttp.internal.Network {
@Override
public void onLost(Network network) {
super.onLost(network);
Timber.d("NetworkCallbackListener.onLost: network=" + network);
Timber.d("NetworkCallbackListener.onLost: network=%s", network);
synchronized (MmsNetworkManager.this) {
releaseRequestLocked(this);
MmsNetworkManager.this.notifyAll();
@@ -205,7 +204,7 @@ public class MmsNetworkManager implements com.squareup.okhttp.internal.Network {
connectivityManager.requestNetwork(
mNetworkRequest, mNetworkCallback);
} catch (SecurityException e) {
Timber.e("permission exception... skipping it for testing purposes", e);
Timber.e(e, "permission exception... skipping it for testing purposes");
permissionError = true;
}
}
@@ -222,7 +221,7 @@ public class MmsNetworkManager implements com.squareup.okhttp.internal.Network {
try {
connectivityManager.unregisterNetworkCallback(callback);
} catch (Exception e) {
Timber.e("couldn't unregister", e);
Timber.e(e, "couldn't unregister");
}
}
resetLocked();
@@ -322,7 +321,7 @@ public class MmsNetworkManager implements com.squareup.okhttp.internal.Network {
if (mmsNetworkInfo != null) {
apnName = mmsNetworkInfo.getExtraInfo();
}
Timber.d("MmsNetworkManager: getApnName: " + apnName);
Timber.d("MmsNetworkManager: getApnName: %s", apnName);
return apnName;
}
@@ -41,8 +41,6 @@ import com.android.mms.service_alt.exception.MmsHttpException;
* Base class for MMS requests. This has the common logic of sending/downloading MMS.
*/
public abstract class MmsRequest {
private static final String TAG = "MmsRequest";
private static final int RETRY_TIMES = 3;
/**
@@ -183,7 +181,7 @@ public abstract class MmsRequest {
try {
networkManager.acquireNetwork();
} catch (Exception e) {
Timber.e("error acquiring network", e);
Timber.e(e, "error acquiring network");
}
final String apnName = networkManager.getApnName();
@@ -210,7 +208,7 @@ public abstract class MmsRequest {
networkManager.releaseNetwork();
}
} catch (ApnException e) {
Timber.e("MmsRequest: APN failure", e);
Timber.e(e, "MmsRequest: APN failure");
result = SmsManager.MMS_ERROR_INVALID_APN;
break;
// } catch (MmsNetworkException e) {
@@ -218,12 +216,12 @@ public abstract class MmsRequest {
// result = SmsManager.MMS_ERROR_UNABLE_CONNECT_MMS;
// // Retry
} catch (MmsHttpException e) {
Timber.e("MmsRequest: HTTP or network I/O failure", e);
Timber.e(e, "MmsRequest: HTTP or network I/O failure");
result = SmsManager.MMS_ERROR_HTTP_FAILURE;
httpStatusCode = e.getStatusCode();
// Retry
} catch (Exception e) {
Timber.e("MmsRequest: unexpected failure", e);
Timber.e(e, "MmsRequest: unexpected failure");
result = SmsManager.MMS_ERROR_UNSPECIFIED;
break;
}
@@ -283,7 +281,7 @@ public abstract class MmsRequest {
}
pendingIntent.send(context, result, fillIn);
} catch (PendingIntent.CanceledException e) {
Timber.e("MmsRequest: sending pending intent canceled", e);
Timber.e(e, "MmsRequest: sending pending intent canceled");
}
}
@@ -32,8 +32,6 @@ import java.util.Locale;
*/
public class PhoneUtils {
private static final String TAG = "PhoneUtils";
/**
* Get a canonical national format phone number. If parsing fails, just return the
* original number.
@@ -43,8 +43,6 @@ import com.google.android.mms.util_alt.SqliteWrapper;
* Request to send an MMS
*/
public class SendRequest extends MmsRequest {
private static final String TAG = "SendRequest";
private final Uri mPduUri;
private byte[] mPduData;
private final String mLocationUrl;
@@ -162,7 +160,7 @@ public class SendRequest extends MmsRequest {
// } catch (MmsException e) {
// Timber.e("SendRequest.persistIfRequired: can not persist message", e);
} catch (RuntimeException e) {
Timber.e("SendRequest.persistIfRequired: unexpected parsing failure", e);
Timber.e(e, "SendRequest.persistIfRequired: unexpected parsing failure");
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -225,7 +223,7 @@ public class SendRequest extends MmsRequest {
try {
context.revokeUriPermission(mPduUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
} catch (NullPointerException e) {
Timber.e("error revoking permissions", e);
Timber.e(e, "error revoking permissions");
}
}
}
@@ -11,8 +11,6 @@ import timber.log.Timber;
import com.google.android.mms.util_alt.SqliteWrapper;
public class SubscriptionIdChecker {
private static final String TAG = "SubscriptionIdChecker";
private static SubscriptionIdChecker sInstance;
private boolean mCanUseSubscriptionId = false;
@@ -26,7 +26,6 @@ import timber.log.Timber;
* Default retry scheme, based on specs.
*/
public class DefaultRetryScheme extends AbstractRetryScheme {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = DEBUG ? Config.LOGD : Config.LOGV;
@@ -32,7 +32,6 @@ import java.util.concurrent.ConcurrentHashMap;
* We should manage to call SMSManager.downloadMultimediaMessage().
*/
public class DownloadManager {
private static final String TAG = "DownloadManager";
private static DownloadManager ourInstance = new DownloadManager();
private static final ConcurrentHashMap<String, MmsDownloadReceiver> mMap = new ConcurrentHashMap<>();
@@ -46,8 +46,6 @@ import com.android.mms.logs.LogTag;
import com.android.mms.MmsConfig;
public class HttpUtils {
private static final String TAG = LogTag.TRANSACTION;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = DEBUG ? Config.LOGD : Config.LOGV;
@@ -42,8 +42,6 @@ import com.google.android.mms.util_alt.SqliteWrapper;
import com.klinker.android.send_message.Settings;
public class MmsMessageSender implements MessageSender {
private static final String TAG = LogTag.TAG;
private final Context mContext;
private final Uri mMessageUri;
private final long mMessageSize;
@@ -181,9 +179,9 @@ public class MmsMessageSender implements MessageSender {
group, null, subId);
context.startService(new Intent(context, TransactionService.class));
} catch (InvalidHeaderValueException e) {
Timber.e("Invalide header value", e);
Timber.e(e, "Invalide header value");
} catch (MmsException e) {
Timber.e("Persist message failed", e);
Timber.e(e, "Persist message failed");
}
}
}
@@ -31,7 +31,6 @@ import timber.log.Timber; import android.util.Log; import static com.klinker.and
*/
public class MmsPushOutboxMessages extends BroadcastReceiver {
private static final String INTENT_MMS_SEND_OUTBOX_MSG = "android.intent.action.MMS_SEND_OUTBOX_MSG";
private static final String TAG = LogTag.TAG;
@Override
public void onReceive(Context context, Intent intent) {
@@ -40,7 +39,7 @@ public class MmsPushOutboxMessages extends BroadcastReceiver {
}
String action = intent.getAction();
if(action.equalsIgnoreCase(INTENT_MMS_SEND_OUTBOX_MSG)){
Log.d(TAG,"Now waking up the MMS service");
Timber.d("Now waking up the MMS service");
context.startService(new Intent(context, TransactionService.class));
}
}
@@ -39,7 +39,6 @@ import com.klinker.android.send_message.Utils;
* </ul>
*/
public class MmsSystemEventReceiver extends BroadcastReceiver {
private static final String TAG = LogTag.TAG;
private static ConnectivityManager mConnMgr = null;
public static void wakeUpService(Context context) {
@@ -73,8 +73,6 @@ import static com.google.android.mms.pdu_alt.PduHeaders.STATUS_UNRECOGNIZED;
* in case the client is in immediate retrieve mode.
*/
public class NotificationTransaction extends Transaction implements Runnable {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private Uri mUri;
@@ -92,7 +90,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
mNotificationInd = (NotificationInd)
PduPersister.getPduPersister(context).load(mUri);
} catch (MmsException e) {
Timber.e("Failed to load NotificationInd from: " + uriString, e);
Timber.e(e, "Failed to load NotificationInd from: %s", uriString);
throw new IllegalArgumentException();
}
@@ -127,7 +125,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
ind, Inbox.CONTENT_URI, !allowAutoDownload(mContext),
group, null, subId);
} catch (MmsException e) {
Timber.e("Failed to save NotificationInd in constructor.", e);
Timber.e(e, "Failed to save NotificationInd in constructor.");
throw new IllegalArgumentException();
}
@@ -159,7 +157,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
boolean autoDownload = allowAutoDownload(mContext);
try {
if (LOCAL_LOGV) {
Timber.v("Notification transaction launched: " + this);
Timber.v("Notification transaction launched: %s", this);
}
// By default, we set status to STATUS_DEFERRED because we
@@ -176,7 +174,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
downloadManager.markState(mUri, DownloadManager.STATE_DOWNLOADING);
if (LOCAL_LOGV) {
Timber.v("Content-Location: " + mContentLocation);
Timber.v("Content-Location: %s", mContentLocation);
}
byte[] retrieveConfData = null;
@@ -191,8 +189,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
if (retrieveConfData != null) {
GenericPdu pdu = new PduParser(retrieveConfData).parse();
if ((pdu == null) || (pdu.getMessageType() != MESSAGE_TYPE_RETRIEVE_CONF)) {
Timber.e("Invalid M-RETRIEVE.CONF PDU. " +
(pdu != null ? "message type: " + pdu.getMessageType() : "null pdu"));
Timber.e("Invalid M-RETRIEVE.CONF PDU. %s", (pdu != null ? "message type: " + pdu.getMessageType() : "null pdu"));
mTransactionState.setState(FAILED);
status = STATUS_UNRECOGNIZED;
} else {
@@ -219,7 +216,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
// M-NotifyResp.ind from Inbox.
SqliteWrapper.delete(mContext, mContext.getContentResolver(),
mUri, null, null);
Timber.v("NotificationTransaction received new mms message: " + uri);
Timber.v("NotificationTransaction received new mms message: %s", uri);
// Delete obsolete threads
SqliteWrapper.delete(mContext, mContext.getContentResolver(),
Threads.OBSOLETE_THREADS_URI, null, null);
@@ -235,7 +232,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
}
if (LOCAL_LOGV) {
Timber.v("status=0x" + Integer.toHexString(status));
Timber.v("status=0x%s", Integer.toHexString(status));
}
// Check the status and update the result state of this Transaction.
@@ -253,7 +250,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
sendNotifyRespInd(status);
} catch (Throwable t) {
Timber.e("error", t);
Timber.e(t, "error");
} finally {
mTransactionState.setContentUri(mUri);
if (!autoDownload) {
@@ -72,7 +72,7 @@ import static com.google.android.mms.pdu_alt.PduHeaders.MESSAGE_TYPE_READ_ORIG_I
* TransactionService by passing the push-data to it.
*/
public class PushReceiver extends BroadcastReceiver {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = true;
@@ -258,9 +258,9 @@ public class PushReceiver extends BroadcastReceiver {
Timber.e("Received unrecognized PDU.");
}
} catch (MmsException e) {
Timber.e("Failed to save the data from PUSH: type=" + type, e);
Timber.e(e, "Failed to save the data from PUSH: type=%s", type);
} catch (RuntimeException e) {
Timber.e("Unexpected RuntimeException.", e);
Timber.e(e, "Unexpected RuntimeException.");
}
if (LOCAL_LOGV) {
@@ -43,8 +43,6 @@ import com.klinker.android.send_message.Utils;
* </ul>
*/
public class ReadRecTransaction extends Transaction implements Runnable{
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private Thread mThread;
@@ -92,15 +90,15 @@ public class ReadRecTransaction extends Transaction implements Runnable{
mTransactionState.setContentUri(uri);
} catch (IOException e) {
if (LOCAL_LOGV) {
Timber.v("Failed to send M-Read-Rec.Ind.", e);
Timber.v(e, "Failed to send M-Read-Rec.Ind.");
}
} catch (MmsException e) {
if (LOCAL_LOGV) {
Timber.v("Failed to load message from Outbox.", e);
Timber.v(e, "Failed to load message from Outbox.");
}
} catch (RuntimeException e) {
if (LOCAL_LOGV) {
Timber.e("Unexpected RuntimeException.", e);
Timber.e(e, "Unexpected RuntimeException.");
}
} finally {
if (mTransactionState.getState() != TransactionState.SUCCESS) {
@@ -57,7 +57,7 @@ import com.klinker.android.send_message.Utils;
* </ul>
*/
public class RetrieveTransaction extends Transaction implements Runnable {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = true;
@@ -41,7 +41,7 @@ import com.klinker.android.send_message.BroadcastUtils;
import com.klinker.android.send_message.R;
public class RetryScheduler implements Observer {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = true;
@@ -56,8 +56,6 @@ import java.util.Arrays;
* </ul>
*/
public class SendTransaction extends Transaction implements Runnable {
private static final String TAG = LogTag.TAG;
private Thread mThread;
public final Uri mSendReqURI;
@@ -94,8 +94,6 @@ import java.util.ArrayList;
* </ul>
*/
public class TransactionService extends Service implements Observer {
private static final String TAG = LogTag.TAG;
/**
* Used to identify notification intents broadcasted by the
* TransactionService when a Transaction is completed.
@@ -1022,7 +1020,7 @@ public class TransactionService extends Service implements Observer {
stopSelf(serviceId);
}
} catch (IOException e) {
Timber.w(e.getMessage(), e);
Timber.w(e);
}
} else {
if (numProcessTransaction == 0) {
@@ -34,10 +34,6 @@ import com.android.mms.logs.LogTag;
* settings or of the MMS Client.
*/
public class TransactionSettings {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = true;
private static final boolean LOCAL_LOGV = false;
private String mServiceCenter;
private String mProxyAddress;
private int mProxyPort = -1;
@@ -113,7 +109,7 @@ public class TransactionSettings {
try {
mProxyPort = Integer.parseInt(Transaction.settings.getPort());
} catch (NumberFormatException e) {
Timber.e("could not get proxy: " + Transaction.settings.getPort(), e);
Timber.e(e, "could not get proxy: %s", Transaction.settings.getPort());
}
}
// }
@@ -27,8 +27,7 @@ import android.os.Looper;
import android.preference.PreferenceManager;
import android.provider.Telephony.Mms;
import com.android.mms.logs.LogTag;
import timber.log.Timber; import android.util.Log;
import timber.log.Timber;
import android.widget.Toast;
import com.android.internal.telephony.TelephonyProperties;
@@ -40,7 +39,6 @@ import com.google.android.mms.pdu_alt.PduPersister;
import com.klinker.android.send_message.R;
public class DownloadManager {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = true;
@@ -125,7 +123,7 @@ public class DownloadManager {
String roaming = SystemPropertiesProxy.get(context,
TelephonyProperties.PROPERTY_OPERATOR_ISROAMING, null);
if (LOCAL_LOGV) {
Timber.v("roaming ------> " + roaming);
Timber.v("roaming ------> %s", roaming);
}
return "true".equals(roaming);
}
@@ -147,7 +145,7 @@ public class DownloadManager {
return;
}
} catch(MmsException e) {
Timber.e(e.getMessage(), e);
Timber.e(e);
return;
}
@@ -159,7 +157,7 @@ public class DownloadManager {
Toast.makeText(mContext, getMessage(uri),
Toast.LENGTH_LONG).show();
} catch (MmsException e) {
Timber.e(e.getMessage(), e);
Timber.e(e);
}
}
});
@@ -182,7 +180,7 @@ public class DownloadManager {
try {
Toast.makeText(mContext, errStr, Toast.LENGTH_LONG).show();
} catch (Exception e) {
Log.e(TAG,"Caught an exception in showErrorCodeToast");
Timber.e("Caught an exception in showErrorCodeToast");
}
}
});
@@ -29,8 +29,6 @@ import com.android.mms.logs.LogTag;
import timber.log.Timber;
public class RateController {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private static final int RATE_LIMIT = 100;
@@ -22,8 +22,6 @@ import com.android.mms.logs.LogTag;
import timber.log.Timber;
public class SendingProgressTokenManager {
private static final String TAG = LogTag.TAG;
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private static final HashMap<Object, Long> TOKEN_POOL;
@@ -27,8 +27,6 @@ import java.util.ArrayList;
* Encoded-string-value = Text-string | Value-length Char-set Text-string
*/
public class EncodedStringValue implements Cloneable {
private static final String TAG = "EncodedStringValue";
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
/**
@@ -74,7 +72,7 @@ public class EncodedStringValue implements Cloneable {
mData = data.getBytes(CharacterSets.DEFAULT_CHARSET_NAME);
mCharacterSet = CharacterSets.DEFAULT_CHARSET;
} catch (UnsupportedEncodingException e) {
Timber.e("Default encoding must be supported.", e);
Timber.e(e, "Default encoding must be supported.");
}
}
@@ -140,7 +138,7 @@ public class EncodedStringValue implements Cloneable {
return new String(mData, name);
} catch (UnsupportedEncodingException e) {
if (LOCAL_LOGV) {
Timber.v(e.getMessage(), e);
Timber.v(e);
}
try {
return new String(mData, CharacterSets.MIMENAME_ISO_8859_1);
@@ -172,7 +170,7 @@ public class EncodedStringValue implements Cloneable {
newTextString.write(mData);
newTextString.write(textString);
} catch (IOException e) {
Timber.e("logging error", e);
Timber.e("logging error");
e.printStackTrace();
throw new NullPointerException(
"appendTextString: failed when write a new Text-string");
@@ -196,7 +194,7 @@ public class EncodedStringValue implements Cloneable {
try {
return new EncodedStringValue(mCharacterSet, dstBytes);
} catch (Exception e) {
Timber.e("logging error", e);
Timber.e("logging error");
e.printStackTrace();
throw new CloneNotSupportedException(e.getMessage());
}
@@ -80,8 +80,6 @@ public class PduComposer {
* Block size when read data from InputStream.
*/
static private final int PDU_COMPOSER_BLOCK_SIZE = 1024;
private static final String TAG = "PduComposer";
/**
* The output message.
*/
@@ -886,7 +884,7 @@ public class PduComposer {
appendTextString(part.getContentType());
}
catch (ArrayIndexOutOfBoundsException e){
Timber.e("logging error", e);
Timber.e("logging error");
e.printStackTrace();
}
@@ -28,6 +28,8 @@ import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashMap;
import timber.log.Timber;
public class PduParser {
/**
* The next are WAP values defined in WSP specification.
@@ -686,7 +688,7 @@ public class PduParser {
if (null != previouslySentBy) {
try {
if (LOCAL_LOGV) {
Log.v(LOG_TAG, "parseHeaders: PREVIOUSLY_SENT_BY: " + headerField
Timber.v("parseHeaders: PREVIOUSLY_SENT_BY: " + headerField
+ " value: " + previouslySentBy.getString());
}
headers.setEncodedStringValue(previouslySentBy,
@@ -719,7 +721,7 @@ public class PduParser {
try {
long perviouslySentDate = parseLongInteger(pduDataStream);
if (LOCAL_LOGV) {
Log.v(LOG_TAG, "parseHeaders: PREVIOUSLY_SENT_DATE: " + headerField
Timber.v("parseHeaders: PREVIOUSLY_SENT_DATE: " + headerField
+ " value: " + perviouslySentDate);
}
headers.setLongInteger(perviouslySentDate,
@@ -738,7 +740,7 @@ public class PduParser {
* Encoded-string-value
*/
if (LOCAL_LOGV) {
Log.v(LOG_TAG, "parseHeaders: MM_FLAGS: " + headerField
Timber.v("parseHeaders: MM_FLAGS: " + headerField
+ " NOT REALLY SUPPORTED");
}
@@ -762,7 +764,7 @@ public class PduParser {
case PduHeaders.MBOX_QUOTAS:
{
if (LOCAL_LOGV) {
Log.v(LOG_TAG, "parseHeaders: MBOX_TOTALS: " + headerField);
Timber.v("parseHeaders: MBOX_TOTALS: " + headerField);
}
/* Value-length */
parseValueLength(pduDataStream);
@@ -785,7 +787,7 @@ public class PduParser {
case PduHeaders.ELEMENT_DESCRIPTOR: {
if (LOCAL_LOGV) {
Log.v(LOG_TAG, "parseHeaders: ELEMENT_DESCRIPTOR: " + headerField);
Timber.v("parseHeaders: ELEMENT_DESCRIPTOR: " + headerField);
}
parseContentType(pduDataStream, null);
@@ -803,7 +805,7 @@ public class PduParser {
if (null != contentType) {
try {
if (LOCAL_LOGV) {
Log.v(LOG_TAG, "parseHeaders: CONTENT_TYPE: " + headerField +
Timber.v("parseHeaders: CONTENT_TYPE: " + headerField +
contentType.toString());
}
headers.setTextString(contentType, PduHeaders.CONTENT_TYPE);
@@ -830,7 +832,7 @@ public class PduParser {
case PduHeaders.ATTRIBUTES:
default: {
if (LOCAL_LOGV) {
Log.v(LOG_TAG, "parseHeaders: Unknown header: " + headerField);
Timber.v("parseHeaders: Unknown header: " + headerField);
}
log("Unknown header");
}
@@ -1476,7 +1478,7 @@ public class PduParser {
map.put(PduPart.P_CHARSET, charsetInt);
} catch (UnsupportedEncodingException e) {
// Not a well-known charset, use "*".
Log.e(LOG_TAG, Arrays.toString(charsetStr), e);
Timber.e(e, Arrays.toString(charsetStr));
map.put(PduPart.P_CHARSET, CharacterSets.ANY_CHARSET);
}
} else {
@@ -1523,7 +1525,7 @@ public class PduParser {
}
if (0 != lastLen) {
Log.e(LOG_TAG, "Corrupt Content-Type");
Timber.e("Corrupt Content-Type");
}
}
@@ -1573,7 +1575,7 @@ public class PduParser {
contentType = parseWapString(pduDataStream, TYPE_TEXT_STRING);
}
} else {
Log.e(LOG_TAG, "Corrupt content-type");
Timber.e("Corrupt content-type");
return (PduContentTypes.contentTypes[0]).getBytes(); //"*/*"
}
@@ -1584,7 +1586,7 @@ public class PduParser {
}
if (parameterLen < 0) {
Log.e(LOG_TAG, "Corrupt MMS message");
Timber.e("Corrupt MMS message");
return (PduContentTypes.contentTypes[0]).getBytes(); //"*/*"
}
} else if (cur <= TEXT_MAX) {
@@ -118,8 +118,6 @@ public class PduPart {
*/
private byte[] mPartData = null;
private static final String TAG = "PduPart";
/**
* Empty Constructor.
*/
@@ -69,8 +69,6 @@ import java.util.Set;
* This class is the high-level manager of PDU storage.
*/
public class PduPersister {
private static final String TAG = "PduPersister";
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private static final long DUMMY_THREAD_ID = Long.MAX_VALUE;
@@ -458,7 +456,7 @@ public class PduPersister {
len = is.read(buffer);
}
} catch (IOException e) {
Timber.e("Failed to load part data", e);
Timber.e(e, "Failed to load part data");
c.close();
throw new MmsException(e);
} finally {
@@ -466,7 +464,7 @@ public class PduPersister {
try {
is.close();
} catch (IOException e) {
Timber.e("Failed to close stream", e);
Timber.e(e, "Failed to close stream");
} // Ignore
}
}
@@ -542,7 +540,7 @@ public class PduPersister {
try {
PDU_CACHE_INSTANCE.wait();
} catch (InterruptedException e) {
Timber.e("load: ", e);
Timber.e(e, "load: ");
}
}
@@ -863,7 +861,7 @@ public class PduPersister {
return;
}
} catch (Exception e) {
Timber.e("Can't get file info for: " + part.getDataUri(), e);
Timber.e(e, "Can't get file info for: %s", part.getDataUri());
}
}
// We haven't converted the file yet, start the conversion
@@ -892,7 +890,7 @@ public class PduPersister {
}
if (LOCAL_LOGV) {
Timber.v("Saving data to: " + uri);
Timber.v("Saving data to: %s", uri);
}
byte[] buffer = new byte[8192];
@@ -910,7 +908,7 @@ public class PduPersister {
}
} else {
if (LOCAL_LOGV) {
Timber.v("Saving data to: " + uri);
Timber.v("Saving data to: %s", uri);
}
if (!isDrm) {
os.write(data);
@@ -926,24 +924,24 @@ public class PduPersister {
}
}
} catch (FileNotFoundException e) {
Timber.e("Failed to open Input/Output stream.", e);
Timber.e(e, "Failed to open Input/Output stream.");
throw new MmsException(e);
} catch (IOException e) {
Timber.e("Failed to read/write data.", e);
Timber.e(e, "Failed to read/write data.");
throw new MmsException(e);
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
Timber.e("IOException while closing: " + os, e);
Timber.e(e, "IOException while closing: %s", os);
} // Ignore
}
if (is != null) {
try {
is.close();
} catch (IOException e) {
Timber.e("IOException while closing: " + is, e);
Timber.e(e, "IOException while closing: %s", is);
} // Ignore
}
if (drmConvertSession != null) {
@@ -1035,7 +1033,7 @@ public class PduPersister {
try {
PDU_CACHE_INSTANCE.wait();
} catch (InterruptedException e) {
Timber.e("updateHeaders: ", e);
Timber.e(e, "updateHeaders: ");
}
}
}
@@ -1203,7 +1201,7 @@ public class PduPersister {
try {
PDU_CACHE_INSTANCE.wait();
} catch (InterruptedException e) {
Timber.e("updateParts: ", e);
Timber.e(e, "updateParts: ");
}
cacheEntry = PDU_CACHE_INSTANCE.get(uri);
if (cacheEntry != null) {
@@ -1313,7 +1311,7 @@ public class PduPersister {
try {
PDU_CACHE_INSTANCE.wait();
} catch (InterruptedException e) {
Timber.e("persist1: ", e);
Timber.e(e, "persist1: ");
}
}
}
@@ -1585,7 +1583,7 @@ public class PduPersister {
return new String(bytes, CharacterSets.MIMENAME_ISO_8859_1);
} catch (UnsupportedEncodingException e) {
// Impossible to reach here!
Timber.e("ISO_8859_1 must be supported!", e);
Timber.e(e, "ISO_8859_1 must be supported!");
return "";
}
}
@@ -1598,7 +1596,7 @@ public class PduPersister {
return data.getBytes(CharacterSets.MIMENAME_ISO_8859_1);
} catch (UnsupportedEncodingException e) {
// Impossible to reach here!
Timber.e("ISO_8859_1 must be supported!", e);
Timber.e(e, "ISO_8859_1 must be supported!");
return new byte[0];
}
}
@@ -25,8 +25,6 @@ import com.google.android.mms.InvalidHeaderValueException;
import com.klinker.android.send_message.Utils;
public class SendReq extends MultimediaMessagePdu {
private static final String TAG = "SendReq";
public SendReq() {
super();
@@ -40,7 +38,7 @@ public class SendReq extends MultimediaMessagePdu {
setTransactionId(generateTransactionId());
} catch (InvalidHeaderValueException e) {
// Impossible to reach here since all headers we set above are valid.
Timber.e("Unexpected InvalidHeaderValueException.", e);
Timber.e(e, "Unexpected InvalidHeaderValueException.");
throw new RuntimeException(e);
}
}
@@ -21,8 +21,6 @@ import timber.log.Timber; import android.util.Log; import static com.klinker.and
import java.util.HashMap;
public abstract class AbstractCache<K, V> {
private static final String TAG = "AbstractCache";
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private static final int MAX_CACHED_ITEMS = 500;
@@ -18,10 +18,9 @@ package com.google.android.mms.util_alt;
import android.content.Context;
import android.drm.DrmManagerClient;
import timber.log.Timber; import android.util.Log;
import timber.log.Timber;
public class DownloadDrmHelper {
private static final String TAG = "DownloadDrmHelper";
/** The MIME type of special DRM files */
public static final String MIMETYPE_DRM_MESSAGE = "application/vnd.oma.drm.message";
@@ -46,7 +45,7 @@ public class DownloadDrmHelper {
result = drmClient.canHandle("", mimetype);
}
} catch (IllegalArgumentException e) {
Log.w(TAG,
Timber.w(
"DrmManagerClient instance could not be created, context is Illegal.");
} catch (IllegalStateException e) {
Timber.w("DrmManagerClient didn't initialize properly.");
@@ -99,7 +98,7 @@ public class DownloadDrmHelper {
result = drmClient.getOriginalMimeType(path);
}
} catch (IllegalArgumentException ex) {
Log.w(TAG,
Timber.w(
"Can't get original mime type since path is null or empty string.");
} catch (IllegalStateException ex) {
Timber.w("DrmManagerClient didn't initialize properly.");
@@ -18,7 +18,7 @@ package com.google.android.mms.util_alt;
import android.content.Context;
import android.drm.DrmConvertedStatus;
import android.drm.DrmManagerClient;
import timber.log.Timber; import android.util.Log;
import timber.log.Timber;
import android.provider.Downloads;
import java.io.FileNotFoundException;
@@ -29,7 +29,6 @@ import java.io.RandomAccessFile;
public class DrmConvertSession {
private DrmManagerClient mDrmClient;
private int mConvertSessionId;
private static final String TAG = "DrmConvertSession";
private DrmConvertSession(DrmManagerClient drmClient, int convertSessionId) {
mDrmClient = drmClient;
@@ -52,13 +51,13 @@ public class DrmConvertSession {
try {
convertSessionId = drmClient.openConvertSession(mimeType);
} catch (IllegalArgumentException e) {
Timber.w("Conversion of Mimetype: " + mimeType
+ " is not supported.", e);
Timber.w(e, "Conversion of Mimetype: " + mimeType
+ " is not supported.");
} catch (IllegalStateException e) {
Timber.w("Could not access Open DrmFramework.", e);
Timber.w(e, "Could not access Open DrmFramework.");
}
} catch (IllegalArgumentException e) {
Log.w(TAG,
Timber.w(
"DrmManagerClient instance could not be created, context is Illegal.");
} catch (IllegalStateException e) {
Timber.w("DrmManagerClient didn't initialize properly.");
@@ -98,11 +97,9 @@ public class DrmConvertSession {
result = convertedStatus.convertedData;
}
} catch (IllegalArgumentException e) {
Timber.w("Buffer with data to convert is illegal. Convertsession: "
+ mConvertSessionId, e);
Timber.w(e, "Buffer with data to convert is illegal. Convertsession: %s", mConvertSessionId);
} catch (IllegalStateException e) {
Timber.w("Could not convert data. Convertsession: " +
mConvertSessionId, e);
Timber.w(e, "Could not convert data. Convertsession: %s", mConvertSessionId);
}
} else {
throw new IllegalArgumentException("Parameter inBuffer is null");
@@ -139,31 +136,30 @@ public class DrmConvertSession {
result = Downloads.Impl.STATUS_SUCCESS;
} catch (FileNotFoundException e) {
result = Downloads.Impl.STATUS_FILE_ERROR;
Timber.w("File: " + filename + " could not be found.", e);
Timber.w(e, "File: " + filename + " could not be found.");
} catch (IOException e) {
result = Downloads.Impl.STATUS_FILE_ERROR;
Timber.w("Could not access File: " + filename + " .", e);
Timber.w(e, "Could not access File: " + filename + " .");
} catch (IllegalArgumentException e) {
result = Downloads.Impl.STATUS_FILE_ERROR;
Timber.w("Could not open file in mode: rw", e);
Timber.w(e, "Could not open file in mode: rw");
} catch (SecurityException e) {
Timber.w("Access to File: " + filename +
" was denied denied by SecurityManager.", e);
Timber.w(e, "Access to File: " + filename +
" was denied denied by SecurityManager.");
} finally {
if (rndAccessFile != null) {
try {
rndAccessFile.close();
} catch (IOException e) {
result = Downloads.Impl.STATUS_FILE_ERROR;
Timber.w("Failed to close File:" + filename
+ ".", e);
Timber.w(e, "Failed to close File:" + filename
+ ".");
}
}
}
}
} catch (IllegalStateException e) {
Timber.w("Could not close convertsession. Convertsession: " +
mConvertSessionId, e);
Timber.w(e, "Could not close convertsession. Convertsession: %s", mConvertSessionId);
}
}
return result;
@@ -26,8 +26,6 @@ import java.util.HashMap;
import java.util.HashSet;
public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
private static final String TAG = "PduCache";
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private static final int MMS_ALL = 0;
@@ -28,7 +28,6 @@ import timber.log.Timber;
import android.widget.Toast;
public final class SqliteWrapper {
private static final String TAG = "SqliteWrapper";
private static final String SQLITE_EXCEPTION_DETAIL_MESSAGE
= "unable to open database file";
@@ -70,7 +69,7 @@ public final class SqliteWrapper {
try {
return resolver.query(uri, projection, selection, selectionArgs, sortOrder);
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when query: ", e);
Timber.e(e, "Catch a SQLiteException when query: ");
checkSQLiteException(context, e);
return null;
}
@@ -80,7 +79,7 @@ public final class SqliteWrapper {
try {
return cursor.requery();
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when requery: ", e);
Timber.e(e, "Catch a SQLiteException when requery: ");
checkSQLiteException(context, e);
return false;
}
@@ -90,7 +89,7 @@ public final class SqliteWrapper {
try {
return resolver.update(uri, values, where, selectionArgs);
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when update: ", e);
Timber.e(e, "Catch a SQLiteException when update: ");
checkSQLiteException(context, e);
return -1;
}
@@ -101,7 +100,7 @@ public final class SqliteWrapper {
try {
return resolver.delete(uri, where, selectionArgs);
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when delete: ", e);
Timber.e(e, "Catch a SQLiteException when delete: ");
checkSQLiteException(context, e);
return -1;
}
@@ -112,7 +111,7 @@ public final class SqliteWrapper {
try {
return resolver.insert(uri, values);
} catch (SQLiteException e) {
Timber.e("Catch a SQLiteException when insert: ", e);
Timber.e(e, "Catch a SQLiteException when insert: ");
checkSQLiteException(context, e);
return null;
}
@@ -21,9 +21,6 @@ import java.io.IOException;
import java.util.ArrayList;
public class ApnUtils {
private static final String TAG = "ApnUtils";
public static void initDefaultApns(final Context context, final OnApnFinishedListener listener) {
loadMmsSettings(context);
final ArrayList<APN> apns = loadApns(context);
@@ -148,11 +145,11 @@ public class ApnUtils {
}
}
} catch (XmlPullParserException e) {
Timber.e("loadMmsSettings caught ", e);
Timber.e(e, "loadMmsSettings caught ");
} catch (NumberFormatException e) {
Timber.e("loadMmsSettings caught ", e);
Timber.e(e, "loadMmsSettings caught ");
} catch (IOException e) {
Timber.e("loadMmsSettings caught ", e);
Timber.e(e, "loadMmsSettings caught ");
} finally {
parser.close();
}
@@ -301,11 +298,11 @@ public class ApnUtils {
}
}
} catch (XmlPullParserException e) {
Timber.e("loadApns caught ", e);
Timber.e(e, "loadApns caught ");
} catch (NumberFormatException e) {
Timber.e("loadApns caught ", e);
Timber.e(e, "loadApns caught ");
} catch (IOException e) {
Timber.e("loadApns caught ", e);
Timber.e(e, "loadApns caught ");
} finally {
parser.close();
}
@@ -58,8 +58,6 @@ import timber.log.Timber;
import static com.google.android.mms.pdu_alt.PduHeaders.STATUS_RETRIEVED;
public abstract class MmsReceivedReceiver extends BroadcastReceiver {
private static final String TAG = "MmsReceivedReceiver";
public static final String MMS_RECEIVED = "com.klinker.android.messaging.MMS_RECEIVED";
public static final String EXTRA_FILE_PATH = "file_path";
public static final String EXTRA_LOCATION_URL = "location_url";
@@ -125,17 +123,17 @@ public abstract class MmsReceivedReceiver extends BroadcastReceiver {
}
} catch (FileNotFoundException e) {
errorMessage = "MMS received, file not found exception";
Timber.e(errorMessage, e);
Timber.e(e);
} catch (IOException e) {
errorMessage = "MMS received, io exception";
Timber.e(errorMessage, e);
Timber.e(e);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
errorMessage = "MMS received, io exception";
Timber.e("MMS received, io exception", e);
Timber.e(e, "MMS received, io exception");
}
}
}
@@ -281,9 +279,9 @@ public abstract class MmsReceivedReceiver extends BroadcastReceiver {
sendPdu(new PduComposer(mContext, notifyRespInd).make());
}
} catch (MmsException e) {
Timber.e("error", e);
Timber.e(e, "error");
} catch (IOException e) {
Timber.e("error", e);
Timber.e(e, "error");
}
return null;
}
@@ -328,11 +326,11 @@ public abstract class MmsReceivedReceiver extends BroadcastReceiver {
sendPdu(new PduComposer(mContext, acknowledgeInd).make());
}
} catch (InvalidHeaderValueException e) {
Timber.e("error", e);
Timber.e(e, "error");
} catch (MmsException e) {
Timber.e("error", e);
Timber.e(e, "error");
} catch (IOException e) {
Timber.e("error", e);
Timber.e(e, "error");
}
}
return null;
@@ -369,7 +367,7 @@ public abstract class MmsReceivedReceiver extends BroadcastReceiver {
return responseTasks;
} catch (MmsException e) {
Timber.e("error", e);
Timber.e(e, "error");
return null;
}
}
@@ -41,7 +41,6 @@ import static com.klinker.android.send_message.MmsReceivedReceiver.EXTRA_TRIGGER
import static com.klinker.android.send_message.MmsReceivedReceiver.EXTRA_URI;
public class MmsReceivedService extends IntentService {
private static final String TAG = "MmsReceivedService";
private static final String LOCATION_SELECTION =
Telephony.Mms.MESSAGE_TYPE + "=? AND " + Telephony.Mms.CONTENT_LOCATION + " =?";
@@ -81,15 +80,15 @@ public class MmsReceivedService extends IntentService {
Timber.v("response length: " + response.length);
mDownloadFile.delete();
} catch (FileNotFoundException e) {
Timber.e("MMS received, file not found exception", e);
Timber.e(e, "MMS received, file not found exception");
} catch (IOException e) {
Timber.e("MMS received, io exception", e);
Timber.e(e, "MMS received, io exception");
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
Timber.e("MMS received, io exception", e);
Timber.e(e, "MMS received, io exception");
}
}
@@ -234,7 +233,7 @@ public class MmsReceivedService extends IntentService {
sendPdu(new PduComposer(mContext, notifyRespInd).make());
}
} catch (MmsException e) {
Timber.e("error", e);
Timber.e(e, "error");
}
}
}
@@ -271,9 +270,9 @@ public class MmsReceivedService extends IntentService {
sendPdu(new PduComposer(mContext, acknowledgeInd).make());
}
} catch (InvalidHeaderValueException e) {
Timber.e("error", e);
Timber.e(e, "error");
} catch (MmsException e) {
Timber.e("error", e);
Timber.e(e, "error");
}
}
}
@@ -301,7 +300,7 @@ public class MmsReceivedService extends IntentService {
return new AcknowledgeIndTask(context, ind, transactionSettings, (RetrieveConf) pdu);
}
} catch (MmsException e) {
Timber.e("error", e);
Timber.e(e, "error");
return null;
}
}
@@ -315,7 +314,7 @@ public class MmsReceivedService extends IntentService {
// need retry ?
task.run();
} catch (IOException e) {
Timber.e("MMS send received notification, io exception", e);
Timber.e(e, "MMS send received notification, io exception");
throw e;
}
}
@@ -28,9 +28,6 @@ import timber.log.Timber;
import java.io.File;
public class MmsSentReceiver extends StatusUpdatedReceiver {
private static final String TAG = "MmsSentReceiver";
public static final String MMS_SENT = "com.klinker.android.messaging.MMS_SENT";
public static final String EXTRA_CONTENT_URI = "content_uri";
public static final String EXTRA_FILE_PATH = "file_path";
@@ -62,8 +62,6 @@ import java.util.*;
* @author Jake Klinker
*/
public class Transaction {
private static final String TAG = "Transaction";
public static Settings settings;
private Context context;
@@ -349,7 +347,7 @@ public class Transaction {
} catch (Exception e) {
// whoops...
Timber.v("send_transaction", "error sending message");
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
try {
((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content).post(new Runnable() {
@@ -385,7 +383,7 @@ public class Transaction {
try {
smsManager.sendMultipartTextMessage(address, null, parts, sPI, dPI);
} catch (Exception e) {
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
}
} else {
Timber.v("send_transaction", "message not sent after delay, no longer exists");
@@ -498,7 +496,7 @@ public class Transaction {
context.registerReceiver(receiver, filter);
} catch (Throwable e) {
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
}
} else {
Timber.v("using lollipop method for sending sms");
@@ -516,7 +514,7 @@ public class Transaction {
MmsNetworkManager manager = new MmsNetworkManager(context, Utils.getDefaultSubscriptionId());
request.execute(context, manager);
} catch (Exception e) {
Timber.e("error sending mms", e);
Timber.e(e, "error sending mms");
}
}
}
@@ -545,7 +543,7 @@ public class Transaction {
try {
sendRequest.prepareFromAddress(context, fromAddress, settings.getSubscriptionId());
} catch (Exception e) {
Timber.e("error getting from address", e);
Timber.e(e, "error getting from address");
}
final PduBody pduBody = new PduBody();
@@ -620,7 +618,7 @@ public class Transaction {
info.location = persister.persist(sendRequest, Uri.parse("content://mms/outbox"), true, settings.getGroup(), null, settings.getSubscriptionId());
} catch (Exception e) {
Timber.v("sending_mms_library", "error saving mms message");
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
// use the old way if something goes wrong with the persister
insert(context, recipients, parts, subject);
@@ -637,7 +635,7 @@ public class Transaction {
info.token = 4444L;
}
} catch (Exception e) {
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
info.token = 4444L;
}
@@ -697,7 +695,7 @@ public class Transaction {
writer.write(new PduComposer(context, sendReq).make());
contentUri = writerUri;
} catch (final IOException e) {
Timber.e("Error writing send file", e);
Timber.e(e, "Error writing send file");
} finally {
if (writer != null) {
try {
@@ -723,11 +721,11 @@ public class Transaction {
try {
pendingIntent.send(SmsManager.MMS_ERROR_IO_ERROR);
} catch (PendingIntent.CanceledException ex) {
Timber.e("Mms pending intent cancelled?", ex);
Timber.e(ex, "Mms pending intent cancelled?");
}
}
} catch (Exception e) {
Timber.e("error using system sending method", e);
Timber.e(e, "error using system sending method");
}
}
@@ -903,7 +901,7 @@ public class Transaction {
return res;
} catch (Exception e) {
Timber.v("sending_mms_library", "still an error saving... :(");
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
}
return null;
@@ -44,7 +44,6 @@ public class Utils {
* characters to compare against when checking for 160 character sending compatibility
*/
public static final String GSM_CHARACTERS_REGEX = "^[A-Za-z0-9 \\r\\n@Ł$ĽčéůěňÇŘřĹĺ\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039EĆćßÉ!\"#$%&'()*+,\\-./:;<=>?ĄÄÖŃܧżäöńüŕ^{}\\\\\\[~\\]|\u20AC]*$";
private static final String TAG = "Utils";
public static final int DEFAULT_SUBSCRIPTION_ID = 1;
/**
@@ -155,7 +154,7 @@ public class Utils {
throw new IOException("Cannot establish route to proxy " + inetAddr);
}
} catch (Exception e) {
Timber.e("Cannot establishh route to proxy " + inetAddr, e);
Timber.e(e, "Cannot establishh route to proxy %s", inetAddr);
}
} else {
Uri uri = Uri.parse(url);
@@ -170,7 +169,7 @@ public class Utils {
throw new IOException("Cannot establish route to proxy " + inetAddr);
}
} catch (Exception e) {
Timber.e("Cannot establishh route to proxy " + inetAddr + " for " + url, e);
Timber.e(e, "Cannot establish route to proxy " + inetAddr + " for " + url);
}
}
}
@@ -190,7 +189,7 @@ public class Utils {
m.setAccessible(true);
return (Boolean) m.invoke(cm);
} catch (Exception e) {
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
return null;
}
}
@@ -206,7 +205,7 @@ public class Utils {
Method m = c.getMethod("getDataEnabled");
return (boolean) m.invoke(telephonyManager);
} catch (Exception e) {
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
return true;
}
}
@@ -223,7 +222,7 @@ public class Utils {
Method m = c.getMethod("getDataEnabled", int.class);
return (boolean) m.invoke(telephonyManager, subId);
} catch (Exception e) {
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
return isDataEnabled(telephonyManager);
}
}
@@ -249,7 +248,7 @@ public class Utils {
setMobileDataEnabledMethod.invoke(iConnectivityManager, enabled);
} catch (Exception e) {
Timber.e("exception thrown", e);
Timber.e(e, "exception thrown");
}
} else {
// TODO find a better way to do this on lollipop!
@@ -267,7 +266,7 @@ public class Utils {
m.setAccessible(true);
m.invoke(telephonyService, enabled);
} catch (Exception e) {
Timber.e("error enabling data on lollipop", e);
Timber.e(e, "error enabling data on lollipop");
}
}