use of android.util.SparseIntArray in project android_frameworks_base by ResurrectionRemix.
the class StreamConfigurationMap method getInternalFormatSizes.
private Size[] getInternalFormatSizes(int format, int dataspace, boolean output, boolean highRes) {
// All depth formats are non-high-res.
if (dataspace == HAL_DATASPACE_DEPTH && highRes) {
return new Size[0];
}
SparseIntArray formatsMap = !output ? mInputFormats : dataspace == HAL_DATASPACE_DEPTH ? mDepthOutputFormats : highRes ? mHighResOutputFormats : mOutputFormats;
int sizesCount = formatsMap.get(format);
if (((!output || dataspace == HAL_DATASPACE_DEPTH) && sizesCount == 0) || (output && dataspace != HAL_DATASPACE_DEPTH && mAllOutputFormats.get(format) == 0)) {
// Only throw if this is really not supported at all
throw new IllegalArgumentException("format not available");
}
Size[] sizes = new Size[sizesCount];
int sizeIndex = 0;
StreamConfiguration[] configurations = (dataspace == HAL_DATASPACE_DEPTH) ? mDepthConfigurations : mConfigurations;
StreamConfigurationDuration[] minFrameDurations = (dataspace == HAL_DATASPACE_DEPTH) ? mDepthMinFrameDurations : mMinFrameDurations;
for (StreamConfiguration config : configurations) {
int fmt = config.getFormat();
if (fmt == format && config.isOutput() == output) {
if (output && mListHighResolution) {
// Filter slow high-res output formats; include for
// highRes, remove for !highRes
long duration = 0;
for (int i = 0; i < minFrameDurations.length; i++) {
StreamConfigurationDuration d = minFrameDurations[i];
if (d.getFormat() == fmt && d.getWidth() == config.getSize().getWidth() && d.getHeight() == config.getSize().getHeight()) {
duration = d.getDuration();
break;
}
}
if (dataspace != HAL_DATASPACE_DEPTH && highRes != (duration > DURATION_20FPS_NS)) {
continue;
}
}
sizes[sizeIndex++] = config.getSize();
}
}
if (sizeIndex != sizesCount) {
throw new AssertionError("Too few sizes (expected " + sizesCount + ", actual " + sizeIndex + ")");
}
return sizes;
}
use of android.util.SparseIntArray in project android_frameworks_base by ResurrectionRemix.
the class StreamConfigurationMap method getPublicFormatCount.
/** Count the number of publicly-visible output formats */
private int getPublicFormatCount(boolean output) {
SparseIntArray formatsMap = getFormatsMap(output);
int size = formatsMap.size();
if (output) {
size += mDepthOutputFormats.size();
}
return size;
}
use of android.util.SparseIntArray in project android_frameworks_base by ResurrectionRemix.
the class StreamConfigurationMap method getPublicFormats.
/** Get the list of publically visible output formats; does not include IMPL_DEFINED */
private int[] getPublicFormats(boolean output) {
int[] formats = new int[getPublicFormatCount(output)];
int i = 0;
SparseIntArray map = getFormatsMap(output);
for (int j = 0; j < map.size(); j++) {
int format = map.keyAt(j);
formats[i++] = imageFormatToPublic(format);
}
if (output) {
for (int j = 0; j < mDepthOutputFormats.size(); j++) {
formats[i++] = depthFormatToPublic(mDepthOutputFormats.keyAt(j));
}
}
if (formats.length != i) {
throw new AssertionError("Too few formats " + i + ", expected " + formats.length);
}
return formats;
}
use of android.util.SparseIntArray in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryActiveView method onDraw.
@Override
protected void onDraw(Canvas canvas) {
if (mProvider == null) {
return;
}
SparseIntArray array = mProvider.getColorArray();
float period = mProvider.getPeriod();
for (int i = 0; i < array.size() - 1; i++) {
drawColor(canvas, array.keyAt(i), array.keyAt(i + 1), array.valueAt(i), period);
}
}
use of android.util.SparseIntArray in project android_frameworks_base by ResurrectionRemix.
the class CursorWindow method printStats.
private String printStats() {
StringBuilder buff = new StringBuilder();
int myPid = Process.myPid();
int total = 0;
SparseIntArray pidCounts = new SparseIntArray();
synchronized (sWindowToPidMap) {
int size = sWindowToPidMap.size();
if (size == 0) {
// this means we are not in the ContentProvider.
return "";
}
for (int indx = 0; indx < size; indx++) {
int pid = sWindowToPidMap.valueAt(indx);
int value = pidCounts.get(pid);
pidCounts.put(pid, ++value);
}
}
int numPids = pidCounts.size();
for (int i = 0; i < numPids; i++) {
buff.append(" (# cursors opened by ");
int pid = pidCounts.keyAt(i);
if (pid == myPid) {
buff.append("this proc=");
} else {
buff.append("pid " + pid + "=");
}
int num = pidCounts.get(pid);
buff.append(num + ")");
total += num;
}
// limit the returned string size to 1000
String s = (buff.length() > 980) ? buff.substring(0, 980) : buff.toString();
return "# Open Cursors=" + total + s;
}
Aggregations