1 /* 2 * Copyright (C) 2021 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 java.util.Arrays; 20 import java.util.HashSet; 21 import java.util.Set; 22 23 /** An {@link IItem} used to store boot event info logged in event log. */ 24 public class BootEventItem extends GenericItem { 25 26 /** Constant for JSON output */ 27 public static final String EVENT_NAME = "EVENT_NAME"; 28 29 public static final String EVENT_DURATION = "DURATION"; 30 31 private static final Set<String> ATTRIBUTES = 32 new HashSet<String>(Arrays.asList(EVENT_NAME, EVENT_DURATION)); 33 34 /** The constructor for {@link BootEventItem}. */ BootEventItem()35 public BootEventItem() { 36 super(ATTRIBUTES); 37 } 38 getEventName()39 public String getEventName() { 40 return (String) getAttribute(EVENT_NAME); 41 } 42 setEventName(String eventName)43 public void setEventName(String eventName) { 44 setAttribute(EVENT_NAME, eventName); 45 } 46 getDuration()47 public Double getDuration() { 48 return (Double) getAttribute(EVENT_DURATION); 49 } 50 setDuration(Double eventDuration)51 public void setDuration(Double eventDuration) { 52 setAttribute(EVENT_DURATION, eventDuration); 53 } 54 } 55