diff options
author | maxwelb <maxwelb@google.com> | 2018-01-30 16:28:22 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-30 17:45:37 -0800 |
commit | 73b231dfc38d895eb6f05f86c61a49a728f9d8b9 (patch) | |
tree | 3db2212e91285e0617668ce3aec0ece4649548d0 | |
parent | beb5e596ac4629e661488b3ec8741b9ab1500dd6 (diff) |
Make default lastModified timestamp configurable
Bug: 72320869
Test: manually verified that the config value is used
PiperOrigin-RevId: 183911716
Change-Id: I15bc2c4505306eb65446a792b305226255ae4315
-rw-r--r-- | java/com/android/dialer/database/DialerDatabaseHelper.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/java/com/android/dialer/database/DialerDatabaseHelper.java b/java/com/android/dialer/database/DialerDatabaseHelper.java index 18c61342d..cb07615a5 100644 --- a/java/com/android/dialer/database/DialerDatabaseHelper.java +++ b/java/com/android/dialer/database/DialerDatabaseHelper.java @@ -42,6 +42,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.database.Selection; +import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns; import com.android.dialer.smartdial.util.SmartDialNameMatcher; import com.android.dialer.smartdial.util.SmartDialPrefix; @@ -76,6 +77,10 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { private static final String DATABASE_LAST_CREATED_SHARED_PREF = "com.android.dialer"; private static final String LAST_UPDATED_MILLIS = "last_updated_millis"; + + @VisibleForTesting + static final String DEFAULT_LAST_UPDATED_CONFIG_KEY = "smart_dial_default_last_update_millis"; + private static final String DATABASE_VERSION_PROPERTY = "database_version"; private static final int MAX_ENTRIES = 20; @@ -635,12 +640,17 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { /** Gets the last update time on the database. */ final SharedPreferences databaseLastUpdateSharedPref = context.getSharedPreferences(DATABASE_LAST_CREATED_SHARED_PREF, Context.MODE_PRIVATE); - final String lastUpdateMillis = - String.valueOf( - forceUpdate ? 0 : databaseLastUpdateSharedPref.getLong(LAST_UPDATED_MILLIS, 0)); - LogUtil.v( - "DialerDatabaseHelper.updateSmartDialDatabase", "last updated at " + lastUpdateMillis); + long defaultLastUpdateMillis = + ConfigProviderBindings.get(context).getLong(DEFAULT_LAST_UPDATED_CONFIG_KEY, 0); + + long sharedPrefLastUpdateMillis = + databaseLastUpdateSharedPref.getLong(LAST_UPDATED_MILLIS, defaultLastUpdateMillis); + + final String lastUpdateMillis = String.valueOf(forceUpdate ? 0 : sharedPrefLastUpdateMillis); + + LogUtil.i( + "DialerDatabaseHelper.updateSmartDialDatabase", "last updated at %s", lastUpdateMillis); /** Sets the time after querying the database as the current update time. */ final Long currentMillis = System.currentTimeMillis(); |