Search in sources :

Example 6 with SparseIntArray

use of android.util.SparseIntArray in project Android-ObservableScrollView by ksoichiro.

the class ObservableGridView method init.

private void init() {
    mChildrenHeights = new SparseIntArray();
    mHeaderViewInfos = new ArrayList<>();
    mFooterViewInfos = new ArrayList<>();
    super.setClipChildren(false);
    super.setOnScrollListener(mScrollListener);
}
Also used : SparseIntArray(android.util.SparseIntArray)

Example 7 with SparseIntArray

use of android.util.SparseIntArray in project Android-ObservableScrollView by ksoichiro.

the class ObservableRecyclerView method init.

private void init() {
    mChildrenHeights = new SparseIntArray();
    checkLibraryVersion();
}
Also used : SparseIntArray(android.util.SparseIntArray)

Example 8 with SparseIntArray

use of android.util.SparseIntArray in project android_frameworks_base by ParanoidAndroid.

the class ContentService method dump.

@Override
protected synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    mContext.enforceCallingOrSelfPermission(Manifest.permission.DUMP, "caller doesn't have the DUMP permission");
    // This makes it so that future permission checks will be in the context of this
    // process rather than the caller's process. We will restore this before returning.
    long identityToken = clearCallingIdentity();
    try {
        if (mSyncManager == null) {
            pw.println("No SyncManager created!  (Disk full?)");
        } else {
            mSyncManager.dump(fd, pw);
        }
        pw.println();
        pw.println("Observer tree:");
        synchronized (mRootNode) {
            int[] counts = new int[2];
            final SparseIntArray pidCounts = new SparseIntArray();
            mRootNode.dumpLocked(fd, pw, args, "", "  ", counts, pidCounts);
            pw.println();
            ArrayList<Integer> sorted = new ArrayList<Integer>();
            for (int i = 0; i < pidCounts.size(); i++) {
                sorted.add(pidCounts.keyAt(i));
            }
            Collections.sort(sorted, new Comparator<Integer>() {

                @Override
                public int compare(Integer lhs, Integer rhs) {
                    int lc = pidCounts.get(lhs);
                    int rc = pidCounts.get(rhs);
                    if (lc < rc) {
                        return 1;
                    } else if (lc > rc) {
                        return -1;
                    }
                    return 0;
                }
            });
            for (int i = 0; i < sorted.size(); i++) {
                int pid = sorted.get(i);
                pw.print("  pid ");
                pw.print(pid);
                pw.print(": ");
                pw.print(pidCounts.get(pid));
                pw.println(" observers");
            }
            pw.println();
            pw.print(" Total number of nodes: ");
            pw.println(counts[0]);
            pw.print(" Total number of observers: ");
            pw.println(counts[1]);
        }
    } finally {
        restoreCallingIdentity(identityToken);
    }
}
Also used : SparseIntArray(android.util.SparseIntArray) ArrayList(java.util.ArrayList)

Example 9 with SparseIntArray

use of android.util.SparseIntArray in project android_frameworks_base by ParanoidAndroid.

the class WindowAnimator method setAppLayoutChanges.

void setAppLayoutChanges(final AppWindowAnimator appAnimator, final int changes, String s) {
    // Used to track which displays layout changes have been done.
    SparseIntArray displays = new SparseIntArray();
    WindowList windows = appAnimator.mAppToken.allAppWindows;
    for (int i = windows.size() - 1; i >= 0; i--) {
        final int displayId = windows.get(i).getDisplayId();
        if (displays.indexOfKey(displayId) < 0) {
            setPendingLayoutChanges(displayId, changes);
            if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
                mService.debugLayoutRepeats(s, getPendingLayoutChanges(displayId));
            }
            // Keep from processing this display again.
            displays.put(displayId, changes);
        }
    }
}
Also used : SparseIntArray(android.util.SparseIntArray)

Example 10 with SparseIntArray

use of android.util.SparseIntArray in project android_frameworks_base by ParanoidAndroid.

the class GsmAlphabet method countGsmSeptetsUsingTables.

/**
     * Returns the count of 7-bit GSM alphabet characters needed
     * to represent this string, using the specified 7-bit language table
     * and extension table (0 for GSM default tables).
     * @param s the Unicode string that will be encoded
     * @param use7bitOnly allow using space in place of unencodable character if true,
     *     otherwise, return -1 if any characters are unencodable
     * @param languageTable the 7 bit language table, or 0 for the default GSM alphabet
     * @param languageShiftTable the 7 bit single shift language table, or 0 for the default
     *     GSM extension table
     * @return the septet count for s using the specified language tables, or -1 if any
     *     characters are unencodable and use7bitOnly is false
     */
public static int countGsmSeptetsUsingTables(CharSequence s, boolean use7bitOnly, int languageTable, int languageShiftTable) {
    int count = 0;
    int sz = s.length();
    SparseIntArray charToLanguageTable = sCharsToGsmTables[languageTable];
    SparseIntArray charToShiftTable = sCharsToShiftTables[languageShiftTable];
    for (int i = 0; i < sz; i++) {
        char c = s.charAt(i);
        if (c == GSM_EXTENDED_ESCAPE) {
            Rlog.w(TAG, "countGsmSeptets() string contains Escape character, skipping.");
            continue;
        }
        if (charToLanguageTable.get(c, -1) != -1) {
            count++;
        } else if (charToShiftTable.get(c, -1) != -1) {
            // escape + shift table index
            count += 2;
        } else if (use7bitOnly) {
            // encode as space
            count++;
        } else {
            // caller must check for this case
            return -1;
        }
    }
    return count;
}
Also used : SparseIntArray(android.util.SparseIntArray)

Aggregations

SparseIntArray (android.util.SparseIntArray)367 RemoteException (android.os.RemoteException)40 Test (org.junit.Test)35 ArrayList (java.util.ArrayList)32 HashMap (java.util.HashMap)22 Context (android.content.Context)19 IAppOpsCallback (com.android.internal.app.IAppOpsCallback)15 SparseArray (android.util.SparseArray)13 IOException (java.io.IOException)13 HistoryItem (android.os.BatteryStats.HistoryItem)12 UsageView (com.android.settings.graph.UsageView)12 Point (android.graphics.Point)11 Map (java.util.Map)11 UserInfo (android.content.pm.UserInfo)10 Paint (android.graphics.Paint)10 ArraySet (android.util.ArraySet)10 HashSet (java.util.HashSet)9 Cursor (android.database.Cursor)8 NetworkStatsHistory (android.net.NetworkStatsHistory)7 SparseBooleanArray (android.util.SparseBooleanArray)7