• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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.car.settings.profiles;
18 
19 import android.content.Context;
20 
21 import androidx.annotation.XmlRes;
22 
23 import com.android.car.settings.R;
24 
25 /**
26  * Business logic for the permissions fragment. This fragment is used when an admin user views the
27  * user details of a non-admin user.
28  */
29 public class ProfileDetailsPermissionsFragment extends ProfileDetailsBaseFragment {
30 
31     /**
32      * Creates instance of ProfileDetailsPermissionsFragment.
33      */
newInstance(int userId)34     public static ProfileDetailsPermissionsFragment newInstance(int userId) {
35         return (ProfileDetailsPermissionsFragment) addUserIdToFragmentArguments(
36                 new ProfileDetailsPermissionsFragment(), userId);
37     }
38 
39     @Override
40     @XmlRes
getPreferenceScreenResId()41     protected int getPreferenceScreenResId() {
42         return R.xml.profile_details_permissions_fragment;
43     }
44 
45     @Override
onAttach(Context context)46     public void onAttach(Context context) {
47         super.onAttach(context);
48         use(ProfileDetailsHeaderPreferenceController.class,
49                 R.string.pk_profile_details_permissions_header).setUserInfo(getUserInfo());
50         use(ProfileDetailsActionButtonsPreferenceController.class,
51                 R.string.pk_profile_details_permissions_action_buttons).setUserInfo(getUserInfo());
52         use(PermissionsPreferenceController.class, R.string.pk_profile_permissions).setUserInfo(
53                 getUserInfo());
54     }
55 
56     @Override
getTitleText()57     protected String getTitleText() {
58         return getContext().getString(R.string.user_details_admin_title,
59                 ProfileUtils.getProfileDisplayName(getContext(), getUserInfo()));
60     }
61 }
62 
63