Loading res/values/config.xml +8 −3 Original line number Diff line number Diff line Loading @@ -26,13 +26,18 @@ <!-- New features must be added behind a boolean flag prefixed w/ "feature_". Please add them in alphabetical order. Same goes for accessor methods in Features class. --> <bool name="feature_archive_creation">false</bool> <bool name="feature_remote_actions">true</bool> <bool name="feature_command_interceptor">true</bool> <bool name="feature_content_paging">true</bool> <bool name="feature_content_refresh">true</bool> <bool name="feature_folders_in_search_results">true</bool> <bool name="feature_system_keyboard_navigation">true</bool> <bool name="feature_gesture_scale">true</bool> <bool name="feature_launch_to_document">true</bool> <bool name="feature_content_refresh">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> </resources> src/com/android/documentsui/BaseActivity.java +3 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ import com.android.documentsui.prefs.LocalPreferences; import com.android.documentsui.prefs.Preferences; import com.android.documentsui.prefs.PreferencesMonitor; import com.android.documentsui.prefs.ScopedPreferences; import com.android.documentsui.queries.DebugCommandProcessor; import com.android.documentsui.queries.CommandInterceptor; import com.android.documentsui.queries.SearchViewManager; import com.android.documentsui.queries.SearchViewManager.SearchManagerListener; import com.android.documentsui.roots.GetRootDocumentTask; Loading Loading @@ -179,8 +179,8 @@ public abstract class BaseActivity // We piggy back on search input as it is the only text input // area in the app. But the functionality is independent // of "regular" search query processing. DebugCommandProcessor dbgCommands = new DebugCommandProcessor(); dbgCommands.add(new DebugCommandProcessor.DumpRootsCacheHandler(this)); CommandInterceptor dbgCommands = new CommandInterceptor(mInjector.features); dbgCommands.add(new CommandInterceptor.DumpRootsCacheHandler(this)); mSearchManager = new SearchViewManager(searchListener, dbgCommands, icicle); mSortController = SortController.create(this, mState.derivedMode, mState.sortModel); Loading src/com/android/documentsui/base/DebugFlags.java +2 −11 Original line number Diff line number Diff line Loading @@ -18,19 +18,18 @@ package com.android.documentsui.base; import android.content.ContentResolver; import android.os.Bundle; import com.android.documentsui.queries.DebugCommandProcessor; import com.android.documentsui.queries.CommandInterceptor; import javax.annotation.Nullable; /** * Shared values that may be set by {@link DebugCommandProcessor}. * Shared values that may be set by {@link CommandInterceptor}. */ public final class DebugFlags { private DebugFlags() {} private static String mQvPackage; private static boolean sGestureScaleEnabled; private static boolean sDocumentDetailsEnabled; private static int sForcedPageOffset = -1; private static int sForcedPageLimit = -1; Loading @@ -51,14 +50,6 @@ public final class DebugFlags { return sDocumentDetailsEnabled; } public static void setGestureScaleEnabled(boolean enabled) { sGestureScaleEnabled = enabled; } public static boolean getGestureScaleEnabled() { return sGestureScaleEnabled; } public static void setForcedPaging(int offset, int limit) { sForcedPageOffset = offset; sForcedPageLimit = limit; Loading src/com/android/documentsui/base/Features.java +48 −14 Original line number Diff line number Diff line Loading @@ -15,7 +15,9 @@ */ package com.android.documentsui.base; import android.annotation.BoolRes; import android.content.res.Resources; import android.util.SparseBooleanArray; import com.android.documentsui.R; Loading @@ -29,63 +31,95 @@ public interface Features { android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.N_MR1; boolean isArchiveCreationEnabled(); boolean isRemoteActionsEnabled(); boolean isCommandInterceptorEnabled(); boolean isContentPagingEnabled(); boolean isContentRefreshEnabled(); boolean isFoldersInSearchResultsEnabled(); boolean isSystemKeyboardNavigationEnabled(); boolean isGestureScaleEnabled(); boolean isLaunchToDocumentEnabled(); boolean isRemoteActionsEnabled(); boolean isSystemKeyboardNavigationEnabled(); boolean isVirtualFilesSharingEnabled(); boolean isContentRefreshEnabled(); public static Features create(Resources resources) { return new RuntimeFeatures(resources); } /** * Call this to force-enable any particular feature known by this class. * Note that all feature may not support being enabled at runtime as * they may depend on runtime initialization guarded by feature check. * * <p>Feature changes will be persisted across activities, but not app restarts. * * @param feature int reference to a boolean feature resource. */ public static void forceFeature(@BoolRes int feature, boolean enabled) { RuntimeFeatures.sDebugEnabled.put(feature, enabled); } final class RuntimeFeatures implements Features { private static final SparseBooleanArray sDebugEnabled = new SparseBooleanArray(); private final Resources mRes; public RuntimeFeatures(Resources resources) { mRes = resources; } private boolean isEnabled(@BoolRes int feature) { return sDebugEnabled.get(feature, mRes.getBoolean(feature)); } @Override public boolean isArchiveCreationEnabled() { return mRes.getBoolean(R.bool.feature_archive_creation); return isEnabled(R.bool.feature_archive_creation); } @Override public boolean isRemoteActionsEnabled() { return mRes.getBoolean(R.bool.feature_remote_actions); public boolean isCommandInterceptorEnabled() { return isEnabled(R.bool.feature_command_interceptor); } @Override public boolean isContentPagingEnabled() { return mRes.getBoolean(R.bool.feature_content_paging); return isEnabled(R.bool.feature_content_paging); } @Override public boolean isContentRefreshEnabled() { return isEnabled(R.bool.feature_content_refresh); } @Override public boolean isFoldersInSearchResultsEnabled() { return mRes.getBoolean(R.bool.feature_folders_in_search_results); return isEnabled(R.bool.feature_folders_in_search_results); } @Override public boolean isSystemKeyboardNavigationEnabled() { return mRes.getBoolean(R.bool.feature_system_keyboard_navigation); public boolean isGestureScaleEnabled() { return isEnabled(R.bool.feature_gesture_scale); } @Override public boolean isLaunchToDocumentEnabled() { return mRes.getBoolean(R.bool.feature_launch_to_document); return isEnabled(R.bool.feature_launch_to_document); } @Override public boolean isContentRefreshEnabled() { return mRes.getBoolean(R.bool.feature_content_refresh); public boolean isRemoteActionsEnabled() { return isEnabled(R.bool.feature_remote_actions); } @Override public boolean isSystemKeyboardNavigationEnabled() { return isEnabled(R.bool.feature_system_keyboard_navigation); } @Override public boolean isVirtualFilesSharingEnabled() { return mRes.getBoolean(R.bool.feature_virtual_files_sharing); return isEnabled(R.bool.feature_virtual_files_sharing); } } } src/com/android/documentsui/dirlist/DirectoryFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -370,6 +370,7 @@ public class DirectoryFragment extends Fragment gestureHandler); new ListeningGestureDetector( mInjector.features, this.getContext(), mRecView, mDragStartListener::onMouseDragEvent, Loading Loading
res/values/config.xml +8 −3 Original line number Diff line number Diff line Loading @@ -26,13 +26,18 @@ <!-- New features must be added behind a boolean flag prefixed w/ "feature_". Please add them in alphabetical order. Same goes for accessor methods in Features class. --> <bool name="feature_archive_creation">false</bool> <bool name="feature_remote_actions">true</bool> <bool name="feature_command_interceptor">true</bool> <bool name="feature_content_paging">true</bool> <bool name="feature_content_refresh">true</bool> <bool name="feature_folders_in_search_results">true</bool> <bool name="feature_system_keyboard_navigation">true</bool> <bool name="feature_gesture_scale">true</bool> <bool name="feature_launch_to_document">true</bool> <bool name="feature_content_refresh">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> </resources>
src/com/android/documentsui/BaseActivity.java +3 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ import com.android.documentsui.prefs.LocalPreferences; import com.android.documentsui.prefs.Preferences; import com.android.documentsui.prefs.PreferencesMonitor; import com.android.documentsui.prefs.ScopedPreferences; import com.android.documentsui.queries.DebugCommandProcessor; import com.android.documentsui.queries.CommandInterceptor; import com.android.documentsui.queries.SearchViewManager; import com.android.documentsui.queries.SearchViewManager.SearchManagerListener; import com.android.documentsui.roots.GetRootDocumentTask; Loading Loading @@ -179,8 +179,8 @@ public abstract class BaseActivity // We piggy back on search input as it is the only text input // area in the app. But the functionality is independent // of "regular" search query processing. DebugCommandProcessor dbgCommands = new DebugCommandProcessor(); dbgCommands.add(new DebugCommandProcessor.DumpRootsCacheHandler(this)); CommandInterceptor dbgCommands = new CommandInterceptor(mInjector.features); dbgCommands.add(new CommandInterceptor.DumpRootsCacheHandler(this)); mSearchManager = new SearchViewManager(searchListener, dbgCommands, icicle); mSortController = SortController.create(this, mState.derivedMode, mState.sortModel); Loading
src/com/android/documentsui/base/DebugFlags.java +2 −11 Original line number Diff line number Diff line Loading @@ -18,19 +18,18 @@ package com.android.documentsui.base; import android.content.ContentResolver; import android.os.Bundle; import com.android.documentsui.queries.DebugCommandProcessor; import com.android.documentsui.queries.CommandInterceptor; import javax.annotation.Nullable; /** * Shared values that may be set by {@link DebugCommandProcessor}. * Shared values that may be set by {@link CommandInterceptor}. */ public final class DebugFlags { private DebugFlags() {} private static String mQvPackage; private static boolean sGestureScaleEnabled; private static boolean sDocumentDetailsEnabled; private static int sForcedPageOffset = -1; private static int sForcedPageLimit = -1; Loading @@ -51,14 +50,6 @@ public final class DebugFlags { return sDocumentDetailsEnabled; } public static void setGestureScaleEnabled(boolean enabled) { sGestureScaleEnabled = enabled; } public static boolean getGestureScaleEnabled() { return sGestureScaleEnabled; } public static void setForcedPaging(int offset, int limit) { sForcedPageOffset = offset; sForcedPageLimit = limit; Loading
src/com/android/documentsui/base/Features.java +48 −14 Original line number Diff line number Diff line Loading @@ -15,7 +15,9 @@ */ package com.android.documentsui.base; import android.annotation.BoolRes; import android.content.res.Resources; import android.util.SparseBooleanArray; import com.android.documentsui.R; Loading @@ -29,63 +31,95 @@ public interface Features { android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.N_MR1; boolean isArchiveCreationEnabled(); boolean isRemoteActionsEnabled(); boolean isCommandInterceptorEnabled(); boolean isContentPagingEnabled(); boolean isContentRefreshEnabled(); boolean isFoldersInSearchResultsEnabled(); boolean isSystemKeyboardNavigationEnabled(); boolean isGestureScaleEnabled(); boolean isLaunchToDocumentEnabled(); boolean isRemoteActionsEnabled(); boolean isSystemKeyboardNavigationEnabled(); boolean isVirtualFilesSharingEnabled(); boolean isContentRefreshEnabled(); public static Features create(Resources resources) { return new RuntimeFeatures(resources); } /** * Call this to force-enable any particular feature known by this class. * Note that all feature may not support being enabled at runtime as * they may depend on runtime initialization guarded by feature check. * * <p>Feature changes will be persisted across activities, but not app restarts. * * @param feature int reference to a boolean feature resource. */ public static void forceFeature(@BoolRes int feature, boolean enabled) { RuntimeFeatures.sDebugEnabled.put(feature, enabled); } final class RuntimeFeatures implements Features { private static final SparseBooleanArray sDebugEnabled = new SparseBooleanArray(); private final Resources mRes; public RuntimeFeatures(Resources resources) { mRes = resources; } private boolean isEnabled(@BoolRes int feature) { return sDebugEnabled.get(feature, mRes.getBoolean(feature)); } @Override public boolean isArchiveCreationEnabled() { return mRes.getBoolean(R.bool.feature_archive_creation); return isEnabled(R.bool.feature_archive_creation); } @Override public boolean isRemoteActionsEnabled() { return mRes.getBoolean(R.bool.feature_remote_actions); public boolean isCommandInterceptorEnabled() { return isEnabled(R.bool.feature_command_interceptor); } @Override public boolean isContentPagingEnabled() { return mRes.getBoolean(R.bool.feature_content_paging); return isEnabled(R.bool.feature_content_paging); } @Override public boolean isContentRefreshEnabled() { return isEnabled(R.bool.feature_content_refresh); } @Override public boolean isFoldersInSearchResultsEnabled() { return mRes.getBoolean(R.bool.feature_folders_in_search_results); return isEnabled(R.bool.feature_folders_in_search_results); } @Override public boolean isSystemKeyboardNavigationEnabled() { return mRes.getBoolean(R.bool.feature_system_keyboard_navigation); public boolean isGestureScaleEnabled() { return isEnabled(R.bool.feature_gesture_scale); } @Override public boolean isLaunchToDocumentEnabled() { return mRes.getBoolean(R.bool.feature_launch_to_document); return isEnabled(R.bool.feature_launch_to_document); } @Override public boolean isContentRefreshEnabled() { return mRes.getBoolean(R.bool.feature_content_refresh); public boolean isRemoteActionsEnabled() { return isEnabled(R.bool.feature_remote_actions); } @Override public boolean isSystemKeyboardNavigationEnabled() { return isEnabled(R.bool.feature_system_keyboard_navigation); } @Override public boolean isVirtualFilesSharingEnabled() { return mRes.getBoolean(R.bool.feature_virtual_files_sharing); return isEnabled(R.bool.feature_virtual_files_sharing); } } }
src/com/android/documentsui/dirlist/DirectoryFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -370,6 +370,7 @@ public class DirectoryFragment extends Fragment gestureHandler); new ListeningGestureDetector( mInjector.features, this.getContext(), mRecView, mDragStartListener::onMouseDragEvent, Loading