Merge "Fixing generation of fake app-to-recents events" into ub-launcher3-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
43936eb05c
@@ -37,10 +37,8 @@ import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.metrics.LogMaker;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.Choreographer;
|
||||
import android.view.Display;
|
||||
@@ -66,40 +64,6 @@ import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
class EventLogTags {
|
||||
private EventLogTags() {
|
||||
} // don't instantiate
|
||||
|
||||
/** 524292 sysui_multi_action (content|4) */
|
||||
public static final int SYSUI_MULTI_ACTION = 524292;
|
||||
|
||||
public static void writeSysuiMultiAction(Object[] content) {
|
||||
android.util.EventLog.writeEvent(SYSUI_MULTI_ACTION, content);
|
||||
}
|
||||
}
|
||||
|
||||
class MetricsLogger {
|
||||
private static MetricsLogger sMetricsLogger;
|
||||
|
||||
private static MetricsLogger getLogger() {
|
||||
if (sMetricsLogger == null) {
|
||||
sMetricsLogger = new MetricsLogger();
|
||||
}
|
||||
return sMetricsLogger;
|
||||
}
|
||||
|
||||
protected void saveLog(Object[] rep) {
|
||||
EventLogTags.writeSysuiMultiAction(rep);
|
||||
}
|
||||
|
||||
public void write(LogMaker content) {
|
||||
if (content.getType() == 0/*MetricsEvent.TYPE_UNKNOWN*/) {
|
||||
content.setType(4/*MetricsEvent.TYPE_ACTION*/);
|
||||
}
|
||||
saveLog(content.serialize());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Touch consumer for handling events originating from an activity other than Launcher
|
||||
*/
|
||||
@@ -129,8 +93,6 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
private VelocityTracker mVelocityTracker;
|
||||
private MotionEventQueue mEventQueue;
|
||||
|
||||
private final MetricsLogger mMetricsLogger = new MetricsLogger();
|
||||
|
||||
public OtherActivityTouchConsumer(Context base, RunningTaskInfo runningTaskInfo,
|
||||
RecentsModel recentsModel, Intent homeIntent, ISystemUiProxy systemUiProxy,
|
||||
MainThreadExecutor mainThreadExecutor, Choreographer backgroundThreadChoreographer,
|
||||
@@ -312,7 +274,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
private void startTouchTrackingForWindowAnimation(long touchTimeMs) {
|
||||
// Create the shared handler
|
||||
final WindowTransformSwipeHandler handler =
|
||||
new WindowTransformSwipeHandler(mRunningTask, this);
|
||||
new WindowTransformSwipeHandler(mRunningTask, this, touchTimeMs);
|
||||
|
||||
// Preload the plan
|
||||
mRecentsModel.loadTasks(mRunningTask.id, null);
|
||||
@@ -350,16 +312,6 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
TraceHelper.endSection("RecentsController", "Finishing no handler");
|
||||
controller.finish(false /* toHome */);
|
||||
}
|
||||
|
||||
// Mimic ActivityMetricsLogger.logAppTransitionMultiEvents() logging for
|
||||
// "Recents" activity for app transition tests.
|
||||
final LogMaker builder = new LogMaker(761/*APP_TRANSITION*/);
|
||||
builder.setPackageName("com.android.systemui");
|
||||
builder.addTaggedData(871/*FIELD_CLASS_NAME*/,
|
||||
"com.android.systemui.recents.RecentsActivity");
|
||||
builder.addTaggedData(319/*APP_TRANSITION_DELAY_MS*/,
|
||||
SystemClock.uptimeMillis() - touchTimeMs);
|
||||
mMetricsLogger.write(builder);
|
||||
}
|
||||
|
||||
public void onAnimationCanceled() {
|
||||
|
||||
@@ -39,9 +39,11 @@ import android.graphics.Matrix.ScaleToFit;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.metrics.LogMaker;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.annotation.WorkerThread;
|
||||
import android.util.Log;
|
||||
@@ -77,6 +79,40 @@ import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||
|
||||
import java.util.StringJoiner;
|
||||
|
||||
class EventLogTags {
|
||||
private EventLogTags() {
|
||||
} // don't instantiate
|
||||
|
||||
/** 524292 sysui_multi_action (content|4) */
|
||||
public static final int SYSUI_MULTI_ACTION = 524292;
|
||||
|
||||
public static void writeSysuiMultiAction(Object[] content) {
|
||||
android.util.EventLog.writeEvent(SYSUI_MULTI_ACTION, content);
|
||||
}
|
||||
}
|
||||
|
||||
class MetricsLogger {
|
||||
private static MetricsLogger sMetricsLogger;
|
||||
|
||||
private static MetricsLogger getLogger() {
|
||||
if (sMetricsLogger == null) {
|
||||
sMetricsLogger = new MetricsLogger();
|
||||
}
|
||||
return sMetricsLogger;
|
||||
}
|
||||
|
||||
protected void saveLog(Object[] rep) {
|
||||
EventLogTags.writeSysuiMultiAction(rep);
|
||||
}
|
||||
|
||||
public void write(LogMaker content) {
|
||||
if (content.getType() == 0/*MetricsEvent.TYPE_UNKNOWN*/) {
|
||||
content.setType(4/*MetricsEvent.TYPE_ACTION*/);
|
||||
}
|
||||
saveLog(content.serialize());
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler {
|
||||
private static final String TAG = WindowTransformSwipeHandler.class.getSimpleName();
|
||||
@@ -189,10 +225,14 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler {
|
||||
|
||||
private final RecentsAnimationWrapper mRecentsAnimationWrapper = new RecentsAnimationWrapper();
|
||||
private Matrix mTmpMatrix = new Matrix();
|
||||
private final long mTouchTimeMs;
|
||||
private long mLauncherFrameDrawnTime;
|
||||
private final MetricsLogger mMetricsLogger = new MetricsLogger();
|
||||
|
||||
WindowTransformSwipeHandler(RunningTaskInfo runningTaskInfo, Context context) {
|
||||
WindowTransformSwipeHandler(RunningTaskInfo runningTaskInfo, Context context, long touchTimeMs) {
|
||||
mContext = context;
|
||||
mRunningTaskId = runningTaskInfo.id;
|
||||
mTouchTimeMs = touchTimeMs;
|
||||
mInputConsumer.registerInputConsumer();
|
||||
initStateCallbacks();
|
||||
}
|
||||
@@ -416,11 +456,22 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler {
|
||||
if (mLauncherDrawnCallback != null) {
|
||||
mLauncherDrawnCallback.run();
|
||||
}
|
||||
mLauncherFrameDrawnTime = SystemClock.uptimeMillis();
|
||||
}
|
||||
|
||||
private void initializeLauncherAnimationController() {
|
||||
mLauncherLayoutListener.setHandler(this);
|
||||
onLauncherLayoutChanged();
|
||||
|
||||
// Mimic ActivityMetricsLogger.logAppTransitionMultiEvents() logging for
|
||||
// "Recents" activity for app transition tests for the app-to-recents case.
|
||||
final LogMaker builder = new LogMaker(761/*APP_TRANSITION*/);
|
||||
builder.setPackageName("com.android.systemui");
|
||||
builder.addTaggedData(871/*FIELD_CLASS_NAME*/,
|
||||
"com.android.systemui.recents.RecentsActivity");
|
||||
builder.addTaggedData(319/*APP_TRANSITION_DELAY_MS*/,
|
||||
mLauncherFrameDrawnTime - mTouchTimeMs);
|
||||
mMetricsLogger.write(builder);
|
||||
}
|
||||
|
||||
public void updateInteractionType(@InteractionType int interactionType) {
|
||||
|
||||
Reference in New Issue
Block a user