• 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  */
23 public class DrmStore {
24     /**
25      * Interface definition for the columns that represent DRM constraints.
26      */
27     public interface ConstraintsColumns {
28         /**
29          * The maximum repeat count.
30          * <p>
31          * Type: INTEGER
32          */
33         public static final String MAX_REPEAT_COUNT = "max_repeat_count";
34 
35         /**
36          * The remaining repeat count.
37          * <p>
38          * Type: INTEGER
39          */
40         public static final String REMAINING_REPEAT_COUNT = "remaining_repeat_count";
41 
42         /**
43          * The time before which the rights-protected file cannot be played/viewed.
44          * <p>
45          * Type: TEXT
46          */
47         public static final String LICENSE_START_TIME = "license_start_time";
48 
49         /**
50          * The time after which the rights-protected file cannot be played/viewed.
51          * <p>
52          * Type: TEXT
53          */
54         public static final String LICENSE_EXPIRY_TIME = "license_expiry_time";
55 
56         /**
57          * The available time left before the license expires.
58          * <p>
59          * Type: TEXT
60          */
61         public static final String LICENSE_AVAILABLE_TIME = "license_available_time";
62 
63         /**
64          * The data stream for extended metadata.
65          * <p>
66          * Type: TEXT
67          */
68         public static final String EXTENDED_METADATA = "extended_metadata";
69     }
70 
71     /**
72      * Defines DRM object types.
73      */
74     public static class DrmObjectType {
75         /**
76          * An unknown object type.
77          */
78         public static final int UNKNOWN = 0x00;
79         /**
80          * A rights-protected file object type.
81          */
82         public static final int CONTENT = 0x01;
83         /**
84          * A rights information object type.
85          */
86         public static final int RIGHTS_OBJECT = 0x02;
87         /**
88          * A trigger information object type.
89          */
90         public static final int TRIGGER_OBJECT = 0x03;
91     }
92 
93     /**
94      * Defines playback states for content.
95      */
96     public static class Playback {
97         /**
98          * Playback started.
99          */
100         public static final int START = 0x00;
101         /**
102          * Playback stopped.
103          */
104         public static final int STOP = 0x01;
105         /**
106          * Playback paused.
107          */
108         public static final int PAUSE = 0x02;
109         /**
110          * Playback resumed.
111          */
112         public static final int RESUME = 0x03;
113 
isValid(int playbackStatus)114         /* package */ static boolean isValid(int playbackStatus) {
115             boolean isValid = false;
116 
117             switch (playbackStatus) {
118                 case START:
119                 case STOP:
120                 case PAUSE:
121                 case RESUME:
122                     isValid = true;
123             }
124             return isValid;
125         }
126     }
127 
128     /**
129      * Defines actions that can be performed on rights-protected content.
130      */
131     public static class Action {
132         /**
133          * The default action.
134          */
135         public static final int DEFAULT = 0x00;
136         /**
137          * The rights-protected content can be played.
138          */
139         public static final int PLAY = 0x01;
140         /**
141          * The rights-protected content can be set as a ringtone.
142          */
143         public static final int RINGTONE = 0x02;
144         /**
145          * The rights-protected content can be transferred.
146          */
147         public static final int TRANSFER = 0x03;
148         /**
149          * The rights-protected content can be set as output.
150          */
151         public static final int OUTPUT = 0x04;
152         /**
153          * The rights-protected content can be previewed.
154          */
155         public static final int PREVIEW = 0x05;
156         /**
157          * The rights-protected content can be executed.
158          */
159         public static final int EXECUTE = 0x06;
160         /**
161          * The rights-protected content can be displayed.
162          */
163         public static final int DISPLAY = 0x07;
164 
isValid(int action)165         /* package */ static boolean isValid(int action) {
166             boolean isValid = false;
167 
168             switch (action) {
169                 case DEFAULT:
170                 case PLAY:
171                 case RINGTONE:
172                 case TRANSFER:
173                 case OUTPUT:
174                 case PREVIEW:
175                 case EXECUTE:
176                 case DISPLAY:
177                     isValid = true;
178             }
179             return isValid;
180         }
181     }
182 
183     /**
184      * Defines status notifications for digital rights.
185      */
186     public static class RightsStatus {
187         /**
188          * The digital rights are valid.
189          */
190         public static final int RIGHTS_VALID = 0x00;
191         /**
192          * The digital rights are invalid.
193          */
194         public static final int RIGHTS_INVALID = 0x01;
195         /**
196          * The digital rights have expired.
197          */
198         public static final int RIGHTS_EXPIRED = 0x02;
199         /**
200          * The digital rights have not been acquired for the rights-protected content.
201          */
202         public static final int RIGHTS_NOT_ACQUIRED = 0x03;
203     }
204 }
205 
206