Upgrade SDK to 30.

This commit is contained in:
Alex Hart
2020-11-17 09:58:14 -04:00
parent 23618923d8
commit 75062ada8a
8 changed files with 39 additions and 39 deletions

View File

@@ -109,8 +109,8 @@ def keystores = [ 'debug' : loadKeystoreProperties('keystore.debug.properties')
android { android {
flavorDimensions 'distribution', 'environment' flavorDimensions 'distribution', 'environment'
compileSdkVersion 29 compileSdkVersion 30
buildToolsVersion '29.0.3' buildToolsVersion '30.0.2'
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
dexOptions { dexOptions {
@@ -133,7 +133,7 @@ android {
versionName canonicalVersionName versionName canonicalVersionName
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 29 targetSdkVersion 30
multiDexEnabled true multiDexEnabled true
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true

View File

@@ -12,7 +12,6 @@ import androidx.documentfile.provider.DocumentFile;
import com.annimon.stream.function.Consumer; import com.annimon.stream.function.Consumer;
import com.annimon.stream.function.Predicate; import com.annimon.stream.function.Predicate;
import com.google.android.collect.Sets;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import net.sqlcipher.database.SQLiteDatabase; import net.sqlcipher.database.SQLiteDatabase;
@@ -38,6 +37,7 @@ import org.thoughtcrime.securesms.database.StickerDatabase;
import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.profiles.AvatarHelper; import org.thoughtcrime.securesms.profiles.AvatarHelper;
import org.thoughtcrime.securesms.util.Conversions; import org.thoughtcrime.securesms.util.Conversions;
import org.thoughtcrime.securesms.util.SetUtil;
import org.thoughtcrime.securesms.util.Stopwatch; import org.thoughtcrime.securesms.util.Stopwatch;
import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.libsignal.kdf.HKDFv3; import org.whispersystems.libsignal.kdf.HKDFv3;
@@ -69,7 +69,7 @@ public class FullBackupExporter extends FullBackupBase {
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final String TAG = FullBackupExporter.class.getSimpleName(); private static final String TAG = FullBackupExporter.class.getSimpleName();
private static final Set<String> BLACKLISTED_TABLES = Sets.newHashSet( private static final Set<String> BLACKLISTED_TABLES = SetUtil.newHashSet(
SignedPreKeyDatabase.TABLE_NAME, SignedPreKeyDatabase.TABLE_NAME,
OneTimePreKeyDatabase.TABLE_NAME, OneTimePreKeyDatabase.TABLE_NAME,
SessionDatabase.TABLE_NAME, SessionDatabase.TABLE_NAME,

View File

@@ -61,7 +61,6 @@ import androidx.recyclerview.widget.RecyclerView.OnScrollListener;
import com.annimon.stream.Collectors; import com.annimon.stream.Collectors;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
import com.google.android.collect.Sets;
import org.thoughtcrime.securesms.ApplicationContext; import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.LoggingFragment; import org.thoughtcrime.securesms.LoggingFragment;
@@ -125,6 +124,7 @@ import org.thoughtcrime.securesms.util.CommunicationActions;
import org.thoughtcrime.securesms.util.HtmlUtil; import org.thoughtcrime.securesms.util.HtmlUtil;
import org.thoughtcrime.securesms.util.RemoteDeleteUtil; import org.thoughtcrime.securesms.util.RemoteDeleteUtil;
import org.thoughtcrime.securesms.util.SaveAttachmentTask; import org.thoughtcrime.securesms.util.SaveAttachmentTask;
import org.thoughtcrime.securesms.util.SetUtil;
import org.thoughtcrime.securesms.util.SnapToTopDataObserver; import org.thoughtcrime.securesms.util.SnapToTopDataObserver;
import org.thoughtcrime.securesms.util.StickyHeaderDecoration; import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
import org.thoughtcrime.securesms.util.StorageUtil; import org.thoughtcrime.securesms.util.StorageUtil;
@@ -1498,8 +1498,8 @@ public class ConversationFragment extends LoggingFragment {
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_info: handleDisplayDetails(conversationMessage); return true; case R.id.action_info: handleDisplayDetails(conversationMessage); return true;
case R.id.action_delete: handleDeleteMessages(Sets.newHashSet(conversationMessage)); return true; case R.id.action_delete: handleDeleteMessages(SetUtil.newHashSet(conversationMessage)); return true;
case R.id.action_copy: handleCopyMessage(Sets.newHashSet(conversationMessage)); return true; case R.id.action_copy: handleCopyMessage(SetUtil.newHashSet(conversationMessage)); return true;
case R.id.action_reply: handleReplyMessage(conversationMessage); return true; case R.id.action_reply: handleReplyMessage(conversationMessage); return true;
case R.id.action_multiselect: handleEnterMultiSelect(conversationMessage); return true; case R.id.action_multiselect: handleEnterMultiSelect(conversationMessage); return true;
case R.id.action_forward: handleForwardMessage(conversationMessage); return true; case R.id.action_forward: handleForwardMessage(conversationMessage); return true;

View File

@@ -1,34 +1,29 @@
package org.thoughtcrime.securesms.linkpreview; package org.thoughtcrime.securesms.linkpreview;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.os.Build;
import android.text.Html; import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.style.URLSpan; import android.text.style.URLSpan;
import android.text.util.Linkify; import android.text.util.Linkify;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
import com.google.android.collect.Sets;
import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.stickers.StickerUrl; import org.thoughtcrime.securesms.stickers.StickerUrl;
import org.thoughtcrime.securesms.util.DateUtils; import org.thoughtcrime.securesms.util.DateUtils;
import org.thoughtcrime.securesms.util.SetUtil;
import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.libsignal.util.guava.Optional; import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.util.OptionalUtil; import org.whispersystems.signalservice.api.util.OptionalUtil;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@@ -50,7 +45,7 @@ public final class LinkPreviewUtil {
private static final Pattern FAVICON_PATTERN = Pattern.compile("<\\s*link[^>]*rel\\s*=\\s*\".*icon.*\"[^>]*>"); private static final Pattern FAVICON_PATTERN = Pattern.compile("<\\s*link[^>]*rel\\s*=\\s*\".*icon.*\"[^>]*>");
private static final Pattern FAVICON_HREF_PATTERN = Pattern.compile("href\\s*=\\s*\"([^\"]*)\""); private static final Pattern FAVICON_HREF_PATTERN = Pattern.compile("href\\s*=\\s*\"([^\"]*)\"");
private static final Set<String> INVALID_TOP_LEVEL_DOMAINS = Sets.newHashSet("onion", "i2p"); private static final Set<String> INVALID_TOP_LEVEL_DOMAINS = SetUtil.newHashSet("onion", "i2p");
/** /**
* @return All whitelisted URLs in the source text. * @return All whitelisted URLs in the source text.

View File

@@ -6,7 +6,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
import com.google.android.collect.Sets;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@@ -72,8 +71,7 @@ public final class FeatureFlags {
* We will only store remote values for flags in this set. If you want a flag to be controllable * We will only store remote values for flags in this set. If you want a flag to be controllable
* remotely, place it in here. * remotely, place it in here.
*/ */
private static final Set<String> REMOTE_CAPABLE = SetUtil.newHashSet(
private static final Set<String> REMOTE_CAPABLE = Sets.newHashSet(
GROUPS_V2_RECOMMENDED_LIMIT, GROUPS_V2_RECOMMENDED_LIMIT,
GROUPS_V2_HARD_LIMIT, GROUPS_V2_HARD_LIMIT,
GROUPS_V2_JOIN_VERSION, GROUPS_V2_JOIN_VERSION,
@@ -108,7 +106,7 @@ public final class FeatureFlags {
* will be updated arbitrarily at runtime. This will make values more responsive, but also places * will be updated arbitrarily at runtime. This will make values more responsive, but also places
* more burden on the reader to ensure that the app experience remains consistent. * more burden on the reader to ensure that the app experience remains consistent.
*/ */
private static final Set<String> HOT_SWAPPABLE = Sets.newHashSet( private static final Set<String> HOT_SWAPPABLE = SetUtil.newHashSet(
GROUPS_V2_JOIN_VERSION, GROUPS_V2_JOIN_VERSION,
VERIFY_V2, VERIFY_V2,
CLIENT_EXPIRATION, CLIENT_EXPIRATION,
@@ -118,7 +116,7 @@ public final class FeatureFlags {
/** /**
* Flags in this set will stay true forever once they receive a true value from a remote config. * Flags in this set will stay true forever once they receive a true value from a remote config.
*/ */
private static final Set<String> STICKY = Sets.newHashSet( private static final Set<String> STICKY = SetUtil.newHashSet(
VERIFY_V2 VERIFY_V2
); );

View File

@@ -1,6 +1,11 @@
package org.thoughtcrime.securesms.util; package org.thoughtcrime.securesms.util;
import android.annotation.SuppressLint;
import com.google.android.collect.Sets;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
@@ -24,4 +29,9 @@ public final class SetUtil {
result.addAll(b); result.addAll(b);
return result; return result;
} }
@SuppressLint("NewApi")
public static <E> HashSet<E> newHashSet(E... elements) {
return Sets.newHashSet(elements);
}
} }

View File

@@ -4,27 +4,24 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.text.BidiFormatter; import androidx.core.text.BidiFormatter;
import com.google.android.collect.Sets;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Set; import java.util.Set;
public final class StringUtil { public final class StringUtil {
private static final Set<Character> WHITESPACE = Sets.newHashSet('\u200E', // left-to-right mark private static final Set<Character> WHITESPACE = SetUtil.newHashSet('\u200E', // left-to-right mark
'\u200F', // right-to-left mark '\u200F', // right-to-left mark
'\u2007'); // figure space '\u2007'); // figure space
private static final class Bidi { private static final class Bidi {
/** Override text direction */ /** Override text direction */
private static final Set<Integer> OVERRIDES = Sets.newHashSet("\u202a".codePointAt(0), /* LRE */ private static final Set<Integer> OVERRIDES = SetUtil.newHashSet("\u202a".codePointAt(0), /* LRE */
"\u202b".codePointAt(0), /* RLE */ "\u202b".codePointAt(0), /* RLE */
"\u202d".codePointAt(0), /* LRO */ "\u202d".codePointAt(0), /* LRO */
"\u202e".codePointAt(0) /* RLO */); "\u202e".codePointAt(0) /* RLO */);
/** Set direction and isolate surrounding text */ /** Set direction and isolate surrounding text */
private static final Set<Integer> ISOLATES = Sets.newHashSet("\u2066".codePointAt(0), /* LRI */ private static final Set<Integer> ISOLATES = SetUtil.newHashSet("\u2066".codePointAt(0), /* LRI */
"\u2067".codePointAt(0), /* RLI */ "\u2067".codePointAt(0), /* RLI */
"\u2068".codePointAt(0) /* FSI */); "\u2068".codePointAt(0) /* FSI */);
/** Closes things in {@link #OVERRIDES} */ /** Closes things in {@link #OVERRIDES} */

View File

@@ -11,8 +11,8 @@ RUN apt-get update -y && apt-get install -y $(cat docker/dependencies.txt)
RUN docker/print-versions.sh docker/dependencies.txt RUN docker/print-versions.sh docker/dependencies.txt
ENV ANDROID_SDK_FILENAME android-sdk_r24.4.1-linux.tgz ENV ANDROID_SDK_FILENAME android-sdk_r24.4.1-linux.tgz
ENV ANDROID_API_LEVELS android-29 ENV ANDROID_API_LEVELS android-30
ENV ANDROID_BUILD_TOOLS_VERSION 29.0.3 ENV ANDROID_BUILD_TOOLS_VERSION 30.0.2
ENV ANDROID_HOME /usr/local/android-sdk-linux ENV ANDROID_HOME /usr/local/android-sdk-linux
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools