• 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"); you may not
5  * use this file except in compliance with the License. You may obtain a copy
6  * 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, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations
14  * under the License.
15  */
16 
17 package com.android.settings.applications;
18 
19 import android.app.FragmentTransaction;
20 import android.os.Bundle;
21 import android.preference.PreferenceFrameLayout;
22 import android.view.LayoutInflater;
23 import android.view.View;
24 import android.view.ViewGroup;
25 
26 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
27 import com.android.settings.core.InstrumentedPreferenceFragment;
28 import com.android.settings.R;
29 
30 public class BackgroundCheckSummary extends InstrumentedPreferenceFragment {
31     // layout inflater object used to inflate views
32     private LayoutInflater mInflater;
33 
34     @Override
getMetricsCategory()35     public int getMetricsCategory() {
36         return MetricsEvent.BACKGROUND_CHECK_SUMMARY;
37     }
38 
39     @Override
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)40     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
41         // initialize the inflater
42         mInflater = inflater;
43 
44         View rootView = mInflater.inflate(R.layout.background_check_summary,
45                 container, false);
46 
47         // We have to do this now because PreferenceFrameLayout looks at it
48         // only when the view is added.
49         if (container instanceof PreferenceFrameLayout) {
50             ((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
51         }
52 
53         FragmentTransaction ft = getChildFragmentManager().beginTransaction();
54         ft.add(R.id.appops_content, new AppOpsCategory(AppOpsState.RUN_IN_BACKGROUND_TEMPLATE,
55                         true), "appops");
56         ft.commitAllowingStateLoss();
57 
58         return rootView;
59     }
60 }
61