diff options
Diffstat (limited to 'java/com/android/dialer/app/dialpad')
-rw-r--r-- | java/com/android/dialer/app/dialpad/DialpadFragment.java | 9 | ||||
-rw-r--r-- | java/com/android/dialer/app/dialpad/SmartDialCursorLoader.java | 29 |
2 files changed, 9 insertions, 29 deletions
diff --git a/java/com/android/dialer/app/dialpad/DialpadFragment.java b/java/com/android/dialer/app/dialpad/DialpadFragment.java index 271f62199..e9d57b399 100644 --- a/java/com/android/dialer/app/dialpad/DialpadFragment.java +++ b/java/com/android/dialer/app/dialpad/DialpadFragment.java @@ -69,7 +69,6 @@ import android.widget.ListView; import android.widget.PopupMenu; import android.widget.RelativeLayout; import android.widget.TextView; -import com.android.contacts.common.GeoUtil; import com.android.contacts.common.dialog.CallSubjectDialog; import com.android.contacts.common.util.StopWatch; import com.android.contacts.common.widget.FloatingActionButtonController; @@ -84,6 +83,7 @@ import com.android.dialer.calllogutils.PhoneAccountUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.dialpadview.DialpadKeyButton; import com.android.dialer.dialpadview.DialpadView; +import com.android.dialer.location.GeoUtil; import com.android.dialer.proguard.UsedByReflection; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.CallUtil; @@ -447,7 +447,7 @@ public class DialpadFragment extends Fragment setFormattedDigits(converted, null); return true; } else { - if (!PermissionsUtil.hasContactsPermissions(getActivity())) { + if (!PermissionsUtil.hasContactsReadPermissions(getActivity())) { return false; } String type = intent.getType(); @@ -1189,7 +1189,6 @@ public class DialpadFragment extends Fragment // Just call 'scaleIn()' method if the mFloatingActionButtonController was not already // previously visible. mFloatingActionButtonController.scaleIn(0); - mFloatingActionButtonController.setVisible(true); } mDialpadChooser.setVisibility(View.GONE); } @@ -1410,10 +1409,10 @@ public class DialpadFragment extends Fragment public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); final DialtactsActivity activity = (DialtactsActivity) getActivity(); - final DialpadView dialpadView = (DialpadView) getView().findViewById(R.id.dialpad_view); - if (activity == null) { + if (activity == null || getView() == null) { return; } + final DialpadView dialpadView = (DialpadView) getView().findViewById(R.id.dialpad_view); if (!hidden && !isDialpadChooserVisible()) { if (mAnimate) { dialpadView.animateShow(); diff --git a/java/com/android/dialer/app/dialpad/SmartDialCursorLoader.java b/java/com/android/dialer/app/dialpad/SmartDialCursorLoader.java index f3a93f916..a0c8b18d3 100644 --- a/java/com/android/dialer/app/dialpad/SmartDialCursorLoader.java +++ b/java/com/android/dialer/app/dialpad/SmartDialCursorLoader.java @@ -20,8 +20,8 @@ import android.content.AsyncTaskLoader; import android.content.Context; import android.database.Cursor; import android.database.MatrixCursor; -import android.util.Log; import com.android.contacts.common.list.PhoneNumberListAdapter.PhoneQuery; +import com.android.dialer.common.LogUtil; import com.android.dialer.database.Database; import com.android.dialer.database.DialerDatabaseHelper; import com.android.dialer.database.DialerDatabaseHelper.ContactNumber; @@ -43,8 +43,6 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> { private String mQuery; private SmartDialNameMatcher mNameMatcher; - private ForceLoadContentObserver mObserver; - private boolean mShowEmptyListForNullQuery = true; public SmartDialCursorLoader(Context context) { @@ -59,7 +57,7 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> { */ public void configureQuery(String query) { if (DEBUG) { - Log.v(TAG, "Configure new query to be " + query); + LogUtil.v(TAG, "Configure new query to be " + query); } mQuery = SmartDialNameMatcher.normalizeNumber(query, SmartDialPrefix.getMap()); @@ -76,10 +74,10 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> { @Override public Cursor loadInBackground() { if (DEBUG) { - Log.v(TAG, "Load in background " + mQuery); + LogUtil.v(TAG, "Load in background " + mQuery); } - if (!PermissionsUtil.hasContactsPermissions(mContext)) { + if (!PermissionsUtil.hasContactsReadPermissions(mContext)) { return new MatrixCursor(PhoneQuery.PROJECTION_PRIMARY); } @@ -90,7 +88,7 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> { dialerDatabaseHelper.getLooseMatches(mQuery, mNameMatcher); if (DEBUG) { - Log.v(TAG, "Loaded matches " + String.valueOf(allMatches.size())); + LogUtil.v(TAG, "Loaded matches " + allMatches.size()); } /** Constructs a cursor for the returned array of results. */ @@ -121,13 +119,6 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> { Cursor oldCursor = mCursor; mCursor = cursor; - if (mObserver == null) { - mObserver = new ForceLoadContentObserver(); - mContext - .getContentResolver() - .registerContentObserver(DialerDatabaseHelper.SMART_DIAL_UPDATED_URI, true, mObserver); - } - if (isStarted()) { /** If the Loader is in a started state, deliver the results to the client. */ super.deliverResult(cursor); @@ -162,11 +153,6 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> { /** Ensure the loader has been stopped. */ onStopLoading(); - if (mObserver != null) { - mContext.getContentResolver().unregisterContentObserver(mObserver); - mObserver = null; - } - /** Release all previously saved query results. */ if (mCursor != null) { releaseResources(mCursor); @@ -178,11 +164,6 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> { public void onCanceled(Cursor cursor) { super.onCanceled(cursor); - if (mObserver != null) { - mContext.getContentResolver().unregisterContentObserver(mObserver); - mObserver = null; - } - /** The load has been canceled, so we should release the resources associated with 'data'. */ releaseResources(cursor); } |