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

Commit b9ac9cf6 authored by Garfield Tan's avatar Garfield Tan
Browse files

Add a feature flag for overwrite confirmation dialog.

Showing that dialog breaks one CTS test in NYC ARC++.

Test: Auto tests & manual tests w/o confirmation.

Change-Id: If3a568b4c48e75b302fbc879b2b6ae693fb68c20
parent 1d4e007d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
    <bool name="feature_job_progress_dialog">true</bool>
    <bool name="feature_launch_to_document">true</bool>
    <bool name="feature_notification_channel">true</bool>
    <bool name="feature_overwrite_confirmation">true</bool>
    <bool name="feature_remote_actions">true</bool>
    <bool name="feature_system_keyboard_navigation">true</bool>
    <bool name="feature_virtual_files_sharing">true</bool>
+6 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public interface Features {
    boolean isJobProgressDialogEnabled();
    boolean isLaunchToDocumentEnabled();
    boolean isNotificationChannelEnabled();
    boolean isOverwriteConfirmationEnabled();
    boolean isRemoteActionsEnabled();
    boolean isSystemKeyboardNavigationEnabled();
    boolean isVirtualFilesSharingEnabled();
@@ -134,6 +135,11 @@ public interface Features {
            return isEnabled(R.bool.feature_notification_channel);
        }

        @Override
        public boolean isOverwriteConfirmationEnabled() {
            return isEnabled(R.bool.feature_overwrite_confirmation);
        }

        @Override
        public boolean isRemoteActionsEnabled() {
            return isEnabled(R.bool.feature_remote_actions);
+7 −1
Original line number Diff line number Diff line
@@ -301,7 +301,13 @@ class ActionHandler<T extends Activity & Addons> extends AbstractActionHandler<T
        assert(mState.action == ACTION_CREATE);
        assert(replaceTarget != null);

        // Adding a confirmation dialog breaks an inherited CTS test (testCreateExisting), so we
        // need to add a feature flag to bypass this feature in ARC++ environment.
        if (mFeatures.isOverwriteConfirmationEnabled()) {
            mInjector.dialogs.confirmOverwrite(fm, replaceTarget);
        } else {
            finishPicking(replaceTarget.derivedUri);
        }
    }

    void finishPicking(Uri... docs) {
+6 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ public class TestFeatures implements Features {
    public boolean jobProgressDialog = false;
    public boolean launchToDocument = true;
    public boolean notificationChannel = true;
    public boolean overwriteConfirmation = true;
    public boolean remoteActions = true;
    public boolean systemKeyboardNavigation = true;
    public boolean virtualFilesSharing = true;
@@ -85,6 +86,11 @@ public class TestFeatures implements Features {
        return notificationChannel;
    }

    @Override
    public boolean isOverwriteConfirmationEnabled() {
        return overwriteConfirmation;
    }

    @Override
    public boolean isRemoteActionsEnabled() {
        return remoteActions;
+4 −0
Original line number Diff line number Diff line
@@ -275,6 +275,10 @@ public class ActionHandlerTest {

    @Test
    public void testSaveDocument_ConfirmsOverwrite() {
        if (!mEnv.features.isOverwriteConfirmationEnabled()) {
            return;
        }

        mEnv.state.action = State.ACTION_CREATE;
        mEnv.state.stack.changeRoot(TestProvidersAccess.HOME);
        mEnv.state.stack.push(TestEnv.FOLDER_1);