Merge "Action OPEN_DOCUMENT_TREE shows advanced roots ignoring config flag Fixed: 27856396" into nyc-dev
am: 160222a
* commit '160222a4390d7738b541ed3f5c116d22c1fda04b':
Action OPEN_DOCUMENT_TREE shows advanced roots ignoring config flag Fixed: 27856396
Change-Id: Ib95b556451834579045eb71ad5ec202e50873049
This commit is contained in:
@@ -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;
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -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();
|
||||
@@ -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<>();
|
||||
@@ -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.");
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user