• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 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.loganalysis.item;
18 
19 import com.android.loganalysis.parser.KernelLogParser;
20 
21 import java.util.Arrays;
22 import java.util.HashSet;
23 import java.util.Set;
24 
25 
26 /**
27  * An {@link IItem} used to store traces info.
28  * <p>
29  * This stores info about selinux events, such as denials.
30  * </p>
31  */
32 public class SELinuxItem extends MiscKernelLogItem {
33 
34     /** Constant for JSON output */
35     public static final String SCONTEXT = "SCONTEXT";
36 
37     private static final Set<String> ATTRIBUTES = new HashSet<String>(Arrays.asList(
38                 SCONTEXT));
39 
40     /**
41      * The constructor for {@link SELinuxItem}.
42      */
SELinuxItem()43     public SELinuxItem() {
44         super(ATTRIBUTES);
45         setCategory(KernelLogParser.SELINUX_DENIAL);
46     }
47 
48     /**
49      * Get the context for the SELinux item.
50      */
getSContext()51     public String getSContext() {
52         return (String) getAttribute(SCONTEXT);
53     }
54 
55     /**
56      * Set the context for the SELinux item.
57      */
setSContext(String context)58     public void setSContext(String context) {
59         setAttribute(SCONTEXT, context);
60     }
61 }
62