diff options
author | Nancy Chen <nancychen@google.com> | 2015-11-18 18:13:07 -0800 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2015-11-18 18:59:16 -0800 |
commit | a1fd281d4989d910ca6b2f78d2321a4792eca36f (patch) | |
tree | a0c3a679333d1fabd2a348acf757627e5e266a51 /src/com/android/dialer/calllog/CallLogFragment.java | |
parent | 4bbb29d0186cc25be1e83717b736dd319127235f (diff) |
Handle backwards compatible permission lookup and requests (1/3).
requestPermissions is not available to the Fragments class and
checkSelfPermission is not available to the Context class in API < 23.
Use other backwards compatible methods to implement the behavior.
Bug: 25776171
Change-Id: I6cb221236f28b319f618d2cf32a9f503a6f4e6e0
Diffstat (limited to 'src/com/android/dialer/calllog/CallLogFragment.java')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index ab5bd435e..fa6deaf55 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -33,6 +33,7 @@ import android.provider.CallLog; import android.provider.CallLog.Calls; import android.provider.ContactsContract; import android.provider.VoicemailContract.Status; +import android.support.v13.app.FragmentCompat; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -55,7 +56,8 @@ import com.android.dialerbind.ObjectFactory; * (all, missed or voicemails), specify it in the constructor. */ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Listener, - CallLogAdapter.CallFetcher, OnEmptyViewActionButtonClickedListener { + CallLogAdapter.CallFetcher, OnEmptyViewActionButtonClickedListener, + FragmentCompat.OnRequestPermissionsResultCallback { private static final String TAG = "CallLogFragment"; /** @@ -513,7 +515,8 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis } if (!PermissionsUtil.hasPermission(activity, READ_CALL_LOG)) { - requestPermissions(new String[] {READ_CALL_LOG}, READ_CALL_LOG_PERMISSION_REQUEST_CODE); + FragmentCompat.requestPermissions(this, new String[] {READ_CALL_LOG}, + READ_CALL_LOG_PERMISSION_REQUEST_CODE); } else if (!mIsCallLogActivity) { // Show dialpad if we are not in the call log activity. ((HostInterface) activity).showDialpad(); |