Add location check action for bt anomaly

This cl adds action to turn off location permission for both
ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION by using API
in RuntimePermissionPresenter

Bug: 36921532
Test: runtest -x LocationCheckActionTest

Change-Id: Ibe1e2908bd745a137d92a70a8432e9f866c1be61
This commit is contained in:
jackqdyulei
2017-06-20 10:09:04 -07:00
parent d793590678
commit c14daa2370
9 changed files with 208 additions and 11 deletions

View File

@@ -38,7 +38,8 @@ public class AnomalyDialogFragment extends InstrumentedDialogFragment implements
@VisibleForTesting
Anomaly mAnomaly;
private AnomalyUtils mAnomalyUtils;
@VisibleForTesting
AnomalyUtils mAnomalyUtils;
/**
* Listener to give the control back to target fragment
@@ -68,6 +69,11 @@ public class AnomalyDialogFragment extends InstrumentedDialogFragment implements
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initAnomalyUtils();
}
@VisibleForTesting
void initAnomalyUtils() {
mAnomalyUtils = AnomalyUtils.getInstance(getContext());
}
@@ -114,6 +120,14 @@ public class AnomalyDialogFragment extends InstrumentedDialogFragment implements
.setPositiveButton(R.string.dialog_background_check_ok, this)
.setNegativeButton(R.string.dlg_cancel, null)
.create();
case Anomaly.AnomalyActionType.LOCATION_CHECK:
return new AlertDialog.Builder(context)
.setTitle(R.string.dialog_location_title)
.setMessage(getString(R.string.dialog_location_message,
mAnomaly.displayName))
.setPositiveButton(R.string.dialog_location_ok, this)
.setNegativeButton(R.string.dlg_cancel, null)
.create();
default:
throw new IllegalArgumentException("unknown type " + mAnomaly.type);
}