This is a change that adds a link from location settings to location permissions Test: Manual Bug: 34400189 Change-Id: If873fbb6e53c1fd86a3cfe38e06465cdec56bef8
40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
package com.android.settings.location;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.provider.Settings;
|
|
import android.support.v7.preference.Preference;
|
|
import android.support.v7.preference.PreferenceScreen;
|
|
|
|
import com.android.settings.core.PreferenceController;
|
|
|
|
public class AppLocationPermissionPreferenceController extends PreferenceController {
|
|
|
|
private static final String KEY_APP_LEVEL_PERMISSIONS = "app_level_permissions";
|
|
private Preference mPreference;
|
|
|
|
public AppLocationPermissionPreferenceController(Context context) {
|
|
super(context);
|
|
}
|
|
|
|
@Override
|
|
public void displayPreference(PreferenceScreen screen) {
|
|
super.displayPreference(screen);
|
|
if (isAvailable()) {
|
|
mPreference = screen.findPreference(KEY_APP_LEVEL_PERMISSIONS);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public String getPreferenceKey() {
|
|
return KEY_APP_LEVEL_PERMISSIONS;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAvailable() {
|
|
return Settings.Global.getInt(mContext.getContentResolver(),
|
|
android.provider.Settings.Global.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED, 1)
|
|
== 1;
|
|
}
|
|
}
|