Add Log.internal()

This commit is contained in:
Greyson Parrelli
2021-04-14 14:38:29 -04:00
parent c393cd655d
commit e461625da4
6 changed files with 162 additions and 61 deletions

View File

@@ -229,7 +229,7 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr
private void initializeLogging() {
persistentLogger = new PersistentLogger(this, LogSecretProvider.getOrCreateAttachmentSecret(this), BuildConfig.VERSION_NAME);
org.signal.core.util.logging.Log.initialize(new AndroidLogger(), persistentLogger);
org.signal.core.util.logging.Log.initialize(FeatureFlags::internalUser, new AndroidLogger(), persistentLogger);
SignalProtocolLoggerProvider.setProvider(new CustomSignalProtocolLogger());
}

View File

@@ -23,7 +23,6 @@ import org.thoughtcrime.securesms.notifications.NotificationIds
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.service.KeyCachingService
import org.thoughtcrime.securesms.util.BubbleUtil.BubbleState
import org.thoughtcrime.securesms.util.FeatureFlags
import org.thoughtcrime.securesms.util.ServiceUtil
import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.thoughtcrime.securesms.webrtc.CallNotificationBuilder
@@ -111,9 +110,7 @@ class MessageNotifierV2 : MessageNotifier {
val state: NotificationStateV2 = NotificationStateProvider.constructNotificationState(context)
if (FeatureFlags.internalUser()) {
Log.i(TAG, state.toString())
}
Log.internal().i(TAG, state.toString())
if (state.isEmpty) {
Log.i(TAG, "State is empty, cancelling all notifications")

View File

@@ -27,7 +27,6 @@ import org.thoughtcrime.securesms.notifications.NotificationIds
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.util.BubbleUtil
import org.thoughtcrime.securesms.util.ConversationUtil
import org.thoughtcrime.securesms.util.FeatureFlags
import org.thoughtcrime.securesms.util.ServiceUtil
import org.thoughtcrime.securesms.util.TextSecurePreferences
@@ -56,9 +55,7 @@ object NotificationFactory {
if (Build.VERSION.SDK_INT >= 23 || state.conversations.size == 1) {
state.conversations.forEach { conversation ->
if (conversation.threadId == visibleThreadId && conversation.hasNewNotifications()) {
if (FeatureFlags.internalUser()) {
Log.i(TAG, "Thread is visible, notifying in thread. notificationId: ${conversation.notificationId}")
}
Log.internal().i(TAG, "Thread is visible, notifying in thread. notificationId: ${conversation.notificationId}")
notifyInThread(context, conversation.recipient, lastAudibleNotification)
} else if (conversation.hasNewNotifications() || alertOverrides.contains(conversation.threadId)) {
@@ -233,9 +230,7 @@ object NotificationFactory {
private fun NotificationManagerCompat.safelyNotify(context: Context, threadRecipient: Recipient?, notificationId: Int, notification: Notification) {
try {
notify(notificationId, notification)
if (FeatureFlags.internalUser()) {
Log.i(TAG, "Posted notification: $notification")
}
Log.internal().i(TAG, "Posted notification: $notification")
} catch (e: SecurityException) {
Log.i(TAG, "Security exception when posting notification, clearing ringtone")
if (threadRecipient != null) {