diff options
author | Yorke Lee <yorkelee@google.com> | 2013-10-07 17:10:13 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-07 17:10:13 -0700 |
commit | 7fdd2ed894e00bb1559f0c6d6583831bfd424fe0 (patch) | |
tree | bd56e96fcfc35737c30abe1c82fb9134dfcc06d5 | |
parent | c6b2d2fbb6124d25a37d9e11811e92dfd84ebaa9 (diff) | |
parent | d1a429e1c1cf1177982e3e73a6b33b820e2035db (diff) |
am d1a429e1: am e8b56fbe: Merge "Clear phone number cache when call log is cleared" into klp-dev
* commit 'd1a429e1c1cf1177982e3e73a6b33b820e2035db':
Clear phone number cache when call log is cleared
-rw-r--r-- | src/com/android/dialer/calllog/ClearCallLogDialog.java | 10 | ||||
-rw-r--r-- | src/com/android/dialer/service/CachedNumberLookupService.java | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/dialer/calllog/ClearCallLogDialog.java b/src/com/android/dialer/calllog/ClearCallLogDialog.java index 1f5b2b3b7..e6b4ce29c 100644 --- a/src/com/android/dialer/calllog/ClearCallLogDialog.java +++ b/src/com/android/dialer/calllog/ClearCallLogDialog.java @@ -22,6 +22,7 @@ import android.app.DialogFragment; import android.app.FragmentManager; import android.app.ProgressDialog; import android.content.ContentResolver; +import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.AsyncTask; @@ -29,11 +30,16 @@ import android.os.Bundle; import android.provider.CallLog.Calls; import com.android.dialer.R; +import com.android.dialer.service.CachedNumberLookupService; +import com.android.dialerbind.ObjectFactory; /** * Dialog that clears the call log after confirming with the user */ public class ClearCallLogDialog extends DialogFragment { + private static final CachedNumberLookupService mCachedNumberLookupService = + ObjectFactory.newCachedNumberLookupService(); + /** Preferred way to show this dialog */ public static void show(FragmentManager fragmentManager) { ClearCallLogDialog dialog = new ClearCallLogDialog(); @@ -43,6 +49,7 @@ public class ClearCallLogDialog extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final ContentResolver resolver = getActivity().getContentResolver(); + final Context context = getActivity().getApplicationContext(); final OnClickListener okListener = new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -53,6 +60,9 @@ public class ClearCallLogDialog extends DialogFragment { @Override protected Void doInBackground(Void... params) { resolver.delete(Calls.CONTENT_URI, null, null); + if (mCachedNumberLookupService != null) { + mCachedNumberLookupService.clearAllCacheEntries(context); + } return null; } @Override diff --git a/src/com/android/dialer/service/CachedNumberLookupService.java b/src/com/android/dialer/service/CachedNumberLookupService.java index 62881d2fe..5745c9ded 100644 --- a/src/com/android/dialer/service/CachedNumberLookupService.java +++ b/src/com/android/dialer/service/CachedNumberLookupService.java @@ -34,4 +34,12 @@ public interface CachedNumberLookupService { public boolean isCacheUri(String uri); public boolean addPhoto(Context context, String number, byte[] photo); + + /** + * Remove all cached phone number entries from the cache, regardless of how old they + * are. + * + * @param context Valid context + */ + public void clearAllCacheEntries(Context context); } |