public AccessPoint(Context context, Bundle savedState) {
   mContext = context;
   mConfig = savedState.getParcelable(KEY_CONFIG);
   if (mConfig != null) {
     loadConfig(mConfig);
   }
   if (savedState.containsKey(KEY_SSID)) {
     ssid = savedState.getString(KEY_SSID);
   }
   if (savedState.containsKey(KEY_SECURITY)) {
     security = savedState.getInt(KEY_SECURITY);
   }
   if (savedState.containsKey(KEY_PSKTYPE)) {
     pskType = savedState.getInt(KEY_PSKTYPE);
   }
   mInfo = (WifiInfo) savedState.getParcelable(KEY_WIFIINFO);
   if (savedState.containsKey(KEY_NETWORKINFO)) {
     mNetworkInfo = savedState.getParcelable(KEY_NETWORKINFO);
   }
   if (savedState.containsKey(KEY_SCANRESULTCACHE)) {
     ArrayList<ScanResult> scanResultArrayList =
         savedState.getParcelableArrayList(KEY_SCANRESULTCACHE);
     mScanResultCache.evictAll();
     for (ScanResult result : scanResultArrayList) {
       mScanResultCache.put(result.BSSID, result);
     }
   }
   update(mConfig, mInfo, mNetworkInfo);
   mRssi = getRssi();
   mSeen = getSeen();
 }
 /**
  * Invalidate the entire cache; the arguments are used for logging only, and indicate the write
  * operation that caused the invalidation
  *
  * @param operation a string describing the operation causing the invalidate (or null)
  * @param uri the uri causing the invalidate (or null)
  * @param selection the selection used with the uri (or null)
  */
 public synchronized void invalidate(String operation, Uri uri, String selection) {
   if (DEBUG_CACHE && (operation != null)) {
     LogUtils.d(
         mLogTag,
         "============ INVALIDATED BY " + operation + ": " + uri + ", SELECTION: " + selection);
   }
   mStats.mInvalidateCount++;
   // Close all cached cursors that are no longer in use
   mLruCache.evictAll();
   // Invalidate all current tokens
   mTokenList.invalidate();
 }
示例#3
0
 public void clearCache() {
   Log.v("마이볼리 캐쉬 사이즈", String.valueOf(cache.size()));
   Log.v("마이볼리 캐쉬", String.valueOf(cache));
   /*
   ClearCacheRequest ccr = new ClearCacheRequest(requestQueue.getCache(),
           new Runnable() {
               @Override
               public void run() {
               }
           });
   ccr.setTag(this);
   Log.v("캐쉬","클리어");
   requestQueue.add(ccr);*/
   cache.evictAll();
   Log.v("캐쉬", "클리어");
   Log.v("마이볼리 캐쉬 사이즈", String.valueOf(cache.size()));
   Log.v("마이볼리 캐쉬", String.valueOf(cache));
 }
  /**
   * Determine whether a word is a distracter to words in dictionaries.
   *
   * @param prevWordsInfo the information of previous words. Not used for now.
   * @param testedWord the word that will be tested to see whether it is a distracter to words in
   *     dictionaries.
   * @param locale the locale of word.
   * @return true if testedWord is a distracter, otherwise false.
   */
  @Override
  public boolean isDistracterToWordsInDictionaries(
      final PrevWordsInfo prevWordsInfo, final String testedWord, final Locale locale) {
    if (locale == null) {
      return false;
    }
    if (!locale.equals(mDictionaryFacilitator.getLocale())) {
      synchronized (mLock) {
        if (!mLocaleToSubtypeMap.containsKey(locale)) {
          Log.e(TAG, "Locale " + locale + " is not enabled.");
          // TODO: Investigate what we should do for disabled locales.
          return false;
        }
        loadKeyboardForLocale(locale);
        // Reset dictionaries for the locale.
        try {
          mDistractersCache.evictAll();
          loadDictionariesForLocale(locale);
        } catch (final InterruptedException e) {
          Log.e(TAG, "Interrupted while waiting for loading dicts in DistracterFilter", e);
          return false;
        }
      }
    }

    if (DEBUG) {
      Log.d(TAG, "testedWord: " + testedWord);
    }
    final Boolean isCachedDistracter = mDistractersCache.get(testedWord);
    if (isCachedDistracter != null && isCachedDistracter) {
      if (DEBUG) {
        Log.d(TAG, "isDistracter: true (cache hit)");
      }
      return true;
    }

    final boolean isDistracterCheckedByGetMaxFreqencyOfExactMatches =
        checkDistracterUsingMaxFreqencyOfExactMatches(testedWord);
    if (isDistracterCheckedByGetMaxFreqencyOfExactMatches) {
      // Add the word to the cache.
      mDistractersCache.put(testedWord, Boolean.TRUE);
      return true;
    }
    final boolean isValidWord =
        mDictionaryFacilitator.isValidWord(testedWord, false /* ignoreCase */);
    if (isValidWord) {
      // Valid word is not a distractor.
      if (DEBUG) {
        Log.d(TAG, "isDistracter: false (valid word)");
      }
      return false;
    }

    final boolean isDistracterCheckedByGetSuggestion =
        checkDistracterUsingGetSuggestions(testedWord);
    if (isDistracterCheckedByGetSuggestion) {
      // Add the word to the cache.
      mDistractersCache.put(testedWord, Boolean.TRUE);
      return true;
    }
    return false;
  }
 public void evictAll() {
   evictable.evictAll();
 }
示例#6
0
 @Override
 public void clear() {
   mCache.evictAll();
 }
 /**
  * Closes the helper and disposes all existing archives. It will block until all ongoing
  * operations on each opened archive are finished.
  */
 @Override
 public void close() {
   synchronized (mArchives) {
     mArchives.evictAll();
   }
 }