Source:
<code>private LocationSettingsResult generateLocationSettingsResult() { boolean needGps = false; boolean needNetwork = false; for (LocationRequest request : settingsRequest.getLocationRequests()) { switch (request.getPriority()) { case LocationRequest.PRIORITY_HIGH_ACCURACY: needGps = true; needNetwork = true; break; case LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY: case LocationRequest.PRIORITY_LOW_POWER: needNetwork = true; break; default: break; } } boolean needBle = settingsRequest.getNeedBle(); boolean gpsUsable = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); boolean gpsPresent = packageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS); boolean networkUsable = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); boolean networkPresent = packageManager.hasSystemFeature( PackageManager.FEATURE_LOCATION_NETWORK); boolean bleUsable = bluetoothAdapter.isEnabled(); <START> boolean blePresent = packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE); <END> boolean hasGpsResolution = needGps && gpsPresent && !gpsUsable; boolean hasNetworkResolution = needNetwork && networkPresent && !networkUsable; boolean hasBleResolution = needBle && blePresent && !bleUsable; boolean hasResolution = hasGpsResolution || hasNetworkResolution || hasBleResolution; boolean gpsResolutionUnavailable = needGps && !gpsPresent; boolean networkResolutionUnavailable = needNetwork && !networkPresent; boolean bleResolutionUnavailable = needBle && !blePresent; boolean resolutionUnavailable = gpsResolutionUnavailable || networkResolutionUnavailable || bleResolutionUnavailable; final Status status; if (hasResolution) { PendingIntent pendingIntent = pendingIntentGenerator.generatePendingIntent(hasBleResolution); status = new Status(RESOLUTION_REQUIRED, pendingIntent); } else if (resolutionUnavailable) { status = new Status(SETTINGS_CHANGE_UNAVAILABLE); } else { status = new Status(SUCCESS); } final LocationSettingsStates states = new LocationSettingsStates(gpsUsable, networkUsable, bleUsable, gpsPresent, networkPresent, blePresent); return new LocationSettingsResult(status, states); }</code><technical_language>PackageManager.FEATURE_BLUETOOTH_LE requires API 18. current minimum SDK for LOST is 15</technical_language>

Target:
private LocationSettingsResult generateLocationSettingsResult() { boolean needGps = false; boolean needNetwork = false; for (LocationRequest request : settingsRequest.getLocationRequests()) { switch (request.getPriority()) { case LocationRequest.PRIORITY_HIGH_ACCURACY: needGps = true; needNetwork = true; break; case LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY: case LocationRequest.PRIORITY_LOW_POWER: needNetwork = true; break; default: break; } } boolean needBle = settingsRequest.getNeedBle(); boolean gpsUsable = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); boolean gpsPresent = packageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS); boolean networkUsable = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); boolean networkPresent = packageManager.hasSystemFeature( PackageManager.FEATURE_LOCATION_NETWORK); boolean bleUsable = bluetoothAdapter != null && bluetoothAdapter.isEnabled(); boolean blePresent = packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE); boolean hasGpsResolution = needGps && gpsPresent && !gpsUsable; boolean hasNetworkResolution = needNetwork && networkPresent && !networkUsable; boolean hasBleResolution = needBle && blePresent && !bleUsable; boolean hasResolution = hasGpsResolution || hasNetworkResolution || hasBleResolution; boolean gpsResolutionUnavailable = needGps && !gpsPresent; boolean networkResolutionUnavailable = needNetwork && !networkPresent; boolean bleResolutionUnavailable = needBle && !blePresent; boolean resolutionUnavailable = gpsResolutionUnavailable || networkResolutionUnavailable || bleResolutionUnavailable; final Status status; if (hasResolution) { PendingIntent pendingIntent = pendingIntentGenerator.generatePendingIntent(hasBleResolution); status = new Status(RESOLUTION_REQUIRED, pendingIntent); } else if (resolutionUnavailable) { status = new Status(SETTINGS_CHANGE_UNAVAILABLE); } else { status = new Status(SUCCESS); } final LocationSettingsStates states = new LocationSettingsStates(gpsUsable, networkUsable, bleUsable, gpsPresent, networkPresent, blePresent); return new LocationSettingsResult(status, states); }