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

Commit 8201bcb7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Move intent action to xml"

parents 0e5b8f14 dbf78d4c
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -37,7 +37,12 @@
        <!-- This preference category gets removed if new_recent_location_ui is disabled -->
        <Preference
            android:key="app_level_permissions"
            android:title="@string/location_app_level_permissions" />
            android:title="@string/location_app_level_permissions">
            <intent android:action="android.intent.action.MANAGE_PERMISSION_APPS">
                <extra android:name="android.intent.extra.PERMISSION_NAME"
                       android:value="android.permission-group.LOCATION" />
            </intent>
        </Preference>

        <com.android.settings.DividedCategory
            android:key="recent_location_requests"
+0 −26
Original line number Diff line number Diff line
@@ -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;