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);
}
}
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));
}
}
}
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);
}
}
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);
}
}
}
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());
}
Aggregations