1 /* 2 * Copyright 2019 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.tuner.filter; 18 19 import android.annotation.NonNull; 20 import android.annotation.SystemApi; 21 22 /** 23 * Table information for Section Filter. 24 * 25 * @hide 26 */ 27 @SystemApi 28 public class SectionSettingsWithTableInfo extends SectionSettings { 29 private final int mTableId; 30 private final int mVersion; 31 SectionSettingsWithTableInfo(int mainType, boolean isCheckCrc, boolean isRepeat, boolean isRaw, int tableId, int version)32 private SectionSettingsWithTableInfo(int mainType, boolean isCheckCrc, boolean isRepeat, 33 boolean isRaw, int tableId, int version) { 34 super(mainType, isCheckCrc, isRepeat, isRaw); 35 mTableId = tableId; 36 mVersion = version; 37 } 38 39 /** 40 * Gets table ID. 41 */ getTableId()42 public int getTableId() { 43 return mTableId; 44 } 45 /** 46 * Gets version. 47 */ getVersion()48 public int getVersion() { 49 return mVersion; 50 } 51 52 /** 53 * Creates a builder for {@link SectionSettingsWithTableInfo}. 54 * 55 * @param mainType the filter main type. 56 */ 57 @NonNull builder(@ilter.Type int mainType)58 public static Builder builder(@Filter.Type int mainType) { 59 return new Builder(mainType); 60 } 61 62 /** 63 * Builder for {@link SectionSettingsWithTableInfo}. 64 */ 65 public static class Builder extends SectionSettings.Builder<Builder> { 66 private int mTableId; 67 private int mVersion; 68 Builder(int mainType)69 private Builder(int mainType) { 70 super(mainType); 71 } 72 73 /** 74 * Sets table ID. 75 */ 76 @NonNull setTableId(int tableId)77 public Builder setTableId(int tableId) { 78 mTableId = tableId; 79 return this; 80 } 81 /** 82 * Sets version. 83 */ 84 @NonNull setVersion(int version)85 public Builder setVersion(int version) { 86 mVersion = version; 87 return this; 88 } 89 90 /** 91 * Builds a {@link SectionSettingsWithTableInfo} object. 92 */ 93 @NonNull build()94 public SectionSettingsWithTableInfo build() { 95 return new SectionSettingsWithTableInfo( 96 mMainType, mCrcEnabled, mIsRepeat, mIsRaw, mTableId, mVersion); 97 } 98 99 @Override self()100 Builder self() { 101 return this; 102 } 103 } 104 105 } 106