Search in sources :

Example 6 with IntArray

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

the class RegisteredServicesCache method updateServices.

public void updateServices(int userId) {
    if (DEBUG) {
        Slog.d(TAG, "updateServices u" + userId);
    }
    List<ServiceInfo<V>> allServices;
    synchronized (mServicesLock) {
        final UserServices<V> user = findOrCreateUserLocked(userId);
        // If services haven't been initialized yet - no updates required
        if (user.services == null) {
            return;
        }
        allServices = new ArrayList<>(user.services.values());
    }
    IntArray updatedUids = null;
    for (ServiceInfo<V> service : allServices) {
        int versionCode = service.componentInfo.applicationInfo.versionCode;
        String pkg = service.componentInfo.packageName;
        ApplicationInfo newAppInfo = null;
        try {
            newAppInfo = mContext.getPackageManager().getApplicationInfoAsUser(pkg, 0, userId);
        } catch (NameNotFoundException e) {
        // Package uninstalled - treat as null app info
        }
        // If package updated or removed
        if ((newAppInfo == null) || (newAppInfo.versionCode != versionCode)) {
            if (DEBUG) {
                Slog.d(TAG, "Package " + pkg + " uid=" + service.uid + " updated. New appInfo: " + newAppInfo);
            }
            if (updatedUids == null) {
                updatedUids = new IntArray();
            }
            updatedUids.add(service.uid);
        }
    }
    if (updatedUids != null && updatedUids.size() > 0) {
        int[] updatedUidsArray = updatedUids.toArray();
        generateServicesMap(updatedUidsArray, userId);
    }
}
Also used : IntArray(android.util.IntArray) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException)

Example 7 with IntArray

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

the class ExploreByTouchHelper method createNodeForHost.

/**
     * Constructs and returns an {@link AccessibilityNodeInfo} for the
     * host view populated with its virtual descendants.
     *
     * @return An {@link AccessibilityNodeInfo} for the parent node.
     */
private AccessibilityNodeInfo createNodeForHost() {
    final AccessibilityNodeInfo node = AccessibilityNodeInfo.obtain(mView);
    mView.onInitializeAccessibilityNodeInfo(node);
    final int realNodeCount = node.getChildCount();
    // Allow the client to populate the host node.
    onPopulateNodeForHost(node);
    // Add the virtual descendants.
    if (mTempArray == null) {
        mTempArray = new IntArray();
    } else {
        mTempArray.clear();
    }
    final IntArray virtualViewIds = mTempArray;
    getVisibleVirtualViews(virtualViewIds);
    if (realNodeCount > 0 && virtualViewIds.size() > 0) {
        throw new RuntimeException("Views cannot have both real and virtual children");
    }
    final int N = virtualViewIds.size();
    for (int i = 0; i < N; i++) {
        node.addChild(mView, virtualViewIds.get(i));
    }
    return node;
}
Also used : IntArray(android.util.IntArray) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo)

Example 8 with IntArray

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

the class ExploreByTouchHelper method createNodeForHost.

/**
     * Constructs and returns an {@link AccessibilityNodeInfo} for the
     * host view populated with its virtual descendants.
     *
     * @return An {@link AccessibilityNodeInfo} for the parent node.
     */
private AccessibilityNodeInfo createNodeForHost() {
    final AccessibilityNodeInfo node = AccessibilityNodeInfo.obtain(mView);
    mView.onInitializeAccessibilityNodeInfo(node);
    final int realNodeCount = node.getChildCount();
    // Allow the client to populate the host node.
    onPopulateNodeForHost(node);
    // Add the virtual descendants.
    if (mTempArray == null) {
        mTempArray = new IntArray();
    } else {
        mTempArray.clear();
    }
    final IntArray virtualViewIds = mTempArray;
    getVisibleVirtualViews(virtualViewIds);
    if (realNodeCount > 0 && virtualViewIds.size() > 0) {
        throw new RuntimeException("Views cannot have both real and virtual children");
    }
    final int N = virtualViewIds.size();
    for (int i = 0; i < N; i++) {
        node.addChild(mView, virtualViewIds.get(i));
    }
    return node;
}
Also used : IntArray(android.util.IntArray) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo)

Example 9 with IntArray

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

the class UserManagerService method getProfilesLU.

/** Assume permissions already checked and caller's identity cleared */
private List<UserInfo> getProfilesLU(int userId, boolean enabledOnly, boolean fullInfo) {
    IntArray profileIds = getProfileIdsLU(userId, enabledOnly);
    ArrayList<UserInfo> users = new ArrayList<>(profileIds.size());
    for (int i = 0; i < profileIds.size(); i++) {
        int profileId = profileIds.get(i);
        UserInfo userInfo = mUsers.get(profileId).info;
        // If full info is not required - clear PII data to prevent 3P apps from reading it
        if (!fullInfo) {
            userInfo = new UserInfo(userInfo);
            userInfo.name = null;
            userInfo.iconPath = null;
        } else {
            userInfo = userWithName(userInfo);
        }
        users.add(userInfo);
    }
    return users;
}
Also used : IntArray(android.util.IntArray) SparseIntArray(android.util.SparseIntArray) ArrayList(java.util.ArrayList) UserInfo(android.content.pm.UserInfo)

Example 10 with IntArray

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

the class NetworkStats method startUserUidEnumeration.

/**
     * Starts uid enumeration for current user.
     * @throws RemoteException
     */
void startUserUidEnumeration() throws RemoteException {
    // TODO: getRelevantUids should be sensitive to time interval. When that's done,
    //       the filtering logic below can be removed.
    int[] uids = mSession.getRelevantUids();
    // Filtering of uids with empty history.
    IntArray filteredUids = new IntArray(uids.length);
    for (int uid : uids) {
        try {
            NetworkStatsHistory history = mSession.getHistoryIntervalForUid(mTemplate, uid, android.net.NetworkStats.SET_ALL, android.net.NetworkStats.TAG_NONE, NetworkStatsHistory.FIELD_ALL, mStartTimeStamp, mEndTimeStamp);
            if (history != null && history.size() > 0) {
                filteredUids.add(uid);
            }
        } catch (RemoteException e) {
            Log.w(TAG, "Error while getting history of uid " + uid, e);
        }
    }
    mUids = filteredUids.toArray();
    mUidOrUidIndex = -1;
    stepHistory();
}
Also used : IntArray(android.util.IntArray) NetworkStatsHistory(android.net.NetworkStatsHistory) RemoteException(android.os.RemoteException)

Aggregations

IntArray (android.util.IntArray)37 SparseIntArray (android.util.SparseIntArray)13 UserInfo (android.content.pm.UserInfo)8 NonNull (android.annotation.NonNull)5 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)5 NetworkStatsHistory (android.net.NetworkStatsHistory)5 RemoteException (android.os.RemoteException)5 AccessibilityNodeInfo (android.view.accessibility.AccessibilityNodeInfo)5 ComponentName (android.content.ComponentName)4 PackageManagerInternal (android.content.pm.PackageManagerInternal)4 PhoneAccountHandle (android.telecom.PhoneAccountHandle)4 TelecomManager (android.telecom.TelecomManager)4 ArrayList (java.util.ArrayList)4