Loading packages/DocumentsUI/src/com/android/documentsui/Metrics.java +2 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.net.Uri; import android.provider.DocumentsContract; import android.util.Log; import com.android.documentsui.State.ActionType; import com.android.documentsui.model.DocumentInfo; import com.android.documentsui.model.RootInfo; import com.android.documentsui.services.FileOperationService; Loading Loading @@ -502,7 +503,7 @@ public final class Metrics { * @param name The name of the histogram. * @param bucket The bucket to increment. */ private static void logHistogram(Context context, String name, int bucket) { private static void logHistogram(Context context, String name, @ActionType int bucket) { if (DEBUG) Log.d(TAG, name + ": " + bucket); MetricsLogger.histogram(context, name, bucket); } Loading packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java +6 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.documentsui; import static com.android.documentsui.Shared.DEBUG; import static com.android.documentsui.State.ACTION_OPEN_TREE; import android.app.Fragment; import android.app.FragmentManager; Loading Loading @@ -117,7 +118,7 @@ public class RootsFragment extends Fragment { Intent handlerAppIntent = getArguments().getParcelable(EXTRA_INCLUDE_APPS); mAdapter = new RootsAdapter(context, result, handlerAppIntent); mAdapter = new RootsAdapter(context, result, handlerAppIntent, state); mList.setAdapter(mAdapter); onCurrentRootChanged(); Loading Loading @@ -308,8 +309,8 @@ public class RootsFragment extends Fragment { * @param handlerAppIntent When not null, apps capable of handling the original * intent will be included in list of roots (in special section at bottom). */ public RootsAdapter( Context context, Collection<RootInfo> roots, @Nullable Intent handlerAppIntent) { public RootsAdapter(Context context, Collection<RootInfo> roots, @Nullable Intent handlerAppIntent, State state) { super(context, 0); final List<RootItem> libraries = new ArrayList<>(); Loading @@ -320,7 +321,8 @@ public class RootsFragment extends Fragment { if (root.isHome() && Shared.isHomeRootHidden(context)) { continue; } else if (root.isAdvanced() && Shared.areAdvancedRootsHidden(context)) { } else if (root.isAdvanced() && Shared.areAdvancedRootsHidden(context, state)) { continue; } else if (root.isLibrary()) { if (DEBUG) Log.d(TAG, "Adding " + root + " as library."); Loading packages/DocumentsUI/src/com/android/documentsui/Shared.java +8 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,11 @@ import android.text.TextUtils; import android.text.format.DateUtils; import android.text.format.Time; import android.view.WindowManager; import com.android.documentsui.State.ActionType; import static com.android.documentsui.State.ACTION_OPEN_TREE; import android.app.AlertDialog; import java.text.Collator; Loading Loading @@ -179,8 +184,9 @@ public final class Shared { /* * Indicates if the advanced roots should be hidden. */ public static boolean areAdvancedRootsHidden(Context context) { return context.getResources().getBoolean(R.bool.advanced_roots_hidden); public static boolean areAdvancedRootsHidden(Context context, State state) { return context.getResources().getBoolean(R.bool.advanced_roots_hidden) && state.action != ACTION_OPEN_TREE; } } packages/DocumentsUI/src/com/android/documentsui/State.java +11 −2 Original line number Diff line number Diff line Loading @@ -43,10 +43,19 @@ public class State implements android.os.Parcelable { private static final String TAG = "State"; @IntDef(flag = true, value = { ACTION_BROWSE, ACTION_PICK_COPY_DESTINATION, ACTION_OPEN, ACTION_CREATE, ACTION_GET_CONTENT, ACTION_OPEN_TREE }) @Retention(RetentionPolicy.SOURCE) public @interface ActionType {} // File manager and related private picking activity. public static final int ACTION_BROWSE = 1; public static final int ACTION_PICK_COPY_DESTINATION = 2; // All public picking activities public static final int ACTION_OPEN = 3; public static final int ACTION_CREATE = 4; Loading @@ -69,7 +78,7 @@ public class State implements android.os.Parcelable { public static final int SORT_ORDER_LAST_MODIFIED = 2; public static final int SORT_ORDER_SIZE = 3; public int action; public @ActionType int action; public String[] acceptMimes; /** Derived from local preferences */ Loading Loading
packages/DocumentsUI/src/com/android/documentsui/Metrics.java +2 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.net.Uri; import android.provider.DocumentsContract; import android.util.Log; import com.android.documentsui.State.ActionType; import com.android.documentsui.model.DocumentInfo; import com.android.documentsui.model.RootInfo; import com.android.documentsui.services.FileOperationService; Loading Loading @@ -502,7 +503,7 @@ public final class Metrics { * @param name The name of the histogram. * @param bucket The bucket to increment. */ private static void logHistogram(Context context, String name, int bucket) { private static void logHistogram(Context context, String name, @ActionType int bucket) { if (DEBUG) Log.d(TAG, name + ": " + bucket); MetricsLogger.histogram(context, name, bucket); } Loading
packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java +6 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.documentsui; import static com.android.documentsui.Shared.DEBUG; import static com.android.documentsui.State.ACTION_OPEN_TREE; import android.app.Fragment; import android.app.FragmentManager; Loading Loading @@ -117,7 +118,7 @@ public class RootsFragment extends Fragment { Intent handlerAppIntent = getArguments().getParcelable(EXTRA_INCLUDE_APPS); mAdapter = new RootsAdapter(context, result, handlerAppIntent); mAdapter = new RootsAdapter(context, result, handlerAppIntent, state); mList.setAdapter(mAdapter); onCurrentRootChanged(); Loading Loading @@ -308,8 +309,8 @@ public class RootsFragment extends Fragment { * @param handlerAppIntent When not null, apps capable of handling the original * intent will be included in list of roots (in special section at bottom). */ public RootsAdapter( Context context, Collection<RootInfo> roots, @Nullable Intent handlerAppIntent) { public RootsAdapter(Context context, Collection<RootInfo> roots, @Nullable Intent handlerAppIntent, State state) { super(context, 0); final List<RootItem> libraries = new ArrayList<>(); Loading @@ -320,7 +321,8 @@ public class RootsFragment extends Fragment { if (root.isHome() && Shared.isHomeRootHidden(context)) { continue; } else if (root.isAdvanced() && Shared.areAdvancedRootsHidden(context)) { } else if (root.isAdvanced() && Shared.areAdvancedRootsHidden(context, state)) { continue; } else if (root.isLibrary()) { if (DEBUG) Log.d(TAG, "Adding " + root + " as library."); Loading
packages/DocumentsUI/src/com/android/documentsui/Shared.java +8 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,11 @@ import android.text.TextUtils; import android.text.format.DateUtils; import android.text.format.Time; import android.view.WindowManager; import com.android.documentsui.State.ActionType; import static com.android.documentsui.State.ACTION_OPEN_TREE; import android.app.AlertDialog; import java.text.Collator; Loading Loading @@ -179,8 +184,9 @@ public final class Shared { /* * Indicates if the advanced roots should be hidden. */ public static boolean areAdvancedRootsHidden(Context context) { return context.getResources().getBoolean(R.bool.advanced_roots_hidden); public static boolean areAdvancedRootsHidden(Context context, State state) { return context.getResources().getBoolean(R.bool.advanced_roots_hidden) && state.action != ACTION_OPEN_TREE; } }
packages/DocumentsUI/src/com/android/documentsui/State.java +11 −2 Original line number Diff line number Diff line Loading @@ -43,10 +43,19 @@ public class State implements android.os.Parcelable { private static final String TAG = "State"; @IntDef(flag = true, value = { ACTION_BROWSE, ACTION_PICK_COPY_DESTINATION, ACTION_OPEN, ACTION_CREATE, ACTION_GET_CONTENT, ACTION_OPEN_TREE }) @Retention(RetentionPolicy.SOURCE) public @interface ActionType {} // File manager and related private picking activity. public static final int ACTION_BROWSE = 1; public static final int ACTION_PICK_COPY_DESTINATION = 2; // All public picking activities public static final int ACTION_OPEN = 3; public static final int ACTION_CREATE = 4; Loading @@ -69,7 +78,7 @@ public class State implements android.os.Parcelable { public static final int SORT_ORDER_LAST_MODIFIED = 2; public static final int SORT_ORDER_SIZE = 3; public int action; public @ActionType int action; public String[] acceptMimes; /** Derived from local preferences */ Loading