diff --git a/AndroidManifest.xml b/AndroidManifest.xml index bcfedcacb..f85121531 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -330,13 +330,6 @@ - - - - - - - diff --git a/src/org/thoughtcrime/securesms/crypto/PreKeyUtil.java b/src/org/thoughtcrime/securesms/crypto/PreKeyUtil.java deleted file mode 100644 index fd6ef67a2..000000000 --- a/src/org/thoughtcrime/securesms/crypto/PreKeyUtil.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2013-2018 Open Whisper Systems - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.thoughtcrime.securesms.crypto; - -import android.content.Context; - -import org.thoughtcrime.securesms.crypto.storage.TextSecurePreKeyStore; -import org.thoughtcrime.securesms.util.TextSecurePreferences; -import org.whispersystems.libsignal.IdentityKeyPair; -import org.whispersystems.libsignal.InvalidKeyException; -import org.whispersystems.libsignal.ecc.Curve; -import org.whispersystems.libsignal.ecc.ECKeyPair; -import org.whispersystems.libsignal.state.PreKeyRecord; -import org.whispersystems.libsignal.state.PreKeyStore; -import org.whispersystems.libsignal.state.SignedPreKeyRecord; -import org.whispersystems.libsignal.state.SignedPreKeyStore; -import org.whispersystems.libsignal.util.Medium; - -import java.util.LinkedList; -import java.util.List; - -public class PreKeyUtil { - - @SuppressWarnings("unused") - private static final String TAG = PreKeyUtil.class.getName(); - - private static final int BATCH_SIZE = 100; - - public synchronized static List generatePreKeys(Context context) { - PreKeyStore preKeyStore = new TextSecurePreKeyStore(context); - List records = new LinkedList<>(); - int preKeyIdOffset = TextSecurePreferences.getNextPreKeyId(context); - - for (int i=0;i INTERVALS = new TreeSet() {{ - add(TimeUnit.HOURS.toMillis(6)); - add(TimeUnit.HOURS.toMillis(12)); - add(TimeUnit.DAYS.toMillis(1)); - add(TimeUnit.DAYS.toMillis(3)); - add(TimeUnit.DAYS.toMillis(7)); - }}; - - public static final long INITIAL_INTERVAL = INTERVALS.first(); - - public static boolean needsReminder(@NonNull Context context) { - return false; - } - - public static void scheduleReminder(@NonNull Context context, boolean success) { - //TODO Remove class - } - -} diff --git a/src/org/thoughtcrime/securesms/qr/QrCode.java b/src/org/thoughtcrime/securesms/qr/QrCode.java deleted file mode 100644 index e6d2b5dc1..000000000 --- a/src/org/thoughtcrime/securesms/qr/QrCode.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.thoughtcrime.securesms.qr; - -import android.graphics.Bitmap; -import android.graphics.Color; -import android.support.annotation.NonNull; -import android.util.Log; - -import com.google.zxing.BarcodeFormat; -import com.google.zxing.WriterException; -import com.google.zxing.common.BitMatrix; -import com.google.zxing.qrcode.QRCodeWriter; - -public class QrCode { - - public static final String TAG = QrCode.class.getSimpleName(); - - public static @NonNull Bitmap create(String data) { - try { - BitMatrix result = new QRCodeWriter().encode(data, BarcodeFormat.QR_CODE, 512, 512); - Bitmap bitmap = Bitmap.createBitmap(result.getWidth(), result.getHeight(), Bitmap.Config.ARGB_8888); - - for (int y = 0; y < result.getHeight(); y++) { - for (int x = 0; x < result.getWidth(); x++) { - if (result.get(x, y)) { - bitmap.setPixel(x, y, Color.BLACK); - } - } - } - - return bitmap; - } catch (WriterException e) { - Log.w(TAG, e); - return Bitmap.createBitmap(512, 512, Bitmap.Config.ARGB_8888); - } - } - -} diff --git a/src/org/thoughtcrime/securesms/qr/ScanListener.java b/src/org/thoughtcrime/securesms/qr/ScanListener.java deleted file mode 100644 index 83faae990..000000000 --- a/src/org/thoughtcrime/securesms/qr/ScanListener.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.thoughtcrime.securesms.qr; - -public interface ScanListener { - public void onQrDataFound(String data); -} diff --git a/src/org/thoughtcrime/securesms/qr/ScanningThread.java b/src/org/thoughtcrime/securesms/qr/ScanningThread.java deleted file mode 100644 index f37374e29..000000000 --- a/src/org/thoughtcrime/securesms/qr/ScanningThread.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.thoughtcrime.securesms.qr; - -import android.content.res.Configuration; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.util.Log; - -import com.google.zxing.BinaryBitmap; -import com.google.zxing.ChecksumException; -import com.google.zxing.DecodeHintType; -import com.google.zxing.FormatException; -import com.google.zxing.NotFoundException; -import com.google.zxing.PlanarYUVLuminanceSource; -import com.google.zxing.Result; -import com.google.zxing.common.HybridBinarizer; -import com.google.zxing.qrcode.QRCodeReader; - -import org.thoughtcrime.securesms.components.camera.CameraView; -import org.thoughtcrime.securesms.components.camera.CameraView.PreviewFrame; -import org.thoughtcrime.securesms.util.Util; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; - -public class ScanningThread extends Thread implements CameraView.PreviewCallback { - - private static final String TAG = ScanningThread.class.getSimpleName(); - - private final QRCodeReader reader = new QRCodeReader(); - private final AtomicReference scanListener = new AtomicReference<>(); - private final Map hints = new HashMap<>(); - - private boolean scanning = true; - private PreviewFrame previewFrame; - - public void setCharacterSet(String characterSet) { - hints.put(DecodeHintType.CHARACTER_SET, characterSet); - } - - public void setScanListener(ScanListener scanListener) { - this.scanListener.set(scanListener); - } - - @Override - public void onPreviewFrame(@NonNull PreviewFrame previewFrame) { - try { - synchronized (this) { - this.previewFrame = previewFrame; - this.notify(); - } - } catch (RuntimeException e) { - Log.w(TAG, e); - } - } - - - @Override - public void run() { - while (true) { - PreviewFrame ourFrame; - - synchronized (this) { - while (scanning && previewFrame == null) { - Util.wait(this, 0); - } - - if (!scanning) return; - else ourFrame = previewFrame; - - previewFrame = null; - } - - String data = getScannedData(ourFrame.getData(), ourFrame.getWidth(), ourFrame.getHeight(), ourFrame.getOrientation()); - ScanListener scanListener = this.scanListener.get(); - - if (data != null && scanListener != null) { - scanListener.onQrDataFound(data); - return; - } - } - } - - public void stopScanning() { - synchronized (this) { - scanning = false; - notify(); - } - } - - private @Nullable String getScannedData(byte[] data, int width, int height, int orientation) { - try { - if (orientation == Configuration.ORIENTATION_PORTRAIT) { - byte[] rotatedData = new byte[data.length]; - - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - rotatedData[x * height + height - y - 1] = data[x + y * width]; - } - } - - int tmp = width; - width = height; - height = tmp; - data = rotatedData; - } - - PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(data, width, height, - 0, 0, width, height, - false); - - BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); - Result result = reader.decode(bitmap, hints); - - if (result != null) return result.getText(); - - } catch (NullPointerException | ChecksumException | FormatException e) { - Log.w(TAG, e); - } catch (NotFoundException e) { - // Thanks ZXing... - } - - return null; - } -} diff --git a/src/org/thoughtcrime/securesms/service/AccountAuthenticatorService.java b/src/org/thoughtcrime/securesms/service/AccountAuthenticatorService.java deleted file mode 100644 index 010681827..000000000 --- a/src/org/thoughtcrime/securesms/service/AccountAuthenticatorService.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.thoughtcrime.securesms.service; - -import android.accounts.AbstractAccountAuthenticator; -import android.accounts.Account; -import android.accounts.AccountAuthenticatorResponse; -import android.accounts.NetworkErrorException; -import android.app.Service; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.os.IBinder; - -public class AccountAuthenticatorService extends Service { - - private static AccountAuthenticatorImpl accountAuthenticator = null; - - @Override - public IBinder onBind(Intent intent) { - if (intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT)) { - return getAuthenticator().getIBinder(); - } else { - return null; - } - } - - private synchronized AccountAuthenticatorImpl getAuthenticator() { - if (accountAuthenticator == null) { - accountAuthenticator = new AccountAuthenticatorImpl(this); - } - - return accountAuthenticator; - } - - private static class AccountAuthenticatorImpl extends AbstractAccountAuthenticator { - - public AccountAuthenticatorImpl(Context context) { - super(context); - } - - @Override - public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, - String[] requiredFeatures, Bundle options) - throws NetworkErrorException - { - return null; - } - - public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) { - return null; - } - - @Override - public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) { - return null; - } - - @Override - public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, - Bundle options) throws NetworkErrorException { - return null; - } - - @Override - public String getAuthTokenLabel(String authTokenType) { - return null; - } - - @Override - public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) - throws NetworkErrorException { - return null; - } - - @Override - public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, - Bundle options) { - return null; - } - } -} diff --git a/src/org/thoughtcrime/securesms/service/AccountVerificationTimeoutException.java b/src/org/thoughtcrime/securesms/service/AccountVerificationTimeoutException.java deleted file mode 100644 index 4a38a3c7b..000000000 --- a/src/org/thoughtcrime/securesms/service/AccountVerificationTimeoutException.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.thoughtcrime.securesms.service; - -public class AccountVerificationTimeoutException extends Exception { - public AccountVerificationTimeoutException() { - } - - public AccountVerificationTimeoutException(String detailMessage) { - super(detailMessage); - } - - public AccountVerificationTimeoutException(String detailMessage, Throwable throwable) { - super(detailMessage, throwable); - } - - public AccountVerificationTimeoutException(Throwable throwable) { - super(throwable); - } -} diff --git a/src/org/thoughtcrime/securesms/sms/IncomingEncryptedMessage.java b/src/org/thoughtcrime/securesms/sms/IncomingEncryptedMessage.java deleted file mode 100644 index 63489bf7b..000000000 --- a/src/org/thoughtcrime/securesms/sms/IncomingEncryptedMessage.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.thoughtcrime.securesms.sms; - -public class IncomingEncryptedMessage extends IncomingTextMessage { - - public IncomingEncryptedMessage(IncomingTextMessage base, String newBody) { - super(base, newBody); - } - - @Override - public IncomingTextMessage withMessageBody(String body) { - return new IncomingEncryptedMessage(this, body); - } - - @Override - public boolean isSecureMessage() { - return true; - } -} diff --git a/src/org/thoughtcrime/securesms/sms/IncomingEndSessionMessage.java b/src/org/thoughtcrime/securesms/sms/IncomingEndSessionMessage.java deleted file mode 100644 index 9277e989a..000000000 --- a/src/org/thoughtcrime/securesms/sms/IncomingEndSessionMessage.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.thoughtcrime.securesms.sms; - -public class IncomingEndSessionMessage extends IncomingTextMessage { - - public IncomingEndSessionMessage(IncomingTextMessage base) { - this(base, base.getMessageBody()); - } - - public IncomingEndSessionMessage(IncomingTextMessage base, String newBody) { - super(base, newBody); - } - - @Override - public IncomingEndSessionMessage withMessageBody(String messageBody) { - return new IncomingEndSessionMessage(this, messageBody); - } - - @Override - public boolean isEndSession() { - return true; - } -} diff --git a/src/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java b/src/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java deleted file mode 100644 index 56cfc47f9..000000000 --- a/src/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.thoughtcrime.securesms.sms; - -import org.thoughtcrime.securesms.database.Address; -import org.whispersystems.libsignal.util.guava.Optional; -import org.whispersystems.signalservice.api.messages.SignalServiceGroup; - -public class IncomingJoinedMessage extends IncomingTextMessage { - - public IncomingJoinedMessage(Address sender) { - super(sender, 1, System.currentTimeMillis(), null, Optional.absent(), 0); - } - - @Override - public boolean isJoined() { - return true; - } - - @Override - public boolean isSecureMessage() { - return true; - } - -} diff --git a/src/org/thoughtcrime/securesms/sms/IncomingPreKeyBundleMessage.java b/src/org/thoughtcrime/securesms/sms/IncomingPreKeyBundleMessage.java deleted file mode 100644 index 1910c366f..000000000 --- a/src/org/thoughtcrime/securesms/sms/IncomingPreKeyBundleMessage.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.thoughtcrime.securesms.sms; - -public class IncomingPreKeyBundleMessage extends IncomingTextMessage { - - private final boolean legacy; - - public IncomingPreKeyBundleMessage(IncomingTextMessage base, String newBody, boolean legacy) { - super(base, newBody); - this.legacy = legacy; - } - - @Override - public IncomingPreKeyBundleMessage withMessageBody(String messageBody) { - return new IncomingPreKeyBundleMessage(this, messageBody, legacy); - } - - @Override - public boolean isLegacyPreKeyBundle() { - return legacy; - } - - @Override - public boolean isContentPreKeyBundle() { - return !legacy; - } - -} diff --git a/src/org/thoughtcrime/securesms/sms/OutgoingPrekeyBundleMessage.java b/src/org/thoughtcrime/securesms/sms/OutgoingPrekeyBundleMessage.java deleted file mode 100644 index ae7f9329a..000000000 --- a/src/org/thoughtcrime/securesms/sms/OutgoingPrekeyBundleMessage.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.thoughtcrime.securesms.sms; - - -public class OutgoingPrekeyBundleMessage extends OutgoingTextMessage { - - public OutgoingPrekeyBundleMessage(OutgoingTextMessage message, String body) { - super(message, body); - } - - @Override - public boolean isPreKeyBundle() { - return true; - } - - @Override - public OutgoingTextMessage withBody(String body) { - return new OutgoingPrekeyBundleMessage(this, body); - } -} diff --git a/src/org/thoughtcrime/securesms/transport/InsecureFallbackApprovalException.java b/src/org/thoughtcrime/securesms/transport/InsecureFallbackApprovalException.java deleted file mode 100644 index 15651696f..000000000 --- a/src/org/thoughtcrime/securesms/transport/InsecureFallbackApprovalException.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.thoughtcrime.securesms.transport; - -public class InsecureFallbackApprovalException extends Exception { - public InsecureFallbackApprovalException(String detailMessage) { - super(detailMessage); - } - - public InsecureFallbackApprovalException(Throwable e) { - super(e); - } -} diff --git a/src/org/thoughtcrime/securesms/transport/RetryLaterException.java b/src/org/thoughtcrime/securesms/transport/RetryLaterException.java deleted file mode 100644 index 0642f7c69..000000000 --- a/src/org/thoughtcrime/securesms/transport/RetryLaterException.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.thoughtcrime.securesms.transport; - -import java.io.IOException; - -public class RetryLaterException extends Exception { - public RetryLaterException(Exception e) { - super(e); - } -} diff --git a/src/org/thoughtcrime/securesms/transport/UndeliverableMessageException.java b/src/org/thoughtcrime/securesms/transport/UndeliverableMessageException.java deleted file mode 100644 index 02987b1cd..000000000 --- a/src/org/thoughtcrime/securesms/transport/UndeliverableMessageException.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.thoughtcrime.securesms.transport; - -public class UndeliverableMessageException extends Exception { - public UndeliverableMessageException() { - } - - public UndeliverableMessageException(String detailMessage) { - super(detailMessage); - } - - public UndeliverableMessageException(String detailMessage, Throwable throwable) { - super(detailMessage, throwable); - } - - public UndeliverableMessageException(Throwable throwable) { - super(throwable); - } -}