三种定位模式

  1. Hight Accuracy

  2. Battery Saving

  3. GPS Only

    1
    2
    3
    4
    public static final int LOCATION_MODE_OFF = 0;
    public static final int LOCATION_MODE_SENSORS_ONLY = 1;
    public static final int LOCATION_MODE_BATTERY_SAVING = 2;
    public static final int LOCATION_MODE_HIGH_ACCURACY = 3

    设置界面的定位设置相关代码路径:

  4. /packages/apps/Settings/src/com/android/settings/location/LocationSettings.java

  5. /packages/apps/Settings/src/com/android/settings/location/LocationSettingsBase.java

设置:

1
Settings.Secure.getInt(activityUnderTest.getContentResolver(), Settings.Secure.LOCATION_MODE);

初始化值:
frameworks\base\packages\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java里面有loadSecureSetting()方法在这里添加