use of com.android.launcher3.logging.UserEventDispatcher in project android_packages_apps_Trebuchet by LineageOS.
the class Launcher method onNewIntent.
@Override
protected void onNewIntent(Intent intent) {
if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
Log.d(TestProtocol.PERMANENT_DIAG_TAG, "Launcher.onNewIntent: " + intent);
}
Object traceToken = TraceHelper.INSTANCE.beginSection(ON_NEW_INTENT_EVT);
super.onNewIntent(intent);
boolean alreadyOnHome = hasWindowFocus() && ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
// Check this condition before handling isActionMain, as this will get reset.
boolean shouldMoveToDefaultScreen = alreadyOnHome && isInState(NORMAL) && AbstractFloatingView.getTopOpenView(this) == null;
boolean isActionMain = Intent.ACTION_MAIN.equals(intent.getAction());
boolean internalStateHandled = ACTIVITY_TRACKER.handleNewIntent(this, intent);
if (isActionMain) {
if (!internalStateHandled) {
// In all these cases, only animate if we're already on home
closeOpenViews(isStarted());
if (!isInState(NORMAL)) {
// Only change state, if not already the same. This prevents cancelling any
// animations running as part of resume
mStateManager.goToState(NORMAL, mStateManager.shouldAnimateStateChange(), this::handlePendingActivityRequest);
}
// Reset the apps view
if (!alreadyOnHome) {
mAppsView.reset(isStarted());
}
if (shouldMoveToDefaultScreen && !mWorkspace.isHandlingTouch()) {
mWorkspace.post(mWorkspace::moveToDefaultScreen);
}
}
// Handle HOME_INTENT
UserEventDispatcher ued = getUserEventDispatcher();
Target target = newContainerTarget(mStateManager.getState().containerType);
target.pageIndex = mWorkspace.getCurrentPage();
ued.logActionCommand(Action.Command.HOME_INTENT, target, newContainerTarget(ContainerType.WORKSPACE));
hideKeyboard();
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onHomeIntent(internalStateHandled);
}
mOverlayManager.hideOverlay(isStarted() && !isForceInvisible());
handleGestureContract(intent);
} else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) {
getStateManager().goToState(ALL_APPS, alreadyOnHome);
}
TraceHelper.INSTANCE.endSection(traceToken);
}
use of com.android.launcher3.logging.UserEventDispatcher in project Neo-Launcher by NeoApplications.
the class Launcher method onNewIntent.
@Override
protected void onNewIntent(Intent intent) {
TraceHelper.beginSection("NEW_INTENT");
super.onNewIntent(intent);
boolean alreadyOnHome = hasWindowFocus() && ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
// Check this condition before handling isActionMain, as this will get reset.
boolean shouldMoveToDefaultScreen = alreadyOnHome && isInState(NORMAL) && AbstractFloatingView.getTopOpenView(this) == null;
boolean isActionMain = Intent.ACTION_MAIN.equals(intent.getAction());
boolean internalStateHandled = InternalStateHandler.handleNewIntent(this, intent, isStarted());
boolean handled = false;
if (isActionMain) {
if (!internalStateHandled) {
// In all these cases, only animate if we're already on home
AbstractFloatingView.closeAllOpenViews(this, isStarted());
if (!isInState(NORMAL)) {
// Only change state, if not already the same. This prevents cancelling any
// animations running as part of resume
mStateManager.goToState(NORMAL);
}
// Reset the apps view
if (!alreadyOnHome) {
mAppsView.reset(isStarted());
handled = true;
}
if (shouldMoveToDefaultScreen && !mWorkspace.isHandlingTouch()) {
mWorkspace.post(mWorkspace::moveToDefaultScreen);
handled = true;
}
if (!handled && this instanceof OmegaLauncher) {
((OmegaLauncher) this).getGestureController().onPressHome();
}
}
// Handle HOME_INTENT
UserEventDispatcher ued = getUserEventDispatcher();
Target target = newContainerTarget(mStateManager.getState().containerType);
target.pageIndex = mWorkspace.getCurrentPage();
ued.logActionCommand(Action.Command.HOME_INTENT, target, newContainerTarget(ContainerType.WORKSPACE));
final View v = getWindow().peekDecorView();
if (v != null && v.getWindowToken() != null) {
UiThreadHelper.hideKeyboardAsync(this, v.getWindowToken());
}
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onHomeIntent(internalStateHandled);
}
}
TraceHelper.endSection("NEW_INTENT");
}
use of com.android.launcher3.logging.UserEventDispatcher in project Neo-Launcher by NeoApplications.
the class Launcher method onBackPressed.
@Override
public void onBackPressed() {
if (finishAutoCancelActionMode()) {
return;
}
if (mLauncherCallbacks != null && mLauncherCallbacks.handleBackPressed()) {
return;
}
if (mDragController.isDragging()) {
mDragController.cancelDrag();
return;
}
// Note: There should be at most one log per method call. This is enforced implicitly
// by using if-else statements.
UserEventDispatcher ued = getUserEventDispatcher();
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(this);
if (topView != null && topView.onBackPressed()) {
// Handled by the floating view.
} else {
mStateManager.getState().onBackPressed(this);
}
}
Aggregations