summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher3/BaseActivity.java8
-rw-r--r--src/com/android/launcher3/FocusHelper.java3
-rw-r--r--src/com/android/launcher3/Hotseat.java1
-rw-r--r--src/com/android/launcher3/Launcher.java25
-rw-r--r--src/com/android/launcher3/PagedView.java4
-rw-r--r--src/com/android/launcher3/Workspace.java2
-rw-r--r--src/com/android/launcher3/folder/FolderPagedView.java4
-rw-r--r--src/com/android/launcher3/logging/UserEventDispatcher.java16
-rw-r--r--src/com/android/launcher3/touch/AbstractStateChangeTouchController.java38
9 files changed, 64 insertions, 37 deletions
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java
index 421966755..e117deb81 100644
--- a/src/com/android/launcher3/BaseActivity.java
+++ b/src/com/android/launcher3/BaseActivity.java
@@ -30,7 +30,9 @@ import android.view.View.AccessibilityDelegate;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.logging.UserEventDispatcher;
+import com.android.launcher3.logging.UserEventDispatcher.UserEventDelegate;
import com.android.launcher3.uioverrides.UiFactory;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.SystemUiController;
import java.io.FileDescriptor;
@@ -38,7 +40,7 @@ import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.util.ArrayList;
-public abstract class BaseActivity extends Activity {
+public abstract class BaseActivity extends Activity implements UserEventDelegate{
public static final int INVISIBLE_BY_STATE_HANDLER = 1 << 0;
public static final int INVISIBLE_BY_APP_TRANSITIONS = 1 << 1;
@@ -89,9 +91,11 @@ public abstract class BaseActivity extends Activity {
return null;
}
+ public void modifyUserEvent(LauncherLogProto.LauncherEvent event) {}
+
public final UserEventDispatcher getUserEventDispatcher() {
if (mUserEventDispatcher == null) {
- mUserEventDispatcher = UserEventDispatcher.newInstance(this, mDeviceProfile);
+ mUserEventDispatcher = UserEventDispatcher.newInstance(this, mDeviceProfile, this);
}
return mUserEventDispatcher;
}
diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java
index 1f18ea1ac..466b7b242 100644
--- a/src/com/android/launcher3/FocusHelper.java
+++ b/src/com/android/launcher3/FocusHelper.java
@@ -65,6 +65,9 @@ class FullscreenKeyEventListener implements View.OnKeyListener {
}
}
+/**
+ * TODO: Reevaluate if this is still required
+ */
public class FocusHelper {
private static final String TAG = "FocusHelper";
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index c6025fe5f..ee4b1130d 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -112,7 +112,6 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett
allAppsButton.setCompoundDrawables(null, d, null, null);
allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
- allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener());
if (mLauncher != null) {
allAppsButton.setOnClickListener((v) -> {
if (!mLauncher.isInState(ALL_APPS)) {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index bddcde341..3eaead11a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -24,6 +24,7 @@ import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
+import static com.android.launcher3.logging.LoggerUtils.newTarget;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -91,6 +92,7 @@ import com.android.launcher3.keyboard.CustomActionsPopup;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.logging.UserEventDispatcher;
+import com.android.launcher3.logging.UserEventDispatcher.UserEventDelegate;
import com.android.launcher3.model.ModelWriter;
import com.android.launcher3.notification.NotificationListener;
import com.android.launcher3.popup.PopupContainerWithArrow;
@@ -100,6 +102,7 @@ import com.android.launcher3.states.InternalStateHandler;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.uioverrides.UiFactory;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
@@ -140,8 +143,8 @@ import java.util.Set;
/**
* Default launcher application.
*/
-public class Launcher extends BaseDraggingActivity
- implements LauncherExterns, LauncherModel.Callbacks, LauncherProviderChangeListener {
+public class Launcher extends BaseDraggingActivity implements LauncherExterns,
+ LauncherModel.Callbacks, LauncherProviderChangeListener, UserEventDelegate{
public static final String TAG = "Launcher";
static final boolean LOGD = false;
@@ -1643,6 +1646,24 @@ public class Launcher extends BaseDraggingActivity
}
}
+ @Override
+ public void modifyUserEvent(LauncherLogProto.LauncherEvent event) {
+ if (event.srcTarget != null && event.srcTarget.length > 0 &&
+ event.srcTarget[1].containerType == ContainerType.PREDICTION) {
+ Target[] targets = new Target[3];
+ targets[0] = event.srcTarget[0];
+ targets[1] = event.srcTarget[1];
+ targets[2] = newTarget(Target.Type.CONTAINER);
+ event.srcTarget = targets;
+ LauncherState state = mStateManager.getState();
+ if (state == LauncherState.ALL_APPS) {
+ event.srcTarget[2].containerType = ContainerType.ALLAPPS;
+ } else if (state == LauncherState.OVERVIEW) {
+ event.srcTarget[2].containerType = ContainerType.TASKSWITCHER;
+ }
+ }
+ }
+
public boolean startActivitySafely(View v, Intent intent, ItemInfo item) {
boolean success = super.startActivitySafely(v, intent, item);
if (success && v instanceof BubbleTextView) {
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index efbd00489..5cc2e8fc5 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -440,9 +440,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
if (getUnboundedScrollX() != mScroller.getCurrX()
|| getScrollY() != mScroller.getCurrY()
|| mOverScrollX != mScroller.getCurrX()) {
- float scaleX = mFreeScroll ? getScaleX() : 1f;
- int scrollX = (int) (mScroller.getCurrX() * (1 / scaleX));
- scrollTo(scrollX, mScroller.getCurrY());
+ scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
}
if (shouldInvalidate) {
invalidate();
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 6631f771c..42e8fde3b 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -881,7 +881,6 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
final CellLayout layout;
if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
layout = mLauncher.getHotseat().getLayout();
- child.setOnKeyListener(new HotseatIconKeyEventListener());
// Hide folder title in the hotseat
if (child instanceof FolderIcon) {
@@ -893,7 +892,6 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
((FolderIcon) child).setTextVisible(true);
}
layout = getScreenWithId(screenId);
- child.setOnKeyListener(new IconKeyEventListener());
}
ViewGroup.LayoutParams genericLp = child.getLayoutParams();
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index fa7565adb..9be71f95c 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -31,7 +31,6 @@ import android.view.ViewDebug;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.FocusHelper.PagedFolderKeyEventListener;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
@@ -88,7 +87,6 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> {
private int mGridCountY;
private Folder mFolder;
- private PagedFolderKeyEventListener mKeyListener;
public FolderPagedView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -108,7 +106,6 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> {
public void setFolder(Folder folder) {
mFolder = folder;
- mKeyListener = new PagedFolderKeyEventListener(folder);
mPageIndicator = folder.findViewById(R.id.folder_page_indicator);
initParentViews(folder);
}
@@ -241,7 +238,6 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> {
textView.setOnClickListener(ItemClickHandler.INSTANCE);
textView.setOnLongClickListener(mFolder);
textView.setOnFocusChangeListener(mFocusIndicatorHelper);
- textView.setOnKeyListener(mKeyListener);
textView.setLayoutParams(new CellLayout.LayoutParams(
item.cellX, item.cellY, item.spanX, item.spanY));
diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java
index 1842e19a4..d1e1051ee 100644
--- a/src/com/android/launcher3/logging/UserEventDispatcher.java
+++ b/src/com/android/launcher3/logging/UserEventDispatcher.java
@@ -70,7 +70,8 @@ public class UserEventDispatcher {
FeatureFlags.IS_DOGFOOD_BUILD && Utilities.isPropertyEnabled(LogConfig.USEREVENT);
private static final String UUID_STORAGE = "uuid";
- public static UserEventDispatcher newInstance(Context context, DeviceProfile dp) {
+ public static UserEventDispatcher newInstance(Context context, DeviceProfile dp,
+ UserEventDelegate delegate) {
SharedPreferences sharedPrefs = Utilities.getDevicePrefs(context);
String uuidStr = sharedPrefs.getString(UUID_STORAGE, null);
if (uuidStr == null) {
@@ -79,6 +80,7 @@ public class UserEventDispatcher {
}
UserEventDispatcher ued = Utilities.getOverrideObject(UserEventDispatcher.class,
context.getApplicationContext(), R.string.user_event_dispatcher_class);
+ ued.mDelegate = delegate;
ued.mIsInLandscapeMode = dp.isVerticalBarLayout();
ued.mIsInMultiWindowMode = dp.isMultiWindowMode;
ued.mUuidStr = uuidStr;
@@ -86,6 +88,14 @@ public class UserEventDispatcher {
return ued;
}
+ public static UserEventDispatcher newInstance(Context context, DeviceProfile dp) {
+ return newInstance(context, dp, null);
+ }
+
+ public interface UserEventDelegate {
+ void modifyUserEvent(LauncherEvent event);
+ }
+
/**
* Implemented by containers to provide a container source for a given child.
*/
@@ -134,6 +144,7 @@ public class UserEventDispatcher {
private String mUuidStr;
protected InstantAppResolver mInstantAppResolver;
private boolean mAppOrTaskLaunch;
+ private UserEventDelegate mDelegate;
// APP_ICON SHORTCUT WIDGET
// --------------------------------------------------------------
@@ -162,6 +173,9 @@ public class UserEventDispatcher {
newItemTarget(v, mInstantAppResolver), newTarget(Target.Type.CONTAINER));
if (fillInLogContainerData(event, v)) {
+ if (mDelegate != null) {
+ mDelegate.modifyUserEvent(event);
+ }
fillIntentInfo(event.srcTarget[0], intent);
}
dispatchUserEvent(event, intent);
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index a9006e314..453810c06 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -42,9 +42,9 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorSetBuilder;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
-import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.util.FlingBlockCheck;
import com.android.launcher3.util.PendingAnimation;
import com.android.launcher3.util.TouchController;
@@ -181,17 +181,6 @@ public abstract class AbstractStateChangeTouchController
return false;
}
- if (reachedToState) {
- logReachedState(Touch.SWIPE);
- }
- if (newFromState == ALL_APPS) {
- mStartContainerType = ContainerType.ALLAPPS;
- } else if (newFromState == NORMAL) {
- mStartContainerType = getLogContainerTypeForNormalState();
- } else if (newFromState == OVERVIEW){
- mStartContainerType = ContainerType.TASKSWITCHER;
- }
-
mFromState = newFromState;
mToState = newToState;
@@ -237,6 +226,13 @@ public abstract class AbstractStateChangeTouchController
@Override
public void onDragStart(boolean start) {
mStartState = mLauncher.getStateManager().getState();
+ if (mStartState == ALL_APPS) {
+ mStartContainerType = LauncherLogProto.ContainerType.ALLAPPS;
+ } else if (mStartState == NORMAL) {
+ mStartContainerType = getLogContainerTypeForNormalState();
+ } else if (mStartState == OVERVIEW){
+ mStartContainerType = LauncherLogProto.ContainerType.TASKSWITCHER;
+ }
if (mCurrentAnimation == null) {
mFromState = mStartState;
mToState = null;
@@ -332,23 +328,21 @@ public abstract class AbstractStateChangeTouchController
@Override
public void onDragEnd(float velocity, boolean fling) {
- final int logAction;
- final LauncherState targetState;
- final float progress = mCurrentAnimation.getProgressFraction();
+ final int logAction = fling ? Touch.FLING : Touch.SWIPE;
boolean blockedFling = fling && mFlingBlockCheck.isBlocked();
if (blockedFling) {
fling = false;
}
+ final LauncherState targetState;
+ final float progress = mCurrentAnimation.getProgressFraction();
if (fling) {
- logAction = Touch.FLING;
targetState =
Float.compare(Math.signum(velocity), Math.signum(mProgressMultiplier)) == 0
? mToState : mFromState;
// snap to top or bottom using the release velocity
} else {
- logAction = Touch.SWIPE;
float successProgress = mToState == ALL_APPS
? MIN_PROGRESS_TO_ALL_APPS : SUCCESS_TRANSITION_PROGRESS;
targetState = (progress > successProgress) ? mToState : mFromState;
@@ -472,20 +466,20 @@ public abstract class AbstractStateChangeTouchController
shouldGoToTargetState = !reachedTarget;
}
if (shouldGoToTargetState) {
- if (targetState != mFromState) {
- logReachedState(logAction);
+ if (targetState != mStartState) {
+ logReachedState(logAction, targetState);
}
mLauncher.getStateManager().goToState(targetState, false /* animated */);
}
}
- private void logReachedState(int logAction) {
+ private void logReachedState(int logAction, LauncherState targetState) {
// Transition complete. log the action
mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,
getDirectionForLog(),
mStartContainerType,
- mFromState.containerType,
- mToState.containerType,
+ mStartState.containerType,
+ targetState.containerType,
mLauncher.getWorkspace().getCurrentPage());
}