Merge "Add metrics for drag and drop. Add metrics for search." into nyc-dev
This commit is contained in:
@@ -67,6 +67,8 @@ public final class Metrics {
|
||||
private static final String COUNT_FILEOP_CANCELED = "docsui_fileop_canceled";
|
||||
private static final String COUNT_STARTUP_MS = "docsui_startup_ms";
|
||||
private static final String COUNT_DRAWER_OPENED = "docsui_drawer_opened";
|
||||
private static final String COUNT_DRAG_N_DROP = "docsui_drag_n_drop";
|
||||
private static final String COUNT_SEARCH = "docsui_search";
|
||||
|
||||
// Indices for bucketing roots in the roots histogram. "Other" is the catch-all index for any
|
||||
// root that is not explicitly recognized by the Metrics code (see {@link
|
||||
@@ -448,6 +450,25 @@ public final class Metrics {
|
||||
logHistogram(context, COUNT_STARTUP_MS, startupMs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a drag and drop action. Call this when the user drops the content triggering copy.
|
||||
* operation.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void logDragNDrop(Context context) {
|
||||
logCount(context, COUNT_DRAG_N_DROP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a search. Call this when the search operation is finished.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void logSearch(Context context) {
|
||||
logCount(context, COUNT_SEARCH);
|
||||
}
|
||||
|
||||
private static void logInterProviderFileOps(
|
||||
Context context,
|
||||
String histogram,
|
||||
|
||||
@@ -85,6 +85,7 @@ import com.android.documentsui.Events;
|
||||
import com.android.documentsui.Events.MotionInputEvent;
|
||||
import com.android.documentsui.Menus;
|
||||
import com.android.documentsui.MessageBar;
|
||||
import com.android.documentsui.Metrics;
|
||||
import com.android.documentsui.R;
|
||||
import com.android.documentsui.RecentsLoader;
|
||||
import com.android.documentsui.RootsCache;
|
||||
@@ -1124,6 +1125,7 @@ public class DirectoryFragment extends Fragment
|
||||
if (Objects.equals(src, dst)) {
|
||||
return false;
|
||||
}
|
||||
Metrics.logDragNDrop(getContext());
|
||||
copyFromClipData(event.getClipData(), dst);
|
||||
return true;
|
||||
}
|
||||
@@ -1622,6 +1624,9 @@ public class DirectoryFragment extends Fragment
|
||||
@Override
|
||||
public void onLoadFinished(Loader<DirectoryResult> loader, DirectoryResult result) {
|
||||
if (!isAdded()) return;
|
||||
if (mSearchMode) {
|
||||
Metrics.logSearch(getContext());
|
||||
}
|
||||
|
||||
State state = getDisplayState();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user