Log the right workspace id for -1 screen for stop and resume.

Test: manual
Bug: 137952354

Logs after this fix:
08-01 12:01:36.220 17105 17105 D UserEvent: action:STOP
08-01 12:01:36.220 17105 17105 D UserEvent:  Source child:WORKSPACE id=-1
08-01 12:01:36.220 17105 17105 D UserEvent:  Elapsed container 5511 ms, session 5511 ms, action 0 ms
08-01 12:01:36.220 17105 17105 D UserEvent:
08-01 12:01:38.042 17105 17105 D UserEvent:
08-01 12:01:38.042 17105 17105 D UserEvent: -----------------------------------------------------
08-01 12:01:38.042 17105 17105 D UserEvent: action:RESUME
08-01 12:01:38.042 17105 17105 D UserEvent:  Source child:WORKSPACE id=-1
08-01 12:01:38.042 17105 17105 D UserEvent:  Elapsed container 7334 ms, session 7334 ms, action 0 ms
08-01 12:01:38.042 17105 17105 D UserEvent:

Change-Id: Ic2d88eee3ff7a0e28d5c7e4cab8ee61952ed95ee
This commit is contained in:
Becky Qiu
2019-08-01 11:09:38 -07:00
parent f489a71365
commit bfc2da1fd8
3 changed files with 25 additions and 5 deletions

View File

@@ -873,9 +873,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onStop();
}
getUserEventDispatcher().logActionCommand(Action.Command.STOP,
mStateManager.getState().containerType, -1);
logStopAndResume(Action.Command.STOP);
mAppWidgetHost.setListenIfResumed(false);
@@ -901,8 +899,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
private void handleDeferredResume() {
if (hasBeenResumed() && !mStateManager.getState().disableInteraction) {
getUserEventDispatcher().logActionCommand(Action.Command.RESUME,
mStateManager.getState().containerType, -1);
logStopAndResume(Action.Command.RESUME);
getUserEventDispatcher().startSession();
UiFactory.onLauncherStateOrResumeChanged(this);
@@ -929,6 +926,17 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
}
}
private void logStopAndResume(int command) {
int containerType = mStateManager.getState().containerType;
if (containerType == ContainerType.WORKSPACE && mWorkspace != null) {
getUserEventDispatcher().logActionCommand(command,
containerType, -1, mWorkspace.isOverlayShown() ? -1 : 0);
} else {
getUserEventDispatcher().logActionCommand(command, containerType, -1);
}
}
protected void onStateSet(LauncherState state) {
getAppWidgetHost().setResumed(state == LauncherState.NORMAL);
if (mDeferredResumePending) {

View File

@@ -3251,6 +3251,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
}
}
public boolean isOverlayShown() {
return mOverlayShown;
}
void moveToDefaultScreen() {
int page = DEFAULT_PAGE;
if (!workspaceInModalState() && getNextPage() != page) {

View File

@@ -187,6 +187,14 @@ public class UserEventDispatcher implements ResourceBasedOverride {
dstContainerType >=0 ? newContainerTarget(dstContainerType) : null);
}
public void logActionCommand(int command, int srcContainerType, int dstContainerType,
int pageIndex) {
Target srcTarget = newContainerTarget(srcContainerType);
srcTarget.pageIndex = pageIndex;
logActionCommand(command, srcTarget,
dstContainerType >=0 ? newContainerTarget(dstContainerType) : null);
}
public void logActionCommand(int command, Target srcTarget, Target dstTarget) {
LauncherEvent event = newLauncherEvent(newCommandAction(command), srcTarget);
if (command == Action.Command.STOP) {