1 /*
2  * Copyright (C) 2015 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.tv.dvr;
18 
19 import android.support.annotation.MainThread;
20 import com.android.tv.dvr.data.ScheduledRecording;
21 import com.android.tv.dvr.data.ScheduledRecording.RecordingState;
22 import com.android.tv.dvr.data.SeriesRecording;
23 
24 /**
25  * Full data manager.
26  *
27  * <p>The following operations need to be synced with permanent storage. The following commands are
28  * for internal use only. Do not call them from UI directly.
29  */
30 @MainThread
31 public interface WritableDvrDataManager extends DvrDataManager {
32     /** Adds new recordings. */
addScheduledRecording(ScheduledRecording... scheduledRecordings)33     void addScheduledRecording(ScheduledRecording... scheduledRecordings);
34 
35     /** Adds new series recordings. */
addSeriesRecording(SeriesRecording... seriesRecordings)36     void addSeriesRecording(SeriesRecording... seriesRecordings);
37 
38     /** Removes recordings. */
removeScheduledRecording(ScheduledRecording... scheduledRecordings)39     void removeScheduledRecording(ScheduledRecording... scheduledRecordings);
40 
41     /**
42      * Removes recordings. If {@code forceRemove} is {@code true}, the schedule will be permanently
43      * removed instead of changing the state to DELETED.
44      */
removeScheduledRecording(boolean forceRemove, ScheduledRecording... scheduledRecordings)45     void removeScheduledRecording(boolean forceRemove, ScheduledRecording... scheduledRecordings);
46 
47     /** Removes series recordings. */
removeSeriesRecording(SeriesRecording... seasonSchedules)48     void removeSeriesRecording(SeriesRecording... seasonSchedules);
49 
50     /** Updates existing recordings. */
updateScheduledRecording(ScheduledRecording... scheduledRecordings)51     void updateScheduledRecording(ScheduledRecording... scheduledRecordings);
52 
53     /** Updates existing series recordings. */
updateSeriesRecording(SeriesRecording... seriesRecordings)54     void updateSeriesRecording(SeriesRecording... seriesRecordings);
55 
56     /** Changes the state of the recording. */
changeState(ScheduledRecording scheduledRecording, @RecordingState int newState)57     void changeState(ScheduledRecording scheduledRecording, @RecordingState int newState);
58 
59     /**
60      * Changes the state of the recording.
61      *
62      * @param reason the reason of this change
63      */
changeState( ScheduledRecording scheduledRecording, @RecordingState int newState, int reason)64     void changeState(
65             ScheduledRecording scheduledRecording, @RecordingState int newState, int reason);
66 
67     /**
68      * Remove all the records related to the input.
69      *
70      * <p>Note that this should be called after the input was removed.
71      */
forgetStorage(String inputId)72     void forgetStorage(String inputId);
73 }
74