Skip to content

Commit 404a06f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into cust_remove_call_confirm
2 parents f44af52 + e70229c commit 404a06f

224 files changed

Lines changed: 7968 additions & 753 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/build.gradle

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ repositories {
1616
includeGroupByRegex "com\\.github\\.chrisbanes.*"
1717
}
1818
}
19-
maven {
20-
url "https://raw.github.com/signalapp/maven/master/shortcutbadger/releases/"
21-
content {
22-
includeGroupByRegex "me\\.leolin.*"
23-
}
24-
}
2519
maven {
2620
url "https://raw.github.com/signalapp/maven/master/circular-progress-button/releases/"
2721
content {
@@ -61,8 +55,8 @@ protobuf {
6155
}
6256
}
6357

64-
def canonicalVersionCode = 798
65-
def canonicalVersionName = "5.4.12"
58+
def canonicalVersionCode = 799
59+
def canonicalVersionName = "5.5.0"
6660

6761
def postFixSize = 100
6862
def abiPostFix = ['universal' : 0,
@@ -161,6 +155,8 @@ android {
161155
exclude 'META-INF/LICENSE'
162156
exclude 'META-INF/NOTICE'
163157
exclude 'META-INF/proguard/androidx-annotations.pro'
158+
exclude '/org/spongycastle/x509/CertPathReviewerMessages.properties'
159+
exclude '/org/spongycastle/x509/CertPathReviewerMessages_de.properties'
164160
}
165161

166162
buildTypes {
@@ -208,6 +204,12 @@ android {
208204
debuggable false
209205
matchingFallbacks = ['debug']
210206
}
207+
mock {
208+
initWith debug
209+
isDefault false
210+
minifyEnabled false
211+
matchingFallbacks = ['debug']
212+
}
211213
}
212214

213215
productFlavors {
@@ -233,6 +235,15 @@ android {
233235
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
234236
}
235237

238+
study {
239+
dimension 'distribution'
240+
241+
applicationIdSuffix ".study"
242+
ext.websiteUpdateUrl = "null"
243+
buildConfigField "boolean", "PLAY_STORE_DISABLED", "false"
244+
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
245+
}
246+
236247
prod {
237248
dimension 'environment'
238249

@@ -252,7 +263,7 @@ android {
252263
buildConfigField "String", "SIGNAL_KEY_BACKUP_URL", "\"https://api-staging.backup.signal.org\""
253264
buildConfigField "String", "CDS_MRENCLAVE", "\"c98e00a4e3ff977a56afefe7362a27e4961e4f19e211febfbb19b897e6b80b15\""
254265
buildConfigField "KbsEnclave", "KBS_ENCLAVE", "new KbsEnclave(\"823a3b2c037ff0cbe305cc48928cfcc97c9ed4a8ca6d49af6f7d6981fb60a4e9\", " +
255-
"\"038c40bbbacdc873caa81ac793bb75afde6dfe436a99ab1f15e3f0cbb7434ced\", " +
266+
"\"51a56084c0b21c6b8f62b1bc792ec9bedac4c7c3964bb08ddcab868158c09982\", " +
256267
"\"a3baab19ef6ce6f34ab9ebb25ba722725ae44a8872dc0ff08ad6d83a9489de87\")"
257268
buildConfigField "KbsEnclave[]", "KBS_FALLBACKS", "new KbsEnclave[0]"
258269
buildConfigField "String", "UNIDENTIFIED_SENDER_TRUST_ROOT", "\"BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx\""
@@ -272,6 +283,18 @@ android {
272283
}
273284
}
274285

286+
android.variantFilter { variant ->
287+
def distribution = variant.getFlavors().get(0).name
288+
def environment = variant.getFlavors().get(1).name
289+
def buildType = variant.buildType.name
290+
291+
if (distribution == 'study' && buildType != 'perf' && buildType != 'mock') {
292+
variant.setIgnore(true)
293+
} else if (distribution != 'study' && buildType == 'mock') {
294+
variant.setIgnore(true)
295+
}
296+
}
297+
275298
lintOptions {
276299
abortOnError true
277300
baseline file("lint-baseline.xml")
@@ -334,15 +357,16 @@ dependencies {
334357
implementation project(':paging')
335358
implementation project(':core-util')
336359
implementation project(':video')
360+
implementation project(':device-transfer')
337361

338362
implementation 'org.signal:zkgroup-android:0.7.0'
339363
implementation 'org.whispersystems:signal-client-android:0.1.7'
340364
implementation 'com.google.protobuf:protobuf-javalite:3.10.0'
341365
implementation 'org.signal:argon2:13.1@aar'
342366

343-
implementation 'org.signal:ringrtc-android:2.9.2'
367+
implementation 'org.signal:ringrtc-android:2.9.4'
344368

345-
implementation "me.leolin:ShortcutBadger:1.1.16"
369+
implementation "me.leolin:ShortcutBadger:1.1.22"
346370
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
347371
implementation 'com.jpardogo.materialtabstrip:library:1.0.9'
348372
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'

app/src/main/AndroidManifest.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,16 @@
377377
android:windowSoftInputMode="stateAlwaysHidden">
378378
</activity>
379379

380+
<activity android:name=".devicetransfer.olddevice.OldDeviceTransferActivity"
381+
android:theme="@style/TextSecure.LightRegistrationTheme"
382+
android:launchMode="singleTask"
383+
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
384+
385+
<activity android:name=".devicetransfer.olddevice.OldDeviceExitActivity"
386+
android:noHistory="true"
387+
android:excludeFromRecents="true"
388+
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
389+
380390
<activity android:name=".registration.RegistrationNavigationActivity"
381391
android:launchMode="singleTask"
382392
android:theme="@style/TextSecure.LightRegistrationTheme"

app/src/main/java/org/thoughtcrime/securesms/DeviceActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import androidx.annotation.NonNull;
1919
import androidx.core.content.ContextCompat;
2020

21+
import org.signal.core.util.ThreadUtil;
2122
import org.signal.core.util.logging.Log;
2223
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
2324
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
@@ -28,7 +29,6 @@
2829
import org.thoughtcrime.securesms.util.DynamicLanguage;
2930
import org.thoughtcrime.securesms.util.DynamicTheme;
3031
import org.thoughtcrime.securesms.util.TextSecurePreferences;
31-
import org.thoughtcrime.securesms.util.Util;
3232
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
3333
import org.whispersystems.libsignal.IdentityKeyPair;
3434
import org.whispersystems.libsignal.InvalidKeyException;
@@ -123,7 +123,7 @@ public void onClick(View v) {
123123

124124
@Override
125125
public void onQrDataFound(final String data) {
126-
Util.runOnMain(() -> {
126+
ThreadUtil.runOnMain(() -> {
127127
((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(50);
128128
Uri uri = Uri.parse(data);
129129
deviceLinkFragment.setLinkClickedListener(uri, DeviceActivity.this);

app/src/main/java/org/thoughtcrime/securesms/LoggingFragment.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ public abstract class LoggingFragment extends Fragment {
1515

1616
private static final String TAG = Log.tag(LoggingFragment.class);
1717

18+
public LoggingFragment() { }
19+
20+
public LoggingFragment(int contentLayoutId) {
21+
super(contentLayoutId);
22+
}
23+
1824
@Override
1925
public void onCreate(@Nullable Bundle savedInstanceState) {
2026
logEvent("onCreate()");

app/src/main/java/org/thoughtcrime/securesms/PassphraseRequiredActivity.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
import androidx.annotation.Nullable;
1212
import androidx.fragment.app.Fragment;
1313

14+
import org.greenrobot.eventbus.EventBus;
1415
import org.signal.core.util.logging.Log;
1516
import org.signal.core.util.tracing.Tracer;
17+
import org.signal.devicetransfer.TransferStatus;
1618
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
1719
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
20+
import org.thoughtcrime.securesms.devicetransfer.olddevice.OldDeviceTransferActivity;
1821
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
1922
import org.thoughtcrime.securesms.keyvalue.SignalStore;
2023
import org.thoughtcrime.securesms.lock.v2.CreateKbsPinActivity;
@@ -45,6 +48,7 @@ public abstract class PassphraseRequiredActivity extends BaseActivity implements
4548
private static final int STATE_ENTER_SIGNAL_PIN = 5;
4649
private static final int STATE_CREATE_PROFILE_NAME = 6;
4750
private static final int STATE_CREATE_SIGNAL_PIN = 7;
51+
private static final int STATE_TRANSFER_ONGOING = 8;
4852

4953
private SignalServiceNetworkAccess networkAccess;
5054
private BroadcastReceiver clearKeyReceiver;
@@ -146,6 +150,7 @@ private Intent getIntentForState(int state) {
146150
case STATE_ENTER_SIGNAL_PIN: return getEnterSignalPinIntent();
147151
case STATE_CREATE_SIGNAL_PIN: return getCreateSignalPinIntent();
148152
case STATE_CREATE_PROFILE_NAME: return getCreateProfileNameIntent();
153+
case STATE_TRANSFER_ONGOING: return getOldDeviceTransferIntent();
149154
default: return null;
150155
}
151156
}
@@ -165,6 +170,8 @@ private int getApplicationState(boolean locked) {
165170
return STATE_CREATE_PROFILE_NAME;
166171
} else if (userMustCreateSignalPin()) {
167172
return STATE_CREATE_SIGNAL_PIN;
173+
} else if (EventBus.getDefault().getStickyEvent(TransferStatus.class) != null && getClass() != OldDeviceTransferActivity.class) {
174+
return STATE_TRANSFER_ONGOING;
168175
} else {
169176
return STATE_NORMAL;
170177
}
@@ -219,6 +226,12 @@ private Intent getCreateProfileNameIntent() {
219226
return getRoutedIntent(EditProfileActivity.class, getIntent());
220227
}
221228

229+
private Intent getOldDeviceTransferIntent() {
230+
Intent intent = new Intent(this, OldDeviceTransferActivity.class);
231+
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
232+
return intent;
233+
}
234+
222235
private Intent getRoutedIntent(Class<?> destination, @Nullable Intent nextIntent) {
223236
final Intent intent = new Intent(this, destination);
224237
if (nextIntent != null) intent.putExtra("next_intent", nextIntent);

app/src/main/java/org/thoughtcrime/securesms/VerifyIdentityActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import androidx.fragment.app.Fragment;
6161
import androidx.fragment.app.FragmentTransaction;
6262

63+
import org.signal.core.util.ThreadUtil;
6364
import org.signal.core.util.concurrent.SignalExecutors;
6465
import org.signal.core.util.logging.Log;
6566
import org.thoughtcrime.securesms.color.MaterialColor;
@@ -185,7 +186,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
185186

186187
@Override
187188
public void onQrDataFound(final String data) {
188-
Util.runOnMain(() -> {
189+
ThreadUtil.runOnMain(() -> {
189190
((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(50);
190191

191192
getSupportFragmentManager().popBackStack();

app/src/main/java/org/thoughtcrime/securesms/audio/AudioRecorder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
import androidx.annotation.NonNull;
1010

11+
import org.signal.core.util.ThreadUtil;
1112
import org.signal.core.util.concurrent.SignalExecutors;
1213
import org.signal.core.util.logging.Log;
1314
import org.thoughtcrime.securesms.providers.BlobProvider;
1415
import org.thoughtcrime.securesms.util.MediaUtil;
15-
import org.thoughtcrime.securesms.util.Util;
1616
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
1717
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
1818
import org.whispersystems.libsignal.util.Pair;
@@ -90,10 +90,10 @@ public void startRecording() {
9090
}
9191

9292
private <T> void sendToFuture(final SettableFuture<T> future, final Exception exception) {
93-
Util.runOnMain(() -> future.setException(exception));
93+
ThreadUtil.runOnMain(() -> future.setException(exception));
9494
}
9595

9696
private <T> void sendToFuture(final SettableFuture<T> future, final T result) {
97-
Util.runOnMain(() -> future.set(result));
97+
ThreadUtil.runOnMain(() -> future.set(result));
9898
}
9999
}

app/src/main/java/org/thoughtcrime/securesms/audio/AudioWaveForm.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import com.google.protobuf.ByteString;
1818

19+
import org.signal.core.util.ThreadUtil;
1920
import org.signal.core.util.concurrent.SignalExecutors;
2021
import org.signal.core.util.logging.Log;
2122
import org.thoughtcrime.securesms.attachments.Attachment;
@@ -26,7 +27,6 @@
2627
import org.thoughtcrime.securesms.media.DecryptableUriMediaInput;
2728
import org.thoughtcrime.securesms.media.MediaInput;
2829
import org.thoughtcrime.securesms.mms.AudioSlide;
29-
import org.thoughtcrime.securesms.util.Util;
3030
import org.thoughtcrime.securesms.util.concurrent.SerialExecutor;
3131

3232
import java.io.IOException;
@@ -61,29 +61,29 @@ public void getWaveForm(@NonNull Consumer<AudioFileInfo> onSuccess, @NonNull Run
6161

6262
if (uri == null) {
6363
Log.w(TAG, "No uri");
64-
Util.runOnMain(onFailure);
64+
ThreadUtil.runOnMain(onFailure);
6565
return;
6666
}
6767

6868
if (!(attachment instanceof DatabaseAttachment)) {
6969
Log.i(TAG, "Not yet in database");
70-
Util.runOnMain(onFailure);
70+
ThreadUtil.runOnMain(onFailure);
7171
return;
7272
}
7373

7474
String cacheKey = uri.toString();
7575
AudioFileInfo cached = WAVE_FORM_CACHE.get(cacheKey);
7676
if (cached != null) {
7777
Log.i(TAG, "Loaded wave form from cache " + cacheKey);
78-
Util.runOnMain(() -> onSuccess.accept(cached));
78+
ThreadUtil.runOnMain(() -> onSuccess.accept(cached));
7979
return;
8080
}
8181

8282
AUDIO_DECODER_EXECUTOR.execute(() -> {
8383
AudioFileInfo cachedInExecutor = WAVE_FORM_CACHE.get(cacheKey);
8484
if (cachedInExecutor != null) {
8585
Log.i(TAG, "Loaded wave form from cache inside executor" + cacheKey);
86-
Util.runOnMain(() -> onSuccess.accept(cachedInExecutor));
86+
ThreadUtil.runOnMain(() -> onSuccess.accept(cachedInExecutor));
8787
return;
8888
}
8989

@@ -92,14 +92,14 @@ public void getWaveForm(@NonNull Consumer<AudioFileInfo> onSuccess, @NonNull Run
9292
AudioFileInfo audioFileInfo = AudioFileInfo.fromDatabaseProtobuf(audioHash.getAudioWaveForm());
9393
if (audioFileInfo.waveForm.length == 0) {
9494
Log.w(TAG, "Recovering from a wave form generation error " + cacheKey);
95-
Util.runOnMain(onFailure);
95+
ThreadUtil.runOnMain(onFailure);
9696
return;
9797
} else if (audioFileInfo.waveForm.length != BAR_COUNT) {
9898
Log.w(TAG, "Wave form from database does not match bar count, regenerating " + cacheKey);
9999
} else {
100100
WAVE_FORM_CACHE.put(cacheKey, audioFileInfo);
101101
Log.i(TAG, "Loaded wave form from DB " + cacheKey);
102-
Util.runOnMain(() -> onSuccess.accept(audioFileInfo));
102+
ThreadUtil.runOnMain(() -> onSuccess.accept(audioFileInfo));
103103
return;
104104
}
105105
}
@@ -120,10 +120,10 @@ public void getWaveForm(@NonNull Consumer<AudioFileInfo> onSuccess, @NonNull Run
120120
attachmentDatabase.writeAudioHash(dbAttachment.getAttachmentId(), fileInfo.toDatabaseProtobuf());
121121

122122
WAVE_FORM_CACHE.put(cacheKey, fileInfo);
123-
Util.runOnMain(() -> onSuccess.accept(fileInfo));
123+
ThreadUtil.runOnMain(() -> onSuccess.accept(fileInfo));
124124
} catch (Throwable e) {
125125
Log.w(TAG, "Failed to create audio wave form for " + cacheKey, e);
126-
Util.runOnMain(onFailure);
126+
ThreadUtil.runOnMain(onFailure);
127127
}
128128
});
129129
}

0 commit comments

Comments
 (0)