Search in sources :

Example 6 with SparseBooleanArray

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

the class NetworkPolicyManagerService method computeUidForegroundLocked.

/**
     * Foreground for PID changed; recompute foreground at UID level. If
     * changed, will trigger {@link #updateRulesForUidLocked(int)}.
     */
private void computeUidForegroundLocked(int uid) {
    final SparseBooleanArray pidForeground = mUidPidForeground.get(uid);
    // current pid is dropping foreground; examine other pids
    boolean uidForeground = false;
    final int size = pidForeground.size();
    for (int i = 0; i < size; i++) {
        if (pidForeground.valueAt(i)) {
            uidForeground = true;
            break;
        }
    }
    final boolean oldUidForeground = mUidForeground.get(uid, false);
    if (oldUidForeground != uidForeground) {
        // foreground changed, push updated rules
        mUidForeground.put(uid, uidForeground);
        updateRulesForUidLocked(uid);
    }
}
Also used : SparseBooleanArray(android.util.SparseBooleanArray)

Example 7 with SparseBooleanArray

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

the class UsbSettingsManager method dump.

public void dump(FileDescriptor fd, PrintWriter pw) {
    synchronized (mLock) {
        pw.println("  Device permissions:");
        for (String deviceName : mDevicePermissionMap.keySet()) {
            pw.print("    " + deviceName + ": ");
            SparseBooleanArray uidList = mDevicePermissionMap.get(deviceName);
            int count = uidList.size();
            for (int i = 0; i < count; i++) {
                pw.print(Integer.toString(uidList.keyAt(i)) + " ");
            }
            pw.println("");
        }
        pw.println("  Accessory permissions:");
        for (UsbAccessory accessory : mAccessoryPermissionMap.keySet()) {
            pw.print("    " + accessory + ": ");
            SparseBooleanArray uidList = mAccessoryPermissionMap.get(accessory);
            int count = uidList.size();
            for (int i = 0; i < count; i++) {
                pw.print(Integer.toString(uidList.keyAt(i)) + " ");
            }
            pw.println("");
        }
        pw.println("  Device preferences:");
        for (DeviceFilter filter : mDevicePreferenceMap.keySet()) {
            pw.println("    " + filter + ": " + mDevicePreferenceMap.get(filter));
        }
        pw.println("  Accessory preferences:");
        for (AccessoryFilter filter : mAccessoryPreferenceMap.keySet()) {
            pw.println("    " + filter + ": " + mAccessoryPreferenceMap.get(filter));
        }
    }
}
Also used : SparseBooleanArray(android.util.SparseBooleanArray) UsbAccessory(android.hardware.usb.UsbAccessory)

Example 8 with SparseBooleanArray

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

the class UsbSettingsManager method grantDevicePermission.

public void grantDevicePermission(UsbDevice device, int uid) {
    synchronized (mLock) {
        String deviceName = device.getDeviceName();
        SparseBooleanArray uidList = mDevicePermissionMap.get(deviceName);
        if (uidList == null) {
            uidList = new SparseBooleanArray(1);
            mDevicePermissionMap.put(deviceName, uidList);
        }
        uidList.put(uid, true);
    }
}
Also used : SparseBooleanArray(android.util.SparseBooleanArray)

Example 9 with SparseBooleanArray

use of android.util.SparseBooleanArray in project HoloEverywhere by Prototik.

the class ListView method setChoiceMode.

@Override
public void setChoiceMode(int choiceMode) {
    mChoiceMode = choiceMode;
    if (mChoiceActionMode != null) {
        mChoiceActionMode.finish();
        mChoiceActionMode = null;
    }
    if (mChoiceMode != CHOICE_MODE_NONE) {
        if (mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }
        if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Integer>();
        }
        if (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL) {
            clearChoices();
            setLongClickable(true);
        }
    }
}
Also used : SparseBooleanArray(android.util.SparseBooleanArray)

Example 10 with SparseBooleanArray

use of android.util.SparseBooleanArray in project RoboBinding by RoboBinding.

the class SparseBooleanArrayCheckedItemPositionsAttributeTest method whenObserveChangesOnTheView_thenValueModelShouldReceiveTheChange.

@Test
public void whenObserveChangesOnTheView_thenValueModelShouldReceiveTheChange() {
    SparseBooleanArray emptySparseBooleanArray = new SparseBooleanArray();
    ValueModel<SparseBooleanArray> valueModel = ValueModelUtils.create(emptySparseBooleanArray);
    attribute.observeChangesOnTheView(viewAddOn, valueModel, view);
    setItemsChecked(SparseBooleanArrayUtils.toSet(checkedItemPositions));
    assertSparseBooleanArrayEquals(checkedItemPositions, valueModel.getValue());
}
Also used : SparseBooleanArray(android.util.SparseBooleanArray) Test(org.junit.Test)

Aggregations

SparseBooleanArray (android.util.SparseBooleanArray)235 Selection (com.android.documentsui.dirlist.MultiSelectManager.Selection)30 ArrayList (java.util.ArrayList)25 View (android.view.View)20 Point (android.graphics.Point)18 ViewGroup (android.view.ViewGroup)16 Paint (android.graphics.Paint)13 HashMap (java.util.HashMap)12 Map (java.util.Map)11 SparseArray (android.util.SparseArray)7 File (java.io.File)7 Pattern (java.util.regex.Pattern)7 Cursor (android.database.Cursor)6 SparseIntArray (android.util.SparseIntArray)6 ActionMenuChildView (com.actionbarsherlock.internal.view.menu.ActionMenuView.ActionMenuChildView)6 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)6 Account (android.accounts.Account)5 NonNull (android.annotation.NonNull)5 ContentValues (android.content.ContentValues)5 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)5