[Contextual Edu] Update Edu stats when going to overview and all apps from home

Update education stats when
- go overview and all apps by swiping up at homepage (AbstractStateChangeTouchController)
- go home from all apps by swiping down the all apps panel (AbstractStateChangeTouchController)
- go home from all apps or overview by swiping up from the bottom nav bar (NavBarToHomeTouchController)
- in 3 button navgiation mode (TaskbarNavButtonController)

NavBarToHomeTouchController does not inherit from AbstractStateChangeTouchController so logic are added separately.

Bug: 363480554
Test: TaskbarNavButtonControllerTest
Flag: com.android.systemui.keyboard_touchpad_contextual_education
Change-Id: I0662704a9093b9f5a4d2f086a8297429fbc49881
This commit is contained in:
helencheuk
2024-09-16 16:24:37 +01:00
parent 6138138d99
commit 5012640ab2
6 changed files with 72 additions and 1 deletions
@@ -40,11 +40,13 @@ import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.contextualeducation.ContextualEduStatsManager;
import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.FlingBlockCheck;
import com.android.launcher3.util.TouchController;
import com.android.systemui.contextualeducation.GestureType;
/**
* TouchController for handling state changes
@@ -388,6 +390,7 @@ public abstract class AbstractStateChangeTouchController
} else {
logReachedState(mToState);
}
updateContextualEduStats(targetState);
}
protected void goToTargetState(LauncherState targetState) {
@@ -403,6 +406,21 @@ public abstract class AbstractStateChangeTouchController
.setDuration(0).start();
}
private void updateContextualEduStats(LauncherState targetState) {
if (targetState == NORMAL) {
ContextualEduStatsManager.INSTANCE.get(
mLauncher).updateEduStats(mDetector.isTrackpadGesture(), GestureType.HOME);
} else if (targetState == OVERVIEW) {
ContextualEduStatsManager.INSTANCE.get(
mLauncher).updateEduStats(mDetector.isTrackpadGesture(), GestureType.OVERVIEW);
} else if (targetState == ALL_APPS && !mDetector.isTrackpadGesture()) {
// Only update if it is touch gesture as trackpad gesture is not relevant for all apps
// which only provides keyboard education.
ContextualEduStatsManager.INSTANCE.get(
mLauncher).updateEduStats(/* isTrackpadGesture= */ false, GestureType.ALL_APPS);
}
}
private void logReachedState(LauncherState targetState) {
if (mStartState == targetState) {
return;