summaryrefslogtreecommitdiffstats
path: root/java/com/android/dialer/databasepopulator
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2017-10-27 16:47:14 -0700
committerEric Erfanian <erfanian@google.com>2017-10-30 08:32:29 -0700
commitf87dbfbf35f996738cb3f5436b654f615b1c1b27 (patch)
treee93fb2211413e5feede15d81c9aa5c19b2f84d0c /java/com/android/dialer/databasepopulator
parent77cb8e5d86ebca9763cd06b5263dc02203576f40 (diff)
downloadandroid_packages_apps_Dialer-f87dbfbf35f996738cb3f5436b654f615b1c1b27.tar.gz
android_packages_apps_Dialer-f87dbfbf35f996738cb3f5436b654f615b1c1b27.tar.bz2
android_packages_apps_Dialer-f87dbfbf35f996738cb3f5436b654f615b1c1b27.zip
Roll forward cl/172154863: Do not load every DialtactsActivity fragment on app open
With this change we now only load the Favorites and Call Log Fragments when the app opens. Paging to the CallLogFragment makes the ContactsFragment load as we would want. This should result in a faster app start time. I'll need to verify the impact of this using the same method as http://cl/170422671 I verified the change in behavior by adding my own log line to the onCreate of each Fragment. I saw all of them get created before the change, and only the expected 2 with this change. This change also fixes flaky test of voicemailTabVisibleNotVisible_volumeStreamCorrect. Bug: 64541209,65460373,67297718 Test: DialtactsActivityIntegrationTest PiperOrigin-RevId: 173734472 Change-Id: Ifd4a3064a6fdcffe5a373eaad6ee4aeebdadda1e
Diffstat (limited to 'java/com/android/dialer/databasepopulator')
-rw-r--r--java/com/android/dialer/databasepopulator/VoicemailPopulator.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
index e99f7c7d4..9e0f45345 100644
--- a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
+++ b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
@@ -19,9 +19,12 @@ package com.android.dialer.databasepopulator;
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
+import android.os.Build.VERSION;
+import android.os.Build.VERSION_CODES;
import android.provider.VoicemailContract.Status;
import android.provider.VoicemailContract.Voicemails;
import android.support.annotation.NonNull;
+import android.support.annotation.VisibleForTesting;
import android.support.annotation.WorkerThread;
import android.telecom.PhoneAccountHandle;
import android.telephony.TelephonyManager;
@@ -98,13 +101,16 @@ public final class VoicemailPopulator {
.delete(Voicemails.buildSourceUri(context.getPackageName()), "", new String[] {});
}
- private static void enableVoicemail(@NonNull Context context) {
+ @VisibleForTesting
+ public static void enableVoicemail(@NonNull Context context) {
PhoneAccountHandle handle =
new PhoneAccountHandle(new ComponentName(context, VoicemailPopulator.class), ACCOUNT_ID);
ContentValues values = new ContentValues();
values.put(Status.SOURCE_PACKAGE, handle.getComponentName().getPackageName());
- values.put(Status.SOURCE_TYPE, TelephonyManager.VVM_TYPE_OMTP);
+ if (VERSION.SDK_INT >= VERSION_CODES.N_MR1) {
+ values.put(Status.SOURCE_TYPE, TelephonyManager.VVM_TYPE_OMTP);
+ }
values.put(Status.PHONE_ACCOUNT_COMPONENT_NAME, handle.getComponentName().flattenToString());
values.put(Status.PHONE_ACCOUNT_ID, handle.getId());
values.put(Status.CONFIGURATION_STATE, Status.CONFIGURATION_STATE_OK);