Merge "Move intent action to xml"

This commit is contained in:
TreeHugger Robot
2017-01-27 20:49:03 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 27 deletions

View File

@@ -18,7 +18,6 @@ package com.android.settings.location;
import android.app.Activity;
import android.app.admin.DevicePolicyManager;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -96,14 +95,11 @@ public class LocationSettings extends LocationSettingsBase
private static final String KEY_LOCATION_MODE = "location_mode";
/** Key for preference category "Recent location requests" */
private static final String KEY_RECENT_LOCATION_REQUESTS = "recent_location_requests";
/** Key for preference "App-level permissions" */
private static final String KEY_APP_LEVEL_PERMISSIONS = "app_level_permissions";
/** Key for preference category "Location services" */
private static final String KEY_LOCATION_SERVICES = "location_services";
private static final int MENU_SCANNING = Menu.FIRST;
private static final String KEY_LOCATION_PERMISSION = "android.permission-group.LOCATION";
private SwitchBar mSwitchBar;
private Switch mSwitch;
private boolean mValidListener = false;
@@ -211,11 +207,6 @@ public class LocationSettings extends LocationSettingsBase
final AppLocationPermissionPreferenceController preferenceController =
new AppLocationPermissionPreferenceController(activity);
preferenceController.displayPreference(root);
if (preferenceController.isAvailable()) {
Preference preferenceAppLevelPermissions =
root.findPreference(KEY_APP_LEVEL_PERMISSIONS);
setupAppLevelPermissionsPreference(preferenceAppLevelPermissions);
}
mCategoryRecentLocationRequests =
(PreferenceCategory) root.findPreference(KEY_RECENT_LOCATION_REQUESTS);
@@ -276,23 +267,6 @@ public class LocationSettings extends LocationSettingsBase
}
}
private void setupAppLevelPermissionsPreference(Preference preference) {
preference.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(Intent.ACTION_MANAGE_PERMISSION_APPS)
.putExtra(Intent.EXTRA_PERMISSION_NAME, KEY_LOCATION_PERMISSION);
try {
getActivity().startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.w("Permission", "No app to handle " + intent);
}
return true;
}
});
}
private void changeManagedProfileLocationAccessStatus(boolean mainSwitchOn) {
if (mManagedProfileSwitch == null) {
return;