Search in sources :

Example 61 with SparseIntArray

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;
}
Also used : SparseIntArray(android.util.SparseIntArray) Size(android.util.Size)

Example 62 with SparseIntArray

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;
}
Also used : SparseIntArray(android.util.SparseIntArray)

Example 63 with SparseIntArray

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;
}
Also used : SparseIntArray(android.util.SparseIntArray)

Example 64 with SparseIntArray

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);
    }
}
Also used : SparseIntArray(android.util.SparseIntArray) Paint(android.graphics.Paint)

Example 65 with SparseIntArray

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;
}
Also used : SparseIntArray(android.util.SparseIntArray)

Aggregations

SparseIntArray (android.util.SparseIntArray)249 RemoteException (android.os.RemoteException)40 ArrayList (java.util.ArrayList)28 HashMap (java.util.HashMap)20 IAppOpsCallback (com.android.internal.app.IAppOpsCallback)15 IOException (java.io.IOException)12 Point (android.graphics.Point)11 SparseArray (android.util.SparseArray)11 UserInfo (android.content.pm.UserInfo)10 ArraySet (android.util.ArraySet)10 Map (java.util.Map)10 HashSet (java.util.HashSet)9 Cursor (android.database.Cursor)8 View (android.view.View)7 SparseBooleanArray (android.util.SparseBooleanArray)6 ActivityManager (android.app.ActivityManager)5 Context (android.content.Context)5 ActivityInfo (android.content.pm.ActivityInfo)5 Configuration (android.content.res.Configuration)5 Resources (android.content.res.Resources)5