diff options
Diffstat (limited to 'java/com/android/dialer/databasepopulator/VoicemailPopulator.java')
-rw-r--r-- | java/com/android/dialer/databasepopulator/VoicemailPopulator.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java index 9e0f45345..b1f8d1fe4 100644 --- a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java +++ b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java @@ -30,6 +30,9 @@ import android.telecom.PhoneAccountHandle; import android.telephony.TelephonyManager; import com.android.dialer.common.Assert; import com.google.auto.value.AutoValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.concurrent.TimeUnit; /** Populates the device database with voicemail entries. */ @@ -74,14 +77,19 @@ public final class VoicemailPopulator { }; @WorkerThread - public static void populateVoicemail(@NonNull Context context) { + public static void populateVoicemail(@NonNull Context context, boolean fastMode) { Assert.isWorkerThread(); enableVoicemail(context); - + List<Voicemail.Builder> voicemails = new ArrayList<>(); + if (fastMode) { + voicemails.add(SIMPLE_VOICEMAILS[0]); + } else { + voicemails = Arrays.asList(SIMPLE_VOICEMAILS); + } // Do this 4 times to make the voicemail database 4 times bigger. long timeMillis = System.currentTimeMillis(); for (int i = 0; i < 4; i++) { - for (Voicemail.Builder builder : SIMPLE_VOICEMAILS) { + for (Voicemail.Builder builder : voicemails) { Voicemail voicemail = builder.setTimeMillis(timeMillis).build(); context .getContentResolver() @@ -94,11 +102,16 @@ public final class VoicemailPopulator { } @WorkerThread + public static void populateVoicemail(@NonNull Context context) { + populateVoicemail(context, false); + } + + @WorkerThread public static void deleteAllVoicemail(@NonNull Context context) { Assert.isWorkerThread(); context .getContentResolver() - .delete(Voicemails.buildSourceUri(context.getPackageName()), "", new String[] {}); + .delete(Voicemails.buildSourceUri(context.getPackageName()), null, null); } @VisibleForTesting |