• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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.drm;
18 
19 /**
20  * Defines constants that are used by the DRM framework.
21  *
22  * @deprecated Please use {@link android.media.MediaDrm}
23  */
24 @Deprecated
25 public class DrmStore {
26     /**
27      * Interface definition for the columns that represent DRM constraints.
28      * {@link android.drm.DrmManagerClient#getConstraints DrmManagerClient.getConstraints()}
29      * can be called by an application to find out the contraints on the
30      * {@link android.drm.DrmStore.Action actions} that can be performed
31      * on right-protected content. The constants defined in this interface
32      * represent three most common types of constraints: count-based,
33      * date-based, and duration-based. Two or more constraints can be used
34      * at the same time to represent more sophisticated constraints.
35      * In addition, user-defined constraint,
36      * {@link #EXTENDED_METADATA extended metadata}, can be
37      * used if these three types of constraints are not sufficient.
38      */
39     public interface ConstraintsColumns {
40         /**
41          * This is a count-based constraint. It represents the maximum
42          * repeat count that can be performed on an
43          * {@link android.drm.DrmStore.Action action}.
44          * <p>
45          * Type: INTEGER
46          */
47         public static final String MAX_REPEAT_COUNT = "max_repeat_count";
48 
49         /**
50          * This is a count-based constraint. It represents the remaining
51          * repeat count that can be performed on an
52          * {@link android.drm.DrmStore.Action action}.
53          * <p>
54          * Type: INTEGER
55          */
56         public static final String REMAINING_REPEAT_COUNT = "remaining_repeat_count";
57 
58         /**
59          * This is a date-based constraint. It represents the time before which
60          * an {@link android.drm.DrmStore.Action action} can be performed on
61          * the rights-protected content.
62          * <p>
63          * Type: TEXT
64          */
65         public static final String LICENSE_START_TIME = "license_start_time";
66 
67         /**
68          * This is a date-based constaint. It represents the time after which
69          * an {@link android.drm.DrmStore.Action action} can not be performed on
70          * the rights-protected content.
71          * <p>
72          * Type: TEXT
73          */
74         public static final String LICENSE_EXPIRY_TIME = "license_expiry_time";
75 
76         /**
77          * This is a duration-based constaint. It represents the available time left
78          * before the license expires.
79          * <p>
80          * Type: TEXT
81          */
82         public static final String LICENSE_AVAILABLE_TIME = "license_available_time";
83 
84         /**
85          * This is a user-defined constraint. It represents the additional constraint
86          * using extended metadata.
87          * <p>
88          * Type: TEXT
89          */
90         public static final String EXTENDED_METADATA = "extended_metadata";
91     }
92 
93     /**
94      * Defines DRM object types.
95      */
96     public static class DrmObjectType {
97         /**
98          * An unknown object type.
99          */
100         public static final int UNKNOWN = 0x00;
101         /**
102          * A rights-protected file object type.
103          */
104         public static final int CONTENT = 0x01;
105         /**
106          * A rights information object type.
107          */
108         public static final int RIGHTS_OBJECT = 0x02;
109         /**
110          * A trigger information object type.
111          */
112         public static final int TRIGGER_OBJECT = 0x03;
113 
114         /**
115          * @deprecated This class should have been an interface instead.
116          * The default constuctor should have not been exposed.
117          */
DrmObjectType()118         public DrmObjectType() {}
119     }
120 
121     /**
122      * Defines playback states for content.
123      */
124     public static class Playback {
125         /**
126          * Playback started.
127          */
128         public static final int START = 0x00;
129         /**
130          * Playback stopped.
131          */
132         public static final int STOP = 0x01;
133         /**
134          * Playback paused.
135          */
136         public static final int PAUSE = 0x02;
137         /**
138          * Playback resumed.
139          */
140         public static final int RESUME = 0x03;
141 
isValid(int playbackStatus)142         /* package */ static boolean isValid(int playbackStatus) {
143             boolean isValid = false;
144 
145             switch (playbackStatus) {
146                 case START:
147                 case STOP:
148                 case PAUSE:
149                 case RESUME:
150                     isValid = true;
151             }
152             return isValid;
153         }
154 
155         /**
156          * @deprecated This class should have been an interface instead.
157          * The default constuctor should have not been exposed.
158          */
Playback()159         public Playback() {}
160     }
161 
162     /**
163      * Defines actions that can be performed on rights-protected content.
164      */
165     public static class Action {
166         /**
167          * The default action.
168          */
169         public static final int DEFAULT = 0x00;
170         /**
171          * The rights-protected content can be played.
172          */
173         public static final int PLAY = 0x01;
174         /**
175          * The rights-protected content can be set as a ringtone.
176          */
177         public static final int RINGTONE = 0x02;
178         /**
179          * The rights-protected content can be transferred.
180          */
181         public static final int TRANSFER = 0x03;
182         /**
183          * The rights-protected content can be set as output.
184          */
185         public static final int OUTPUT = 0x04;
186         /**
187          * The rights-protected content can be previewed.
188          */
189         public static final int PREVIEW = 0x05;
190         /**
191          * The rights-protected content can be executed.
192          */
193         public static final int EXECUTE = 0x06;
194         /**
195          * The rights-protected content can be displayed.
196          */
197         public static final int DISPLAY = 0x07;
198 
isValid(int action)199         /* package */ static boolean isValid(int action) {
200             boolean isValid = false;
201 
202             switch (action) {
203                 case DEFAULT:
204                 case PLAY:
205                 case RINGTONE:
206                 case TRANSFER:
207                 case OUTPUT:
208                 case PREVIEW:
209                 case EXECUTE:
210                 case DISPLAY:
211                     isValid = true;
212             }
213             return isValid;
214         }
215 
216         /**
217          * @deprecated This class should have been an interface instead.
218          * The default constuctor should have not been exposed.
219          */
Action()220         public Action() {}
221     }
222 
223     /**
224      * Defines status notifications for digital rights.
225      */
226     public static class RightsStatus {
227         /**
228          * The digital rights are valid.
229          */
230         public static final int RIGHTS_VALID = 0x00;
231         /**
232          * The digital rights are invalid.
233          */
234         public static final int RIGHTS_INVALID = 0x01;
235         /**
236          * The digital rights have expired.
237          */
238         public static final int RIGHTS_EXPIRED = 0x02;
239         /**
240          * The digital rights have not been acquired for the rights-protected content.
241          */
242         public static final int RIGHTS_NOT_ACQUIRED = 0x03;
243 
244         /**
245          * @deprecated This class should have been an interface instead.
246          * The default constuctor should have not been exposed.
247          */
RightsStatus()248         public RightsStatus() {}
249     }
250 
251     /**
252      * @deprecated This class should have been an interface instead.
253      * The default constuctor should have not been exposed.
254      */
DrmStore()255     public DrmStore() {}
256 }
257 
258