Merge branch 'dev' into firebase

This commit is contained in:
nielsandriesse 2020-06-09 15:11:23 +10:00
commit 5db952d676
12 changed files with 227 additions and 270 deletions

View File

@ -6,7 +6,7 @@
<uses-sdk tools:overrideLibrary="com.amulyakhare.textdrawable,com.astuetz.pagerslidingtabstrip,pl.tajchert.waitingdots,com.h6ah4i.android.multiselectlistpreferencecompat,android.support.v13,com.davemorrissey.labs.subscaleview,com.tomergoldst.tooltips,com.klinker.android.send_message,com.takisoft.colorpicker,android.support.v14.preference" /> <uses-sdk tools:overrideLibrary="com.amulyakhare.textdrawable,com.astuetz.pagerslidingtabstrip,pl.tajchert.waitingdots,com.h6ah4i.android.multiselectlistpreferencecompat,android.support.v13,com.davemorrissey.labs.subscaleview,com.tomergoldst.tooltips,com.klinker.android.send_message,com.takisoft.colorpicker,android.support.v14.preference" />
<permission <permission
android:name="network.loki.messenger.ACCESS_SECRETS" android:name="network.loki.messenger.ACCESS_SESSION_SECRETS"
android:label="Access to TextSecure Secrets" android:label="Access to TextSecure Secrets"
android:protectionLevel="signature" /> android:protectionLevel="signature" />
@ -31,7 +31,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" /> <uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="network.loki.messenger.ACCESS_SECRETS" /> <uses-permission android:name="network.loki.messenger.ACCESS_SESSION_SECRETS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
@ -676,11 +676,6 @@
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name="org.thoughtcrime.securesms.loki.api.BackgroundOpenGroupPollWorker">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<!-- Session --> <!-- Session -->
<service <service
android:name="org.thoughtcrime.securesms.jobmanager.JobSchedulerScheduler$SystemService" android:name="org.thoughtcrime.securesms.jobmanager.JobSchedulerScheduler$SystemService"

View File

@ -73,6 +73,7 @@ configurations.all {
exclude group: "org.whispersystems", module: "signal-protocol-android" exclude group: "org.whispersystems", module: "signal-protocol-android"
exclude group: "org.signal", module: "signal-metadata-java" exclude group: "org.signal", module: "signal-metadata-java"
exclude group: "org.signal", module: "signal-metadata-android" exclude group: "org.signal", module: "signal-metadata-android"
exclude module: "commons-logging"
} }
dependencies { dependencies {
@ -196,8 +197,8 @@ dependencies {
implementation "com.opencsv:opencsv:$opencsv_version" implementation "com.opencsv:opencsv:$opencsv_version"
} }
def canonicalVersionCode = 53 def canonicalVersionCode = 55
def canonicalVersionName = "1.2.1" def canonicalVersionName = "1.2.2"
def postFixSize = 10 def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1, def abiPostFix = ['armeabi-v7a' : 1,

View File

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <ScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/default_session_background" android:background="@drawable/default_session_background"
android:orientation="vertical"> android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/very_large_spacing"
android:layout_marginRight="@dimen/very_large_spacing" android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="@dimen/very_large_font_size" android:textSize="@dimen/very_large_font_size"
android:textStyle="bold" android:textStyle="bold"
@ -25,7 +25,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="10dp" android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/very_large_spacing" android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="@dimen/medium_font_size" android:textSize="@dimen/medium_font_size"
android:textColor="@color/text" android:textColor="@color/text"
@ -36,7 +36,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/medium_spacing" android:layout_marginTop="20dp"
android:layout_marginRight="@dimen/very_large_spacing" android:layout_marginRight="@dimen/very_large_spacing"
android:padding="12dp" android:padding="12dp"
android:orientation="vertical" android:orientation="vertical"
@ -98,19 +98,17 @@
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button <Button
style="@style/MediumProminentFilledButton" style="@style/MediumProminentFilledButton"
android:id="@+id/registerButton" android:id="@+id/registerButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/medium_button_height" android:layout_height="@dimen/medium_button_height"
android:layout_marginLeft="@dimen/massive_spacing" android:layout_marginLeft="@dimen/massive_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/massive_spacing" android:layout_marginRight="@dimen/massive_spacing"
android:layout_marginBottom="@dimen/medium_spacing" android:layout_marginBottom="@dimen/medium_spacing"
android:text="Continue" /> android:text="@string/continue_2" />
</LinearLayout> </LinearLayout>
</ScrollView>

View File

@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <ScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/default_session_background" android:background="@drawable/default_session_background"
android:orientation="vertical"> android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="@dimen/very_large_spacing"
android:layout_marginRight="@dimen/very_large_spacing" android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="18sp" android:textSize="@dimen/large_font_size"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/text" android:textColor="@color/text"
android:text="@string/activity_pn_mode_title" /> android:text="@string/activity_pn_mode_title" />
@ -25,9 +25,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="4dp" android:layout_marginTop="@dimen/small_spacing"
android:layout_marginRight="@dimen/very_large_spacing" android:layout_marginRight="@dimen/very_large_spacing"
android:textSize="13sp" android:textSize="@dimen/small_font_size"
android:textColor="@color/text" android:textColor="@color/text"
android:text="@string/activity_pn_mode_explanation" /> android:text="@string/activity_pn_mode_explanation" />
@ -36,16 +36,16 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="4dp" android:layout_marginTop="12dp"
android:layout_marginRight="@dimen/very_large_spacing" android:layout_marginRight="@dimen/very_large_spacing"
android:padding="10dp" android:padding="12dp"
android:orientation="vertical" android:orientation="vertical"
android:background="@drawable/pn_option_background"> android:background="@drawable/pn_option_background">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="14sp" android:textSize="@dimen/medium_spacing"
android:textColor="@color/text" android:textColor="@color/text"
android:textStyle="bold" android:textStyle="bold"
android:text="@string/activity_pn_mode_fcm_option_title" /> android:text="@string/activity_pn_mode_fcm_option_title" />
@ -74,16 +74,16 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/very_large_spacing" android:layout_marginLeft="@dimen/very_large_spacing"
android:layout_marginTop="4dp" android:layout_marginTop="@dimen/small_spacing"
android:layout_marginRight="@dimen/very_large_spacing" android:layout_marginRight="@dimen/very_large_spacing"
android:padding="10dp" android:padding="12dp"
android:orientation="vertical" android:orientation="vertical"
android:background="@drawable/pn_option_background"> android:background="@drawable/pn_option_background">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="14sp" android:textSize="@dimen/medium_spacing"
android:textColor="@color/text" android:textColor="@color/text"
android:textStyle="bold" android:textStyle="bold"
android:text="@string/activity_pn_mode_background_polling_option_title" /> android:text="@string/activity_pn_mode_background_polling_option_title" />
@ -98,19 +98,17 @@
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button <Button
style="@style/MediumProminentFilledButton" style="@style/MediumProminentFilledButton"
android:id="@+id/registerButton" android:id="@+id/registerButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/medium_button_height" android:layout_height="@dimen/medium_button_height"
android:layout_marginLeft="@dimen/massive_spacing" android:layout_marginLeft="@dimen/massive_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginRight="@dimen/massive_spacing" android:layout_marginRight="@dimen/massive_spacing"
android:layout_marginBottom="@dimen/medium_spacing" android:layout_marginBottom="@dimen/medium_spacing"
android:text="@string/continue_2" /> android:text="@string/continue_2" />
</LinearLayout> </LinearLayout>
</ScrollView>

View File

@ -59,7 +59,6 @@ import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.logging.PersistentLogger; import org.thoughtcrime.securesms.logging.PersistentLogger;
import org.thoughtcrime.securesms.logging.UncaughtExceptionLogger; import org.thoughtcrime.securesms.logging.UncaughtExceptionLogger;
import org.thoughtcrime.securesms.loki.activities.HomeActivity; import org.thoughtcrime.securesms.loki.activities.HomeActivity;
import org.thoughtcrime.securesms.loki.api.BackgroundOpenGroupPollWorker;
import org.thoughtcrime.securesms.loki.api.BackgroundPollWorker; import org.thoughtcrime.securesms.loki.api.BackgroundPollWorker;
import org.thoughtcrime.securesms.loki.api.LokiPublicChatManager; import org.thoughtcrime.securesms.loki.api.LokiPublicChatManager;
import org.thoughtcrime.securesms.loki.api.LokiPushNotificationManager; import org.thoughtcrime.securesms.loki.api.LokiPushNotificationManager;
@ -366,7 +365,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
LocalBackupListener.schedule(this); LocalBackupListener.schedule(this);
RotateSenderCertificateListener.schedule(this); RotateSenderCertificateListener.schedule(this);
BackgroundPollWorker.schedule(this); // Loki BackgroundPollWorker.schedule(this); // Loki
BackgroundOpenGroupPollWorker.schedule(this); // Loki
if (BuildConfig.PLAY_STORE_DISABLED) { if (BuildConfig.PLAY_STORE_DISABLED) {
UpdateApkRefreshListener.schedule(this); UpdateApkRefreshListener.schedule(this);

View File

@ -2066,7 +2066,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
} else if (!isSecureText && !isDefaultSms) { } else if (!isSecureText && !isDefaultSms) {
unblockButton.setVisibility(View.GONE); unblockButton.setVisibility(View.GONE);
inputPanel.setVisibility(View.GONE); inputPanel.setVisibility(View.GONE);
makeDefaultSmsButton.setVisibility(View.VISIBLE); makeDefaultSmsButton.setVisibility(View.GONE);
registerButton.setVisibility(View.GONE); registerButton.setVisibility(View.GONE);
} else { } else {
inputPanel.setVisibility(View.VISIBLE); inputPanel.setVisibility(View.VISIBLE);

View File

@ -1,38 +0,0 @@
package org.thoughtcrime.securesms.loki.api
import android.content.Context
import android.content.Intent
import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.service.PersistentAlarmManagerListener
import org.thoughtcrime.securesms.util.TextSecurePreferences
import java.util.concurrent.TimeUnit
class BackgroundOpenGroupPollWorker : PersistentAlarmManagerListener() {
companion object {
private val pollInterval = TimeUnit.MINUTES.toMillis(4)
@JvmStatic
fun schedule(context: Context) {
BackgroundOpenGroupPollWorker().onReceive(context, Intent())
}
}
override fun getNextScheduledExecutionTime(context: Context): Long {
return TextSecurePreferences.getOpenGroupBackgroundPollTime(context)
}
override fun onAlarm(context: Context, scheduledTime: Long): Long {
if (scheduledTime != 0L) {
val openGroups = DatabaseFactory.getLokiThreadDatabase(context).getAllPublicChats().map { it.value }
for (openGroup in openGroups) {
val poller = LokiPublicChatPoller(context, openGroup)
poller.stop()
poller.pollForNewMessages()
}
}
val nextTime = System.currentTimeMillis() + pollInterval
TextSecurePreferences.setOpenGroupBackgroundPollTime(context, nextTime)
return nextTime
}
}

View File

@ -15,7 +15,7 @@ import java.util.concurrent.TimeUnit
class BackgroundPollWorker : PersistentAlarmManagerListener() { class BackgroundPollWorker : PersistentAlarmManagerListener() {
companion object { companion object {
private val pollInterval = TimeUnit.MINUTES.toMillis(2) private val pollInterval = TimeUnit.MINUTES.toMillis(10)
@JvmStatic @JvmStatic
fun schedule(context: Context) { fun schedule(context: Context) {
@ -28,14 +28,14 @@ class BackgroundPollWorker : PersistentAlarmManagerListener() {
} }
override fun onAlarm(context: Context, scheduledTime: Long): Long { override fun onAlarm(context: Context, scheduledTime: Long): Long {
if (TextSecurePreferences.isUsingFCM(context)) { return 0L }
if (scheduledTime != 0L) { if (scheduledTime != 0L) {
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context) if (TextSecurePreferences.isUsingFCM(context)) {
val userPublicKey = TextSecurePreferences.getLocalNumber(context)
val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context) val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context)
try { try {
val applicationContext = context.applicationContext as ApplicationContext val applicationContext = context.applicationContext as ApplicationContext
val broadcaster = applicationContext.broadcaster val broadcaster = applicationContext.broadcaster
LokiAPI.configureIfNeeded(userHexEncodedPublicKey, lokiAPIDatabase, broadcaster) LokiAPI.configureIfNeeded(userPublicKey, lokiAPIDatabase, broadcaster)
LokiAPI.shared.getMessages().map { messages -> LokiAPI.shared.getMessages().map { messages ->
messages.forEach { messages.forEach {
PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it), false) PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it), false)
@ -45,6 +45,13 @@ class BackgroundPollWorker : PersistentAlarmManagerListener() {
// Do nothing // Do nothing
} }
} }
val openGroups = DatabaseFactory.getLokiThreadDatabase(context).getAllPublicChats().map { it.value }
for (openGroup in openGroups) {
val poller = LokiPublicChatPoller(context, openGroup)
poller.stop()
poller.pollForNewMessages()
}
}
val nextTime = System.currentTimeMillis() + pollInterval val nextTime = System.currentTimeMillis() + pollInterval
TextSecurePreferences.setBackgroundPollTime(context, nextTime) TextSecurePreferences.setBackgroundPollTime(context, nextTime)
return nextTime return nextTime

View File

@ -26,8 +26,8 @@ class LokiSessionResetImplementation(private val context: Context) : LokiSession
} }
override fun validatePreKeySignalMessage(sender: String, message: PreKeySignalMessage) { override fun validatePreKeySignalMessage(sender: String, message: PreKeySignalMessage) {
val preKeyRecord = DatabaseFactory.getLokiPreKeyRecordDatabase(context).getPreKeyRecord(sender) val preKeyRecord = DatabaseFactory.getLokiPreKeyRecordDatabase(context).getPreKeyRecord(sender) ?: return
check(preKeyRecord != null) { "Received a background message from a user without an associated pre key record." } // TODO: Checking that the pre key record isn't null is causing issues when it shouldn't
check(preKeyRecord.id == (message.preKeyId ?: -1)) { "Received a background message from an unknown source." } check(preKeyRecord.id == (message.preKeyId ?: -1)) { "Received a background message from an unknown source." }
} }
} }

View File

@ -14,7 +14,6 @@ import android.os.VibrationEffect
import android.os.VibrationEffect.DEFAULT_AMPLITUDE import android.os.VibrationEffect.DEFAULT_AMPLITUDE
import android.os.Vibrator import android.os.Vibrator
import android.support.annotation.ColorRes import android.support.annotation.ColorRes
import android.support.annotation.DimenRes
import android.support.annotation.DrawableRes import android.support.annotation.DrawableRes
import android.util.AttributeSet import android.util.AttributeSet
import android.view.MotionEvent import android.view.MotionEvent
@ -198,12 +197,9 @@ class NewConversationButtonSetView : RelativeLayout {
when (event.action) { when (event.action) {
MotionEvent.ACTION_DOWN -> { MotionEvent.ACTION_DOWN -> {
if (isExpanded) { if (isExpanded) {
if (sessionButton.contains(touch)) { delegate?.createNewPrivateChat(); collapse() } if (mainButton.contains(touch)) { collapse() }
else if (closedGroupButton.contains(touch)) { delegate?.createNewClosedGroup(); collapse() }
else if (openGroupButton.contains(touch)) { delegate?.joinOpenGroup(); collapse() }
else if (mainButton.contains(touch)) { collapse() }
} else { } else {
isExpanded = !isExpanded isExpanded = true
expand() expand()
} }
val vibrator = context.getSystemService(VIBRATOR_SERVICE) as Vibrator val vibrator = context.getSystemService(VIBRATOR_SERVICE) as Vibrator
@ -235,15 +231,17 @@ class NewConversationButtonSetView : RelativeLayout {
} }
} }
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
val distanceFromRestPosition = touch.distanceTo(buttonRestPosition) val mainButtonCenter = PointF(width.toFloat() / 2, height.toFloat() - bottomMargin - mainButton.expandedSize / 2)
if (distanceFromRestPosition > (minDragDistance + mainButton.collapsedSize / 2)) { val distanceFromMainButtonCenter = touch.distanceTo(mainButtonCenter)
fun collapse() {
isExpanded = false
this.collapse()
}
if (distanceFromMainButtonCenter > (minDragDistance + mainButton.collapsedSize / 2)) {
if (sessionButton.contains(touch) || touch.isAbove(sessionButton, dragMargin)) { delegate?.createNewPrivateChat(); collapse() } if (sessionButton.contains(touch) || touch.isAbove(sessionButton, dragMargin)) { delegate?.createNewPrivateChat(); collapse() }
else if (closedGroupButton.contains(touch) || touch.isRightOf(closedGroupButton, dragMargin)) { delegate?.createNewClosedGroup(); collapse() } else if (closedGroupButton.contains(touch) || touch.isRightOf(closedGroupButton, dragMargin)) { delegate?.createNewClosedGroup(); collapse() }
else if (openGroupButton.contains(touch) || touch.isLeftOf(openGroupButton, dragMargin)) { delegate?.joinOpenGroup(); collapse() } else if (openGroupButton.contains(touch) || touch.isLeftOf(openGroupButton, dragMargin)) { delegate?.joinOpenGroup(); collapse() }
else { else { collapse() }
isExpanded = !isExpanded
if (!isExpanded) { collapse() }
}
} else { } else {
val currentPosition = PointF(mainButton.x, mainButton.y) val currentPosition = PointF(mainButton.x, mainButton.y)
mainButton.animatePositionChange(currentPosition, buttonRestPosition) mainButton.animatePositionChange(currentPosition, buttonRestPosition)

View File

@ -61,7 +61,7 @@ public class KeyCachingService extends Service {
public static final int SERVICE_RUNNING_ID = 4141; public static final int SERVICE_RUNNING_ID = 4141;
public static final String KEY_PERMISSION = "network.loki.messenger.ACCESS_SECRETS"; public static final String KEY_PERMISSION = "network.loki.messenger.ACCESS_SESSION_SECRETS";
public static final String NEW_KEY_EVENT = "org.thoughtcrime.securesms.service.action.NEW_KEY_EVENT"; public static final String NEW_KEY_EVENT = "org.thoughtcrime.securesms.service.action.NEW_KEY_EVENT";
public static final String CLEAR_KEY_EVENT = "org.thoughtcrime.securesms.service.action.CLEAR_KEY_EVENT"; public static final String CLEAR_KEY_EVENT = "org.thoughtcrime.securesms.service.action.CLEAR_KEY_EVENT";
public static final String LOCK_TOGGLED_EVENT = "org.thoughtcrime.securesms.service.action.LOCK_ENABLED_EVENT"; public static final String LOCK_TOGGLED_EVENT = "org.thoughtcrime.securesms.service.action.LOCK_ENABLED_EVENT";

View File

@ -40,7 +40,7 @@ public class BitmapUtil {
private static final String TAG = BitmapUtil.class.getSimpleName(); private static final String TAG = BitmapUtil.class.getSimpleName();
private static final int MAX_COMPRESSION_QUALITY = 90; private static final int MAX_COMPRESSION_QUALITY = 95;
private static final int MIN_COMPRESSION_QUALITY = 45; private static final int MIN_COMPRESSION_QUALITY = 45;
private static final int MAX_COMPRESSION_ATTEMPTS = 5; private static final int MAX_COMPRESSION_ATTEMPTS = 5;
private static final int MIN_COMPRESSION_QUALITY_DECREASE = 5; private static final int MIN_COMPRESSION_QUALITY_DECREASE = 5;
@ -255,7 +255,7 @@ public class BitmapUtil {
public static InputStream toCompressedJpeg(Bitmap bitmap) { public static InputStream toCompressedJpeg(Bitmap bitmap) {
ByteArrayOutputStream thumbnailBytes = new ByteArrayOutputStream(); ByteArrayOutputStream thumbnailBytes = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.JPEG, 85, thumbnailBytes); bitmap.compress(CompressFormat.JPEG, 95, thumbnailBytes);
return new ByteArrayInputStream(thumbnailBytes.toByteArray()); return new ByteArrayInputStream(thumbnailBytes.toByteArray());
} }