1 /** 2 * Copyright (C) 2018 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.car.radio.storage; 18 19 import android.hardware.radio.ProgramSelector; 20 import android.hardware.radio.ProgramSelector.IdentifierType; 21 22 import androidx.annotation.NonNull; 23 import androidx.annotation.Nullable; 24 import androidx.room.Entity; 25 26 @Entity 27 class IdentifierEntity { 28 @IdentifierType 29 public final int type; 30 31 public final long value; 32 IdentifierEntity(@dentifierType int type, long value)33 IdentifierEntity(@IdentifierType int type, long value) { 34 this.type = type; 35 this.value = value; 36 } 37 IdentifierEntity(@onNull ProgramSelector.Identifier id)38 IdentifierEntity(@NonNull ProgramSelector.Identifier id) { 39 type = id.getType(); 40 value = id.getValue(); 41 } 42 sameAs(@ullable ProgramSelector.Identifier id)43 public boolean sameAs(@Nullable ProgramSelector.Identifier id) { 44 if (id == null) return false; 45 return id.getType() == type && id.getValue() == value; 46 } 47 } 48