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