Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fc9a1cf authored by Winson Chung's avatar Winson Chung
Browse files

Merging ub-launcher3-qt-r1-dev, build 5749827

Test: Manual

Bug:136282913 P1 Swipe up from Assistant Fulfillment Card Jank
Bug:137129923 P1 Pixel launcher is leaking memory
Bug:137161198 P1 Unable to pull notification panel down with a swipe on home screen
Bug:137253043 P1 "Pixel Launcher keeps stopping" when scrolling through recent apps
Bug:137487381 P1 Overview goes back to fullscreen when swiping up during transition
Bug:137836033 P4 Fail to stop music due to "Swipe failed to receive an event for the swipe end"
Bug:138152531 P2 [Android Q][04713598] Launcher test cases are failed
Bug:138236583 P1 Icon scale is wrong when dragging from all apps or folders
Bug:138251824 P1 Flake: want to switch from background to overview; Swipe failed to receive an event for the swipe end
Bug:138252347 P1 qt-r1-dev Pixel Launcher flag ENABLE_HINTS_IN_OVERVIEW is Disable by Default
Change-Id: Idd0e987d26e1ffc75cdb9f90e9c08c26bb8c6503
parents 5841e40a 7b0520af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -186,7 +186,7 @@ public class TouchInteractionService extends Service {
        return mMyBinder;
    }

    public static boolean isInputMonitorInitialized() {
    public static boolean isInitialized() {
        return true;
    }
}
+8 −4
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Process;
import android.os.UserHandle;
import androidx.annotation.NonNull;

/**
 * This class will be moved to androidx library. There shouldn't be any dependency outside
@@ -154,7 +155,7 @@ public class BaseIconFactory implements AutoCloseable {
     * @param scale                     returns the scale result from normalization
     * @return a bitmap suitable for disaplaying as an icon at various system UIs.
     */
    public BitmapInfo createBadgedIconBitmap(Drawable icon, UserHandle user,
    public BitmapInfo createBadgedIconBitmap(@NonNull Drawable icon, UserHandle user,
            boolean shrinkNonAdaptiveIcons, boolean isInstantApp, float[] scale) {
        if (scale == null) {
            scale = new float[1];
@@ -204,8 +205,11 @@ public class BaseIconFactory implements AutoCloseable {
        mDisableColorExtractor = true;
    }

    private Drawable normalizeAndWrapToAdaptiveIcon(Drawable icon, boolean shrinkNonAdaptiveIcons,
            RectF outIconBounds, float[] outScale) {
    private Drawable normalizeAndWrapToAdaptiveIcon(@NonNull Drawable icon,
            boolean shrinkNonAdaptiveIcons, RectF outIconBounds, float[] outScale) {
        if (icon == null) {
            return null;
        }
        float scale = 1f;

        if (shrinkNonAdaptiveIcons && ATLEAST_OREO) {
@@ -261,7 +265,7 @@ public class BaseIconFactory implements AutoCloseable {
     * @param icon drawable that should be flattened to a bitmap
     * @param scale the scale to apply before drawing {@param icon} on the canvas
     */
    public Bitmap createIconBitmap(Drawable icon, float scale, int size) {
    public Bitmap createIconBitmap(@NonNull Drawable icon, float scale, int size) {
        Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
        if (icon == null) {
            return bitmap;
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {

            case TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED: {
                response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
                        TouchInteractionService.isInputMonitorInitialized());
                        TouchInteractionService.isInitialized());
                return response;
            }

+2 −7
Original line number Diff line number Diff line
@@ -19,12 +19,12 @@ import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;

import static com.android.launcher3.Utilities.FLAG_NO_GESTURES;

import android.view.InputEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;

import androidx.annotation.UiThread;

import com.android.launcher3.util.Preconditions;
import com.android.quickstep.inputconsumers.InputConsumer;
import com.android.quickstep.util.SwipeAnimationTargetSet;
@@ -33,8 +33,6 @@ import com.android.systemui.shared.system.InputConsumerController;
import java.util.ArrayList;
import java.util.function.Supplier;

import androidx.annotation.UiThread;

/**
 * Wrapper around RecentsAnimationController to help with some synchronization
 */
@@ -184,10 +182,7 @@ public class RecentsAnimationWrapper {
            }
        }
        if (mInputConsumer != null) {
            int flags = ev.getEdgeFlags();
            ev.setEdgeFlags(flags | FLAG_NO_GESTURES);
            mInputConsumer.onMotionEvent(ev);
            ev.setEdgeFlags(flags);
        }

        return true;
+44 −8
Original line number Diff line number Diff line
@@ -33,11 +33,13 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_N
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_ASSISTANT;

import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.Service;
import android.app.TaskInfo;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -103,6 +105,7 @@ import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
import com.android.systemui.shared.system.RecentsAnimationListener;
import com.android.systemui.shared.system.SystemGestureExclusionListenerCompat;

import com.android.systemui.shared.system.TaskInfoCompat;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Arrays;
@@ -154,6 +157,7 @@ public class TouchInteractionService extends Service implements
            MAIN_THREAD_EXECUTOR.execute(TouchInteractionService.this::initInputMonitor);
            MAIN_THREAD_EXECUTOR.execute(TouchInteractionService.this::onSystemUiProxySet);
            MAIN_THREAD_EXECUTOR.execute(() -> preloadOverview(true /* fromInit */));
            sIsInitialized = true;
        }

        @Override
@@ -227,15 +231,15 @@ public class TouchInteractionService extends Service implements
    };

    private static boolean sConnected = false;
    private static boolean sInputMonitorInitialized = false;
    private static boolean sIsInitialized = false;
    private static final SwipeSharedState sSwipeSharedState = new SwipeSharedState();

    public static boolean isConnected() {
        return sConnected;
    }

    public static boolean isInputMonitorInitialized() {
        return sInputMonitorInitialized;
    public static boolean isInitialized() {
        return sIsInitialized;
    }

    public static SwipeSharedState getSwipeSharedState() {
@@ -336,25 +340,32 @@ public class TouchInteractionService extends Service implements
            mInputMonitorCompat.dispose();
            mInputMonitorCompat = null;
        }
        sInputMonitorInitialized = false;
    }

    private void initInputMonitor() {
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "initInputMonitor 1");
        }
        if (!mMode.hasGestures || mISystemUiProxy == null) {
            return;
        }
        disposeEventHandlers();
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "initInputMonitor 2");
        }

        try {
            mInputMonitorCompat = InputMonitorCompat.fromBundle(mISystemUiProxy
                    .monitorGestureInput("swipe-up", mDefaultDisplayId), KEY_EXTRA_INPUT_MONITOR);
            mInputEventReceiver = mInputMonitorCompat.getInputReceiver(Looper.getMainLooper(),
                    mMainChoreographer, this::onInputEvent);
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "initInputMonitor 3");
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to create input monitor", e);
        }
        initTouchBounds();
        sInputMonitorInitialized = true;
    }

    private int getNavbarSize(String resName) {
@@ -408,6 +419,9 @@ public class TouchInteractionService extends Service implements

    @Override
    public void onNavigationModeChanged(Mode newMode) {
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "onNavigationModeChanged " + newMode);
        }
        if (mMode.hasGestures != newMode.hasGestures) {
            if (newMode.hasGestures) {
                getSystemService(DisplayManager.class).registerDisplayListener(
@@ -492,6 +506,7 @@ public class TouchInteractionService extends Service implements

    @Override
    public void onDestroy() {
        sIsInitialized = false;
        if (mIsUserUnlocked) {
            mInputConsumer.unregisterInputConsumer();
            mOverviewComponentObserver.onDestroy();
@@ -516,6 +531,9 @@ public class TouchInteractionService extends Service implements
    }

    private void onInputEvent(InputEvent ev) {
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "onInputEvent " + ev);
        }
        if (!(ev instanceof MotionEvent)) {
            Log.e(TAG, "Unknown event " + ev);
            return;
@@ -567,7 +585,7 @@ public class TouchInteractionService extends Service implements
            if (isInValidSystemUiState) {
                // This handles apps launched in direct boot mode (e.g. dialer) as well as apps
                // launched while device is locked even after exiting direct boot mode (e.g. camera).
                return createDeviceLockedInputConsumer(mAM.getRunningTask(0));
                return createDeviceLockedInputConsumer(mAM.getRunningTask(ACTIVITY_TYPE_ASSISTANT));
            } else {
                return mResetGestureInputConsumer;
            }
@@ -605,7 +623,7 @@ public class TouchInteractionService extends Service implements
    }

    private InputConsumer newBaseConsumer(boolean useSharedState, MotionEvent event) {
        final RunningTaskInfo runningTaskInfo = mAM.getRunningTask(0);
        RunningTaskInfo runningTaskInfo = mAM.getRunningTask(0);
        if (!useSharedState) {
            sSwipeSharedState.clearAllState(false /* finishAnimation */);
        }
@@ -617,6 +635,17 @@ public class TouchInteractionService extends Service implements
        final ActivityControlHelper activityControl =
                mOverviewComponentObserver.getActivityControlHelper();

        boolean forceOverviewInputConsumer = false;
        if (isExcludedAssistant(runningTaskInfo)) {
            // In the case where we are in the excluded assistant state, ignore it and treat the
            // running activity as the task behind the assistant
            runningTaskInfo = mAM.getRunningTask(ACTIVITY_TYPE_ASSISTANT);
            final ComponentName homeComponent =
                    mOverviewComponentObserver.getHomeIntent().getComponent();
            forceOverviewInputConsumer =
                    runningTaskInfo.baseIntent.getComponent().equals(homeComponent);
        }

        if (runningTaskInfo == null && !sSwipeSharedState.goingToLauncher
                && !sSwipeSharedState.recentsAnimationFinishInterrupted) {
            return mResetGestureInputConsumer;
@@ -626,7 +655,8 @@ public class TouchInteractionService extends Service implements
            RunningTaskInfo info = new ActivityManager.RunningTaskInfo();
            info.id = sSwipeSharedState.nextRunningTaskId;
            return createOtherActivityInputConsumer(event, info);
        } else if (sSwipeSharedState.goingToLauncher || activityControl.isResumed()) {
        } else if (sSwipeSharedState.goingToLauncher || activityControl.isResumed()
                || forceOverviewInputConsumer) {
            return createOverviewInputConsumer(event);
        } else if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityControl.isInLiveTileMode()) {
            return createOverviewInputConsumer(event);
@@ -638,6 +668,12 @@ public class TouchInteractionService extends Service implements
        }
    }

    private boolean isExcludedAssistant(TaskInfo info) {
        return info != null
                && TaskInfoCompat.getActivityType(info) == ACTIVITY_TYPE_ASSISTANT
                && (info.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
    }

    private boolean disableHorizontalSwipe(MotionEvent event) {
        // mExclusionRegion can change on binder thread, use a local instance here.
        Region exclusionRegion = mExclusionRegion;
Loading