From a57bf0cd98d7f357e9a68e7e1388469d85ccfc39 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Thu, 27 Feb 2020 15:36:22 +1100 Subject: [PATCH] Remove un-used permissions. --- AndroidManifest.xml | 69 ++------ res/layout/conversation_item_footer.xml | 21 +-- .../securesms/ApplicationContext.java | 13 -- .../securesms/RegistrationActivity.java | 9 +- .../components/ConversationItemFooter.java | 32 +--- .../contacts/ContactsSyncAdapter.java | 49 ------ .../SignalCommunicationModule.java | 4 - .../securesms/gcm/FcmService.java | 158 ------------------ .../thoughtcrime/securesms/gcm/FcmUtil.java | 44 ----- .../migration/WorkManagerFactoryMappings.java | 2 - .../securesms/jobs/FcmRefreshJob.java | 151 ----------------- .../securesms/jobs/JobManagerFactories.java | 1 - .../service/ContactsSyncAdapterService.java | 26 --- 13 files changed, 18 insertions(+), 561 deletions(-) delete mode 100644 src/org/thoughtcrime/securesms/contacts/ContactsSyncAdapter.java delete mode 100644 src/org/thoughtcrime/securesms/gcm/FcmService.java delete mode 100644 src/org/thoughtcrime/securesms/gcm/FcmUtil.java delete mode 100644 src/org/thoughtcrime/securesms/jobs/FcmRefreshJob.java delete mode 100644 src/org/thoughtcrime/securesms/service/ContactsSyncAdapterService.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 0e5a5d0654..53fe7fd3e3 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -38,58 +38,36 @@ - - - - - - - - - + + - + - - + - - + - - - + + - - + + + + + + + - - - - - - - - @@ -612,11 +576,6 @@ - - - - - - - - fcmToken; - - if (gcmSupported) { - fcmToken = FcmUtil.getToken(); - } else { - fcmToken = Optional.absent(); - } + Optional fcmToken = Optional.absent(); accountManager = AccountManagerFactory.createManager(RegistrationActivity.this, e164number, password); accountManager.requestSmsVerificationCode(smsRetrieverSupported, registrationState.captchaToken); diff --git a/src/org/thoughtcrime/securesms/components/ConversationItemFooter.java b/src/org/thoughtcrime/securesms/components/ConversationItemFooter.java index 00c50630d6..cf30ea76b9 100644 --- a/src/org/thoughtcrime/securesms/components/ConversationItemFooter.java +++ b/src/org/thoughtcrime/securesms/components/ConversationItemFooter.java @@ -1,6 +1,5 @@ package org.thoughtcrime.securesms.components; -import android.Manifest; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.TypedArray; @@ -14,22 +13,18 @@ import android.widget.LinearLayout; import android.widget.TextView; import org.thoughtcrime.securesms.ApplicationContext; -import network.loki.messenger.R; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.model.MessageRecord; -import org.thoughtcrime.securesms.permissions.Permissions; import org.thoughtcrime.securesms.service.ExpiringMessageManager; import org.thoughtcrime.securesms.util.DateUtils; -import org.thoughtcrime.securesms.util.dualsim.SubscriptionInfoCompat; -import org.thoughtcrime.securesms.util.dualsim.SubscriptionManagerCompat; -import org.whispersystems.libsignal.util.guava.Optional; import java.util.Locale; +import network.loki.messenger.R; + public class ConversationItemFooter extends LinearLayout { private TextView dateView; - private TextView simView; private ExpirationTimerView timerView; private ImageView insecureIndicatorView; private DeliveryStatusView deliveryStatusView; @@ -53,7 +48,6 @@ public class ConversationItemFooter extends LinearLayout { inflate(getContext(), R.layout.conversation_item_footer, this); dateView = findViewById(R.id.footer_date); - simView = findViewById(R.id.footer_sim_info); timerView = findViewById(R.id.footer_expiration_timer); insecureIndicatorView = findViewById(R.id.footer_insecure_indicator); deliveryStatusView = findViewById(R.id.footer_delivery_status); @@ -74,7 +68,6 @@ public class ConversationItemFooter extends LinearLayout { public void setMessageRecord(@NonNull MessageRecord messageRecord, @NonNull Locale locale) { presentDate(messageRecord, locale); - presentSimInfo(messageRecord); presentTimer(messageRecord); presentInsecureIndicator(messageRecord); presentDeliveryStatus(messageRecord); @@ -82,7 +75,6 @@ public class ConversationItemFooter extends LinearLayout { public void setTextColor(int color) { dateView.setTextColor(color); - simView.setTextColor(color); } public void setIconColor(int color) { @@ -103,26 +95,6 @@ public class ConversationItemFooter extends LinearLayout { } } - private void presentSimInfo(@NonNull MessageRecord messageRecord) { - SubscriptionManagerCompat subscriptionManager = new SubscriptionManagerCompat(getContext()); - - if (messageRecord.isPush() || messageRecord.getSubscriptionId() == -1 || !Permissions.hasAll(getContext(), Manifest.permission.READ_PHONE_STATE) || !subscriptionManager.isMultiSim()) { - simView.setVisibility(View.GONE); - } else { - Optional subscriptionInfo = subscriptionManager.getActiveSubscriptionInfo(messageRecord.getSubscriptionId()); - - if (subscriptionInfo.isPresent() && messageRecord.isOutgoing()) { - simView.setText(getContext().getString(R.string.ConversationItem_from_s, subscriptionInfo.get().getDisplayName())); - simView.setVisibility(View.VISIBLE); - } else if (subscriptionInfo.isPresent()) { - simView.setText(getContext().getString(R.string.ConversationItem_to_s, subscriptionInfo.get().getDisplayName())); - simView.setVisibility(View.VISIBLE); - } else { - simView.setVisibility(View.GONE); - } - } - } - @SuppressLint("StaticFieldLeak") private void presentTimer(@NonNull final MessageRecord messageRecord) { if (messageRecord.getExpiresIn() > 0 && !messageRecord.isPending()) { diff --git a/src/org/thoughtcrime/securesms/contacts/ContactsSyncAdapter.java b/src/org/thoughtcrime/securesms/contacts/ContactsSyncAdapter.java deleted file mode 100644 index 71d3b790d1..0000000000 --- a/src/org/thoughtcrime/securesms/contacts/ContactsSyncAdapter.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.thoughtcrime.securesms.contacts; - -import android.accounts.Account; -import android.content.AbstractThreadedSyncAdapter; -import android.content.ContentProviderClient; -import android.content.Context; -import android.content.SyncResult; -import android.os.Bundle; -import org.thoughtcrime.securesms.logging.Log; - -import org.thoughtcrime.securesms.util.DirectoryHelper; -import org.thoughtcrime.securesms.util.TextSecurePreferences; - -import java.io.IOException; - -public class ContactsSyncAdapter extends AbstractThreadedSyncAdapter { - - private static final String TAG = ContactsSyncAdapter.class.getSimpleName(); - - public ContactsSyncAdapter(Context context, boolean autoInitialize) { - super(context, autoInitialize); - } - - @Override - public void onPerformSync(Account account, Bundle extras, String authority, - ContentProviderClient provider, SyncResult syncResult) - { - Log.i(TAG, "onPerformSync(" + authority +")"); - - if (TextSecurePreferences.isPushRegistered(getContext())) { - try { - DirectoryHelper.refreshDirectory(getContext(), true); - } catch (IOException e) { - Log.w(TAG, e); - } - } - } - - @Override - public void onSyncCanceled() { - Log.w(TAG, "onSyncCanceled()"); - } - - @Override - public void onSyncCanceled(Thread thread) { - Log.w(TAG, "onSyncCanceled(" + thread + ")"); - } - -} diff --git a/src/org/thoughtcrime/securesms/dependencies/SignalCommunicationModule.java b/src/org/thoughtcrime/securesms/dependencies/SignalCommunicationModule.java index c59224d481..9e1bf481f1 100644 --- a/src/org/thoughtcrime/securesms/dependencies/SignalCommunicationModule.java +++ b/src/org/thoughtcrime/securesms/dependencies/SignalCommunicationModule.java @@ -9,13 +9,11 @@ import org.thoughtcrime.securesms.DeviceListFragment; import org.thoughtcrime.securesms.crypto.storage.SignalProtocolStoreImpl; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.events.ReminderUpdateEvent; -import org.thoughtcrime.securesms.gcm.FcmService; import org.thoughtcrime.securesms.jobs.AttachmentDownloadJob; import org.thoughtcrime.securesms.jobs.AttachmentUploadJob; import org.thoughtcrime.securesms.jobs.AvatarDownloadJob; import org.thoughtcrime.securesms.jobs.CleanPreKeysJob; import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob; -import org.thoughtcrime.securesms.jobs.FcmRefreshJob; import org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob; import org.thoughtcrime.securesms.jobs.MultiDeviceConfigurationUpdateJob; import org.thoughtcrime.securesms.jobs.MultiDeviceContactUpdateJob; @@ -86,7 +84,6 @@ import network.loki.messenger.BuildConfig; MultiDeviceBlockedUpdateJob.class, DeviceListFragment.class, RefreshAttributesJob.class, - FcmRefreshJob.class, RequestGroupInfoJob.class, PushGroupUpdateJob.class, AvatarDownloadJob.class, @@ -99,7 +96,6 @@ import network.loki.messenger.BuildConfig; MultiDeviceProfileKeyUpdateJob.class, SendReadReceiptJob.class, AppProtectionPreferenceFragment.class, - FcmService.class, RotateCertificateJob.class, SendDeliveryReceiptJob.class, RotateProfileKeyJob.class, diff --git a/src/org/thoughtcrime/securesms/gcm/FcmService.java b/src/org/thoughtcrime/securesms/gcm/FcmService.java deleted file mode 100644 index cbb3da3807..0000000000 --- a/src/org/thoughtcrime/securesms/gcm/FcmService.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.thoughtcrime.securesms.gcm; - -import android.content.Context; -import android.os.PowerManager; -import android.support.annotation.NonNull; - -import com.google.firebase.messaging.FirebaseMessagingService; -import com.google.firebase.messaging.RemoteMessage; - -import org.thoughtcrime.securesms.ApplicationContext; -import network.loki.messenger.R; -import org.thoughtcrime.securesms.dependencies.InjectableType; -import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint; -import org.thoughtcrime.securesms.jobs.FcmRefreshJob; -import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob; -import org.thoughtcrime.securesms.logging.Log; -import org.thoughtcrime.securesms.notifications.NotificationChannels; -import org.thoughtcrime.securesms.service.GenericForegroundService; -import org.thoughtcrime.securesms.util.PowerManagerCompat; -import org.thoughtcrime.securesms.util.ServiceUtil; -import org.thoughtcrime.securesms.util.TextSecurePreferences; -import org.thoughtcrime.securesms.util.WakeLockUtil; -import org.thoughtcrime.securesms.util.concurrent.SignalExecutors; -import org.whispersystems.signalservice.api.SignalServiceMessageReceiver; -import org.whispersystems.signalservice.internal.util.Util; - -import java.io.IOException; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.Executor; -import java.util.concurrent.atomic.AtomicBoolean; - -import javax.inject.Inject; - -public class FcmService extends FirebaseMessagingService implements InjectableType { - - private static final String TAG = FcmService.class.getSimpleName(); - - private static final Executor MESSAGE_EXECUTOR = SignalExecutors.newCachedSingleThreadExecutor("FcmMessageProcessing"); - private static final String WAKE_LOCK_TAG = "FcmMessageProcessing"; - - @Inject SignalServiceMessageReceiver messageReceiver; - - private static int activeCount; - - @Override - public void onMessageReceived(RemoteMessage remoteMessage) { - Log.i(TAG, "FCM message... Original Priority: " + remoteMessage.getOriginalPriority() + ", Actual Priority: " + remoteMessage.getPriority()); - ApplicationContext.getInstance(getApplicationContext()).injectDependencies(this); - - WakeLockUtil.runWithLock(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK, 60000, WAKE_LOCK_TAG, () -> { - handleReceivedNotification(getApplicationContext()); - }); - } - - @Override - public void onNewToken(String token) { - Log.i(TAG, "onNewToken()"); - - if (!TextSecurePreferences.isPushRegistered(getApplicationContext())) { - Log.i(TAG, "Got a new FCM token, but the user isn't registered."); - return; - } - - ApplicationContext.getInstance(getApplicationContext()) - .getJobManager() - .add(new FcmRefreshJob()); - } - - private void handleReceivedNotification(Context context) { - if (!incrementActiveGcmCount()) { - Log.i(TAG, "Skipping FCM processing -- there's already one enqueued."); - return; - } - - TextSecurePreferences.setNeedsMessagePull(context, true); - - long startTime = System.currentTimeMillis(); - PowerManager powerManager = ServiceUtil.getPowerManager(getApplicationContext()); - boolean doze = PowerManagerCompat.isDeviceIdleMode(powerManager); - boolean network = new NetworkConstraint.Factory(ApplicationContext.getInstance(context)).create().isMet(); - - final Object foregroundLock = new Object(); - final AtomicBoolean foregroundRunning = new AtomicBoolean(false); - final AtomicBoolean taskCompleted = new AtomicBoolean(false); - final CountDownLatch latch = new CountDownLatch(1); - - if (doze || !network) { - Log.i(TAG, "Starting a foreground task because we may be operating in a constrained environment. Doze: " + doze + " Network: " + network); - showForegroundNotification(context); - foregroundRunning.set(true); - latch.countDown(); - } - - MESSAGE_EXECUTOR.execute(() -> { - try { - new PushNotificationReceiveJob(context).pullAndProcessMessages(messageReceiver, TAG, startTime); - } catch (IOException e) { - Log.i(TAG, "Failed to retrieve the envelope. Scheduling on JobManager.", e); - ApplicationContext.getInstance(context) - .getJobManager() - .add(new PushNotificationReceiveJob(context)); - } finally { - synchronized (foregroundLock) { - if (foregroundRunning.getAndSet(false)) { - GenericForegroundService.stopForegroundTask(context); - } else { - latch.countDown(); - } - taskCompleted.set(true); - } - - decrementActiveGcmCount(); - Log.i(TAG, "Processing complete."); - } - }); - - if (!foregroundRunning.get()) { - new Thread("FcmForegroundServiceTimer") { - @Override - public void run() { - Util.sleep(7000); - synchronized (foregroundLock) { - if (!taskCompleted.get() && !foregroundRunning.getAndSet(true)) { - Log.i(TAG, "Starting a foreground task because the job is running long."); - showForegroundNotification(context); - latch.countDown(); - } - } - } - }.start(); - } - - try { - latch.await(); - } catch (InterruptedException e) { - Log.w(TAG, "Latch was interrupted.", e); - } - } - - private void showForegroundNotification(@NonNull Context context) { - GenericForegroundService.startForegroundTask(context, - context.getString(R.string.GcmBroadcastReceiver_retrieving_a_message), - NotificationChannels.OTHER, - R.drawable.ic_signal_downloading); - } - - private static synchronized boolean incrementActiveGcmCount() { - if (activeCount < 2) { - activeCount++; - return true; - } - return false; - } - - private static synchronized void decrementActiveGcmCount() { - activeCount--; - } -} diff --git a/src/org/thoughtcrime/securesms/gcm/FcmUtil.java b/src/org/thoughtcrime/securesms/gcm/FcmUtil.java deleted file mode 100644 index 2a2e2b04d5..0000000000 --- a/src/org/thoughtcrime/securesms/gcm/FcmUtil.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.thoughtcrime.securesms.gcm; - -import android.support.annotation.WorkerThread; -import android.text.TextUtils; - -import com.google.firebase.iid.FirebaseInstanceId; - -import org.thoughtcrime.securesms.logging.Log; -import org.whispersystems.libsignal.util.guava.Optional; - -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicReference; - -public final class FcmUtil { - - private static final String TAG = FcmUtil.class.getSimpleName(); - - /** - * Retrieves the current FCM token. If one isn't available, it'll be generated. - */ - @WorkerThread - public static Optional getToken() { - CountDownLatch latch = new CountDownLatch(1); - AtomicReference token = new AtomicReference<>(null); - - FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(task -> { - if (task.isSuccessful() && task.getResult() != null && !TextUtils.isEmpty(task.getResult().getToken())) { - token.set(task.getResult().getToken()); - } else { - Log.w(TAG, "Failed to get the token.", task.getException()); - } - - latch.countDown(); - }); - - try { - latch.await(); - } catch (InterruptedException e) { - Log.w(TAG, "Was interrupted while waiting for the token."); - } - - return Optional.fromNullable(token.get()); - } -} diff --git a/src/org/thoughtcrime/securesms/jobmanager/migration/WorkManagerFactoryMappings.java b/src/org/thoughtcrime/securesms/jobmanager/migration/WorkManagerFactoryMappings.java index 156fdf9b0f..4957ebd72d 100644 --- a/src/org/thoughtcrime/securesms/jobmanager/migration/WorkManagerFactoryMappings.java +++ b/src/org/thoughtcrime/securesms/jobmanager/migration/WorkManagerFactoryMappings.java @@ -9,7 +9,6 @@ import org.thoughtcrime.securesms.jobs.AvatarDownloadJob; import org.thoughtcrime.securesms.jobs.CleanPreKeysJob; import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob; import org.thoughtcrime.securesms.jobs.DirectoryRefreshJob; -import org.thoughtcrime.securesms.jobs.FcmRefreshJob; import org.thoughtcrime.securesms.jobs.LocalBackupJob; import org.thoughtcrime.securesms.jobs.MmsDownloadJob; import org.thoughtcrime.securesms.jobs.MmsReceiveJob; @@ -59,7 +58,6 @@ public class WorkManagerFactoryMappings { put(CleanPreKeysJob.class.getName(), CleanPreKeysJob.KEY); put(CreateSignedPreKeyJob.class.getName(), CreateSignedPreKeyJob.KEY); put(DirectoryRefreshJob.class.getName(), DirectoryRefreshJob.KEY); - put(FcmRefreshJob.class.getName(), FcmRefreshJob.KEY); put(LocalBackupJob.class.getName(), LocalBackupJob.KEY); put(MmsDownloadJob.class.getName(), MmsDownloadJob.KEY); put(MmsReceiveJob.class.getName(), MmsReceiveJob.KEY); diff --git a/src/org/thoughtcrime/securesms/jobs/FcmRefreshJob.java b/src/org/thoughtcrime/securesms/jobs/FcmRefreshJob.java deleted file mode 100644 index 2f63316d2a..0000000000 --- a/src/org/thoughtcrime/securesms/jobs/FcmRefreshJob.java +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Copyright (C) 2014 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.jobs; - -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.graphics.BitmapFactory; -import android.support.annotation.NonNull; -import android.support.v4.app.NotificationCompat; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.GoogleApiAvailability; - -import org.thoughtcrime.securesms.gcm.FcmUtil; -import org.thoughtcrime.securesms.jobmanager.Data; -import org.thoughtcrime.securesms.jobmanager.Job; -import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint; -import org.thoughtcrime.securesms.logging.Log; - -import org.thoughtcrime.securesms.PlayServicesProblemActivity; -import network.loki.messenger.R; -import org.thoughtcrime.securesms.dependencies.InjectableType; -import org.thoughtcrime.securesms.notifications.NotificationChannels; -import org.thoughtcrime.securesms.transport.RetryLaterException; -import org.thoughtcrime.securesms.util.TextSecurePreferences; -import org.whispersystems.libsignal.util.guava.Optional; -import org.whispersystems.signalservice.api.SignalServiceAccountManager; -import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException; - -import java.io.IOException; -import java.util.concurrent.TimeUnit; - -import javax.inject.Inject; - -public class FcmRefreshJob extends BaseJob implements InjectableType { - - public static final String KEY = "FcmRefreshJob"; - - private static final String TAG = FcmRefreshJob.class.getSimpleName(); - - @Inject SignalServiceAccountManager textSecureAccountManager; - - public FcmRefreshJob() { - this(new Job.Parameters.Builder() - .setQueue("FcmRefreshJob") - .addConstraint(NetworkConstraint.KEY) - .setMaxAttempts(1) - .setLifespan(TimeUnit.MINUTES.toMillis(5)) - .setMaxInstances(1) - .build()); - } - - private FcmRefreshJob(@NonNull Job.Parameters parameters) { - super(parameters); - } - - @Override - public @NonNull Data serialize() { - return Data.EMPTY; - } - - @Override - public @NonNull String getFactoryKey() { - return KEY; - } - - @Override - public void onRun() throws Exception { - if (TextSecurePreferences.isFcmDisabled(context)) return; - - Log.i(TAG, "Reregistering FCM..."); - - int result = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context); - - if (result != ConnectionResult.SUCCESS) { - notifyFcmFailure(); - } else { - Optional token = FcmUtil.getToken(); - - if (token.isPresent()) { - String oldToken = TextSecurePreferences.getFcmToken(context); - - if (!token.get().equals(oldToken)) { - int oldLength = oldToken != null ? oldToken.length() : -1; - Log.i(TAG, "Token changed. oldLength: " + oldLength + " newLength: " + token.get().length()); - } else { - Log.i(TAG, "Token didn't change."); - } - - textSecureAccountManager.setGcmId(token); - TextSecurePreferences.setFcmToken(context, token.get()); - TextSecurePreferences.setFcmTokenLastSetTime(context, System.currentTimeMillis()); - TextSecurePreferences.setWebsocketRegistered(context, true); - } else { - throw new RetryLaterException(new IOException("Failed to retrieve a token.")); - } - } - } - - @Override - public void onCanceled() { - Log.w(TAG, "GCM reregistration failed after retry attempt exhaustion!"); - } - - @Override - public boolean onShouldRetry(@NonNull Exception throwable) { - if (throwable instanceof NonSuccessfulResponseCodeException) return false; - return true; - } - - private void notifyFcmFailure() { - Intent intent = new Intent(context, PlayServicesProblemActivity.class); - PendingIntent pendingIntent = PendingIntent.getActivity(context, 1122, intent, PendingIntent.FLAG_CANCEL_CURRENT); - NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NotificationChannels.FAILURES); - - builder.setSmallIcon(R.drawable.ic_notification); - builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), - R.drawable.ic_action_warning_red)); - builder.setContentTitle(context.getString(R.string.GcmRefreshJob_Permanent_Signal_communication_failure)); - builder.setContentText(context.getString(R.string.GcmRefreshJob_Signal_was_unable_to_register_with_Google_Play_Services)); - builder.setTicker(context.getString(R.string.GcmRefreshJob_Permanent_Signal_communication_failure)); - builder.setVibrate(new long[] {0, 1000}); - builder.setContentIntent(pendingIntent); - - ((NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE)) - .notify(12, builder.build()); - } - - public static final class Factory implements Job.Factory { - @Override - public @NonNull FcmRefreshJob create(@NonNull Parameters parameters, @NonNull Data data) { - return new FcmRefreshJob(parameters); - } - } -} diff --git a/src/org/thoughtcrime/securesms/jobs/JobManagerFactories.java b/src/org/thoughtcrime/securesms/jobs/JobManagerFactories.java index cfa9aa7beb..266d6194df 100644 --- a/src/org/thoughtcrime/securesms/jobs/JobManagerFactories.java +++ b/src/org/thoughtcrime/securesms/jobs/JobManagerFactories.java @@ -31,7 +31,6 @@ public final class JobManagerFactories { put(CleanPreKeysJob.KEY, new CleanPreKeysJob.Factory()); put(CreateSignedPreKeyJob.KEY, new CreateSignedPreKeyJob.Factory()); put(DirectoryRefreshJob.KEY, new DirectoryRefreshJob.Factory(application)); - put(FcmRefreshJob.KEY, new FcmRefreshJob.Factory()); put(LocalBackupJob.KEY, new LocalBackupJob.Factory()); put(MmsDownloadJob.KEY, new MmsDownloadJob.Factory()); put(MmsReceiveJob.KEY, new MmsReceiveJob.Factory()); diff --git a/src/org/thoughtcrime/securesms/service/ContactsSyncAdapterService.java b/src/org/thoughtcrime/securesms/service/ContactsSyncAdapterService.java deleted file mode 100644 index c162d9104d..0000000000 --- a/src/org/thoughtcrime/securesms/service/ContactsSyncAdapterService.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.thoughtcrime.securesms.service; - -import android.app.Service; -import android.content.Intent; -import android.os.IBinder; -import android.support.annotation.Nullable; - -import org.thoughtcrime.securesms.contacts.ContactsSyncAdapter; - -public class ContactsSyncAdapterService extends Service { - - private static ContactsSyncAdapter syncAdapter; - - @Override - public synchronized void onCreate() { - if (syncAdapter == null) { - syncAdapter = new ContactsSyncAdapter(this, true); - } - } - - @Nullable - @Override - public IBinder onBind(Intent intent) { - return syncAdapter.getSyncAdapterBinder(); - } -}