Esempio n. 1
0
  public void onStackPicked(DocumentStack stack) {
    try {
      // Update the restored stack to ensure we have freshest data
      stack.updateDocuments(getContentResolver());

      mState.stack = stack;
      mState.stackTouched = true;
      onCurrentDirectoryChanged(ANIM_SIDE);

    } catch (FileNotFoundException e) {
      Log.w(TAG, "Failed to restore stack: " + e);
    }
  }
Esempio n. 2
0
 @Override
 protected Void doInBackground(Void... params) {
   // Restore last stack for calling package
   final String packageName = getCallingPackageMaybeExtra();
   final Cursor cursor =
       getContentResolver()
           .query(RecentsProvider.buildResume(packageName), null, null, null, null);
   try {
     if (cursor.moveToFirst()) {
       mExternal = cursor.getInt(cursor.getColumnIndex(ResumeColumns.EXTERNAL)) != 0;
       final byte[] rawStack = cursor.getBlob(cursor.getColumnIndex(ResumeColumns.STACK));
       /// M: modify stack on UI thread @{
       DurableUtils.readFromArray(rawStack, mStack);
       mRestoredStack = true;
       mShouldReset = true;
       /// @}
     }
   } catch (IOException e) {
     Log.w(TAG, "Failed to resume: " + e);
   } finally {
     IoUtils.closeQuietly(cursor);
   }
   /// M: modify stack on UI thread @{
   if (mRestoredStack) {
     // Update the restored stack to ensure we have freshest data
     final Collection<RootInfo> matchingRoots = mRoots.getMatchingRootsBlocking(mState);
     try {
       mStack.updateRoot(matchingRoots);
       mStack.updateDocuments(getContentResolver());
     } catch (FileNotFoundException e) {
       Log.w(TAG, "Failed to restore stack: " + e);
       mStack.reset();
       mRestoredStack = false;
     }
   }
   /// @}
   return null;
 }