1 /* 2 * Copyright (C) 2023 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.devicelockcontroller.activities; 18 19 import java.util.Objects; 20 21 /** 22 * A data model class which is used to describe the policy that the device provider enforces on the 23 * device. 24 */ 25 final class DevicePolicy { 26 private final int mDrawableId; 27 28 private final int mTextId; 29 DevicePolicy(int drawableId, int textId)30 DevicePolicy(int drawableId, int textId) { 31 mDrawableId = drawableId; 32 mTextId = textId; 33 } 34 getDrawableId()35 int getDrawableId() { 36 return mDrawableId; 37 } 38 getTextId()39 int getTextId() { 40 return mTextId; 41 } 42 43 @Override equals(Object obj)44 public boolean equals(Object obj) { 45 if (this == obj) { 46 return true; 47 } 48 if (!(obj instanceof DevicePolicy)) { 49 return false; 50 } 51 DevicePolicy that = (DevicePolicy) obj; 52 return this.mDrawableId == that.mDrawableId && this.mTextId == that.mTextId; 53 } 54 55 @Override hashCode()56 public int hashCode() { 57 return Objects.hash(mDrawableId, mTextId); 58 } 59 } 60