Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4544b75 authored by David Christie's avatar David Christie
Browse files

Update Quick Settings to use new consolidated master location method.

This is an effort to consolidate the logic of what the "master
location switch" means.  Quick settings will no longeer explicitly
enable/disable gps and network providers.

Change-Id: I78e1337561f72aca81ba5b14321845a0a9d0b597
parent 58930af0
Loading
Loading
Loading
Loading
+4 −11
Original line number Original line Diff line number Diff line
@@ -125,12 +125,9 @@ public class LocationController extends BroadcastReceiver {
            return;
            return;
        }
        }
        final ContentResolver cr = mContext.getContentResolver();
        final ContentResolver cr = mContext.getContentResolver();
        Settings.Secure.setLocationProviderEnabled(
        // When enabling location, a user consent dialog will pop up, and the
                cr, LocationManager.GPS_PROVIDER, enabled);
        // setting won't be fully enabled until the user accepts the agreement.
        // When enabling the NETWORK_PROVIDER, a user consent dialog will pop up, and the
        Settings.Secure.setLocationMasterSwitchEnabled(cr, enabled);
        // setting won't actually be enabled until the user accepts the agreement.
        Settings.Secure.setLocationProviderEnabled(
                cr, LocationManager.NETWORK_PROVIDER, enabled);
    }
    }


    /**
    /**
@@ -138,11 +135,7 @@ public class LocationController extends BroadcastReceiver {
     */
     */
    public boolean isLocationEnabled() {
    public boolean isLocationEnabled() {
        ContentResolver contentResolver = mContext.getContentResolver();
        ContentResolver contentResolver = mContext.getContentResolver();
        boolean isGpsEnabled = Settings.Secure.isLocationProviderEnabled(
        return Settings.Secure.isLocationMasterSwitchEnabled(contentResolver);
                contentResolver, LocationManager.GPS_PROVIDER);
        boolean isNetworkEnabled = Settings.Secure.isLocationProviderEnabled(
                contentResolver, LocationManager.NETWORK_PROVIDER);
       return isGpsEnabled || isNetworkEnabled;
    }
    }


    @Override
    @Override