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