• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 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.SystemApi;
20 
21 /**
22  * An Event that the client would receive after starting a filter. This event is optional to be
23  * received on the newly opened and started filter. It must be received after stopping,
24  * reconfiguring and restarting a Filter to differentiate the valid reconfigured events from the
25  * previous events.
26  *
27  * <p>After stopping and restarting the filter, the client has to discard all coming events until
28  * it receives {@link RestartEvent} to avoid using the events from the previous configuration.
29  *
30  * <p>Recofiguring must happen after stopping the filter.
31  *
32  * @see Filter#stop()
33  * @see Filter#start()
34  * @see Filter#configure(FilterConfiguration)
35  *
36  * @hide
37  */
38 @SystemApi
39 public final class RestartEvent extends FilterEvent {
40     /**
41      * The stard id reserved for the newly opened filter's first start event.
42      */
43     public static final int NEW_FILTER_FIRST_START_ID = 0;
44 
45     private final int mStartId;
46 
47     // This constructor is used by JNI code only
RestartEvent(int startId)48     private RestartEvent(int startId) {
49         mStartId = startId;
50     }
51 
52     /**
53      * Gets the start id sent via the current Restart Event.
54      *
55      * <p>An unique ID to mark the start point of receiving the valid reconfigured filter events.
56      * The client must receive at least once after the filter is reconfigured and restarted.
57      *
58      * <p>{@link #NEW_FILTER_FIRST_START_ID} is reserved for the newly opened filter's first start.
59      * It's optional to be received.
60      */
getStartId()61     public int getStartId() {
62         return mStartId;
63     }
64 }
65