Merge "Untab Location Settings and tab Location Services" into sc-dev

This commit is contained in:
Yu-Han Yang
2021-03-30 16:48:38 +00:00
committed by Android (Google) Code Review
4 changed files with 61 additions and 22 deletions

View File

@@ -38,7 +38,17 @@
<PreferenceCategory
android:key="location_advanced_settings"
android:layout="@layout/preference_category_no_label"
settings:initialExpandedChildrenCount="2">
settings:initialExpandedChildrenCount="3">
<!-- This preference gets removed if there is no managed profile -->
<com.android.settingslib.RestrictedSwitchPreference
android:enabled="false"
android:key="managed_profile_location_switch"
android:selectable="true"
android:title="@string/managed_profile_location_switch_title"
settings:controller="com.android.settings.location.LocationForWorkPreferenceController"
settings:forWork="true"
settings:useAdminDisabledSummary="true"/>
<!-- This preference category gets removed if new_recent_location_ui is disabled -->
<Preference
@@ -57,23 +67,6 @@
android:title="@string/location_services_screen_title"
settings:controller="com.android.settings.location.LocationServicesPreferenceController"/>
<!-- This preference gets removed if there is no managed profile -->
<com.android.settingslib.RestrictedSwitchPreference
android:enabled="false"
android:key="managed_profile_location_switch"
android:selectable="true"
android:title="@string/managed_profile_location_switch_title"
settings:controller="com.android.settings.location.LocationForWorkPreferenceController"
settings:forWork="true"
settings:useAdminDisabledSummary="true"/>
<!-- This preference gets removed if there is no managed profile -->
<PreferenceCategory
android:key="location_services_managed_profile"
android:title="@string/managed_profile_location_services"
settings:forWork="true"
settings:controller="com.android.settings.location.LocationInjectedServicesForWorkPreferenceController"/>
</PreferenceCategory>
<com.android.settingslib.widget.FooterPreference

View File

@@ -20,7 +20,7 @@ import android.util.ArrayMap;
import com.android.settings.accounts.AccountDashboardFragment;
import com.android.settings.applications.manageapplications.ManageApplications;
import com.android.settings.location.LocationSettings;
import com.android.settings.location.LocationServices;
import com.android.settings.location.RecentLocationAccessSeeAllFragment;
import java.util.Map;
@@ -42,9 +42,9 @@ public class ProfileFragmentBridge {
ProfileSelectAccountFragment.class.getName());
FRAGMENT_MAP.put(ManageApplications.class.getName(),
ProfileSelectManageApplications.class.getName());
FRAGMENT_MAP.put(LocationSettings.class.getName(),
ProfileSelectLocationFragment.class.getName());
FRAGMENT_MAP.put(RecentLocationAccessSeeAllFragment.class.getName(),
ProfileSelectRecentLocationAccessFragment.class.getName());
FRAGMENT_MAP.put(LocationServices.class.getName(),
ProfileSelectLocationServicesFragment.class.getName());
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.dashboard.profileselector;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.android.settings.location.LocationServices;
import com.android.settings.location.LocationServicesForWork;
/**
* Location Services page for personal/managed profile.
*/
public class ProfileSelectLocationServicesFragment extends ProfileSelectFragment {
@Override
public Fragment[] getFragments() {
final Bundle workOnly = new Bundle();
workOnly.putInt(EXTRA_PROFILE, ProfileType.WORK);
final Fragment workFragment = new LocationServicesForWork();
workFragment.setArguments(workOnly);
final Bundle personalOnly = new Bundle();
personalOnly.putInt(EXTRA_PROFILE, ProfileType.PERSONAL);
final Fragment personalFragment = new LocationServices();
personalFragment.setArguments(personalOnly);
return new Fragment[]{
personalFragment, // 0
workFragment
};
}
}

View File

@@ -85,7 +85,6 @@ public class LocationSettings extends DashboardFragment {
use(RecentLocationAccessPreferenceController.class).init(this);
use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this);
use(LocationForWorkPreferenceController.class).init(this);
use(LocationInjectedServicesForWorkPreferenceController.class).init(this);
}
@Override