Revert "Merge commit '8d14dbe041199d611839140f1c9285fd4174e9f4' ..."
Revert "Merging from ub-launcher3-master @ build 6877130" Revert "Merging from ub-launcher3-master @ build 6877130" Revert "Merging from ub-launcher3-master @ build 6877130" Revert submission 12738409-merge_ub-launcher3-master_6877130 Reason for revert: Introduced crashes to global presubmit Reverted Changes: I624658ce6:Merge commit '8d14dbe041199d611839140f1c9285fd4174... Iccd2f1e3a:Merging from ub-launcher3-master @ build 6877130 I791d64951:Merging from ub-launcher3-master @ build 6877130 Icdd32ab01:Merging from ub-launcher3-master @ build 6877130 Bug: 169963211 Change-Id: I77a4ae59e823147beae8dd7cb9b54ccdace2c7f4
This commit is contained in:
1 parent
49a94be109
commit
087a9e39b6
138 files changed
+2135
-1944
No files matched your search
@@ -0,0 +1,49 @@
|
||||
package com.android.launcher3.logging;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class StatsLogUtils {
|
||||
private final static int MAXIMUM_VIEW_HIERARCHY_LEVEL = 5;
|
||||
|
||||
/**
|
||||
* Implemented by containers to provide a container source for a given child.
|
||||
*/
|
||||
public interface LogContainerProvider {
|
||||
|
||||
/**
|
||||
* Populates parent container targets for an item
|
||||
*/
|
||||
void fillInLogContainerData(ItemInfo childInfo, Target child, ArrayList<Target> parents);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively finds the parent of the given child which implements IconLogInfoProvider
|
||||
*/
|
||||
public static LogContainerProvider getLaunchProviderRecursive(@Nullable View v) {
|
||||
ViewParent parent;
|
||||
if (v != null) {
|
||||
parent = v.getParent();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Optimization to only check up to 5 parents.
|
||||
int count = MAXIMUM_VIEW_HIERARCHY_LEVEL;
|
||||
while (parent != null && count-- > 0) {
|
||||
if (parent instanceof LogContainerProvider) {
|
||||
return (LogContainerProvider) parent;
|
||||
} else {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user