Java Code Examples for android.util.SparseBooleanArray#delete()
The following examples show how to use
android.util.SparseBooleanArray#delete() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstantAppRegistry.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private void removeInstantAppLPw(@UserIdInt int userId, int instantAppId) { // remove from the installed list if (mInstalledInstantAppUids == null) { return; // no instant apps on the system } final SparseBooleanArray instantAppList = mInstalledInstantAppUids.get(userId); if (instantAppList == null) { return; } instantAppList.delete(instantAppId); // remove any grants if (mInstantGrants == null) { return; // no grants on the system } final SparseArray<SparseBooleanArray> targetAppList = mInstantGrants.get(userId); if (targetAppList == null) { return; // no grants for this user } for (int i = targetAppList.size() - 1; i >= 0; --i) { targetAppList.valueAt(i).delete(instantAppId); } }
Example 2
Source File: AppStateTracker.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private static boolean removeUidFromArray(SparseBooleanArray array, int uid, boolean remove) { if (UserHandle.isCore(uid)) { return false; } if (!array.get(uid)) { return false; } if (remove) { array.delete(uid); } else { array.put(uid, false); } return true; }
Example 3
Source File: NetworkManagementService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void setUidOnMeteredNetworkList(int uid, boolean blacklist, boolean enable) { mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG); // silently discard when control disabled // TODO: eventually migrate to be always enabled if (!mBandwidthControlEnabled) return; final String chain = blacklist ? "naughtyapps" : "niceapps"; final String suffix = enable ? "add" : "remove"; synchronized (mQuotaLock) { boolean oldEnable; SparseBooleanArray quotaList; synchronized (mRulesLock) { quotaList = blacklist ? mUidRejectOnMetered : mUidAllowOnMetered; oldEnable = quotaList.get(uid, false); } if (oldEnable == enable) { // TODO: eventually consider throwing return; } Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "inetd bandwidth"); try { mConnector.execute("bandwidth", suffix + chain, uid); synchronized (mRulesLock) { if (enable) { quotaList.put(uid, true); } else { quotaList.delete(uid); } } } catch (NativeDaemonConnectorException e) { throw e.rethrowAsParcelableException(); } finally { Trace.traceEnd(Trace.TRACE_TAG_NETWORK); } } }