Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e7f90df authored by herriojr's avatar herriojr Committed by Jon Herriott
Browse files

Fixed ANR associated with SecureStorage

An ANR was happening on SecureConsole when a very large item was
added, canceled, and click the parent in the Secure folder. This is
caused by the locking mechanism used by SecureConsole. Consoles,
long-term, need to be refactored to not synchronize on the
SecureConsole object itself during execute. The only fix we can do
without full refactoring is to not allow cancelling the operation
because the Console doesn't support the cancel operation.

Change-Id: I845372567b8656d63192bfde27952240915ecfe6
Ticket: QRDL-971
(cherry picked from commit ddb22bba)
parent 378030da
Loading
Loading
Loading
Loading
+16 −21
Original line number Diff line number Diff line
@@ -2301,27 +2301,14 @@ public class NavigationActivity extends Activity
        return false;
    }

    /**
     * Method that opens the actions dialog
     *
     * @param item The path or the {@link FileSystemObject}
     * @param global If the menu to display is the one with global actions
     */
    private void openActionsDialog(Object item, boolean global) {
        // Resolve the full path
        String path = String.valueOf(item);
        if (item instanceof FileSystemObject) {
            path = ((FileSystemObject)item).getFullPath();
        }

        // Prior to show the dialog, refresh the item reference
    private void openActionsDialog(String path, boolean global) {
        FileSystemObject fso = null;
        try {
            fso = CommandHelper.getFileInfo(this, path, false, null);
            if (fso == null) {
                throw new NoSuchFileOrDirectory(path);
            }

            openActionsDialog(fso, global);
        } catch (Exception e) {
            // Notify the user
            ExceptionUtil.translateException(this, e);
@@ -2330,17 +2317,25 @@ public class NavigationActivity extends Activity
            if (e instanceof FileNotFoundException || e instanceof NoSuchFileOrDirectory) {
                // If have a FileSystemObject reference then there is no need to search
                // the path (less resources used)
                if (item instanceof FileSystemObject) {
                    getCurrentNavigationView().removeItem((FileSystemObject)item);
                } else {
                    getCurrentNavigationView().removeItem((String)item);
                }
                getCurrentNavigationView().removeItem(path);
            }
            return;
        }
    }

    /**
     * Method that opens the actions dialog
     *
     * @param item The path or the {@link FileSystemObject}
     * @param global If the menu to display is the one with global actions
     */
    private void openActionsDialog(FileSystemObject item, boolean global) {
        // We used to refresh the item reference here, but the access to the SecureConsole is synchronized,
        // which can/will cause on ANR in certain scenarios.  We don't care if it doesn't exist anymore really
        // For this to work, SecureConsole NEEDS to be refactored.

        // Show the dialog
        ActionsDialog dialog = new ActionsDialog(this, this, fso, global, false);
        ActionsDialog dialog = new ActionsDialog(this, this, item, global, false);
        dialog.setOnRequestRefreshListener(this);
        dialog.setOnSelectionListener(getCurrentNavigationView());
        dialog.show();
+1 −1
Original line number Diff line number Diff line
@@ -282,7 +282,7 @@ public final class CopyMoveActionPolicy extends ActionsPolicy {
            }
            @Override
            public boolean isDialogCancellable() {
                return true;
                return false;
            }

            @Override