android.content.pm.PackageStats#android.util.ArrayMap源码实例Demo

下面列出了android.content.pm.PackageStats#android.util.ArrayMap 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: FragmentTransition.java
/**
 * Sets the epicenter for the exit transition.
 *
 * @param sharedElementTransition The shared element transition
 * @param exitTransition The transition for the outgoing fragment's views
 * @param outSharedElements Shared elements in the outgoing fragment
 * @param outIsPop Is the outgoing fragment being removed as a pop transaction?
 * @param outTransaction The transaction that caused the fragment to be removed.
 */
private static void setOutEpicenter(TransitionSet sharedElementTransition,
        Transition exitTransition, ArrayMap<String, View> outSharedElements, boolean outIsPop,
        BackStackRecord outTransaction) {
    if (outTransaction.mSharedElementSourceNames != null &&
            !outTransaction.mSharedElementSourceNames.isEmpty()) {
        final String sourceName = outIsPop
                ? outTransaction.mSharedElementTargetNames.get(0)
                : outTransaction.mSharedElementSourceNames.get(0);
        final View outEpicenterView = outSharedElements.get(sourceName);
        setEpicenter(sharedElementTransition, outEpicenterView);

        if (exitTransition != null) {
            setEpicenter(exitTransition, outEpicenterView);
        }
    }
}
 
源代码2 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public SharedPreferences getSharedPreferences(String name, int mode) {
    // At least one application in the world actually passes in a null
    // name.  This happened to work because when we generated the file name
    // we would stringify it to "null.xml".  Nice.
    if (mPackageInfo.getApplicationInfo().targetSdkVersion <
            Build.VERSION_CODES.KITKAT) {
        if (name == null) {
            name = "null";
        }
    }

    File file;
    synchronized (ContextImpl.class) {
        if (mSharedPrefsPaths == null) {
            mSharedPrefsPaths = new ArrayMap<>();
        }
        file = mSharedPrefsPaths.get(name);
        if (file == null) {
            file = getSharedPreferencesPath(name);
            mSharedPrefsPaths.put(name, file);
        }
    }
    return getSharedPreferences(file, mode);
}
 
源代码3 项目: android_9.0.0_r45   文件: UsageStatsManager.java
/**
 * A convenience method that queries for all stats in the given range (using the best interval
 * for that range), merges the resulting data, and keys it by package name.
 * See {@link #queryUsageStats(int, long, long)}.
 * <p> The caller must have {@link android.Manifest.permission#PACKAGE_USAGE_STATS} </p>
 *
 * @param beginTime The inclusive beginning of the range of stats to include in the results.
 * @param endTime The exclusive end of the range of stats to include in the results.
 * @return A {@link java.util.Map} keyed by package name
 */
public Map<String, UsageStats> queryAndAggregateUsageStats(long beginTime, long endTime) {
    List<UsageStats> stats = queryUsageStats(INTERVAL_BEST, beginTime, endTime);
    if (stats.isEmpty()) {
        return Collections.emptyMap();
    }

    ArrayMap<String, UsageStats> aggregatedStats = new ArrayMap<>();
    final int statCount = stats.size();
    for (int i = 0; i < statCount; i++) {
        UsageStats newStat = stats.get(i);
        UsageStats existingStat = aggregatedStats.get(newStat.getPackageName());
        if (existingStat == null) {
            aggregatedStats.put(newStat.mPackageName, newStat);
        } else {
            existingStat.add(newStat);
        }
    }
    return aggregatedStats;
}
 
源代码4 项目: android_9.0.0_r45   文件: AccessibilityManager.java
/**
 * Notifies the registered {@link HighTextContrastChangeListener}s.
 */
private void notifyHighTextContrastStateChanged() {
    final boolean isHighTextContrastEnabled;
    final ArrayMap<HighTextContrastChangeListener, Handler> listeners;
    synchronized (mLock) {
        if (mHighTextContrastStateChangeListeners.isEmpty()) {
            return;
        }
        isHighTextContrastEnabled = mIsHighTextContrastEnabled;
        listeners = new ArrayMap<>(mHighTextContrastStateChangeListeners);
    }

    final int numListeners = listeners.size();
    for (int i = 0; i < numListeners; i++) {
        final HighTextContrastChangeListener listener = listeners.keyAt(i);
        listeners.valueAt(i).post(() ->
                listener.onHighTextContrastStateChanged(isHighTextContrastEnabled));
    }
}
 
源代码5 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public boolean deleteSharedPreferences(String name) {
    synchronized (ContextImpl.class) {
        final File prefs = getSharedPreferencesPath(name);
        final File prefsBackup = SharedPreferencesImpl.makeBackupFile(prefs);

        // Evict any in-memory caches
        final ArrayMap<File, SharedPreferencesImpl> cache = getSharedPreferencesCacheLocked();
        cache.remove(prefs);

        prefs.delete();
        prefsBackup.delete();

        // We failed if files are still lingering
        return !(prefs.exists() || prefsBackup.exists());
    }
}
 
源代码6 项目: GLEXP-Team-onebillion   文件: ScrollingHelper.java
public static void prepareForScrollMeasureTickValue(OBControl con, float tickValue,double decay,float minSpeedX, float minSpeedY)
{
    Object data = con.propertyValue("scrolling_data");
    Map<String,Object> scrollingData;
    if(data == null)
        scrollingData = new ArrayMap<String,Object>();
    else
        scrollingData = (ArrayMap<String,Object>)data;

    scrollingData.put("last_action",SystemClock.uptimeMillis());
    scrollingData.put("last_loc",OBMisc.copyPoint(con.position()));
    scrollingData.put("speed_x",0.0f);
    scrollingData.put("speed_y",0.0f);
    scrollingData.put("min_speed_x",minSpeedX);
    scrollingData.put("min_speed_y",minSpeedY);
    scrollingData.put("decay",decay);
    scrollingData.put("tick",tickValue);
    con.setProperty("scrolling_data", scrollingData);
}
 
/**
 * Called when gesture detection becomes active or inactive
 * @hide
 */
public void onGestureDetectionActiveChanged(boolean active) {
    final ArrayMap<FingerprintGestureCallback, Handler> handlerMap;
    synchronized (mLock) {
        handlerMap = new ArrayMap<>(mCallbackHandlerMap);
    }
    int numListeners = handlerMap.size();
    for (int i = 0; i < numListeners; i++) {
        FingerprintGestureCallback callback = handlerMap.keyAt(i);
        Handler handler = handlerMap.valueAt(i);
        if (handler != null) {
            handler.post(() -> callback.onGestureDetectionAvailabilityChanged(active));
        } else {
            callback.onGestureDetectionAvailabilityChanged(active);
        }
    }
}
 
源代码8 项目: android_9.0.0_r45   文件: AccessibilityManager.java
/**
 * Notifies the registered {@link AccessibilityStateChangeListener}s.
 */
private void notifyAccessibilityStateChanged() {
    final boolean isEnabled;
    final ArrayMap<AccessibilityStateChangeListener, Handler> listeners;
    synchronized (mLock) {
        if (mAccessibilityStateChangeListeners.isEmpty()) {
            return;
        }
        isEnabled = isEnabled();
        listeners = new ArrayMap<>(mAccessibilityStateChangeListeners);
    }

    final int numListeners = listeners.size();
    for (int i = 0; i < numListeners; i++) {
        final AccessibilityStateChangeListener listener = listeners.keyAt(i);
        listeners.valueAt(i).post(() ->
                listener.onAccessibilityStateChanged(isEnabled));
    }
}
 
源代码9 项目: android_9.0.0_r45   文件: ShortcutPackage.java
/**
 * Build a list of shortcuts for each target activity and return as a map. The result won't
 * contain "floating" shortcuts because they don't belong on any activities.
 */
private ArrayMap<ComponentName, ArrayList<ShortcutInfo>> sortShortcutsToActivities() {
    final ArrayMap<ComponentName, ArrayList<ShortcutInfo>> activitiesToShortcuts
            = new ArrayMap<>();
    for (int i = mShortcuts.size() - 1; i >= 0; i--) {
        final ShortcutInfo si = mShortcuts.valueAt(i);
        if (si.isFloating()) {
            continue; // Ignore floating shortcuts, which are not tied to any activities.
        }

        final ComponentName activity = si.getActivity();
        if (activity == null) {
            mShortcutUser.mService.wtf("null activity detected.");
            continue;
        }

        ArrayList<ShortcutInfo> list = activitiesToShortcuts.get(activity);
        if (list == null) {
            list = new ArrayList<>();
            activitiesToShortcuts.put(activity, list);
        }
        list.add(si);
    }
    return activitiesToShortcuts;
}
 
源代码10 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public SharedPreferences getSharedPreferences(String name, int mode) {
    // At least one application in the world actually passes in a null
    // name.  This happened to work because when we generated the file name
    // we would stringify it to "null.xml".  Nice.
    if (mPackageInfo.getApplicationInfo().targetSdkVersion <
            Build.VERSION_CODES.KITKAT) {
        if (name == null) {
            name = "null";
        }
    }

    File file;
    synchronized (ContextImpl.class) {
        if (mSharedPrefsPaths == null) {
            mSharedPrefsPaths = new ArrayMap<>();
        }
        file = mSharedPrefsPaths.get(name);
        if (file == null) {
            file = getSharedPreferencesPath(name);
            mSharedPrefsPaths.put(name, file);
        }
    }
    return getSharedPreferences(file, mode);
}
 
源代码11 项目: GLEXP-Team-onebillion   文件: OC_2dShapes_S2f.java
public void prepare()
{
    setStatus(STATUS_BUSY);
    super.prepare();
    loadFingers();
    loadEvent("master2");
    this.localisations = loadLocalisations(getLocalPath("_localisations.xml"));
    textColour = OBUtils.colorFromRGBString(eventAttributes.get("colour_text"));
    dropObjs = new ArrayMap<>();
    events = Arrays.asList(eventAttributes.get("scenes").split(","));
    OBPath box = (OBPath)objectDict.get("box");

    box.setProperty("start_loc", OBMisc.copyPoint(box.position()));
    OBPath dot = (OBPath)objectDict.get("dot");
    dot.sizeToBoundingBoxInset(-applyGraphicScale(2));
    setSceneXX(currentEvent());
    box.sizeToBoundingBoxIncludingStroke();
}
 
private ArrayMap<String, View> mapNamedElements(ArrayList<String> accepted,
        ArrayList<String> localNames) {
    ArrayMap<String, View> sharedElements = new ArrayMap<String, View>();
    ViewGroup decorView = getDecor();
    if (decorView != null) {
        decorView.findNamedViews(sharedElements);
    }
    if (accepted != null) {
        for (int i = 0; i < localNames.size(); i++) {
            String localName = localNames.get(i);
            String acceptedName = accepted.get(i);
            if (localName != null && !localName.equals(acceptedName)) {
                View view = sharedElements.get(localName);
                if (view != null) {
                    sharedElements.put(acceptedName, view);
                }
            }
        }
    }
    return sharedElements;
}
 
源代码13 项目: GLEXP-Team-onebillion   文件: ScrollingHelper.java
public static void measureScrollSpeed(OBControl con)
{
    Object data = con.propertyValue("scrolling_data");
    if(data == null)
        return;
    Map<String,Object> scrollingData = (ArrayMap<String,Object>)data;

    long currentTime = SystemClock.uptimeMillis();
    long lastTime = (long)scrollingData.get("last_action");
    if(currentTime == lastTime)
        return;
    float lastSpeedX = (float)scrollingData.get("speed_x");
    float lastSpeedY = (float)scrollingData.get("speed_y");
    float tick = (float)scrollingData.get("tick") ;
    PointF lastLoc = (PointF)scrollingData.get("last_loc");
    PointF currentLoc = OBMisc.copyPoint(con.position());
    float ticks =  (currentTime - lastTime)*1.0f/(1000.0f*tick);
    float speedX = 0.8f * ((currentLoc.x - lastLoc.x) / ticks) + 0.2f * lastSpeedX;
    float speedY = 0.8f * ((currentLoc.y - lastLoc.y) / ticks) + 0.2f * lastSpeedY;
    scrollingData.put("speed_x",speedX);
    scrollingData.put("speed_y", speedY);
    scrollingData.put("last_loc",currentLoc);
    scrollingData.put("last_action",currentTime);
}
 
源代码14 项目: android_9.0.0_r45   文件: SnoozeHelper.java
public void dump(PrintWriter pw, NotificationManagerService.DumpFilter filter) {
    pw.println("\n  Snoozed notifications:");
    for (int userId : mSnoozedNotifications.keySet()) {
        pw.print(INDENT);
        pw.println("user: " + userId);
        ArrayMap<String, ArrayMap<String, NotificationRecord>> snoozedPkgs =
                mSnoozedNotifications.get(userId);
        for (String pkg : snoozedPkgs.keySet()) {
            pw.print(INDENT);
            pw.print(INDENT);
            pw.println("package: " + pkg);
            Set<String> snoozedKeys = snoozedPkgs.get(pkg).keySet();
            for (String key : snoozedKeys) {
                pw.print(INDENT);
                pw.print(INDENT);
                pw.print(INDENT);
                pw.println(key);
            }
        }
    }
}
 
源代码15 项目: AndroidComponentPlugin   文件: ContentService.java
@Override
@RequiresPermission(android.Manifest.permission.CACHE_CONTENT)
public Bundle getCache(String packageName, Uri key, int userId) {
    enforceCrossUserPermission(userId, TAG);
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.CACHE_CONTENT, TAG);
    mContext.getSystemService(AppOpsManager.class).checkPackage(Binder.getCallingUid(),
            packageName);

    final String providerPackageName = getProviderPackageName(key);
    final Pair<String, Uri> fullKey = Pair.create(packageName, key);

    synchronized (mCache) {
        final ArrayMap<Pair<String, Uri>, Bundle> cache = findOrCreateCacheLocked(userId,
                providerPackageName);
        return cache.get(fullKey);
    }
}
 
源代码16 项目: android_9.0.0_r45   文件: AccessibilityManager.java
@Override
public void notifyServicesStateChanged() {
    final ArrayMap<AccessibilityServicesStateChangeListener, Handler> listeners;
    synchronized (mLock) {
        if (mServicesStateChangeListeners.isEmpty()) {
            return;
        }
        listeners = new ArrayMap<>(mServicesStateChangeListeners);
    }

    int numListeners = listeners.size();
    for (int i = 0; i < numListeners; i++) {
        final AccessibilityServicesStateChangeListener listener =
                mServicesStateChangeListeners.keyAt(i);
        mServicesStateChangeListeners.valueAt(i).post(() -> listener
                .onAccessibilityServicesStateChanged(AccessibilityManager.this));
    }
}
 
源代码17 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public boolean moveSharedPreferencesFrom(Context sourceContext, String name) {
    synchronized (ContextImpl.class) {
        final File source = sourceContext.getSharedPreferencesPath(name);
        final File target = getSharedPreferencesPath(name);

        final int res = moveFiles(source.getParentFile(), target.getParentFile(),
                source.getName());
        if (res > 0) {
            // We moved at least one file, so evict any in-memory caches for
            // either location
            final ArrayMap<File, SharedPreferencesImpl> cache =
                    getSharedPreferencesCacheLocked();
            cache.remove(source);
            cache.remove(target);
        }
        return res != -1;
    }
}
 
源代码18 项目: android_9.0.0_r45   文件: IntentResolver.java
private final void addFilter(ArrayMap<String, F[]> map, String name, F filter) {
    F[] array = map.get(name);
    if (array == null) {
        array = newArray(2);
        map.put(name,  array);
        array[0] = filter;
    } else {
        final int N = array.length;
        int i = N;
        while (i > 0 && array[i-1] == null) {
            i--;
        }
        if (i < N) {
            array[i] = filter;
        } else {
            F[] newa = newArray((N*3)/2);
            System.arraycopy(array, 0, newa, 0, N);
            newa[N] = filter;
            map.put(name, newa);
        }
    }
}
 
private void triggerViewsReady(final ArrayMap<String, View> sharedElements) {
    if (mAreViewsReady) {
        return;
    }
    mAreViewsReady = true;
    final ViewGroup decor = getDecor();
    // Ensure the views have been laid out before capturing the views -- we need the epicenter.
    if (decor == null || (decor.isAttachedToWindow() &&
            (sharedElements.isEmpty() || !sharedElements.valueAt(0).isLayoutRequested()))) {
        viewsReady(sharedElements);
    } else {
        mViewsReadyListener = OneShotPreDrawListener.add(decor, () -> {
            mViewsReadyListener = null;
            viewsReady(sharedElements);
        });
        decor.invalidate();
    }
}
 
源代码20 项目: android_9.0.0_r45   文件: Parcel.java
void readArrayMapSafelyInternal(ArrayMap outVal, int N,
    ClassLoader loader) {
    if (DEBUG_ARRAY_MAP) {
        RuntimeException here =  new RuntimeException("here");
        here.fillInStackTrace();
        Log.d(TAG, "Reading safely " + N + " ArrayMap entries", here);
    }
    while (N > 0) {
        String key = readString();
        if (DEBUG_ARRAY_MAP) Log.d(TAG, "  Read safe #" + (N-1) + ": key=0x"
                + (key != null ? key.hashCode() : 0) + " " + key);
        Object value = readValue(loader);
        outVal.put(key, value);
        N--;
    }
}
 
源代码21 项目: android_9.0.0_r45   文件: FileUpdater.java
/**
 * Write values to files. (Note the actual writes happen ASAP but asynchronously.)
 */
public void writeFiles(ArrayMap<String, String> fileValues) {
    synchronized (mLock) {
        for (int i = fileValues.size() - 1; i >= 0; i--) {
            final String file = fileValues.keyAt(i);
            final String value = fileValues.valueAt(i);

            if (DEBUG) {
                Slog.d(TAG, "Scheduling write: '" + value + "' to '" + file + "'");
            }

            mPendingWrites.put(file, value);

        }
        mRetries = 0;

        mHandler.removeCallbacks(mHandleWriteOnHandlerRunnable);
        mHandler.post(mHandleWriteOnHandlerRunnable);
    }
}
 
源代码22 项目: GLEXP-Team-onebillion   文件: OC_Pws.java
public void prepare()
{
    setStatus(STATUS_BUSY);
    super.prepare();
    loadFingers();
    loadEvent("master");
    showDemo = OBUtils.getBooleanValue(parameters.get("demo"));
    eventColours = new ArrayMap<>();
    eventColours = OBMisc.loadEventColours(this);
    componentDict = OBUtils.LoadWordComponentsXML(true);
    loadEvent(eventName());
    eventColours.putAll(OBMisc.loadEventColours(this));
    wordBag = new OC_WordBag((OBGroup)objectDict.get("word_bag"),this);
    setSceneXX(currentEvent());

    animateWobble = false;
    boxTouchMode = true;
    currentMode = MODE_BAG;
}
 
源代码23 项目: AndroidHttpCapture   文件: ProxyUtils.java
@TargetApi(Build.VERSION_CODES.KITKAT)
private static boolean setProxyLollipop(final Context context, String host, int port) {
    System.setProperty("http.proxyHost", host);
    System.setProperty("http.proxyPort", port + "");
    System.setProperty("https.proxyHost", host);
    System.setProperty("https.proxyPort", port + "");
    try {
        Context appContext = context.getApplicationContext();
        Class applictionClass = Class.forName("android.app.Application");
        Field mLoadedApkField = applictionClass.getDeclaredField("mLoadedApk");
        mLoadedApkField.setAccessible(true);
        Object mloadedApk = mLoadedApkField.get(appContext);
        Class loadedApkClass = Class.forName("android.app.LoadedApk");
        Field mReceiversField = loadedApkClass.getDeclaredField("mReceivers");
        mReceiversField.setAccessible(true);
        ArrayMap receivers = (ArrayMap) mReceiversField.get(mloadedApk);
        for (Object receiverMap : receivers.values()) {
            for (Object receiver : ((ArrayMap) receiverMap).keySet()) {
                Class clazz = receiver.getClass();
                if (clazz.getName().contains("ProxyChangeListener")) {
                    Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class);
                    Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);
                    onReceiveMethod.invoke(receiver, appContext, intent);
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }

    return true;
}
 
源代码24 项目: android_9.0.0_r45   文件: FragmentTransition.java
/**
 * The main entry point for Fragment Transitions, this starts the transitions
 * set on the leaving Fragment's {@link Fragment#getExitTransition()}, the
 * entering Fragment's {@link Fragment#getEnterTransition()} and
 * {@link Fragment#getSharedElementEnterTransition()}. When popping,
 * the leaving Fragment's {@link Fragment#getReturnTransition()} and
 * {@link Fragment#getSharedElementReturnTransition()} and the entering
 * {@link Fragment#getReenterTransition()} will be run.
 * <p>
 * With reordered Fragment Transitions, all Views have been added to the
 * View hierarchy prior to calling this method. The incoming Fragment's Views
 * will be INVISIBLE. With ordered Fragment Transitions, this method
 * is called before any change has been made to the hierarchy. That means
 * that the added Fragments have not created their Views yet and the hierarchy
 * is unknown.
 *
 * @param fragmentManager The executing FragmentManagerImpl
 * @param records The list of transactions being executed.
 * @param isRecordPop For each transaction, whether it is a pop transaction or not.
 * @param startIndex The first index into records and isRecordPop to execute as
 *                   part of this transition.
 * @param endIndex One past the last index into records and isRecordPop to execute
 *                 as part of this transition.
 * @param isReordered true if this is a reordered transaction, meaning that the
 *                    Views of incoming fragments have been added. false if the
 *                    transaction has yet to be run and Views haven't been created.
 */
static void startTransitions(FragmentManagerImpl fragmentManager,
        ArrayList<BackStackRecord> records, ArrayList<Boolean> isRecordPop,
        int startIndex, int endIndex, boolean isReordered) {
    if (fragmentManager.mCurState < Fragment.CREATED) {
        return;
    }
    SparseArray<FragmentContainerTransition> transitioningFragments =
            new SparseArray<>();
    for (int i = startIndex; i < endIndex; i++) {
        final BackStackRecord record = records.get(i);
        final boolean isPop = isRecordPop.get(i);
        if (isPop) {
            calculatePopFragments(record, transitioningFragments, isReordered);
        } else {
            calculateFragments(record, transitioningFragments, isReordered);
        }
    }

    if (transitioningFragments.size() != 0) {
        final View nonExistentView = new View(fragmentManager.mHost.getContext());
        final int numContainers = transitioningFragments.size();
        for (int i = 0; i < numContainers; i++) {
            int containerId = transitioningFragments.keyAt(i);
            ArrayMap<String, String> nameOverrides = calculateNameOverrides(containerId,
                    records, isRecordPop, startIndex, endIndex);

            FragmentContainerTransition containerTransition = transitioningFragments.valueAt(i);

            if (isReordered) {
                configureTransitionsReordered(fragmentManager, containerId,
                        containerTransition, nonExistentView, nameOverrides);
            } else {
                configureTransitionsOrdered(fragmentManager, containerId,
                        containerTransition, nonExistentView, nameOverrides);
            }
        }
    }
}
 
源代码25 项目: input-samples   文件: DebugService.java
static FillResponse createResponse(@NonNull Context context,
        @NonNull ArrayMap<String, AutofillId> fields, int numDatasets,
        boolean authenticateDatasets) {
    String packageName = context.getPackageName();
    FillResponse.Builder response = new FillResponse.Builder();
    // 1.Add the dynamic datasets
    for (int i = 1; i <= numDatasets; i++) {
        Dataset unlockedDataset = newUnlockedDataset(fields, packageName, i);
        if (authenticateDatasets) {
            Dataset.Builder lockedDataset = new Dataset.Builder();
            for (Entry<String, AutofillId> field : fields.entrySet()) {
                String hint = field.getKey();
                AutofillId id = field.getValue();
                String value = i + "-" + hint;
                IntentSender authentication =
                        SimpleAuthActivity.newIntentSenderForDataset(context, unlockedDataset);
                RemoteViews presentation = newDatasetPresentation(packageName,
                        "Tap to auth " + value);
                lockedDataset.setValue(id, null, presentation)
                        .setAuthentication(authentication);
            }
            response.addDataset(lockedDataset.build());
        } else {
            response.addDataset(unlockedDataset);
        }
    }

    // 2.Add save info
    Collection<AutofillId> ids = fields.values();
    AutofillId[] requiredIds = new AutofillId[ids.size()];
    ids.toArray(requiredIds);
    response.setSaveInfo(
            // We're simple, so we're generic
            new SaveInfo.Builder(SaveInfo.SAVE_DATA_TYPE_GENERIC, requiredIds).build());

    // 3.Profit!
    return response.build();
}
 
private void buildShowBadgeLocked() {
    Bundle showBadge = mRankingUpdate.getShowBadge();
    mShowBadge = new ArrayMap<>(showBadge.size());
    for (String key : showBadge.keySet()) {
        mShowBadge.put(key, showBadge.getBoolean(key));
    }
}
 
源代码27 项目: android_9.0.0_r45   文件: ContentService.java
@GuardedBy("mCache")
private ArrayMap<Pair<String, Uri>, Bundle> findOrCreateCacheLocked(int userId,
        String providerPackageName) {
    ArrayMap<String, ArrayMap<Pair<String, Uri>, Bundle>> userCache = mCache.get(userId);
    if (userCache == null) {
        userCache = new ArrayMap<>();
        mCache.put(userId, userCache);
    }
    ArrayMap<Pair<String, Uri>, Bundle> packageCache = userCache.get(providerPackageName);
    if (packageCache == null) {
        packageCache = new ArrayMap<>();
        userCache.put(providerPackageName, packageCache);
    }
    return packageCache;
}
 
源代码28 项目: android_9.0.0_r45   文件: PrintManager.java
/**
 * Listen for changes to the installed and enabled print services.
 *
 * @param listener the listener to add
 * @param handler the handler the listener is called back on
 *
 * @see android.print.PrintManager#getPrintServices
 *
 * @hide
 */
@SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRINT_SERVICES)
public void addPrintServicesChangeListener(@NonNull PrintServicesChangeListener listener,
        @Nullable Handler handler) {
    Preconditions.checkNotNull(listener);

    if (handler == null) {
        handler = mHandler;
    }

    if (mService == null) {
        Log.w(LOG_TAG, "Feature android.software.print not available");
        return;
    }
    if (mPrintServicesChangeListeners == null) {
        mPrintServicesChangeListeners = new ArrayMap<>();
    }
    PrintServicesChangeListenerWrapper wrappedListener =
            new PrintServicesChangeListenerWrapper(listener, handler);
    try {
        mService.addPrintServicesChangeListener(wrappedListener, mUserId);
        mPrintServicesChangeListeners.put(listener, wrappedListener);
    } catch (RemoteException re) {
        throw re.rethrowFromSystemServer();
    }
}
 
源代码29 项目: android_9.0.0_r45   文件: HealthStats.java
/**
 * Create an ArrayMap<String,T extends Parcelable> from the given Parcel using
 * the given Parcelable.Creator.
 */
private static <T extends Parcelable> ArrayMap<String,T> createParcelableMap(Parcel in,
        Parcelable.Creator<T> creator) {
    final int count = in.readInt();
    final ArrayMap<String,T> result = new ArrayMap<String,T>(count);
    for (int i=0; i<count; i++) {
        result.put(in.readString(), creator.createFromParcel(in));
    }
    return result;
}
 
源代码30 项目: android_9.0.0_r45   文件: Parcel.java
/**
 * @hide For testing only.
 */
public void readArrayMap(ArrayMap outVal, ClassLoader loader) {
    final int N = readInt();
    if (N < 0) {
        return;
    }
    readArrayMapInternal(outVal, N, loader);
}