Merge "Wrap old search index update logic behind FeatureProvider."
This commit is contained in:
committed by
Android (Google) Code Review
commit
63e8d160f9
@@ -462,10 +462,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
if (mIsShowingDashboard) {
|
||||
// Run the Index update only if we have some space
|
||||
if (!Utils.isLowStorage(this)) {
|
||||
long indexStartTime = System.currentTimeMillis();
|
||||
Index.getInstance(getApplicationContext()).update();
|
||||
if (DEBUG_TIMING) Log.d(LOG_TAG, "Index.update() took "
|
||||
+ (System.currentTimeMillis() - indexStartTime) + " ms");
|
||||
mSearchFeatureProvider.updateIndex(getApplicationContext());
|
||||
} else {
|
||||
Log.w(LOG_TAG, "Cannot update the Indexer as we are running low on storage space!");
|
||||
}
|
||||
|
@@ -19,19 +19,21 @@ package com.android.settings.search2;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.Index;
|
||||
|
||||
import com.android.settings.applications.PackageManagerWrapperImpl;
|
||||
import com.android.settings.search.Index;
|
||||
|
||||
/**
|
||||
* FeatureProvider for the refactored search code.
|
||||
*/
|
||||
public class SearchFeatureProviderImpl implements SearchFeatureProvider {
|
||||
|
||||
private static final String TAG = "SearchFeatureProvider";
|
||||
|
||||
private DatabaseIndexingManager mDatabaseIndexingManager;
|
||||
|
||||
@Override
|
||||
@@ -81,10 +83,12 @@ public class SearchFeatureProviderImpl implements SearchFeatureProvider {
|
||||
|
||||
@Override
|
||||
public void updateIndex(Context context) {
|
||||
long indexStartTime = System.currentTimeMillis();
|
||||
if (isEnabled(context)) {
|
||||
getIndexingManager(context).update();
|
||||
} else {
|
||||
Index.getInstance(context).update();
|
||||
}
|
||||
Log.d(TAG, "Index.update() took " + (System.currentTimeMillis() - indexStartTime) + " ms");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user