diff options
Diffstat (limited to 'src')
6 files changed, 26 insertions, 11 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(); diff --git a/src/com/android/dialer/list/AllContactsFragment.java b/src/com/android/dialer/list/AllContactsFragment.java index 0f31ff88f..6ed1fbbbd 100644 --- a/src/com/android/dialer/list/AllContactsFragment.java +++ b/src/com/android/dialer/list/AllContactsFragment.java @@ -28,6 +28,7 @@ import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.QuickContact; +import android.support.v13.app.FragmentCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -49,7 +50,8 @@ import com.android.dialer.widget.EmptyContentView.OnEmptyViewActionButtonClicked * Fragments to show all contacts with phone numbers. */ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryListAdapter> - implements OnEmptyViewActionButtonClickedListener { + implements OnEmptyViewActionButtonClickedListener, + FragmentCompat.OnRequestPermissionsResultCallback { private static final int READ_CONTACTS_PERMISSION_REQUEST_CODE = 1; @@ -168,7 +170,8 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi } if (!PermissionsUtil.hasPermission(activity, READ_CONTACTS)) { - requestPermissions(new String[] {READ_CONTACTS}, READ_CONTACTS_PERMISSION_REQUEST_CODE); + FragmentCompat.requestPermissions(this, new String[] {READ_CONTACTS}, + READ_CONTACTS_PERMISSION_REQUEST_CODE); } else { // Add new contact DialerUtils.startActivityWithErrorToast(activity, IntentUtil.getNewContactIntent(), diff --git a/src/com/android/dialer/list/RegularSearchFragment.java b/src/com/android/dialer/list/RegularSearchFragment.java index 30b01c091..d067b65b1 100644 --- a/src/com/android/dialer/list/RegularSearchFragment.java +++ b/src/com/android/dialer/list/RegularSearchFragment.java @@ -19,6 +19,7 @@ import static android.Manifest.permission.READ_CONTACTS; import android.app.Activity; import android.content.pm.PackageManager; +import android.support.v13.app.FragmentCompat; import android.view.LayoutInflater; import android.view.ViewGroup; @@ -37,7 +38,8 @@ import com.android.dialer.widget.EmptyContentView; import com.android.dialer.widget.EmptyContentView.OnEmptyViewActionButtonClickedListener; public class RegularSearchFragment extends SearchFragment - implements OnEmptyViewActionButtonClickedListener { + implements OnEmptyViewActionButtonClickedListener, + FragmentCompat.OnRequestPermissionsResultCallback { public static final int PERMISSION_REQUEST_CODE = 1; @@ -123,7 +125,8 @@ public class RegularSearchFragment extends SearchFragment } if (READ_CONTACTS.equals(mPermissionToRequest)) { - requestPermissions(new String[] {mPermissionToRequest}, PERMISSION_REQUEST_CODE); + FragmentCompat.requestPermissions(this, new String[] {mPermissionToRequest}, + PERMISSION_REQUEST_CODE); } } diff --git a/src/com/android/dialer/list/SmartDialSearchFragment.java b/src/com/android/dialer/list/SmartDialSearchFragment.java index a230e6e66..4984d953b 100644 --- a/src/com/android/dialer/list/SmartDialSearchFragment.java +++ b/src/com/android/dialer/list/SmartDialSearchFragment.java @@ -22,6 +22,7 @@ import android.content.Loader; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; +import android.support.v13.app.FragmentCompat; import android.util.Log; import android.view.View; @@ -40,7 +41,8 @@ import java.util.ArrayList; * Implements a fragment to load and display SmartDial search results. */ public class SmartDialSearchFragment extends SearchFragment - implements EmptyContentView.OnEmptyViewActionButtonClickedListener { + implements EmptyContentView.OnEmptyViewActionButtonClickedListener, + FragmentCompat.OnRequestPermissionsResultCallback { private static final String TAG = SmartDialSearchFragment.class.getSimpleName(); private static final int CALL_PHONE_PERMISSION_REQUEST_CODE = 1; @@ -108,7 +110,8 @@ public class SmartDialSearchFragment extends SearchFragment return; } - requestPermissions(new String[] {CALL_PHONE}, CALL_PHONE_PERMISSION_REQUEST_CODE); + FragmentCompat.requestPermissions(this, new String[] {CALL_PHONE}, + CALL_PHONE_PERMISSION_REQUEST_CODE); } @Override diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java index 19180f81e..fcfff2120 100644 --- a/src/com/android/dialer/list/SpeedDialFragment.java +++ b/src/com/android/dialer/list/SpeedDialFragment.java @@ -31,6 +31,7 @@ import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.os.Trace; +import android.support.v13.app.FragmentCompat; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -63,7 +64,8 @@ import java.util.HashMap; */ public class SpeedDialFragment extends Fragment implements OnItemClickListener, PhoneFavoritesTileAdapter.OnDataSetChangedForAnimationListener, - EmptyContentView.OnEmptyViewActionButtonClickedListener { + EmptyContentView.OnEmptyViewActionButtonClickedListener, + FragmentCompat.OnRequestPermissionsResultCallback { private static final int READ_CONTACTS_PERMISSION_REQUEST_CODE = 1; @@ -482,7 +484,8 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener, } if (!PermissionsUtil.hasPermission(activity, READ_CONTACTS)) { - requestPermissions(new String[] {READ_CONTACTS}, READ_CONTACTS_PERMISSION_REQUEST_CODE); + FragmentCompat.requestPermissions(this, new String[] {READ_CONTACTS}, + READ_CONTACTS_PERMISSION_REQUEST_CODE); } else { // Switch tabs ((HostInterface) activity).showAllContactsTab(); diff --git a/src/com/android/dialer/util/TelecomUtil.java b/src/com/android/dialer/util/TelecomUtil.java index bab1adeea..58675cf2b 100644 --- a/src/com/android/dialer/util/TelecomUtil.java +++ b/src/com/android/dialer/util/TelecomUtil.java @@ -181,7 +181,7 @@ public class TelecomUtil { } private static boolean hasPermission(Context context, String permission) { - return context.checkSelfPermission(permission) + return context.getPackageManager().checkPermission(permission, context.getPackageName()) == PackageManager.PERMISSION_GRANTED; } |