From dad9c040b82874008e4ec9030ed305cc2d3a85ee Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Wed, 15 Jul 2015 11:07:53 -0700 Subject: [PATCH] Improve drawer performance - Instead of using a ColorFilter or an Opacity widget to colorize the Icons, add a ColorFilter parameter it the image classes. This avoids needing to call saveLayer for each DrawerItem. - Ask Android for unbuffered input events to avoid bad synchronization with vsync. R=ianh@google.com Review URL: https://codereview.chromium.org/1236043004 . --- .../org/domokit/sky/shell/PlatformViewAndroid.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/shell/android/org/domokit/sky/shell/PlatformViewAndroid.java b/engine/src/flutter/shell/android/org/domokit/sky/shell/PlatformViewAndroid.java index be7dbf41d6b..a9e4dbb1fdb 100644 --- a/engine/src/flutter/shell/android/org/domokit/sky/shell/PlatformViewAndroid.java +++ b/engine/src/flutter/shell/android/org/domokit/sky/shell/PlatformViewAndroid.java @@ -5,6 +5,7 @@ package org.domokit.sky.shell; import android.content.Context; +import android.os.Build; import android.view.MotionEvent; import android.view.Surface; import android.view.SurfaceHolder; @@ -170,15 +171,23 @@ public class PlatformViewAndroid extends SurfaceView inputEvent.timeStamp = event.getEventTime(); inputEvent.pointerData = pointerData; - - mSkyEngine.onInputEvent(inputEvent); } @Override public boolean onTouchEvent(MotionEvent event) { + // TODO(abarth): This version check might not be effective in some + // versions of Android that statically compile code and will be upset + // at the lack of |requestUnbufferedDispatch|. Instead, we should factor + // version-dependent code into separate classes for each supported + // version and dispatch dynamically. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + requestUnbufferedDispatch(event); + } mGestureProvider.onTouchEvent(event); + // TODO(abarth): Rather than unpacking these events here, we should + // probably send them in one packet to the engine. int maskedAction = event.getActionMasked(); // ACTION_UP, ACTION_POINTER_UP, ACTION_DOWN, and ACTION_POINTER_DOWN // only apply to a single pointer, other events apply to all pointers.