• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.FragmentTransaction;
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 com.android.internal.logging.nano.MetricsProto.MetricsEvent;
28 import com.android.settings.core.InstrumentedPreferenceFragment;
29 import com.android.settings.R;
30 
31 public class BackgroundCheckSummary extends InstrumentedPreferenceFragment {
32     // layout inflater object used to inflate views
33     private LayoutInflater mInflater;
34 
35     @Override
getMetricsCategory()36     public int getMetricsCategory() {
37         return MetricsEvent.BACKGROUND_CHECK_SUMMARY;
38     }
39 
40     @Override
onCreate(@ullable Bundle savedInstanceState)41     public void onCreate(@Nullable Bundle savedInstanceState) {
42         super.onCreate(savedInstanceState);
43         getActivity().setTitle(R.string.background_check_pref);
44     }
45 
46     @Override
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)47     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
48         // initialize the inflater
49         mInflater = inflater;
50 
51         View rootView = mInflater.inflate(R.layout.background_check_summary,
52                 container, false);
53 
54         // We have to do this now because PreferenceFrameLayout looks at it
55         // only when the view is added.
56         if (container instanceof PreferenceFrameLayout) {
57             ((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
58         }
59 
60         FragmentTransaction ft = getChildFragmentManager().beginTransaction();
61         ft.add(R.id.appops_content, new AppOpsCategory(AppOpsState.RUN_IN_BACKGROUND_TEMPLATE),
62                 "appops");
63         ft.commitAllowingStateLoss();
64 
65         return rootView;
66     }
67 
68 }
69