From 738bb09adee2b56c99063a0264f8f76de393143b Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Fri, 5 May 2017 09:08:20 -0700 Subject: Update Dialer to v10 RC17 This release was created following the instructions at: go/dialer-aosp-release Subsequent dialer releases will follow as O bugs are fixed, until we reach our final RC. Version: 10 Candidate: RC17 Branch: dialer-android_release_branch/153304843.1 dialer-android/dialer-android_20170416.00/dialer-android_20170416.00_RC17 This release contains the following bug fixes since RC16: Bug: 37962346 Test: make, on device Change-Id: I1852cc096ef242c7bfcd85b11f954ddb00903c39 --- .../dialer/app/dialpad/SmartDialCursorLoader.java | 28 ---------------- .../dialer/app/list/SmartDialSearchFragment.java | 38 ++++++++++++++++++++-- .../dialer/database/DialerDatabaseHelper.java | 4 +++ .../dialer/logging/contact_lookup_result.proto | 1 - 4 files changed, 40 insertions(+), 31 deletions(-) (limited to 'java') diff --git a/java/com/android/dialer/app/dialpad/SmartDialCursorLoader.java b/java/com/android/dialer/app/dialpad/SmartDialCursorLoader.java index 2e3b0cf92..175360c2d 100644 --- a/java/com/android/dialer/app/dialpad/SmartDialCursorLoader.java +++ b/java/com/android/dialer/app/dialpad/SmartDialCursorLoader.java @@ -17,10 +17,7 @@ package com.android.dialer.app.dialpad; import android.content.AsyncTaskLoader; -import android.content.BroadcastReceiver; import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; import android.database.Cursor; import android.database.MatrixCursor; import com.android.contacts.common.list.PhoneNumberListAdapter.PhoneQuery; @@ -46,8 +43,6 @@ public class SmartDialCursorLoader extends AsyncTaskLoader { private String mQuery; private SmartDialNameMatcher mNameMatcher; - private BroadcastReceiver mSmartDialUpdatedReceiver; - private boolean mShowEmptyListForNullQuery = true; public SmartDialCursorLoader(Context context) { @@ -124,19 +119,6 @@ public class SmartDialCursorLoader extends AsyncTaskLoader { Cursor oldCursor = mCursor; mCursor = cursor; - if (mSmartDialUpdatedReceiver == null) { - mSmartDialUpdatedReceiver = - new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - onContentChanged(); - } - }; - mContext.registerReceiver( - mSmartDialUpdatedReceiver, - new IntentFilter(DialerDatabaseHelper.ACTION_SMART_DIAL_UPDATED)); - } - if (isStarted()) { /** If the Loader is in a started state, deliver the results to the client. */ super.deliverResult(cursor); @@ -171,11 +153,6 @@ public class SmartDialCursorLoader extends AsyncTaskLoader { /** Ensure the loader has been stopped. */ onStopLoading(); - if (mSmartDialUpdatedReceiver != null) { - mContext.unregisterReceiver(mSmartDialUpdatedReceiver); - mSmartDialUpdatedReceiver = null; - } - /** Release all previously saved query results. */ if (mCursor != null) { releaseResources(mCursor); @@ -187,11 +164,6 @@ public class SmartDialCursorLoader extends AsyncTaskLoader { public void onCanceled(Cursor cursor) { super.onCanceled(cursor); - if (mSmartDialUpdatedReceiver != null) { - mContext.unregisterReceiver(mSmartDialUpdatedReceiver); - mSmartDialUpdatedReceiver = null; - } - /** The load has been canceled, so we should release the resources associated with 'data'. */ releaseResources(cursor); } diff --git a/java/com/android/dialer/app/list/SmartDialSearchFragment.java b/java/com/android/dialer/app/list/SmartDialSearchFragment.java index 5d72ee615..eb1508c72 100644 --- a/java/com/android/dialer/app/list/SmartDialSearchFragment.java +++ b/java/com/android/dialer/app/list/SmartDialSearchFragment.java @@ -18,6 +18,10 @@ package com.android.dialer.app.list; import static android.Manifest.permission.CALL_PHONE; import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.content.Loader; import android.database.Cursor; import android.os.Bundle; @@ -27,6 +31,8 @@ import com.android.dialer.app.R; import com.android.dialer.app.dialpad.SmartDialCursorLoader; import com.android.dialer.app.widget.EmptyContentView; import com.android.dialer.callintent.CallInitiationType; +import com.android.dialer.common.LogUtil; +import com.android.dialer.database.DialerDatabaseHelper; import com.android.dialer.util.PermissionsUtil; /** Implements a fragment to load and display SmartDial search results. */ @@ -34,10 +40,17 @@ public class SmartDialSearchFragment extends SearchFragment implements EmptyContentView.OnEmptyViewActionButtonClickedListener, FragmentCompat.OnRequestPermissionsResultCallback { - private static final String TAG = SmartDialSearchFragment.class.getSimpleName(); - private static final int CALL_PHONE_PERMISSION_REQUEST_CODE = 1; + private final BroadcastReceiver mSmartDialUpdatedReceiver = + new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + LogUtil.i("SmartDialSearchFragment.onReceive", "smart dial update broadcast received"); + reloadData(); + } + }; + /** Creates a SmartDialListAdapter to display and operate on search results. */ @Override protected ContactEntryListAdapter createListAdapter() { @@ -82,6 +95,27 @@ public class SmartDialSearchFragment extends SearchFragment } } + @Override + public void onStart() { + super.onStart(); + + LogUtil.i("SmartDialSearchFragment.onStart", "registering smart dial update receiver"); + + getActivity() + .registerReceiver( + mSmartDialUpdatedReceiver, + new IntentFilter(DialerDatabaseHelper.ACTION_SMART_DIAL_UPDATED)); + } + + @Override + public void onStop() { + super.onStop(); + + LogUtil.i("SmartDialSearchFragment.onStop", "unregistering smart dial update receiver"); + + getActivity().unregisterReceiver(mSmartDialUpdatedReceiver); + } + @Override public void onEmptyViewActionButtonClicked() { final Activity activity = getActivity(); diff --git a/java/com/android/dialer/database/DialerDatabaseHelper.java b/java/com/android/dialer/database/DialerDatabaseHelper.java index 1984b9abc..7b6033b65 100644 --- a/java/com/android/dialer/database/DialerDatabaseHelper.java +++ b/java/com/android/dialer/database/DialerDatabaseHelper.java @@ -597,6 +597,8 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { * since last update. */ public void updateSmartDialDatabase() { + LogUtil.enterBlock("DialerDatabaseHelper.updateSmartDialDatabase"); + final SQLiteDatabase db = getWritableDatabase(); synchronized (mLock) { @@ -799,6 +801,8 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { editor.putLong(LAST_UPDATED_MILLIS, currentMillis); editor.apply(); + LogUtil.i("DialerDatabaseHelper.updateSmartDialDatabase", "broadcasting smart dial update"); + // Notify content observers that smart dial database has been updated. Intent intent = new Intent(ACTION_SMART_DIAL_UPDATED); intent.setPackage(mContext.getPackageName()); diff --git a/java/com/android/dialer/logging/contact_lookup_result.proto b/java/com/android/dialer/logging/contact_lookup_result.proto index c9624aff1..835d7d7dc 100644 --- a/java/com/android/dialer/logging/contact_lookup_result.proto +++ b/java/com/android/dialer/logging/contact_lookup_result.proto @@ -5,7 +5,6 @@ option java_package = "com.android.dialer.logging"; option java_multiple_files = true; option optimize_for = LITE_RUNTIME; - message ContactLookupResult { // The different results of a contact lookup done using a phone number. enum Type { -- cgit v1.2.3