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 android.car.cts.powerpolicy; 18 19 import java.util.Objects; 20 21 public class ComponentPowerStateInfo { 22 private final String mComponentName; 23 private final boolean mPowerState; 24 ComponentPowerStateInfo(String componentName, boolean powerState)25 protected ComponentPowerStateInfo(String componentName, boolean powerState) { 26 mComponentName = componentName; 27 mPowerState = powerState; 28 } 29 getComponentName()30 public String getComponentName() { 31 return mComponentName; 32 } 33 isPowerOn()34 public boolean isPowerOn() { 35 return mPowerState; 36 } 37 38 @Override equals(Object o)39 public boolean equals(Object o) { 40 if (this == o) return true; 41 if (o == null || getClass() != o.getClass()) return false; 42 ComponentPowerStateInfo that = (ComponentPowerStateInfo) o; 43 return (mPowerState == that.mPowerState) 44 && mComponentName.equals(that.mComponentName); 45 } 46 47 @Override hashCode()48 public int hashCode() { 49 return Objects.hash(mPowerState, mComponentName); 50 } 51 } 52