Loading go/quickstep/src/com/android/quickstep/TouchInteractionService.java +1 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ public class TouchInteractionService extends Service { return mMyBinder; } public static boolean isInputMonitorInitialized() { public static boolean isInitialized() { return true; } } iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java +8 −4 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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]; Loading Loading @@ -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) { Loading Loading @@ -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; Loading quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -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; } Loading quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java +2 −7 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 */ Loading Loading @@ -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; Loading quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +44 −8 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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() { Loading Loading @@ -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) { Loading Loading @@ -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( Loading Loading @@ -492,6 +506,7 @@ public class TouchInteractionService extends Service implements @Override public void onDestroy() { sIsInitialized = false; if (mIsUserUnlocked) { mInputConsumer.unregisterInputConsumer(); mOverviewComponentObserver.onDestroy(); Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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 */); } Loading @@ -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; Loading @@ -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); Loading @@ -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 Loading
go/quickstep/src/com/android/quickstep/TouchInteractionService.java +1 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ public class TouchInteractionService extends Service { return mMyBinder; } public static boolean isInputMonitorInitialized() { public static boolean isInitialized() { return true; } }
iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java +8 −4 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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]; Loading Loading @@ -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) { Loading Loading @@ -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; Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -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; } Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java +2 −7 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 */ Loading Loading @@ -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; Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +44 −8 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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() { Loading Loading @@ -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) { Loading Loading @@ -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( Loading Loading @@ -492,6 +506,7 @@ public class TouchInteractionService extends Service implements @Override public void onDestroy() { sIsInitialized = false; if (mIsUserUnlocked) { mInputConsumer.unregisterInputConsumer(); mOverviewComponentObserver.onDestroy(); Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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 */); } Loading @@ -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; Loading @@ -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); Loading @@ -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