Home | History | Annotate | Download | only in keymaster

Lines Matching refs:tag

65      * Adds an enum tag with the provided value.
67 * @throws IllegalArgumentException if {@code tag} is not an enum tag.
69 public void addEnum(int tag, int value) {
70 int tagType = KeymasterDefs.getTagType(tag);
72 throw new IllegalArgumentException("Not an enum or repeating enum tag: " + tag);
74 addEnumTag(tag, value);
78 * Adds a repeated enum tag with the provided values.
80 * @throws IllegalArgumentException if {@code tag} is not a repeating enum tag.
82 public void addEnums(int tag, int... values) {
83 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_ENUM_REP) {
84 throw new IllegalArgumentException("Not a repeating enum tag: " + tag);
87 addEnumTag(tag, value);
92 * Returns the value of the specified enum tag or {@code defaultValue} if the tag is not
95 * @throws IllegalArgumentException if {@code tag} is not an enum tag.
97 public int getEnum(int tag, int defaultValue) {
98 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_ENUM) {
99 throw new IllegalArgumentException("Not an enum tag: " + tag);
101 KeymasterArgument arg = getArgumentByTag(tag);
109 * Returns all values of the specified repeating enum tag.
111 * throws IllegalArgumentException if {@code tag} is not a repeating enum tag.
113 public List<Integer> getEnums(int tag) {
114 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_ENUM_REP) {
115 throw new IllegalArgumentException("Not a repeating enum tag: " + tag);
119 if (arg.tag == tag) {
126 private void addEnumTag(int tag, int value) {
127 mArguments.add(new KeymasterIntArgument(tag, value));
135 * Adds an unsigned 32-bit int tag with the provided value.
137 * @throws IllegalArgumentException if {@code tag} is not an unsigned 32-bit int tag or if
140 public void addUnsignedInt(int tag, long value) {
141 int tagType = KeymasterDefs.getTagType(tag);
143 throw new IllegalArgumentException("Not an int or repeating int tag: " + tag);
147 throw new IllegalArgumentException("Int tag value out of range: " + value);
149 mArguments.add(new KeymasterIntArgument(tag, (int) value));
153 * Returns the value of the specified unsigned 32-bit int tag or {@code defaultValue} if the tag
156 * @throws IllegalArgumentException if {@code tag} is not an unsigned 32-bit int tag.
158 public long getUnsignedInt(int tag, long defaultValue) {
159 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_UINT) {
160 throw new IllegalArgumentException("Not an int tag: " + tag);
162 KeymasterArgument arg = getArgumentByTag(tag);
171 * Adds an unsigned 64-bit long tag with the provided value.
173 * @throws IllegalArgumentException if {@code tag} is not an unsigned 64-bit long tag or if
176 public void addUnsignedLong(int tag, BigInteger value) {
177 int tagType = KeymasterDefs.getTagType(tag);
179 throw new IllegalArgumentException("Not a long or repeating long tag: " + tag);
181 addLongTag(tag, value);
185 * Returns all values of the specified repeating unsigned 64-bit long tag.
187 * @throws IllegalArgumentException if {@code tag} is not a repeating unsigned 64-bit long tag.
189 public List<BigInteger> getUnsignedLongs(int tag) {
190 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_ULONG_REP) {
191 throw new IllegalArgumentException("Tag is not a repeating long: " + tag);
195 if (arg.tag == tag) {
202 private void addLongTag(int tag, BigInteger value) {
205 throw new IllegalArgumentException("Long tag value out of range: " + value);
207 mArguments.add(new KeymasterLongArgument(tag, value.longValue()));
217 * Adds the provided boolean tag. Boolean tags are considered to be set to {@code true} if
220 * @throws IllegalArgumentException if {@code tag} is not a boolean tag.
222 public void addBoolean(int tag) {
223 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_BOOL) {
224 throw new IllegalArgumentException("Not a boolean tag: " + tag);
226 mArguments.add(new KeymasterBooleanArgument(tag));
230 * Returns {@code true} if the provided boolean tag is present, {@code false} if absent.
232 * @throws IllegalArgumentException if {@code tag} is not a boolean tag.
234 public boolean getBoolean(int tag) {
235 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_BOOL) {
236 throw new IllegalArgumentException("Not a boolean tag: " + tag);
238 KeymasterArgument arg = getArgumentByTag(tag);
246 * Adds a bytes tag with the provided value.
248 * @throws IllegalArgumentException if {@code tag} is not a bytes tag.
250 public void addBytes(int tag, byte[] value) {
251 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_BYTES) {
252 throw new IllegalArgumentException("Not a bytes tag: " + tag);
257 mArguments.add(new KeymasterBlobArgument(tag, value));
261 * Returns the value of the specified bytes tag or {@code defaultValue} if the tag is not
264 * @throws IllegalArgumentException if {@code tag} is not a bytes tag.
266 public byte[] getBytes(int tag, byte[] defaultValue) {
267 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_BYTES) {
268 throw new IllegalArgumentException("Not a bytes tag: " + tag);
270 KeymasterArgument arg = getArgumentByTag(tag);
278 * Adds a date tag with the provided value.
280 * @throws IllegalArgumentException if {@code tag} is not a date tag or if {@code value} is
283 public void addDate(int tag, Date value) {
284 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_DATE) {
285 throw new IllegalArgumentException("Not a date tag: " + tag);
293 throw new IllegalArgumentException("Date tag value out of range: " + value);
295 mArguments.add(new KeymasterDateArgument(tag, value));
299 * Adds a date tag with the provided value, if the value is not {@code null}. Does nothing if
302 * @throws IllegalArgumentException if {@code tag} is not a date tag or if {@code value} is
305 public void addDateIfNotNull(int tag, Date value) {
306 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_DATE) {
307 throw new IllegalArgumentException("Not a date tag: " + tag);
310 addDate(tag, value);
315 * Returns the value of the specified date tag or {@code defaultValue} if the tag is not
318 * @throws IllegalArgumentException if {@code tag} is not a date tag or if the tag's value
322 public Date getDate(int tag, Date defaultValue) {
323 if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_DATE) {
324 throw new IllegalArgumentException("Tag is not a date type: " + tag);
326 KeymasterArgument arg = getArgumentByTag(tag);
334 throw new IllegalArgumentException("Tag value too large. Tag: " + tag);
339 private KeymasterArgument getArgumentByTag(int tag) {
341 if (arg.tag == tag) {
348 public boolean containsTag(int tag) {
349 return getArgumentByTag(tag) != null;