diff options
author | Yorke Lee <yorkelee@google.com> | 2015-10-12 10:03:07 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-10-12 15:57:44 -0700 |
commit | 807afd8a39366b7423eacd83fb18bff2ba7a0422 (patch) | |
tree | 6f8c1638026f948f670a4739e4a9da5adbd3c0b2 /src/com/android/dialer/list/RegularSearchFragment.java | |
parent | f49c817d525ca3f3a85ccea10f8e94d397c7feb5 (diff) |
Move capability checker out of RegularSearchFragment
AOSP Dialer does not care about having location enabled,
so move the relevant code out into a separate fragment
Bug: 24172011
Change-Id: I7c29ba4ed8e3fb0a600360c10e9c9fdd6d543b1f
Diffstat (limited to 'src/com/android/dialer/list/RegularSearchFragment.java')
-rw-r--r-- | src/com/android/dialer/list/RegularSearchFragment.java | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/com/android/dialer/list/RegularSearchFragment.java b/src/com/android/dialer/list/RegularSearchFragment.java index 33ce95f78..6b89ef0a3 100644 --- a/src/com/android/dialer/list/RegularSearchFragment.java +++ b/src/com/android/dialer/list/RegularSearchFragment.java @@ -16,7 +16,6 @@ package com.android.dialer.list; import static android.Manifest.permission.READ_CONTACTS; -import static android.Manifest.permission.ACCESS_FINE_LOCATION; import android.app.Activity; import android.content.pm.PackageManager; @@ -38,7 +37,7 @@ import com.android.dialer.widget.EmptyContentView.OnEmptyViewActionButtonClicked public class RegularSearchFragment extends SearchFragment implements OnEmptyViewActionButtonClickedListener { - private static final int PERMISSION_REQUEST_CODE = 1; + public static final int PERMISSION_REQUEST_CODE = 1; private static final int SEARCH_DIRECTORY_RESULT_LIMIT = 5; @@ -49,8 +48,7 @@ public class RegularSearchFragment extends SearchFragment public boolean isNearbyPlacesSearchEnabled(); } - private String mPermissionToRequest; - private CapabilityChecker mCapabilityChecker; + protected String mPermissionToRequest; public RegularSearchFragment() { configureDirectorySearch(); @@ -64,7 +62,6 @@ public class RegularSearchFragment extends SearchFragment @Override public void onDetach() { - mCapabilityChecker = null; super.onDetach(); } @@ -110,13 +107,6 @@ public class RegularSearchFragment extends SearchFragment descriptionResource = R.string.permission_no_search; listener = this; mPermissionToRequest = READ_CONTACTS; - } else if (isNearbyPlacesSearchEnabled() - && !PermissionsUtil.hasPermission(getActivity(), ACCESS_FINE_LOCATION)) { - imageResource = R.drawable.empty_contacts; - actionLabelResource = R.string.permission_single_turn_on; - descriptionResource = R.string.permission_no_location_for_search; - listener = this; - mPermissionToRequest = ACCESS_FINE_LOCATION; } else { imageResource = EmptyContentView.NO_IMAGE; actionLabelResource = EmptyContentView.NO_LABEL; @@ -141,8 +131,7 @@ public class RegularSearchFragment extends SearchFragment return; } - if (READ_CONTACTS.equals(mPermissionToRequest) - || ACCESS_FINE_LOCATION.equals(mPermissionToRequest)) { + if (READ_CONTACTS.equals(mPermissionToRequest)) { requestPermissions(new String[] {mPermissionToRequest}, PERMISSION_REQUEST_CODE); } } @@ -164,15 +153,4 @@ public class RegularSearchFragment extends SearchFragment return isRemoteDirectory ? LogState.INITIATION_REMOTE_DIRECTORY : LogState.INITIATION_REGULAR_SEARCH; } - - public void setCapabilityChecker(CapabilityChecker capabilityChecker) { - mCapabilityChecker = capabilityChecker; - } - - private boolean isNearbyPlacesSearchEnabled() { - if (mCapabilityChecker != null) { - return mCapabilityChecker.isNearbyPlacesSearchEnabled(); - } - return false; - } } |