android.util.ArrayMap#entrySet ( )源码实例Demo

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

源代码1 项目: android_9.0.0_r45   文件: SnoozeHelper.java
protected boolean cancel(int userId, String pkg, String tag, int id) {
    if (mSnoozedNotifications.containsKey(userId)) {
        ArrayMap<String, NotificationRecord> recordsForPkg =
                mSnoozedNotifications.get(userId).get(pkg);
        if (recordsForPkg != null) {
            final Set<Map.Entry<String, NotificationRecord>> records = recordsForPkg.entrySet();
            String key = null;
            for (Map.Entry<String, NotificationRecord> record : records) {
                final StatusBarNotification sbn = record.getValue().sbn;
                if (Objects.equals(sbn.getTag(), tag) && sbn.getId() == id) {
                    record.getValue().isCanceled = true;
                    return true;
                }
            }
        }
    }
    return false;
}
 
源代码2 项目: buck   文件: ResourcesLoader.java
@TargetApi(NOUGAT)
private static void updateResourceKeys(Context context, String originalResourcePath)
    throws InvocationTargetException, IllegalAccessException, NoSuchFieldException, IOException {
  List<String> exoResourcePaths = getExoPaths(context);
  if (exoResourcePaths.isEmpty()) {
    return;
  }
  String resDir = exoResourcePaths.get(0);
  String[] splitResDirs =
      exoResourcePaths
          .subList(1, exoResourcePaths.size())
          .toArray(new String[exoResourcePaths.size() - 1]);

  ArrayMap<?, ?> resourceImpls = ResourcesManagerInternal.getInstance().getResourceImpls();
  ArrayMap<Object, Object> newResourceImpls = new ArrayMap<>(resourceImpls.size());
  for (Map.Entry<?, ?> entry : resourceImpls.entrySet()) {
    Object key = entry.getKey();
    ResourcesKeyInternal keyInternal = new ResourcesKeyInternal(key);
    if (keyInternal.getResDir().equals(originalResourcePath)) {
      keyInternal.setResDir(resDir);
      keyInternal.setSplitResDirs(splitResDirs);
      newResourceImpls.put(key, entry.getValue());
    }
  }
  ResourcesManagerInternal.getInstance().setResourceImpls(newResourceImpls);
}
 
源代码3 项目: 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();
}
 
源代码4 项目: android-AutofillFramework   文件: 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();
}
 
源代码5 项目: Android-Plugin-Framework   文件: Debug.java
public static boolean trackHuaweiReceivers() {
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
        return false;
    }
    boolean maybeLeak = false;
    Object mLoadedApk = new HackApplication(FairyGlobal.getHostApplication()).getLoadedApk();
    if (mLoadedApk != null) {
        Object object = new HackLoadedApk(mLoadedApk).getReceivers();
        if (object != null && object instanceof ArrayMap) {
            ArrayMap arrayMap = (ArrayMap) object;
            Set entrySet = arrayMap.entrySet();
            Iterator entrySetIterator = entrySet.iterator();
            JSONObject jsonObject = new JSONObject();
            while(entrySetIterator.hasNext()) {
                Object entry = entrySetIterator.next();
                if (entry instanceof Map.Entry) {
                    String key1 = ((Map.Entry)entry).getKey().getClass().getName();
                    Object value = ((Map.Entry)entry).getValue();
                    if (value instanceof ArrayMap) {
                        Iterator valueIterator = ((ArrayMap)value).entrySet().iterator();
                        while (valueIterator.hasNext()) {
                            Object valueEntry = valueIterator.next();
                            if (valueEntry instanceof Map.Entry) {
                                String key2 = ((Map.Entry)valueEntry).getKey().getClass().getName();
                                String key = key1 + "->" + key2;
                                int count = jsonObject.optInt(key);
                                count++;
                                try {
                                    jsonObject.put(key, count);
                                } catch (JSONException e) {
                                }
                                if (count >=10) {
                                    maybeLeak = true;
                                }
                            }
                        }
                    }
                }
            }
            Log.e("Debug_track", jsonObject.toString());
        }
    }
    return maybeLeak;
}