Merge "[settings-pixel-search] Add ww logging to track slice fetching timeout" into sc-dev am: 08843d8e37
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15068624 Change-Id: I3f9c316172aaabd2eb3595eaf80a1edf75045fe4
This commit is contained in:
commit
e04ca46d2a
2 files changed
+31
-7
No files matched your search
@@ -151,6 +151,7 @@ public class StatsLogCompatManager extends StatsLogManager {
|
|||||||
private Optional<ToState> mToState = Optional.empty();
|
private Optional<ToState> mToState = Optional.empty();
|
||||||
private Optional<String> mEditText = Optional.empty();
|
private Optional<String> mEditText = Optional.empty();
|
||||||
private SliceItem mSliceItem;
|
private SliceItem mSliceItem;
|
||||||
|
private LauncherAtom.Slice mSlice;
|
||||||
|
|
||||||
StatsCompatLogger(Context context) {
|
StatsCompatLogger(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -193,7 +194,7 @@ public class StatsLogCompatManager extends StatsLogManager {
|
|||||||
@Override
|
@Override
|
||||||
public StatsLogger withContainerInfo(ContainerInfo containerInfo) {
|
public StatsLogger withContainerInfo(ContainerInfo containerInfo) {
|
||||||
checkState(mItemInfo == DEFAULT_ITEM_INFO,
|
checkState(mItemInfo == DEFAULT_ITEM_INFO,
|
||||||
"ItemInfo and ContainerInfo are mutual exclusive; cannot log both.");
|
"ItemInfo and ContainerInfo are mutual exclusive; cannot log both.");
|
||||||
this.mContainerInfo = Optional.of(containerInfo);
|
this.mContainerInfo = Optional.of(containerInfo);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -218,9 +219,21 @@ public class StatsLogCompatManager extends StatsLogManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StatsLogger withSliceItem(@NonNull SliceItem sliceItem) {
|
public StatsLogger withSliceItem(@NonNull SliceItem sliceItem) {
|
||||||
|
checkState(mItemInfo == DEFAULT_ITEM_INFO && mSlice == null,
|
||||||
|
"ItemInfo, Slice and SliceItem are mutual exclusive; cannot set more than one"
|
||||||
|
+ " of them.");
|
||||||
this.mSliceItem = checkNotNull(sliceItem, "expected valid sliceItem but received null");
|
this.mSliceItem = checkNotNull(sliceItem, "expected valid sliceItem but received null");
|
||||||
checkState(mItemInfo == DEFAULT_ITEM_INFO,
|
return this;
|
||||||
"ItemInfo and SliceItem are mutual exclusive; cannot log both.");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatsLogger withSlice(LauncherAtom.Slice slice) {
|
||||||
|
checkState(mItemInfo == DEFAULT_ITEM_INFO && mSliceItem == null,
|
||||||
|
"ItemInfo, Slice and SliceItem are mutual exclusive; cannot set more than one"
|
||||||
|
+ " of them.");
|
||||||
|
checkNotNull(slice, "expected valid slice but received null");
|
||||||
|
checkNotNull(slice.getUri(), "expected valid slice uri but received null");
|
||||||
|
this.mSlice = slice;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,13 +244,16 @@ public class StatsLogCompatManager extends StatsLogManager {
|
|||||||
}
|
}
|
||||||
LauncherAppState appState = LauncherAppState.getInstanceNoCreate();
|
LauncherAppState appState = LauncherAppState.getInstanceNoCreate();
|
||||||
|
|
||||||
if (mSliceItem != null) {
|
if (mSlice == null && mSliceItem != null) {
|
||||||
|
mSlice = LauncherAtom.Slice.newBuilder().setUri(
|
||||||
|
mSliceItem.getSlice().getUri().toString()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mSlice != null) {
|
||||||
Executors.MODEL_EXECUTOR.execute(
|
Executors.MODEL_EXECUTOR.execute(
|
||||||
() -> {
|
() -> {
|
||||||
LauncherAtom.ItemInfo.Builder itemInfoBuilder =
|
LauncherAtom.ItemInfo.Builder itemInfoBuilder =
|
||||||
LauncherAtom.ItemInfo.newBuilder().setSlice(
|
LauncherAtom.ItemInfo.newBuilder().setSlice(mSlice);
|
||||||
LauncherAtom.Slice.newBuilder().setUri(
|
|
||||||
mSliceItem.getSlice().getUri().toString()));
|
|
||||||
mContainerInfo.ifPresent(itemInfoBuilder::setContainerInfo);
|
mContainerInfo.ifPresent(itemInfoBuilder::setContainerInfo);
|
||||||
write(event, applyOverwrites(itemInfoBuilder.build()));
|
write(event, applyOverwrites(itemInfoBuilder.build()));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.slice.SliceItem;
|
import androidx.slice.SliceItem;
|
||||||
|
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
|
import com.android.launcher3.logger.LauncherAtom;
|
||||||
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
|
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
|
||||||
import com.android.launcher3.logger.LauncherAtom.FromState;
|
import com.android.launcher3.logger.LauncherAtom.FromState;
|
||||||
import com.android.launcher3.logger.LauncherAtom.ToState;
|
import com.android.launcher3.logger.LauncherAtom.ToState;
|
||||||
@@ -599,6 +600,13 @@ public class StatsLogManager implements ResourceBasedOverride {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets logging fields from provided {@link LauncherAtom.Slice}.
|
||||||
|
*/
|
||||||
|
default StatsLogger withSlice(LauncherAtom.Slice slice) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the final message and logs it as {@link EventEnum}.
|
* Builds the final message and logs it as {@link EventEnum}.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user