mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Added instrumentation when allapps is opened by button click in the taskbar. Starting the slice in the onClickListener of the allApps button and ending it on the end of the animation. Test: checked the trace Fixes: b/270128563 Flag: None Change-Id: I492a4a7af81e0c40dc3d7d415ffc7b16c057b25d
111 lines
3.8 KiB
Java
111 lines
3.8 KiB
Java
/*
|
|
* Copyright (C) 2024 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.android.launcher3.taskbar;
|
|
|
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_ALLAPPS_BUTTON_LONG_PRESS;
|
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP;
|
|
|
|
import android.view.InputDevice;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
|
|
import com.android.internal.jank.Cuj;
|
|
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
|
|
|
/**
|
|
* Callbacks for {@link TaskbarView} to interact with its controller.
|
|
*/
|
|
public class TaskbarViewCallbacks {
|
|
|
|
private final TaskbarActivityContext mActivity;
|
|
private final TaskbarControllers mControllers;
|
|
private final TaskbarView mTaskbarView;
|
|
|
|
public TaskbarViewCallbacks(TaskbarActivityContext activity, TaskbarControllers controllers,
|
|
TaskbarView taskbarView) {
|
|
mActivity = activity;
|
|
mControllers = controllers;
|
|
mTaskbarView = taskbarView;
|
|
}
|
|
|
|
public View.OnClickListener getIconOnClickListener() {
|
|
return mActivity.getItemOnClickListener();
|
|
}
|
|
|
|
public View.OnClickListener getAllAppsButtonClickListener() {
|
|
return v -> {
|
|
InteractionJankMonitorWrapper.begin(v, Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS,
|
|
/* tag= */ "TASKBAR_BUTTON");
|
|
mActivity.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP);
|
|
mControllers.taskbarAllAppsController.toggle();
|
|
};
|
|
}
|
|
|
|
public View.OnLongClickListener getAllAppsButtonLongClickListener() {
|
|
return v -> {
|
|
mActivity.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_ALLAPPS_BUTTON_LONG_PRESS);
|
|
return true;
|
|
};
|
|
}
|
|
|
|
public boolean isAllAppsButtonHapticFeedbackEnabled() {
|
|
return false;
|
|
}
|
|
|
|
public View.OnLongClickListener getTaskbarDividerLongClickListener() {
|
|
return v -> {
|
|
mControllers.taskbarPinningController.showPinningView(v);
|
|
return true;
|
|
};
|
|
}
|
|
|
|
public View.OnTouchListener getTaskbarDividerRightClickListener() {
|
|
return (v, event) -> {
|
|
if (event.isFromSource(InputDevice.SOURCE_MOUSE)
|
|
&& event.getButtonState() == MotionEvent.BUTTON_SECONDARY) {
|
|
mControllers.taskbarPinningController.showPinningView(v);
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
}
|
|
|
|
public View.OnLongClickListener getIconOnLongClickListener() {
|
|
return mControllers.taskbarDragController::startDragOnLongClick;
|
|
}
|
|
|
|
/** Gets the hover listener for the provided icon view. */
|
|
public View.OnHoverListener getIconOnHoverListener(View icon) {
|
|
return new TaskbarHoverToolTipController(mActivity, mTaskbarView, icon);
|
|
}
|
|
|
|
/**
|
|
* Notifies launcher to update icon alignment.
|
|
*/
|
|
public void notifyIconLayoutBoundsChanged() {
|
|
mControllers.uiController.onIconLayoutBoundsChanged();
|
|
}
|
|
|
|
/**
|
|
* Notifies the taskbar scrim when the visibility of taskbar changes.
|
|
*/
|
|
public void notifyVisibilityChanged() {
|
|
mControllers.taskbarScrimViewController.onTaskbarVisibilityChanged(
|
|
mTaskbarView.getVisibility());
|
|
}
|
|
}
|