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

Commit 49e120a3 authored by Garfield Tan's avatar Garfield Tan Committed by android-build-merger
Browse files

Remove State#restored.

am: 40c85052

Change-Id: Ic17f93a15ea34bbea3c4d9453fa3e0f0b505434d
parents a8e5596c 40c85052
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -365,6 +365,12 @@ public abstract class BaseActivity
     */
     */
    @Override
    @Override
    public final void refreshCurrentRootAndDirectory(int anim) {
    public final void refreshCurrentRootAndDirectory(int anim) {
        // The following call will crash if it's called before onCreateOptionMenu() is called in
        // which we install menu item to search view manager, and there is a search query we need to
        // restore. This happens when we're still initializing our UI so we shouldn't cancel the
        // search which will be restored later in onCreateOptionMenu(). Try finding a way to guard
        // refreshCurrentRootAndDirectory() from being called while we're restoring the state of UI
        // from the saved state passed in onCreate().
        mSearchManager.cancelSearch();
        mSearchManager.cancelSearch();


        refreshDirectory(anim);
        refreshDirectory(anim);
+4 −0
Original line number Original line Diff line number Diff line
@@ -90,6 +90,10 @@ public class DocumentStack implements Durable, Parcelable {
        mRoot = src.mRoot;
        mRoot = src.mRoot;
    }
    }


    public boolean isInitialized() {
        return mRoot != null;
    }

    public @Nullable RootInfo getRoot() {
    public @Nullable RootInfo getRoot() {
        return mRoot;
        return mRoot;
    }
    }
+0 −3
Original line number Original line Diff line number Diff line
@@ -79,7 +79,6 @@ public class State implements android.os.Parcelable {
    public boolean localOnly;
    public boolean localOnly;
    public boolean showDeviceStorageOption;
    public boolean showDeviceStorageOption;
    public boolean showAdvanced;
    public boolean showAdvanced;
    public boolean restored;
    /*
    /*
     * Indicates handler was an external app, like photos.
     * Indicates handler was an external app, like photos.
     */
     */
@@ -131,7 +130,6 @@ public class State implements android.os.Parcelable {
        out.writeInt(localOnly ? 1 : 0);
        out.writeInt(localOnly ? 1 : 0);
        out.writeInt(showDeviceStorageOption ? 1 : 0);
        out.writeInt(showDeviceStorageOption ? 1 : 0);
        out.writeInt(showAdvanced ? 1 : 0);
        out.writeInt(showAdvanced ? 1 : 0);
        out.writeInt(restored ? 1 : 0);
        out.writeInt(external ? 1 : 0);
        out.writeInt(external ? 1 : 0);
        DurableUtils.writeToParcel(out, stack);
        DurableUtils.writeToParcel(out, stack);
        out.writeMap(dirConfigs);
        out.writeMap(dirConfigs);
@@ -155,7 +153,6 @@ public class State implements android.os.Parcelable {
            state.localOnly = in.readInt() != 0;
            state.localOnly = in.readInt() != 0;
            state.showDeviceStorageOption = in.readInt() != 0;
            state.showDeviceStorageOption = in.readInt() != 0;
            state.showAdvanced = in.readInt() != 0;
            state.showAdvanced = in.readInt() != 0;
            state.restored = in.readInt() != 0;
            state.external = in.readInt() != 0;
            state.external = in.readInt() != 0;
            DurableUtils.readFromParcel(in, state.stack);
            DurableUtils.readFromParcel(in, state.stack);
            in.readMap(state.dirConfigs, loader);
            in.readMap(state.dirConfigs, loader);
+9 −6
Original line number Original line Diff line number Diff line
@@ -341,12 +341,14 @@ public class ActionHandler<T extends Activity & Addons> extends AbstractActionHa
    public void initLocation(Intent intent) {
    public void initLocation(Intent intent) {
        assert(intent != null);
        assert(intent != null);


        if (mState.restored) {
        // stack is initialized if it's restored from bundle, which means we're restoring a
        // previously stored state.
        if (mState.stack.isInitialized()) {
            if (DEBUG) Log.d(TAG, "Stack already resolved for uri: " + intent.getData());
            if (DEBUG) Log.d(TAG, "Stack already resolved for uri: " + intent.getData());
            return;
            return;
        }
        }


        if (launchToStackLocation(mState.stack)) {
        if (launchToStackLocation(intent)) {
            if (DEBUG) Log.d(TAG, "Launched to location from stack.");
            if (DEBUG) Log.d(TAG, "Launched to location from stack.");
            return;
            return;
        }
        }
@@ -370,9 +372,8 @@ public class ActionHandler<T extends Activity & Addons> extends AbstractActionHa
        loadHomeDir();
        loadHomeDir();
    }
    }


    // If a non-empty stack is present in our state, it was read (presumably)
    // If EXTRA_STACK is not null in intent, we'll skip other means of loading
    // from EXTRA_STACK intent extra. In this case, we'll skip other means of
    // or restoring the stack (like URI).
    // loading or restoring the stack (like URI).
    //
    //
    // When restoring from a stack, if a URI is present, it should only ever be:
    // When restoring from a stack, if a URI is present, it should only ever be:
    // -- a launch URI: Launch URIs support sensible activity management,
    // -- a launch URI: Launch URIs support sensible activity management,
@@ -381,11 +382,13 @@ public class ActionHandler<T extends Activity & Addons> extends AbstractActionHa
    //
    //
    // Any other URI is *sorta* unexpected...except when browsing an archive
    // Any other URI is *sorta* unexpected...except when browsing an archive
    // in downloads.
    // in downloads.
    private boolean launchToStackLocation(DocumentStack stack) {
    private boolean launchToStackLocation(Intent intent) {
        DocumentStack stack = intent.getParcelableExtra(Shared.EXTRA_STACK);
        if (stack == null || stack.getRoot() == null) {
        if (stack == null || stack.getRoot() == null) {
            return false;
            return false;
        }
        }


        mState.stack.reset(stack);
        if (mState.stack.isEmpty()) {
        if (mState.stack.isEmpty()) {
            mActivity.onRootPicked(mState.stack.getRoot());
            mActivity.onRootPicked(mState.stack.getRoot());
        } else {
        } else {
+0 −5
Original line number Original line Diff line number Diff line
@@ -177,11 +177,6 @@ public class FilesActivity extends BaseActivity implements ActionHandler.Addons


        // Options specific to the DocumentsActivity.
        // Options specific to the DocumentsActivity.
        assert(!intent.hasExtra(Intent.EXTRA_LOCAL_ONLY));
        assert(!intent.hasExtra(Intent.EXTRA_LOCAL_ONLY));

        final DocumentStack stack = intent.getParcelableExtra(Shared.EXTRA_STACK);
        if (stack != null) {
            state.stack.reset(stack);
        }
    }
    }


    @Override
    @Override
Loading