mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Updated logging.
This commit is contained in:
parent
2489ea0d5b
commit
bfdad2f47c
@ -191,7 +191,6 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
|
||||
@Override
|
||||
protected void onBindItemViewHolder(ViewHolder viewHolder, @NonNull MessageRecord messageRecord) {
|
||||
long start = System.currentTimeMillis();
|
||||
int adapterPosition = viewHolder.getAdapterPosition();
|
||||
MessageRecord previousRecord = adapterPosition < getItemCount() - 1 && !isFooterPosition(adapterPosition + 1) ? getRecordForPositionOrThrow(adapterPosition + 1) : null;
|
||||
MessageRecord nextRecord = adapterPosition > 0 && !isHeaderPosition(adapterPosition - 1) ? getRecordForPositionOrThrow(adapterPosition - 1) : null;
|
||||
@ -208,8 +207,6 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
if (messageRecord == recordToPulseHighlight) {
|
||||
recordToPulseHighlight = null;
|
||||
}
|
||||
|
||||
Log.d(TAG, "Bind time: " + (System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +159,7 @@ public class ComposeText extends EmojiEditText {
|
||||
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB_MR2)
|
||||
private static class CommitContentListener implements InputConnectionCompat.OnCommitContentListener {
|
||||
|
||||
private static final String TAG = CommitContentListener.class.getName();
|
||||
private static final String TAG = CommitContentListener.class.getSimpleName();
|
||||
|
||||
private final InputPanel.MediaListener mediaListener;
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class RecentPhotoViewRail extends FrameLayout implements LoaderManager.Lo
|
||||
private static class RecentPhotoAdapter extends CursorRecyclerViewAdapter<RecentPhotoAdapter.RecentPhotoViewHolder> {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = RecentPhotoAdapter.class.getName();
|
||||
private static final String TAG = RecentPhotoAdapter.class.getSimpleName();
|
||||
|
||||
@NonNull private final Uri baseUri;
|
||||
@Nullable private OnItemClickedListener clickedListener;
|
||||
|
@ -61,7 +61,7 @@ public class ThreadPhotoRailView extends FrameLayout {
|
||||
private static class ThreadPhotoRailAdapter extends CursorRecyclerViewAdapter<ThreadPhotoRailAdapter.ThreadPhotoViewHolder> {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = ThreadPhotoRailAdapter.class.getName();
|
||||
private static final String TAG = ThreadPhotoRailAdapter.class.getSimpleName();
|
||||
|
||||
@NonNull private final GlideRequests glideRequests;
|
||||
|
||||
|
@ -35,7 +35,7 @@ import java.io.InputStream;
|
||||
|
||||
public class ZoomingImageView extends FrameLayout {
|
||||
|
||||
private static final String TAG = ZoomingImageView.class.getName();
|
||||
private static final String TAG = ZoomingImageView.class.getSimpleName();
|
||||
|
||||
private final PhotoView photoView;
|
||||
private final SubsamplingScaleImageView subsamplingImageView;
|
||||
|
@ -19,7 +19,7 @@ import java.io.InputStream;
|
||||
|
||||
public class AttachmentRegionDecoder implements ImageRegionDecoder {
|
||||
|
||||
private static final String TAG = AttachmentRegionDecoder.class.getName();
|
||||
private static final String TAG = AttachmentRegionDecoder.class.getSimpleName();
|
||||
|
||||
private SkiaImageRegionDecoder passthrough;
|
||||
|
||||
|
@ -37,7 +37,7 @@ import java.util.List;
|
||||
public class PreKeyUtil {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = PreKeyUtil.class.getName();
|
||||
private static final String TAG = PreKeyUtil.class.getSimpleName();
|
||||
|
||||
private static final int BATCH_SIZE = 100;
|
||||
|
||||
|
@ -54,9 +54,9 @@ public class UnidentifiedAccessUtil {
|
||||
ourUnidentifiedAccessKey = Util.getSecretBytes(16);
|
||||
}
|
||||
|
||||
Log.i(TAG, "Their access key present? " + (theirUnidentifiedAccessKey != null));
|
||||
Log.i(TAG, "Our access key present? " + (ourUnidentifiedAccessKey != null));
|
||||
Log.i(TAG, "Our certificate present? " + (ourUnidentifiedAccessCertificate != null));
|
||||
Log.i(TAG, "Their access key present? " + (theirUnidentifiedAccessKey != null) +
|
||||
" | Our access key present? " + (ourUnidentifiedAccessKey != null) +
|
||||
" | Our certificate present? " + (ourUnidentifiedAccessCertificate != null));
|
||||
|
||||
if (theirUnidentifiedAccessKey != null &&
|
||||
ourUnidentifiedAccessKey != null &&
|
||||
|
@ -1103,7 +1103,6 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
|
||||
where += (" ELSE " + DATE_RECEIVED + " < " + date + " END)");
|
||||
|
||||
Log.i("MmsDatabase", "Executing trim query: " + where);
|
||||
cursor = db.query(TABLE_NAME, new String[] {ID}, where, new String[] {threadId+""}, null, null, null);
|
||||
|
||||
while (cursor != null && cursor.moveToNext()) {
|
||||
|
@ -374,7 +374,6 @@ public class MmsSmsDatabase extends Database {
|
||||
@SuppressWarnings("deprecation")
|
||||
String query = outerQueryBuilder.buildQuery(projection, null, null, null, null, null, null);
|
||||
|
||||
Log.d(TAG, "Executing query: " + query);
|
||||
SQLiteDatabase db = databaseHelper.getReadableDatabase();
|
||||
return db.rawQuery(query, null);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import okhttp3.Response;
|
||||
|
||||
public abstract class GiphyLoader extends AsyncLoader<List<GiphyImage>> {
|
||||
|
||||
private static final String TAG = GiphyLoader.class.getName();
|
||||
private static final String TAG = GiphyLoader.class.getSimpleName();
|
||||
|
||||
public static int PAGE_SIZE = 100;
|
||||
|
||||
|
@ -22,7 +22,7 @@ import okhttp3.ResponseBody;
|
||||
*/
|
||||
class OkHttpStreamFetcher implements DataFetcher<InputStream> {
|
||||
|
||||
private static final String TAG = OkHttpStreamFetcher.class.getName();
|
||||
private static final String TAG = OkHttpStreamFetcher.class.getSimpleName();
|
||||
|
||||
private final OkHttpClient client;
|
||||
private final GlideUrl url;
|
||||
|
@ -129,7 +129,7 @@ public abstract class Job extends Worker implements Serializable {
|
||||
}
|
||||
|
||||
final void onSubmit(@NonNull Context context, @NonNull UUID id) {
|
||||
Log.i(TAG, buildLog(id, "onSubmit()"));
|
||||
Log.i(TAG, buildLog(id, "onSubmit() network: " + (new NetworkRequirement(getApplicationContext()).isPresent())));
|
||||
|
||||
if (this instanceof ContextDependent) {
|
||||
((ContextDependent) this).setContext(context);
|
||||
@ -257,9 +257,8 @@ public abstract class Job extends Worker implements Serializable {
|
||||
return "[" + id + "] " + getClass().getSimpleName() + " :: " + message;
|
||||
}
|
||||
|
||||
private String logSuffix() {
|
||||
protected String logSuffix() {
|
||||
long timeSinceSubmission = System.currentTimeMillis() - getInputData().getLong(KEY_SUBMIT_TIME, 0);
|
||||
return " (Time since submission: " + timeSinceSubmission + " ms, Run attempt: " + getRunAttemptCount() + ", isStopped: " + isStopped() + ")";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import org.thoughtcrime.securesms.database.documents.NetworkFailure;
|
||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.jobmanager.JobParameters;
|
||||
import org.thoughtcrime.securesms.jobmanager.SafeData;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.mms.MediaConstraints;
|
||||
import org.thoughtcrime.securesms.mms.MmsException;
|
||||
import org.thoughtcrime.securesms.mms.OutgoingGroupMediaMessage;
|
||||
@ -114,12 +113,12 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType {
|
||||
List<IdentityKeyMismatch> existingIdentityMismatches = message.getIdentityKeyMismatches();
|
||||
|
||||
if (database.isSent(messageId)) {
|
||||
Log.w(TAG, "Message " + messageId + " was already sent. Ignoring.");
|
||||
log(TAG, "Message " + messageId + " was already sent. Ignoring.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Log.i(TAG, "Sending message: " + messageId);
|
||||
log(TAG, "Sending message: " + messageId);
|
||||
|
||||
List<Address> target;
|
||||
|
||||
@ -178,11 +177,11 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType {
|
||||
}
|
||||
|
||||
} catch (InvalidNumberException | RecipientFormattingException | UndeliverableMessageException e) {
|
||||
Log.w(TAG, e);
|
||||
warn(TAG, e);
|
||||
database.markAsSentFailed(messageId);
|
||||
notifyMediaMessageDeliveryFailed(context, messageId);
|
||||
} catch (UntrustedIdentityException e) {
|
||||
Log.w(TAG, e);
|
||||
warn(TAG, e);
|
||||
database.markAsSentFailed(messageId);
|
||||
notifyMediaMessageDeliveryFailed(context, messageId);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import org.thoughtcrime.securesms.database.NoSuchMessageException;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase.UnidentifiedAccessMode;
|
||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.jobmanager.SafeData;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.mms.MediaConstraints;
|
||||
import org.thoughtcrime.securesms.mms.MmsException;
|
||||
import org.thoughtcrime.securesms.mms.OutgoingMediaMessage;
|
||||
@ -87,12 +86,12 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType {
|
||||
OutgoingMediaMessage message = database.getOutgoingMessage(messageId);
|
||||
|
||||
if (database.isSent(messageId)) {
|
||||
Log.w(TAG, "Message " + messageId + " was already sent. Ignoring.");
|
||||
warn(TAG, "Message " + messageId + " was already sent. Ignoring.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Log.i(TAG, "Sending message: " + messageId);
|
||||
log(TAG, "Sending message: " + messageId);
|
||||
|
||||
Recipient recipient = message.getRecipient().resolve();
|
||||
byte[] profileKey = recipient.getProfileKey();
|
||||
@ -106,13 +105,13 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType {
|
||||
|
||||
if (TextSecurePreferences.isUnidentifiedDeliveryEnabled(context)) {
|
||||
if (unidentified && accessMode == UnidentifiedAccessMode.UNKNOWN && profileKey == null) {
|
||||
Log.i(TAG, "Marking recipient as UD-unrestricted following a UD send.");
|
||||
log(TAG, "Marking recipient as UD-unrestricted following a UD send.");
|
||||
DatabaseFactory.getRecipientDatabase(context).setUnidentifiedAccessMode(recipient, UnidentifiedAccessMode.UNRESTRICTED);
|
||||
} else if (unidentified && accessMode == UnidentifiedAccessMode.UNKNOWN) {
|
||||
Log.i(TAG, "Marking recipient as UD-enabled following a UD send.");
|
||||
log(TAG, "Marking recipient as UD-enabled following a UD send.");
|
||||
DatabaseFactory.getRecipientDatabase(context).setUnidentifiedAccessMode(recipient, UnidentifiedAccessMode.ENABLED);
|
||||
} else if (!unidentified && accessMode != UnidentifiedAccessMode.DISABLED) {
|
||||
Log.i(TAG, "Marking recipient as UD-disabled following a non-UD send.");
|
||||
log(TAG, "Marking recipient as UD-disabled following a non-UD send.");
|
||||
DatabaseFactory.getRecipientDatabase(context).setUnidentifiedAccessMode(recipient, UnidentifiedAccessMode.DISABLED);
|
||||
}
|
||||
}
|
||||
@ -122,15 +121,15 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType {
|
||||
expirationManager.scheduleDeletion(messageId, true, message.getExpiresIn());
|
||||
}
|
||||
|
||||
Log.i(TAG, "Sent message: " + messageId);
|
||||
log(TAG, "Sent message: " + messageId);
|
||||
|
||||
} catch (InsecureFallbackApprovalException ifae) {
|
||||
Log.w(TAG, ifae);
|
||||
warn(TAG, "Failure", ifae);
|
||||
database.markAsPendingInsecureSmsFallback(messageId);
|
||||
notifyMediaMessageDeliveryFailed(context, messageId);
|
||||
ApplicationContext.getInstance(context).getJobManager().add(new DirectoryRefreshJob(context, false));
|
||||
} catch (UntrustedIdentityException uie) {
|
||||
Log.w(TAG, uie);
|
||||
warn(TAG, "Failure", uie);
|
||||
database.addMismatchedIdentity(messageId, Address.fromSerialized(uie.getE164Number()), uie.getIdentityKey());
|
||||
database.markAsSentFailed(messageId);
|
||||
}
|
||||
@ -179,13 +178,13 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType {
|
||||
|
||||
return messageSender.sendMessage(address, UnidentifiedAccessUtil.getAccessFor(context, message.getRecipient()), mediaMessage).getSuccess().isUnidentified();
|
||||
} catch (UnregisteredUserException e) {
|
||||
Log.w(TAG, e);
|
||||
warn(TAG, e);
|
||||
throw new InsecureFallbackApprovalException(e);
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.w(TAG, e);
|
||||
warn(TAG, e);
|
||||
throw new UndeliverableMessageException(e);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
warn(TAG, e);
|
||||
throw new RetryLaterException(e);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import org.thoughtcrime.securesms.TextSecureExpiredException;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.contactshare.Contact;
|
||||
import org.thoughtcrime.securesms.contactshare.ContactModelMapper;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
@ -76,9 +75,7 @@ public abstract class PushSendJob extends SendJob {
|
||||
throw new TextSecureExpiredException("Too many signed prekey rotation failures");
|
||||
}
|
||||
|
||||
Log.i(TAG, "Starting message send attempt");
|
||||
onPushSend();
|
||||
Log.i(TAG, "Message send completed");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,6 @@ import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase.UnidentifiedAccessMode;
|
||||
import org.thoughtcrime.securesms.jobmanager.SafeData;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.crypto.UnidentifiedAccessUtil;
|
||||
@ -69,7 +68,6 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
|
||||
@Override
|
||||
public void onAdded() {
|
||||
Log.i(TAG, "onAdded() messageId: " + messageId);
|
||||
DatabaseFactory.getSmsDatabase(context).markAsSending(messageId);
|
||||
}
|
||||
|
||||
@ -80,12 +78,12 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
SmsMessageRecord record = database.getMessage(messageId);
|
||||
|
||||
if (!record.isPending() && !record.isFailed()) {
|
||||
Log.w(TAG, "Message " + messageId + " was already sent. Ignoring.");
|
||||
warn(TAG, "Message " + messageId + " was already sent. Ignoring.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Log.i(TAG, "Sending message: " + messageId);
|
||||
log(TAG, "Sending message: " + messageId);
|
||||
|
||||
Recipient recipient = record.getRecipient().resolve();
|
||||
byte[] profileKey = recipient.getProfileKey();
|
||||
@ -98,13 +96,13 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
|
||||
if (TextSecurePreferences.isUnidentifiedDeliveryEnabled(context)) {
|
||||
if (unidentified && accessMode == UnidentifiedAccessMode.UNKNOWN && profileKey == null) {
|
||||
Log.i(TAG, "Marking recipient as UD-unrestricted following a UD send.");
|
||||
log(TAG, "Marking recipient as UD-unrestricted following a UD send.");
|
||||
DatabaseFactory.getRecipientDatabase(context).setUnidentifiedAccessMode(recipient, UnidentifiedAccessMode.UNRESTRICTED);
|
||||
} else if (unidentified && accessMode == UnidentifiedAccessMode.UNKNOWN) {
|
||||
Log.i(TAG, "Marking recipient as UD-enabled following a UD send.");
|
||||
log(TAG, "Marking recipient as UD-enabled following a UD send.");
|
||||
DatabaseFactory.getRecipientDatabase(context).setUnidentifiedAccessMode(recipient, UnidentifiedAccessMode.ENABLED);
|
||||
} else if (!unidentified && accessMode != UnidentifiedAccessMode.DISABLED) {
|
||||
Log.i(TAG, "Marking recipient as UD-disabled following a non-UD send.");
|
||||
log(TAG, "Marking recipient as UD-disabled following a non-UD send.");
|
||||
DatabaseFactory.getRecipientDatabase(context).setUnidentifiedAccessMode(recipient, UnidentifiedAccessMode.DISABLED);
|
||||
}
|
||||
}
|
||||
@ -114,15 +112,15 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
expirationManager.scheduleDeletion(record.getId(), record.isMms(), record.getExpiresIn());
|
||||
}
|
||||
|
||||
Log.i(TAG, "Sent message: " + messageId);
|
||||
log(TAG, "Sent message: " + messageId);
|
||||
|
||||
} catch (InsecureFallbackApprovalException e) {
|
||||
Log.w(TAG, e);
|
||||
warn(TAG, "Failure", e);
|
||||
database.markAsPendingInsecureSmsFallback(record.getId());
|
||||
MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
|
||||
ApplicationContext.getInstance(context).getJobManager().add(new DirectoryRefreshJob(context, false));
|
||||
} catch (UntrustedIdentityException e) {
|
||||
Log.w(TAG, e);
|
||||
warn(TAG, "Failure", e);
|
||||
database.addMismatchedIdentity(record.getId(), Address.fromSerialized(e.getE164Number()), e.getIdentityKey());
|
||||
database.markAsSentFailed(record.getId());
|
||||
database.markAsPush(record.getId());
|
||||
@ -158,7 +156,7 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
Optional<byte[]> profileKey = getProfileKey(message.getIndividualRecipient());
|
||||
Optional<UnidentifiedAccessPair> unidentifiedAccess = UnidentifiedAccessUtil.getAccessFor(context, message.getIndividualRecipient());
|
||||
|
||||
Log.w(TAG, "Have access key to use: " + unidentifiedAccess.isPresent());
|
||||
log(TAG, "Have access key to use: " + unidentifiedAccess.isPresent());
|
||||
|
||||
SignalServiceDataMessage textSecureMessage = SignalServiceDataMessage.newBuilder()
|
||||
.withTimestamp(message.getDateSent())
|
||||
@ -170,10 +168,10 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
|
||||
return messageSender.sendMessage(address, unidentifiedAccess, textSecureMessage).getSuccess().isUnidentified();
|
||||
} catch (UnregisteredUserException e) {
|
||||
Log.w(TAG, e);
|
||||
warn(TAG, "Failure", e);
|
||||
throw new InsecureFallbackApprovalException(e);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
warn(TAG, "Failure", e);
|
||||
throw new RetryLaterException(e);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class RotateCertificateJob extends ContextJob implements InjectableType {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final String TAG = RotateCertificateJob.class.getName();
|
||||
private static final String TAG = RotateCertificateJob.class.getSimpleName();
|
||||
|
||||
@Inject transient SignalServiceAccountManager accountManager;
|
||||
|
||||
|
@ -25,7 +25,7 @@ import androidx.work.WorkerParameters;
|
||||
|
||||
public class RotateSignedPreKeyJob extends ContextJob implements InjectableType {
|
||||
|
||||
private static final String TAG = RotateSignedPreKeyJob.class.getName();
|
||||
private static final String TAG = RotateSignedPreKeyJob.class.getSimpleName();
|
||||
|
||||
@Inject transient SignalServiceAccountManager accountManager;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.jobs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
@ -95,4 +96,20 @@ public abstract class SendJob extends ContextJob {
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
protected void log(@NonNull String tag, @NonNull String message) {
|
||||
Log.i(tag, "[" + getId().toString() + "] " + message + logSuffix());
|
||||
}
|
||||
|
||||
protected void warn(@NonNull String tag, @NonNull String message) {
|
||||
warn(tag, message, null);
|
||||
}
|
||||
|
||||
protected void warn(@NonNull String tag, @Nullable Throwable t) {
|
||||
warn(tag, "", t);
|
||||
}
|
||||
|
||||
protected void warn(@NonNull String tag, @NonNull String message, @Nullable Throwable t) {
|
||||
Log.w(tag, "[" + getId().toString() + "] " + message + logSuffix(), t);
|
||||
}
|
||||
}
|
||||
|
@ -73,18 +73,17 @@ public class SmsSendJob extends SendJob {
|
||||
|
||||
@Override
|
||||
public void onAdded() {
|
||||
Log.i(TAG, "onAdded() messageId: " + messageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSend() throws NoSuchMessageException, RequirementNotMetException, TooManyRetriesException {
|
||||
if (!requirementsMet()) {
|
||||
Log.w(TAG, "No service. Retrying.");
|
||||
warn(TAG, "No service. Retrying.");
|
||||
throw new RequirementNotMetException();
|
||||
}
|
||||
|
||||
if (runAttempt >= MAX_ATTEMPTS) {
|
||||
Log.w(TAG, "Hit the retry limit. Failing.");
|
||||
warn(TAG, "Hit the retry limit. Failing.");
|
||||
throw new TooManyRetriesException();
|
||||
}
|
||||
|
||||
@ -92,16 +91,16 @@ public class SmsSendJob extends SendJob {
|
||||
SmsMessageRecord record = database.getMessage(messageId);
|
||||
|
||||
if (!record.isPending() && !record.isFailed()) {
|
||||
Log.w(TAG, "Message " + messageId + " was already sent. Ignoring.");
|
||||
warn(TAG, "Message " + messageId + " was already sent. Ignoring.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Log.i(TAG, "Sending message: " + messageId + " (attempt " + runAttempt + ")");
|
||||
log(TAG, "Sending message: " + messageId + " (attempt " + runAttempt + ")");
|
||||
deliver(record);
|
||||
Log.i(TAG, "Sent message: " + messageId);
|
||||
log(TAG, "Sent message: " + messageId);
|
||||
} catch (UndeliverableMessageException ude) {
|
||||
Log.w(TAG, ude);
|
||||
warn(TAG, ude);
|
||||
DatabaseFactory.getSmsDatabase(context).markAsSentFailed(record.getId());
|
||||
MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
|
||||
}
|
||||
@ -114,7 +113,7 @@ public class SmsSendJob extends SendJob {
|
||||
|
||||
@Override
|
||||
public void onCanceled() {
|
||||
Log.w(TAG, "onCanceled() messageId: " + messageId);
|
||||
warn(TAG, "onCanceled() messageId: " + messageId);
|
||||
long threadId = DatabaseFactory.getSmsDatabase(context).getThreadIdForMessage(messageId);
|
||||
Recipient recipient = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(threadId);
|
||||
|
||||
@ -165,9 +164,9 @@ public class SmsSendJob extends SendJob {
|
||||
try {
|
||||
getSmsManagerFor(message.getSubscriptionId()).sendMultipartTextMessage(recipient, null, messages, sentIntents, deliveredIntents);
|
||||
} catch (NullPointerException | IllegalArgumentException npe) {
|
||||
Log.w(TAG, npe);
|
||||
Log.i(TAG, "Recipient: " + recipient);
|
||||
Log.i(TAG, "Message Parts: " + messages.size());
|
||||
warn(TAG, npe);
|
||||
log(TAG, "Recipient: " + recipient);
|
||||
log(TAG, "Message Parts: " + messages.size());
|
||||
|
||||
try {
|
||||
for (int i=0;i<messages.size();i++) {
|
||||
@ -176,11 +175,11 @@ public class SmsSendJob extends SendJob {
|
||||
deliveredIntents == null ? null : deliveredIntents.get(i));
|
||||
}
|
||||
} catch (NullPointerException | IllegalArgumentException npe2) {
|
||||
Log.w(TAG, npe);
|
||||
warn(TAG, npe);
|
||||
throw new UndeliverableMessageException(npe2);
|
||||
}
|
||||
} catch (SecurityException se) {
|
||||
Log.w(TAG, se);
|
||||
warn(TAG, se);
|
||||
throw new UndeliverableMessageException(se);
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
package org.thoughtcrime.securesms.logsubmit.util;
|
||||
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -43,7 +41,6 @@ public class Scrubber {
|
||||
}
|
||||
|
||||
public String scrub(final String in) {
|
||||
android.util.Log.d(TAG, "scrubbing input");
|
||||
String out = in;
|
||||
for (Pattern pattern : patterns) {
|
||||
Matcher matcher = pattern.matcher(out);
|
||||
@ -59,7 +56,6 @@ public class Scrubber {
|
||||
builder.append(censored);
|
||||
|
||||
lastEndingPos = matcher.end();
|
||||
android.util.Log.i(TAG, "replacing a match on /" + pattern.toString() + "/ => " + censored);
|
||||
}
|
||||
builder.append(out.substring(lastEndingPos));
|
||||
out = builder.toString();
|
||||
|
@ -18,6 +18,7 @@ package org.thoughtcrime.securesms.notifications;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
@ -288,8 +289,11 @@ public class MessageNotifier {
|
||||
@NonNull NotificationState notificationState,
|
||||
boolean signal, boolean bundled)
|
||||
{
|
||||
Log.i(TAG, "sendSingleThreadNotification() signal: " + signal + " bundled: " + bundled);
|
||||
|
||||
if (notificationState.getNotifications().isEmpty()) {
|
||||
if (!bundled) cancelActiveNotifications(context);
|
||||
Log.i(TAG, "Empty notification state. Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -336,13 +340,17 @@ public class MessageNotifier {
|
||||
builder.setGroupSummary(true);
|
||||
}
|
||||
|
||||
NotificationManagerCompat.from(context).notify(notificationId, builder.build());
|
||||
Notification notification = builder.build();
|
||||
NotificationManagerCompat.from(context).notify(notificationId, notification);
|
||||
Log.i(TAG, "Posted notification. " + notification.toString());
|
||||
}
|
||||
|
||||
private static void sendMultipleThreadNotification(@NonNull Context context,
|
||||
@NonNull NotificationState notificationState,
|
||||
boolean signal)
|
||||
{
|
||||
Log.i(TAG, "sendSingleThreadNotification() signal: " + signal);
|
||||
|
||||
MultipleRecipientNotificationBuilder builder = new MultipleRecipientNotificationBuilder(context, TextSecurePreferences.getNotificationPrivacy(context));
|
||||
List<NotificationItem> notifications = notificationState.getNotifications();
|
||||
|
||||
@ -371,7 +379,9 @@ public class MessageNotifier {
|
||||
notifications.get(0).getText());
|
||||
}
|
||||
|
||||
Notification notification = builder.build();
|
||||
NotificationManagerCompat.from(context).notify(SUMMARY_NOTIFICATION_ID, builder.build());
|
||||
Log.i(TAG, "Posted notification. " + notification.toString());
|
||||
}
|
||||
|
||||
private static void sendInThreadNotification(Context context, Recipient recipient) {
|
||||
|
@ -12,7 +12,7 @@ import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
|
||||
public class AccountManagerFactory {
|
||||
|
||||
private static final String TAG = AccountManagerFactory.class.getName();
|
||||
private static final String TAG = AccountManagerFactory.class.getSimpleName();
|
||||
|
||||
public static SignalServiceAccountManager createManager(Context context) {
|
||||
return new SignalServiceAccountManager(new SignalServiceNetworkAccess(context).getConfiguration(context),
|
||||
|
@ -22,7 +22,7 @@ import okhttp3.TlsVersion;
|
||||
public class SignalServiceNetworkAccess {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = SignalServiceNetworkAccess.class.getName();
|
||||
private static final String TAG = SignalServiceNetworkAccess.class.getSimpleName();
|
||||
|
||||
private static final String COUNTRY_CODE_EGYPT = "+20";
|
||||
private static final String COUNTRY_CODE_UAE = "+971";
|
||||
|
@ -20,7 +20,7 @@ import org.whispersystems.libsignal.util.guava.Optional;
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
public class ScribbleActivity extends PassphraseRequiredActionBarActivity implements ScribbleFragment.Controller {
|
||||
|
||||
private static final String TAG = ScribbleActivity.class.getName();
|
||||
private static final String TAG = ScribbleActivity.class.getSimpleName();
|
||||
|
||||
public static final int SCRIBBLE_REQUEST_CODE = 31424;
|
||||
|
||||
|
@ -48,7 +48,7 @@ import static android.app.Activity.RESULT_OK;
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
public class ScribbleFragment extends Fragment implements ScribbleHud.EventListener, VerticalSlideColorPicker.OnColorChangeListener {
|
||||
|
||||
private static final String TAG = ScribbleFragment.class.getName();
|
||||
private static final String TAG = ScribbleFragment.class.getSimpleName();
|
||||
|
||||
private static final String KEY_IMAGE_URI = "image_uri";
|
||||
private static final String KEY_LOCALE = "locale";
|
||||
|
@ -27,7 +27,7 @@ import java.io.IOException;
|
||||
|
||||
class StickerLoader extends AsyncLoader<String[]> {
|
||||
|
||||
private static final String TAG = StickerLoader.class.getName();
|
||||
private static final String TAG = StickerLoader.class.getSimpleName();
|
||||
|
||||
private final String assetDirectory;
|
||||
|
||||
|
@ -37,7 +37,7 @@ import org.thoughtcrime.securesms.R;
|
||||
|
||||
public class StickerSelectActivity extends FragmentActivity implements StickerSelectFragment.StickerSelectionListener {
|
||||
|
||||
private static final String TAG = StickerSelectActivity.class.getName();
|
||||
private static final String TAG = StickerSelectActivity.class.getSimpleName();
|
||||
|
||||
public static final String EXTRA_STICKER_FILE = "extra_sticker_file";
|
||||
|
||||
|
@ -25,7 +25,7 @@ import android.view.MotionEvent;
|
||||
*/
|
||||
public class RotateGestureDetector extends TwoFingerGestureDetector {
|
||||
|
||||
private static final String TAG = RotateGestureDetector.class.getName();
|
||||
private static final String TAG = RotateGestureDetector.class.getSimpleName();
|
||||
private final OnRotateGestureListener mListener;
|
||||
private boolean mSloppyGesture;
|
||||
|
||||
|
@ -19,7 +19,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class StickyHeaderDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
private static final String TAG = StickyHeaderDecoration.class.getName();
|
||||
private static final String TAG = StickyHeaderDecoration.class.getSimpleName();
|
||||
|
||||
private static final long NO_HEADER_ID = -1L;
|
||||
|
||||
|
@ -66,7 +66,7 @@ import java.io.IOException;
|
||||
|
||||
public class VideoPlayer extends FrameLayout {
|
||||
|
||||
private static final String TAG = VideoPlayer.class.getName();
|
||||
private static final String TAG = VideoPlayer.class.getSimpleName();
|
||||
|
||||
@Nullable private final VideoView videoView;
|
||||
@Nullable private final PlayerView exoView;
|
||||
|
@ -22,7 +22,7 @@ import java.lang.reflect.Method;
|
||||
*/
|
||||
public class IncomingPstnCallReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = IncomingPstnCallReceiver.class.getName();
|
||||
private static final String TAG = IncomingPstnCallReceiver.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
Loading…
Reference in New Issue
Block a user