/**
  * If values are passed in, replaces any cached cursor with one containing new values, and then
  * closes the previously cached one (if any, and if not in use) If values are not passed in,
  * removes the row from cache If the row was locked, unlock it
  *
  * @param id the id of the row
  * @param values new ContentValues for the row (or null if row should simply be removed)
  * @param wasLocked whether or not the row was locked; if so, the lock will be removed
  */
 private void unlockImpl(String id, ContentValues values, boolean wasLocked) {
   Cursor c = get(id);
   if (c != null) {
     if (MailActivityEmail.DEBUG && DEBUG_CACHE) {
       LogUtils.d(mLogTag, "=========== Unlocking cache for: " + id);
     }
     if (values != null && !sLockCache) {
       MatrixCursor cursor = getMatrixCursor(id, mBaseProjection, values);
       if (cursor != null) {
         if (MailActivityEmail.DEBUG && DEBUG_CACHE) {
           LogUtils.d(mLogTag, "=========== Recaching with new values: " + id);
         }
         cursor.moveToFirst();
         mLruCache.put(id, cursor);
       } else {
         mLruCache.remove(id);
       }
     } else {
       mLruCache.remove(id);
     }
     // If there are no cursors using the old cached cursor, close it
     if (!sActiveCursors.contains(c)) {
       c.close();
     }
   }
   if (wasLocked) {
     mLockMap.subtract(id);
   }
 }
 /**
  * Try to continue chat conversation
  *
  * @param continueChat the intent to continue the chat conversation
  * @param chatId the chat ID
  * @return the unique ID to be used to create the pending intent if chat conversation is not on
  *     foreground or null if continuing the conversation succeeded
  */
 public Integer tryContinueChatConversation(Intent continueChat, String chatId) {
   if (mForegroundInfo.isConversationOnForeground(chatId)) {
     /*
      * Do not display notification if activity is on foreground for this chatId
      */
     Integer pendingIntentId = mPendingNotificationIdCache.get(chatId);
     if (pendingIntentId != null) {
       mPendingNotificationIdCache.remove(chatId);
       mNotifManager.cancel(pendingIntentId);
     }
     /* This will trigger onNewIntent for the target activity */
     mCtx.startActivity(continueChat);
     return null;
   }
   Integer uniquePendingIntentId = mPendingNotificationIdCache.get(chatId);
   if (uniquePendingIntentId == null) {
     /*
      * If the PendingIntent has the same operation, action, data, categories, components,
      * and flags it will be replaced. Invitation should be notified individually so we use a
      * random generator to provide a unique request code and reuse it for the notification.
      */
     uniquePendingIntentId = Utils.getUniqueIdForPendingIntent();
     mPendingNotificationIdCache.put(chatId, uniquePendingIntentId);
   }
   return uniquePendingIntentId;
 }
 /** Remove a bitmap from the LRU cache. */
 protected Bitmap removeBitmapFromMemCache(String key) {
   if (key == null) {
     return null;
   }
   if (key.startsWith(RecentPanelView.TASK_PACKAGE_IDENTIFIER)) {
     mKeys.remove(key);
   }
   return mMemoryCache.remove(key);
 }
示例#4
0
 /**
  * Creates an empty placeholder.
  *
  * @param size the size of the placeholder in pixels.
  * @return A new URI used to reference this placeholder
  */
 @Nonnull
 public static Uri addEmptyPlaceholder(@Nonnull Size size) {
   Uri uri = generateUniquePlaceholderUri();
   sSessionsToSizes.put(uri, new Point(size.getWidth(), size.getHeight()));
   sSessionsToPlaceholderBitmap.remove(uri);
   Integer currentVersion = sSessionsToPlaceholderVersions.get(uri);
   sSessionsToPlaceholderVersions.put(uri, currentVersion == null ? 0 : currentVersion + 1);
   return uri;
 }
示例#5
0
  public void removeCache(String url) {
    Log.v("마이볼리 캐쉬 사이즈", String.valueOf(cache.size()));
    Log.v("마이볼리 캐쉬", String.valueOf(cache));
    Log.v("url name", url);

    if (cache.remove(url) == null) {
      Log.v("url", "null");
    }

    Log.v("마이볼리 캐쉬 사이즈", String.valueOf(cache.size()));
    Log.v("마이볼리 캐쉬", String.valueOf(cache));
  }
 public static Bitmap removeBitmap(String key) {
   return sMemoryCache.remove(key);
 }
 public void remove(String key) {
   if (mLruCache != null) {
     mLruCache.remove(key);
   }
 }
示例#8
0
 /** Remove a placeholder from in memory storage. */
 public static void removePlaceholder(Uri uri) {
   sSessionsToSizes.remove(uri);
   sSessionsToPlaceholderBitmap.remove(uri);
   sSessionsToPlaceholderVersions.remove(uri);
 }
 /**
  * Releases resources for an archive with the specified document ID. It will block until all
  * operations on the archive are finished. If not opened, the method does nothing.
  *
  * <p>Calling this method is optional. The helper automatically closes the least recently used
  * archives if too many archives are opened.
  *
  * @param archiveDocumentId ID of the archive file.
  */
 public void closeArchive(String documentId) {
   synchronized (mArchives) {
     mArchives.remove(documentId);
   }
 }