diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-10-18 06:28:36 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-10-18 06:28:36 +0000 |
commit | 5cb3ecff08854c7b3da976f7981d1b9c3ff5bee0 (patch) | |
tree | dd54827288a08600f58ac0aed849e179fcddd8df /java/com/android/dialer/simulator/impl | |
parent | 7a168cbe0086ec54454a1692b7c128ba12145d4d (diff) | |
parent | 639943a7668ad4229942e1207128045d49e9ed02 (diff) |
Merge "Support bulk inserted voicemails."
Diffstat (limited to 'java/com/android/dialer/simulator/impl')
-rw-r--r-- | java/com/android/dialer/simulator/impl/SimulatorNotifications.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/java/com/android/dialer/simulator/impl/SimulatorNotifications.java b/java/com/android/dialer/simulator/impl/SimulatorNotifications.java index 3f402d317..4ed7c9b8f 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorNotifications.java +++ b/java/com/android/dialer/simulator/impl/SimulatorNotifications.java @@ -16,12 +16,15 @@ package com.android.dialer.simulator.impl; +import android.content.ContentValues; import android.content.Context; import android.provider.VoicemailContract.Voicemails; import android.support.annotation.NonNull; import android.view.ActionProvider; import com.android.dialer.common.LogUtil; import com.android.dialer.databasepopulator.VoicemailPopulator; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.TimeUnit; /** Implements the simulator submenu. */ @@ -45,6 +48,7 @@ final class SimulatorNotifications { private static void addVoicemailNotifications(@NonNull Context context) { LogUtil.enterBlock("SimulatorNotifications.addVoicemailNotifications"); + List<ContentValues> voicemails = new ArrayList<>(); for (int i = NOTIFICATION_COUNT; i > 0; i--) { VoicemailPopulator.Voicemail voicemail = VoicemailPopulator.Voicemail.builder() @@ -54,11 +58,12 @@ final class SimulatorNotifications { .setIsRead(false) .setTimeMillis(System.currentTimeMillis() - TimeUnit.HOURS.toMillis(i)) .build(); - context - .getContentResolver() - .insert( - Voicemails.buildSourceUri(context.getPackageName()), - voicemail.getAsContentValues(context)); + voicemails.add(voicemail.getAsContentValues(context)); } + context + .getContentResolver() + .bulkInsert( + Voicemails.buildSourceUri(context.getPackageName()), + voicemails.toArray(new ContentValues[voicemails.size()])); } } |