/** Command for reading the historical records from a file off the UI thread. */ private void readHistoricalDataImpl() { try { GeckoProfile profile = GeckoProfile.get(mContext); File f = profile.getFile(mHistoryFileName); if (!f.exists()) { // Fall back to the non-profile aware file if it exists... File oldFile = new File(mHistoryFileName); oldFile.renameTo(f); } readHistoricalDataFromStream(new FileInputStream(f)); } catch (FileNotFoundException fnfe) { final Distribution dist = Distribution.getInstance(mContext); dist.addOnDistributionReadyCallback( new Runnable() { @Override public void run() { Log.d(LOGTAG, "Running post-distribution task: quickshare."); if (!dist.exists()) { return; } try { File distFile = dist.getDistributionFile("quickshare/" + mHistoryFileName); if (distFile == null) { if (DEBUG) { Log.i(LOG_TAG, "Could not open historical records file: " + mHistoryFileName); } return; } readHistoricalDataFromStream(new FileInputStream(distFile)); } catch (Exception ex) { if (DEBUG) { Log.i(LOG_TAG, "Could not open historical records file: " + mHistoryFileName); } return; } } }); } }