Disable registration lock reminders for <=KK devices

Fixes #7500
This commit is contained in:
Moxie Marlinspike 2018-03-11 17:30:31 -07:00
parent 43d7e99a50
commit 6b5da7f8cf
2 changed files with 10 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
@ -43,7 +44,8 @@ public class RegistrationLockDialog {
private static final String TAG = RegistrationLockDialog.class.getSimpleName(); private static final String TAG = RegistrationLockDialog.class.getSimpleName();
public static void showReminderIfNecessary(@NonNull Context context) { public static void showReminderIfNecessary(@NonNull Context context) {
if (!RegistrationLockReminders.needsReminder(context)) return; if (!RegistrationLockReminders.needsReminder(context)) return;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
AlertDialog dialog = new AlertDialog.Builder(context, R.style.RationaleDialog) AlertDialog dialog = new AlertDialog.Builder(context, R.style.RationaleDialog)
.setView(R.layout.registration_lock_reminder_view) .setView(R.layout.registration_lock_reminder_view)

View File

@ -44,8 +44,13 @@ public class RegistrationLockReminders {
long lastReminderInterval = TextSecurePreferences.getRegistrationLockNextReminderInterval(context); long lastReminderInterval = TextSecurePreferences.getRegistrationLockNextReminderInterval(context);
long nextReminderInterval; long nextReminderInterval;
if (success) nextReminderInterval = INTERVAL_PROGRESSION.get(lastReminderInterval); if (success) {
else nextReminderInterval = INTERVAL_REGRESSION.get(lastReminderInterval); if (INTERVAL_PROGRESSION.containsKey(lastReminderInterval)) nextReminderInterval = INTERVAL_PROGRESSION.get(lastReminderInterval);
else nextReminderInterval = INTERVAL_PROGRESSION.get(TimeUnit.HOURS.toMillis(6));
} else {
if (INTERVAL_REGRESSION.containsKey(lastReminderInterval)) nextReminderInterval = INTERVAL_REGRESSION.get(lastReminderInterval);
else nextReminderInterval = INTERVAL_REGRESSION.get(TimeUnit.HOURS.toMillis(12));
}
TextSecurePreferences.setRegistrationLockLastReminderTime(context, System.currentTimeMillis()); TextSecurePreferences.setRegistrationLockLastReminderTime(context, System.currentTimeMillis());
TextSecurePreferences.setRegistrationLockNextReminderInterval(context, nextReminderInterval); TextSecurePreferences.setRegistrationLockNextReminderInterval(context, nextReminderInterval);