diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-12-20 20:57:28 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-12-20 20:57:28 +0000 |
commit | e2da6ef8a56bd9f7eedfa1c6d89e968590e0c09b (patch) | |
tree | 0d306da41539feb37b10e8ff56a23fe0704676e3 /java/com/android/dialer | |
parent | f976beb4b56b9b0b1ea17c6466d79b16a4eb7477 (diff) | |
parent | cc8942a206ad7d6c779547c0ec84c35988a6beaa (diff) |
Merge changes I5a55df44,I7230508f
* changes:
Populate voicemails in simulator
Print array map for debugging purposes.
Diffstat (limited to 'java/com/android/dialer')
-rw-r--r-- | java/com/android/dialer/simulator/impl/SimulatorMainMenu.java | 30 | ||||
-rw-r--r-- | java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java | 18 |
2 files changed, 39 insertions, 9 deletions
diff --git a/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java b/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java index 6ec30f64b..c48e2836e 100644 --- a/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java +++ b/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java @@ -44,8 +44,12 @@ final class SimulatorMainMenu { "Notifications", SimulatorNotifications.getActionProvider(activity.getApplicationContext())) .addItem("Populate database", () -> populateDatabase(activity.getApplicationContext())) + .addItem("Populate voicemail", () -> populateVoicemail(activity.getApplicationContext())) .addItem( "Fast populate database", () -> fastPopulateDatabase(activity.getApplicationContext())) + .addItem( + "Fast populate voicemail database", + () -> populateVoicemailFast(activity.getApplicationContext())) .addItem("Clean database", () -> cleanDatabase(activity.getApplicationContext())) .addItem("clear preferred SIM", () -> clearPreferredSim(activity.getApplicationContext())) .addItem("Sync voicemail", () -> syncVoicemail(activity.getApplicationContext())) @@ -65,6 +69,32 @@ final class SimulatorMainMenu { .executeSerial(new PopulateDatabaseWorkerInput(context, false)); } + private static void populateVoicemail(@NonNull Context context) { + DialerExecutorComponent.get(context) + .dialerExecutorFactory() + .createNonUiTaskBuilder(new PopulateVoicemailWorker()) + .build() + .executeSerial(new PopulateDatabaseWorkerInput(context, false)); + } + + private static void populateVoicemailFast(@NonNull Context context) { + DialerExecutorComponent.get(context) + .dialerExecutorFactory() + .createNonUiTaskBuilder(new PopulateVoicemailWorker()) + .build() + .executeSerial(new PopulateDatabaseWorkerInput(context, true)); + } + + private static class PopulateVoicemailWorker + implements Worker<PopulateDatabaseWorkerInput, Void> { + @Nullable + @Override + public Void doInBackground(PopulateDatabaseWorkerInput input) { + VoicemailPopulator.populateVoicemail(input.context, input.fastMode); + return null; + } + } + private static void fastPopulateDatabase(@NonNull Context context) { DialerExecutorComponent.get(context) .dialerExecutorFactory() diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java b/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java index a4848c8f0..315bf1cf0 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java @@ -190,7 +190,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> // TODO(uabdullah): a bug Remove logging, temporarily here for debugging. printHashSet(); // TODO(uabdullah): a bug Remove logging, temporarily here for debugging. - printHashMap(); + printArrayMap(); if (viewHolder instanceof NewVoicemailHeaderViewHolder) { LogUtil.i( @@ -241,7 +241,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> newVoicemailViewHolderArrayMap.remove(newVoicemailViewHolder.getViewHolderId()); printHashSet(); - printHashMap(); + printArrayMap(); } newVoicemailViewHolder.reset(); @@ -265,7 +265,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> // TODO(uabdullah): a bug Remove logging, temporarily here for debugging. printHashSet(); // TODO(uabdullah): a bug Remove logging, temporarily here for debugging. - printHashMap(); + printArrayMap(); // If the viewholder is playing the voicemail, keep updating its media player view (seekbar, // duration etc.) @@ -298,12 +298,12 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> // TODO(uabdullah): a bug Remove logging, temporarily here for debugging. printHashSet(); // TODO(uabdullah): a bug Remove logging, temporarily here for debugging. - printHashMap(); + printArrayMap(); } - private void printHashMap() { + private void printArrayMap() { LogUtil.i( - "NewVoicemailAdapter.printHashMap", + "NewVoicemailAdapter.printArrayMap", "hashMapSize: %d, currentlyExpandedViewHolderId:%d", newVoicemailViewHolderArrayMap.size(), currentlyExpandedViewHolderId); @@ -311,9 +311,9 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> if (!newVoicemailViewHolderArrayMap.isEmpty()) { String ids = ""; for (int id : newVoicemailViewHolderArrayMap.keySet()) { - ids = id + String.valueOf(id) + " "; + ids = ids + id + " "; } - LogUtil.i("NewVoicemailAdapter.printHashMap", "ids are " + ids); + LogUtil.i("NewVoicemailAdapter.printArrayMap", "ids are " + ids); } } @@ -801,7 +801,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> currentlyExpandedViewHolderId); // TODO(uabdullah): a bug Remove logging, temporarily here for debugging. printHashSet(); - printHashMap(); + printArrayMap(); return null; } } |