1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settings.location; 18 19 import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_LOCATION_SWITCH_TITLE; 20 21 import android.app.settings.SettingsEnums; 22 import android.content.Context; 23 import android.os.Bundle; 24 25 import com.android.settings.R; 26 import com.android.settings.dashboard.DashboardFragment; 27 import com.android.settings.dashboard.profileselector.ProfileSelectFragment; 28 29 /** 30 * Location Setting page for managed profile. 31 */ 32 public class LocationWorkProfileSettings extends DashboardFragment { 33 34 private static final String TAG = "LocationWorkProfile"; 35 36 @Override getMetricsCategory()37 public int getMetricsCategory() { 38 return SettingsEnums.LOCATION_WORK; 39 } 40 41 @Override getPreferenceScreenResId()42 protected int getPreferenceScreenResId() { 43 return R.xml.location_settings_workprofile; 44 } 45 46 @Override onCreate(Bundle icicle)47 public void onCreate(Bundle icicle) { 48 super.onCreate(icicle); 49 replaceEnterpriseStringTitle("managed_profile_location_switch", 50 WORK_PROFILE_LOCATION_SWITCH_TITLE, R.string.managed_profile_location_switch_title); 51 } 52 53 @Override getLogTag()54 protected String getLogTag() { 55 return TAG; 56 } 57 58 @Override onAttach(Context context)59 public void onAttach(Context context) { 60 super.onAttach(context); 61 62 use(AppLocationPermissionPreferenceController.class).init(this); 63 use(LocationForWorkPreferenceController.class).init(this); 64 use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this); 65 use(LocationSettingsFooterPreferenceController.class).init(this); 66 67 final int profileType = getArguments().getInt(ProfileSelectFragment.EXTRA_PROFILE); 68 final RecentLocationAccessPreferenceController controller = use( 69 RecentLocationAccessPreferenceController.class); 70 controller.init(this); 71 controller.setProfileType(profileType); 72 } 73 74 @Override getHelpResource()75 public int getHelpResource() { 76 return R.string.help_url_location_access; 77 } 78 } 79