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.media.tv; 18 19 import android.annotation.NonNull; 20 import android.media.tv.interactive.TvInteractiveAppServiceInfo; 21 import android.os.Parcel; 22 import android.os.Parcelable; 23 24 /** 25 * AIT (Application Information Table) info. 26 */ 27 public final class AitInfo implements Parcelable { 28 static final String TAG = "AitInfo"; 29 30 public static final @NonNull Creator<AitInfo> CREATOR = new Creator<AitInfo>() { 31 @Override 32 public AitInfo createFromParcel(Parcel in) { 33 return new AitInfo(in); 34 } 35 36 @Override 37 public AitInfo[] newArray(int size) { 38 return new AitInfo[size]; 39 } 40 }; 41 42 private final int mType; 43 private final int mVersion; 44 AitInfo(Parcel in)45 private AitInfo(Parcel in) { 46 mType = in.readInt(); 47 mVersion = in.readInt(); 48 } 49 50 /** 51 * Constructs AIT info. 52 */ AitInfo(@vInteractiveAppServiceInfo.InteractiveAppType int type, int version)53 public AitInfo(@TvInteractiveAppServiceInfo.InteractiveAppType int type, int version) { 54 mType = type; 55 mVersion = version; 56 } 57 58 /** 59 * Gets interactive app type. 60 */ 61 @TvInteractiveAppServiceInfo.InteractiveAppType getType()62 public int getType() { 63 return mType; 64 } 65 66 /** 67 * Gets version. 68 */ getVersion()69 public int getVersion() { 70 return mVersion; 71 } 72 73 @Override describeContents()74 public int describeContents() { 75 return 0; 76 } 77 78 @Override writeToParcel(@onNull Parcel dest, int flags)79 public void writeToParcel(@NonNull Parcel dest, int flags) { 80 dest.writeInt(mType); 81 dest.writeInt(mVersion); 82 } 83 84 @Override toString()85 public String toString() { 86 return "type=" + mType + ";version=" + mVersion; 87 } 88 } 89