Search in sources :

Example 1 with MutableInt

use of android.util.MutableInt in project platform_frameworks_base by android.

the class SystemProperties method onKeyAccess.

private static void onKeyAccess(String key) {
    if (!TRACK_KEY_ACCESS)
        return;
    if (key != null && key.startsWith("ro.")) {
        synchronized (sRoReads) {
            MutableInt numReads = sRoReads.getOrDefault(key, null);
            if (numReads == null) {
                numReads = new MutableInt(0);
                sRoReads.put(key, numReads);
            }
            numReads.value++;
            if (numReads.value > 3) {
                Log.d(TAG, "Repeated read (count=" + numReads.value + ") of a read-only system property '" + key + "'", new Exception());
            }
        }
    }
}
Also used : MutableInt(android.util.MutableInt)

Example 2 with MutableInt

use of android.util.MutableInt in project android_frameworks_base by DirtyUnicorns.

the class SystemProperties method onKeyAccess.

private static void onKeyAccess(String key) {
    if (!TRACK_KEY_ACCESS)
        return;
    if (key != null && key.startsWith("ro.")) {
        synchronized (sRoReads) {
            MutableInt numReads = sRoReads.getOrDefault(key, null);
            if (numReads == null) {
                numReads = new MutableInt(0);
                sRoReads.put(key, numReads);
            }
            numReads.value++;
            if (numReads.value > 3) {
                Log.d(TAG, "Repeated read (count=" + numReads.value + ") of a read-only system property '" + key + "'", new Exception());
            }
        }
    }
}
Also used : MutableInt(android.util.MutableInt)

Example 3 with MutableInt

use of android.util.MutableInt in project android_frameworks_base by DirtyUnicorns.

the class IntentResolver method dumpMap.

boolean dumpMap(PrintWriter out, String titlePrefix, String title, String prefix, ArrayMap<String, F[]> map, String packageName, boolean printFilter, boolean collapseDuplicates) {
    final String eprefix = prefix + "  ";
    final String fprefix = prefix + "    ";
    final ArrayMap<Object, MutableInt> found = new ArrayMap<>();
    boolean printedSomething = false;
    Printer printer = null;
    for (int mapi = 0; mapi < map.size(); mapi++) {
        F[] a = map.valueAt(mapi);
        final int N = a.length;
        boolean printedHeader = false;
        F filter;
        if (collapseDuplicates && !printFilter) {
            found.clear();
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                Object label = filterToLabel(filter);
                int index = found.indexOfKey(label);
                if (index < 0) {
                    found.put(label, new MutableInt(1));
                } else {
                    found.valueAt(index).value++;
                }
            }
            for (int i = 0; i < found.size(); i++) {
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilterLabel(out, fprefix, found.keyAt(i), found.valueAt(i).value);
            }
        } else {
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilter(out, fprefix, filter);
                if (printFilter) {
                    if (printer == null) {
                        printer = new PrintWriterPrinter(out);
                    }
                    filter.dump(printer, fprefix + "  ");
                }
            }
        }
    }
    return printedSomething;
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) MutableInt(android.util.MutableInt) ArrayMap(android.util.ArrayMap) PrintWriterPrinter(android.util.PrintWriterPrinter) LogPrinter(android.util.LogPrinter) Printer(android.util.Printer)

Example 4 with MutableInt

use of android.util.MutableInt in project android_frameworks_base by ResurrectionRemix.

the class IntentResolver method dumpMap.

boolean dumpMap(PrintWriter out, String titlePrefix, String title, String prefix, ArrayMap<String, F[]> map, String packageName, boolean printFilter, boolean collapseDuplicates) {
    final String eprefix = prefix + "  ";
    final String fprefix = prefix + "    ";
    final ArrayMap<Object, MutableInt> found = new ArrayMap<>();
    boolean printedSomething = false;
    Printer printer = null;
    for (int mapi = 0; mapi < map.size(); mapi++) {
        F[] a = map.valueAt(mapi);
        final int N = a.length;
        boolean printedHeader = false;
        F filter;
        if (collapseDuplicates && !printFilter) {
            found.clear();
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                Object label = filterToLabel(filter);
                int index = found.indexOfKey(label);
                if (index < 0) {
                    found.put(label, new MutableInt(1));
                } else {
                    found.valueAt(index).value++;
                }
            }
            for (int i = 0; i < found.size(); i++) {
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilterLabel(out, fprefix, found.keyAt(i), found.valueAt(i).value);
            }
        } else {
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilter(out, fprefix, filter);
                if (printFilter) {
                    if (printer == null) {
                        printer = new PrintWriterPrinter(out);
                    }
                    filter.dump(printer, fprefix + "  ");
                }
            }
        }
    }
    return printedSomething;
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) MutableInt(android.util.MutableInt) ArrayMap(android.util.ArrayMap) PrintWriterPrinter(android.util.PrintWriterPrinter) LogPrinter(android.util.LogPrinter) Printer(android.util.Printer)

Example 5 with MutableInt

use of android.util.MutableInt in project android_frameworks_base by crdroidandroid.

the class IntentResolver method dumpMap.

boolean dumpMap(PrintWriter out, String titlePrefix, String title, String prefix, ArrayMap<String, F[]> map, String packageName, boolean printFilter, boolean collapseDuplicates) {
    final String eprefix = prefix + "  ";
    final String fprefix = prefix + "    ";
    final ArrayMap<Object, MutableInt> found = new ArrayMap<>();
    boolean printedSomething = false;
    Printer printer = null;
    for (int mapi = 0; mapi < map.size(); mapi++) {
        F[] a = map.valueAt(mapi);
        final int N = a.length;
        boolean printedHeader = false;
        F filter;
        if (collapseDuplicates && !printFilter) {
            found.clear();
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                Object label = filterToLabel(filter);
                int index = found.indexOfKey(label);
                if (index < 0) {
                    found.put(label, new MutableInt(1));
                } else {
                    found.valueAt(index).value++;
                }
            }
            for (int i = 0; i < found.size(); i++) {
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilterLabel(out, fprefix, found.keyAt(i), found.valueAt(i).value);
            }
        } else {
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilter(out, fprefix, filter);
                if (printFilter) {
                    if (printer == null) {
                        printer = new PrintWriterPrinter(out);
                    }
                    filter.dump(printer, fprefix + "  ");
                }
            }
        }
    }
    return printedSomething;
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) MutableInt(android.util.MutableInt) ArrayMap(android.util.ArrayMap) PrintWriterPrinter(android.util.PrintWriterPrinter) LogPrinter(android.util.LogPrinter) Printer(android.util.Printer)

Aggregations

MutableInt (android.util.MutableInt)9 ArrayMap (android.util.ArrayMap)5 LogPrinter (android.util.LogPrinter)5 PrintWriterPrinter (android.util.PrintWriterPrinter)5 Printer (android.util.Printer)5 ActivityManager (android.app.ActivityManager)1 UriPermission (android.content.UriPermission)1 PackageManager (android.content.pm.PackageManager)1 ProviderInfo (android.content.pm.ProviderInfo)1 CursorWindow (android.database.CursorWindow)1 DbStats (android.database.sqlite.SQLiteDebug.DbStats)1 Preference (android.support.v7.preference.Preference)1 MutableBoolean (android.util.MutableBoolean)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1