Methods Summary |
---|
public boolean | contains(android.hardware.camera2.CaptureRequest.Key key)Query this instance for whether it prefers a particular choice for the
given request parameter.
This method can be used to detect whether a particular field is forced
to its default value or simply unset. While {@link #get} will return
{@code null} in both these cases, this method will return {@code true}
and {@code false}, respectively.
if (key == null) {
throw new NullPointerException("Received a null key");
}
return mDictionary.containsKey(key);
|
public android.hardware.camera2.CaptureRequest | createRequest(android.hardware.camera2.CameraDevice camera, int template, android.view.Surface targets)Create a {@link CaptureRequest} specialized for the specified
{@link CameraDevice} and targeting the given {@link Surface}s.
if (camera == null) {
throw new NullPointerException("Tried to create request using null CameraDevice");
}
Builder reqBuilder = camera.createCaptureRequest(template);
for (Key<?> key : mDictionary.keySet()) {
setRequestFieldIfNonNull(reqBuilder, key);
}
for (Surface target : targets) {
if (target == null) {
throw new NullPointerException("Tried to add null Surface as request target");
}
reqBuilder.addTarget(target);
}
return reqBuilder.build();
|
public T | get(android.hardware.camera2.CaptureRequest.Key key)Interrogate the current specialization of a setting.
if (key == null) {
throw new NullPointerException("Received a null key");
}
return (T) mDictionary.get(key);
|
public long | getRevision()Get this set of settings's revision identifier, which can be compared
against cached past values to determine whether it has been modified.
Distinct revisions across the same object do not necessarily indicate
that the object's key/value pairs have changed at all, but the same
revision on the same object does imply that they've stayed the same.
return mRevision;
|
public boolean | matches(android.hardware.camera2.CaptureRequest.Key key, T value)Check whether the value of the specified setting matches the given one.
This method uses the {@code T} type's {@code equals} method, but is
{@code null}-tolerant.
return Objects.equals(get(key), value);
|
public boolean | set(android.hardware.camera2.CaptureRequest.Key key, T value)Specify a setting, potentially overriding the template's default choice.
Providing a {@code null} {@code value} will indicate a forced use of
the template's selection for that {@code key}; the difference here is
that this information will be propagated with unions as documented in
{@link #union}. This method increments the revision identifier if the new
choice is different than the existing selection.
if (key == null) {
throw new NullPointerException("Received a null key");
}
Object currentValue = get(key);
// Only save the value if it's different from the one we already have
if (!mDictionary.containsKey(key) || !Objects.equals(value, currentValue)) {
mDictionary.put(key, value);
++mRevision;
return true;
}
return false;
|
private void | setRequestFieldIfNonNull(android.hardware.camera2.CaptureRequest.Builder requestBuilder, android.hardware.camera2.CaptureRequest.Key key)
T value = get(key);
if (value != null) {
requestBuilder.set(key, value);
}
|
public boolean | union(com.android.ex.camera2.utils.Camera2RequestSettingsSet moreSettings)Add all settings choices defined by {@code moreSettings} to this object.
For any settings defined in both, the choice stored in the argument
to this method take precedence. Unset settings are not propagated, but
those forced to default as described in {@link set} are also forced to
default in {@code this} set. Invoking this method increments {@code this}
object's revision counter, but leaves the argument's unchanged.
if (moreSettings == null || moreSettings == this) {
return false;
}
mDictionary.putAll(moreSettings.mDictionary);
++mRevision;
return true;
|
public boolean | unset(android.hardware.camera2.CaptureRequest.Key key)Unsets a setting, preventing it from being propagated with unions or from
overriding the default when creating a capture request.
This method increments the revision identifier if a selection had
previously been made for that parameter.
if (key == null) {
throw new NullPointerException("Received a null key");
}
if (mDictionary.containsKey(key)) {
mDictionary.remove(key);
++mRevision;
return true;
}
return false;
|