1 /* 2 * Copyright (C) 2015 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.applications.appops; 18 19 import android.annotation.Nullable; 20 import android.app.settings.SettingsEnums; 21 import android.os.Bundle; 22 import android.preference.PreferenceFrameLayout; 23 import android.view.LayoutInflater; 24 import android.view.View; 25 import android.view.ViewGroup; 26 27 import androidx.fragment.app.FragmentTransaction; 28 29 import com.android.settings.R; 30 import com.android.settings.core.InstrumentedPreferenceFragment; 31 32 public class BackgroundCheckSummary extends InstrumentedPreferenceFragment { 33 // layout inflater object used to inflate views 34 private LayoutInflater mInflater; 35 36 @Override getMetricsCategory()37 public int getMetricsCategory() { 38 return SettingsEnums.BACKGROUND_CHECK_SUMMARY; 39 } 40 41 @Override onCreate(@ullable Bundle savedInstanceState)42 public void onCreate(@Nullable Bundle savedInstanceState) { 43 super.onCreate(savedInstanceState); 44 getActivity().setTitle(R.string.background_check_pref); 45 } 46 47 @Override onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)48 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 49 // initialize the inflater 50 mInflater = inflater; 51 52 View rootView = mInflater.inflate(R.layout.background_check_summary, 53 container, false); 54 55 // We have to do this now because PreferenceFrameLayout looks at it 56 // only when the view is added. 57 if (container instanceof PreferenceFrameLayout) { 58 ((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true; 59 } 60 61 FragmentTransaction ft = getChildFragmentManager().beginTransaction(); 62 ft.add(R.id.appops_content, new AppOpsCategory(AppOpsState.RUN_IN_BACKGROUND_TEMPLATE), 63 "appops"); 64 ft.commitAllowingStateLoss(); 65 66 return rootView; 67 } 68 69 } 70