am 8b525e75: Merge "Switch QuickSettings to new LocationMode setting api." into klp-dev
* commit '8b525e75a05c693623a88fc49dfc78958858b4d7': Switch QuickSettings to new LocationMode setting api.
This commit is contained in:
@@ -123,15 +123,17 @@ public class LocationController extends BroadcastReceiver {
|
|||||||
final ContentResolver cr = mContext.getContentResolver();
|
final ContentResolver cr = mContext.getContentResolver();
|
||||||
// When enabling location, a user consent dialog will pop up, and the
|
// When enabling location, a user consent dialog will pop up, and the
|
||||||
// setting won't be fully enabled until the user accepts the agreement.
|
// setting won't be fully enabled until the user accepts the agreement.
|
||||||
Settings.Secure.setLocationMasterSwitchEnabled(cr, enabled);
|
int mode = enabled
|
||||||
|
? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY : Settings.Secure.LOCATION_MODE_OFF;
|
||||||
|
Settings.Secure.setLocationMode(cr, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if either gps or network location are enabled in settings.
|
* Returns true if location isn't disabled in settings.
|
||||||
*/
|
*/
|
||||||
public boolean isLocationEnabled() {
|
public boolean isLocationEnabled() {
|
||||||
ContentResolver contentResolver = mContext.getContentResolver();
|
ContentResolver resolver = mContext.getContentResolver();
|
||||||
return Settings.Secure.isLocationMasterSwitchEnabled(contentResolver);
|
return Settings.Secure.getLocationMode(resolver) != Settings.Secure.LOCATION_MODE_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user