remove KeyCachingService completely

This commit is contained in:
B. Petersen
2018-11-26 22:09:28 +01:00
parent 44269cc6bb
commit ffe0f2b22d
8 changed files with 0 additions and 77 deletions
@@ -44,7 +44,6 @@ import org.thoughtcrime.securesms.preferences.ChatsPreferenceFragment;
import org.thoughtcrime.securesms.preferences.CorrectedPreferenceFragment;
import org.thoughtcrime.securesms.preferences.NotificationsPreferenceFragment;
import org.thoughtcrime.securesms.preferences.widgets.ProfilePreference;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
@@ -35,7 +35,6 @@ import org.thoughtcrime.securesms.components.SearchToolbar;
import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.qr.QrScanHandler;
import org.thoughtcrime.securesms.search.SearchFragment;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
import org.thoughtcrime.securesms.util.DynamicTheme;
@@ -27,7 +27,6 @@ import android.util.Log;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.notifications.MessageNotifier;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.VersionTracker;
@@ -84,12 +83,9 @@ public class DatabaseUpgradeActivity extends BaseActivity {
add(BAD_IMPORT_CLEANUP);
}};
private MasterSecret masterSecret;
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.masterSecret = KeyCachingService.getMasterSecret(this);
if (needsUpgradeTask()) {
Log.w("DatabaseUpgradeActivity", "Upgrading...");
@@ -1,9 +1,7 @@
package org.thoughtcrime.securesms;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
@@ -12,7 +10,6 @@ import android.support.v4.app.Fragment;
import android.util.Log;
import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.service.KeyCachingService;
import java.util.Locale;
@@ -48,7 +45,6 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
protected void onResume() {
Log.w(TAG, "onResume()");
super.onResume();
KeyCachingService.registerPassphraseActivityStarted(this);
isVisible = true;
}
@@ -57,7 +53,6 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
protected void onPause() {
Log.w(TAG, "onPause()");
super.onPause();
KeyCachingService.registerPassphraseActivityStopped(this);
isVisible = false;
}
@@ -25,7 +25,6 @@ import org.thoughtcrime.securesms.database.RecipientDatabase;
import org.thoughtcrime.securesms.database.SearchDatabase;
import org.thoughtcrime.securesms.database.SmsDatabase;
import org.thoughtcrime.securesms.database.ThreadDatabase;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import java.io.File;
@@ -98,12 +97,6 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
android.database.sqlite.SQLiteDatabase legacyDb = legacyHelper.getWritableDatabase();
SQLCipherMigrationHelper.migratePlaintext(context, legacyDb, db);
MasterSecret masterSecret = KeyCachingService.getMasterSecret(context);
if (masterSecret != null) SQLCipherMigrationHelper.migrateCiphertext(context, masterSecret, legacyDb, db, null);
else TextSecurePreferences.setNeedsSqlCipherMigration(context, true);
}
}
@@ -45,7 +45,6 @@ import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.connect.KeepAliveService;
import org.thoughtcrime.securesms.mms.SlideDeck;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.ServiceUtil;
import org.thoughtcrime.securesms.util.SpanUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
@@ -145,7 +144,6 @@ public class MessageNotifier {
boolean validNotification = false;
if (notification.getId() != SUMMARY_NOTIFICATION_ID &&
notification.getId() != KeyCachingService.SERVICE_RUNNING_ID &&
notification.getId() != KeepAliveService.FG_NOTIFICATION_ID &&
notification.getId() != PENDING_MESSAGES_ID)
{
@@ -34,7 +34,6 @@ import org.thoughtcrime.securesms.attachments.AttachmentId;
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.mms.PartUriParser;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.MemoryFileUtil;
import org.thoughtcrime.securesms.util.Util;
@@ -73,11 +72,6 @@ public class PartProvider extends ContentProvider {
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException {
Log.w(TAG, "openFile() called!");
if (KeyCachingService.isLocked(getContext())) {
Log.w(TAG, "masterSecret was null, abandoning.");
return null;
}
switch (uriMatcher.match(uri)) {
case SINGLE_ROW:
Log.w(TAG, "Parting out a single row...");
@@ -1,51 +0,0 @@
/*
* Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.service;
import android.app.Service;
import android.content.Context;
import android.support.annotation.Nullable;
import org.thoughtcrime.securesms.crypto.MasterSecret;
/**
* Small service that stays running to keep a key cached in memory.
*
* @author Moxie Marlinspike
*/
public class KeyCachingService {
private static final String TAG = KeyCachingService.class.getSimpleName();
public static final int SERVICE_RUNNING_ID = 4141;
public KeyCachingService() {}
public static synchronized boolean isLocked(Context context) {
return getMasterSecret(context) == null;
}
public static synchronized @Nullable MasterSecret getMasterSecret(Context context) {
return null;
}
public static void registerPassphraseActivityStarted(Context activity) {
}
public static void registerPassphraseActivityStopped(Context activity) {
}
}