From 2a613022dbb278f0f7dd94cf49885cde9d36100c Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Wed, 1 Jul 2015 14:28:13 -0700 Subject: Restore Dialer content after permissions granted First pass at making Dialer display the call log, favorites, all contacts, and contact search after permissions are granted withut having to restart the app. Update cached permission status in onResume for Dialer activities Update SpeedDialFragment to correctly initialize loader in onResume if it was null previously because of revoked permission. Bug: 22205650 Change-Id: I68982e69395bc9c7da84ff3221cd12b8f79005f9 --- src/com/android/dialer/CallDetailActivity.java | 2 ++ src/com/android/dialer/DialtactsActivity.java | 2 ++ src/com/android/dialer/calllog/CallLogActivity.java | 2 ++ src/com/android/dialer/list/SpeedDialFragment.java | 7 ++++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 734e78f46..ec92f3f94 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -47,6 +47,7 @@ import android.widget.Toast; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; +import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.common.GeoUtil; import com.android.contacts.common.CallUtil; import com.android.dialer.calllog.CallDetailHistoryAdapter; @@ -267,6 +268,7 @@ public class CallDetailActivity extends Activity @Override public void onResume() { super.onResume(); + PermissionsUtil.updateCachedPermissions(this); getCallDetails(); } diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index b8a1d4dce..d1a687240 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -511,6 +511,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O protected void onResume() { Trace.beginSection(TAG + " onResume"); super.onResume(); + + PermissionsUtil.updateCachedPermissions(this); mStateSaved = false; if (mFirstLaunch) { displayFragment(getIntent()); diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java index d5444de8a..0f2f83860 100644 --- a/src/com/android/dialer/calllog/CallLogActivity.java +++ b/src/com/android/dialer/calllog/CallLogActivity.java @@ -35,6 +35,7 @@ import android.view.ViewGroup; import com.android.contacts.common.interactions.TouchPointManager; import com.android.contacts.common.list.ViewPagerTabs; +import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.commonbind.analytics.AnalyticsUtil; import com.android.dialer.DialtactsActivity; import com.android.dialer.R; @@ -150,6 +151,7 @@ public class CallLogActivity extends Activity implements ViewPager.OnPageChangeL protected void onResume() { mIsResumed = true; super.onResume(); + PermissionsUtil.updateCachedPermissions(this); sendScreenViewForChildFragment(mViewPager.getCurrentItem()); } diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java index 541cdf6e1..bf9575858 100644 --- a/src/com/android/dialer/list/SpeedDialFragment.java +++ b/src/com/android/dialer/list/SpeedDialFragment.java @@ -194,7 +194,12 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener, super.onResume(); if (PermissionsUtil.hasContactsPermissions(getActivity())) { - getLoaderManager().getLoader(LOADER_ID_CONTACT_TILE).forceLoad(); + if (getLoaderManager().getLoader(LOADER_ID_CONTACT_TILE) == null) { + getLoaderManager().initLoader(LOADER_ID_CONTACT_TILE, null, + mContactTileLoaderListener); + } else { + getLoaderManager().getLoader(LOADER_ID_CONTACT_TILE).forceLoad(); + } } Trace.endSection(); } -- cgit v1.2.3