Move intent action to xml
This is a follow-up change for ag/1798497 which move the implementation of OnPreferenceClickListener to the xml. Test: Manual bug: 34400189 Change-Id: I4691beecf829e8d98d5c6188b3ff74f4902104d2
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user