List of usage examples for android.os PersistableBundle getLong
public long getLong(String key)
From source file:com.android.contacts.DynamicShortcuts.java
@VisibleForTesting void updatePinned() { final List<ShortcutInfo> updates = new ArrayList<>(); final List<String> removedIds = new ArrayList<>(); final List<String> enable = new ArrayList<>(); for (ShortcutInfo shortcut : mShortcutManager.getPinnedShortcuts()) { final PersistableBundle extras = shortcut.getExtras(); if (extras == null || extras.getInt(EXTRA_SHORTCUT_TYPE, SHORTCUT_TYPE_UNKNOWN) != SHORTCUT_TYPE_CONTACT_URI) { continue; }// w w w.j a va 2s.c o m // The contact ID may have changed but that's OK because it is just an optimization final long contactId = extras.getLong(Contacts._ID); final ShortcutInfo update = createShortcutForUri(Contacts.getLookupUri(contactId, shortcut.getId())); if (update != null) { updates.add(update); if (!shortcut.isEnabled()) { // Handle the case that a contact is disabled because it doesn't exist but // later is created (for instance by a sync) enable.add(update.getId()); } } else if (shortcut.isEnabled()) { removedIds.add(shortcut.getId()); } } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "updating " + updates); Log.d(TAG, "enabling " + enable); Log.d(TAG, "disabling " + removedIds); } mShortcutManager.updateShortcuts(updates); mShortcutManager.enableShortcuts(enable); mShortcutManager.disableShortcuts(removedIds, mContext.getString(R.string.dynamic_shortcut_contact_removed_message)); }