diff options
Diffstat (limited to 'java/com/android/dialer/simulator')
-rw-r--r-- | java/com/android/dialer/simulator/impl/SimulatorMainMenu.java | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java b/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java index e2082105b..6053a0d52 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java +++ b/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java @@ -40,6 +40,7 @@ final class SimulatorMainMenu { .addItem("IMS video", SimulatorVideoCall.getActionProvider(context)) .addItem("Notifications", SimulatorNotifications.getActionProvider(context)) .addItem("Populate database", () -> populateDatabase(context)) + .addItem("Fast populate database", () -> fastPopulateDatabase(context)) .addItem("Clean database", () -> cleanDatabase(context)) .addItem("clear preferred SIM", () -> clearPreferredSim(context)) .addItem("Sync voicemail", () -> syncVoicemail(context)) @@ -54,7 +55,15 @@ final class SimulatorMainMenu { .dialerExecutorFactory() .createNonUiTaskBuilder(new PopulateDatabaseWorker()) .build() - .executeSerial(context); + .executeSerial(new PopulateDatabaseWorkerInput(context, false)); + } + + private static void fastPopulateDatabase(@NonNull Context context) { + DialerExecutorComponent.get(context) + .dialerExecutorFactory() + .createNonUiTaskBuilder(new PopulateDatabaseWorker()) + .build() + .executeSerial(new PopulateDatabaseWorkerInput(context, true)); } private static void cleanDatabase(@NonNull Context context) { @@ -97,13 +106,13 @@ final class SimulatorMainMenu { private SimulatorMainMenu() {} - private static class PopulateDatabaseWorker implements Worker<Context, Void> { + private static class PopulateDatabaseWorker implements Worker<PopulateDatabaseWorkerInput, Void> { @Nullable @Override - public Void doInBackground(Context context) { - ContactsPopulator.populateContacts(context); - CallLogPopulator.populateCallLog(context); - VoicemailPopulator.populateVoicemail(context); + public Void doInBackground(PopulateDatabaseWorkerInput input) { + ContactsPopulator.populateContacts(input.context, input.fastMode); + CallLogPopulator.populateCallLog(input.context, false, input.fastMode); + VoicemailPopulator.populateVoicemail(input.context, input.fastMode); return null; } } @@ -135,4 +144,14 @@ final class SimulatorMainMenu { return PersistentLogger.dumpLogToString(); } } + + private static class PopulateDatabaseWorkerInput { + Context context; + boolean fastMode; + + PopulateDatabaseWorkerInput(Context context, boolean fastMode) { + this.context = context; + this.fastMode = fastMode; + } + } } |