mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Add launcher logging of back button
Bug: 127848641 Test: adb shell setprop log.tag.UserEvent VERBOSE, then hit back Change-Id: I020738280d2e51a8a192e577baf48c0b092f22f6
This commit is contained in:
@@ -88,6 +88,10 @@ public class TouchInteractionService extends Service {
|
||||
// TODO handle assistant
|
||||
}
|
||||
|
||||
public void onBackAction(boolean completed, int downX, int downY, boolean isButton,
|
||||
boolean gestureSwipeLeft) {
|
||||
}
|
||||
|
||||
/** Deprecated methods **/
|
||||
public void onQuickStep(MotionEvent motionEvent) { }
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ enum ControlType {
|
||||
RESIZE_HANDLE = 8;
|
||||
VERTICAL_SCROLL = 9;
|
||||
HOME_INTENT = 10; // Deprecated, use enum Command instead
|
||||
BACK_BUTTON = 11; // Deprecated, use enum Command instead
|
||||
BACK_BUTTON = 11;
|
||||
QUICK_SCRUB_BUTTON = 12;
|
||||
CLEAR_ALL_BUTTON = 13;
|
||||
CANCEL_TARGET = 14;
|
||||
@@ -114,6 +114,7 @@ enum ControlType {
|
||||
SPLIT_SCREEN_TARGET = 16;
|
||||
REMOTE_ACTION_SHORTCUT = 17;
|
||||
APP_USAGE_SETTINGS = 18;
|
||||
BACK_GESTURE = 19;
|
||||
}
|
||||
|
||||
enum TipType {
|
||||
|
||||
@@ -192,7 +192,11 @@ public final class FallbackActivityControllerHelper implements
|
||||
|
||||
@Override
|
||||
public int getContainerType() {
|
||||
return LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER;
|
||||
RecentsActivity activity = getCreatedActivity();
|
||||
boolean visible = activity != null && activity.isStarted() && activity.hasWindowFocus();
|
||||
return visible
|
||||
? LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER
|
||||
: LauncherLogProto.ContainerType.APP;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,6 +53,7 @@ import com.android.launcher3.MainThreadExecutor;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.compat.UserManagerCompat;
|
||||
import com.android.launcher3.logging.EventLogArray;
|
||||
import com.android.launcher3.logging.UserEventDispatcher;
|
||||
import com.android.launcher3.util.LooperExecutor;
|
||||
import com.android.launcher3.util.UiThreadHelper;
|
||||
import com.android.quickstep.SysUINavigationMode.Mode;
|
||||
@@ -141,6 +142,14 @@ public class TouchInteractionService extends Service implements
|
||||
});
|
||||
}
|
||||
|
||||
public void onBackAction(boolean completed, int downX, int downY, boolean isButton,
|
||||
boolean gestureSwipeLeft) {
|
||||
final ActivityControlHelper activityControl =
|
||||
mOverviewComponentObserver.getActivityControlHelper();
|
||||
UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY,
|
||||
isButton, gestureSwipeLeft, activityControl.getContainerType());
|
||||
}
|
||||
|
||||
/** Deprecated methods **/
|
||||
public void onQuickStep(MotionEvent motionEvent) { }
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ import android.content.SharedPreferences;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DropTarget;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
@@ -54,15 +55,12 @@ import com.android.launcher3.util.ResourceBasedOverride;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Manages the creation of {@link LauncherEvent}.
|
||||
* To debug this class, execute following command before side loading a new apk.
|
||||
*
|
||||
* $ adb shell setprop log.tag.UserEvent VERBOSE
|
||||
*/
|
||||
@Deprecated
|
||||
public class UserEventDispatcher implements ResourceBasedOverride {
|
||||
|
||||
private static final String TAG = "UserEvent";
|
||||
@@ -360,6 +358,27 @@ public class UserEventDispatcher implements ResourceBasedOverride {
|
||||
dispatchUserEvent(event, null);
|
||||
}
|
||||
|
||||
public void logActionBack(boolean completed, int downX, int downY, boolean isButton,
|
||||
boolean gestureSwipeLeft, int containerType) {
|
||||
int actionTouch = isButton ? Action.Touch.TAP : Action.Touch.SWIPE;
|
||||
Action action = newCommandAction(actionTouch);
|
||||
action.command = Action.Command.BACK;
|
||||
action.dir = isButton
|
||||
? Action.Direction.NONE
|
||||
: gestureSwipeLeft
|
||||
? Action.Direction.LEFT
|
||||
: Action.Direction.RIGHT;
|
||||
Target target = newControlTarget(isButton
|
||||
? LauncherLogProto.ControlType.BACK_BUTTON
|
||||
: LauncherLogProto.ControlType.BACK_GESTURE);
|
||||
target.spanX = downX;
|
||||
target.spanY = downY;
|
||||
target.cardinality = completed ? 1 : 0;
|
||||
LauncherEvent event = newLauncherEvent(action, target, newContainerTarget(containerType));
|
||||
|
||||
dispatchUserEvent(event, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently logs following containers: workspace, allapps, widget tray.
|
||||
* @param reason
|
||||
|
||||
Reference in New Issue
Block a user