Merge "Migrate PiP logs to UiEvent" into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
178e18a7fc
@@ -16,14 +16,8 @@
|
|||||||
|
|
||||||
package com.android.internal.os.logging;
|
package com.android.internal.os.logging;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
|
||||||
import android.util.Pair;
|
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
|
||||||
import com.android.internal.util.FrameworkStatsLog;
|
import com.android.internal.util.FrameworkStatsLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,81 +26,6 @@ import com.android.internal.util.FrameworkStatsLog;
|
|||||||
*/
|
*/
|
||||||
public class MetricsLoggerWrapper {
|
public class MetricsLoggerWrapper {
|
||||||
|
|
||||||
private static final int METRIC_VALUE_DISMISSED_BY_TAP = 0;
|
|
||||||
private static final int METRIC_VALUE_DISMISSED_BY_DRAG = 1;
|
|
||||||
|
|
||||||
public static void logPictureInPictureDismissByTap(Context context,
|
|
||||||
Pair<ComponentName, Integer> topActivityInfo) {
|
|
||||||
MetricsLogger.action(context, MetricsEvent.ACTION_PICTURE_IN_PICTURE_DISMISSED,
|
|
||||||
METRIC_VALUE_DISMISSED_BY_TAP);
|
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED,
|
|
||||||
getUid(context, topActivityInfo.first, topActivityInfo.second),
|
|
||||||
topActivityInfo.first.flattenToString(),
|
|
||||||
FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED__STATE__DISMISSED);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logPictureInPictureDismissByDrag(Context context,
|
|
||||||
Pair<ComponentName, Integer> topActivityInfo) {
|
|
||||||
MetricsLogger.action(context,
|
|
||||||
MetricsEvent.ACTION_PICTURE_IN_PICTURE_DISMISSED,
|
|
||||||
METRIC_VALUE_DISMISSED_BY_DRAG);
|
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED,
|
|
||||||
getUid(context, topActivityInfo.first, topActivityInfo.second),
|
|
||||||
topActivityInfo.first.flattenToString(),
|
|
||||||
FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED__STATE__DISMISSED);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logPictureInPictureMinimize(Context context, boolean isMinimized,
|
|
||||||
Pair<ComponentName, Integer> topActivityInfo) {
|
|
||||||
MetricsLogger.action(context, MetricsEvent.ACTION_PICTURE_IN_PICTURE_MINIMIZED,
|
|
||||||
isMinimized);
|
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED,
|
|
||||||
getUid(context, topActivityInfo.first, topActivityInfo.second),
|
|
||||||
topActivityInfo.first.flattenToString(),
|
|
||||||
FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED__STATE__MINIMIZED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get uid from component name and user Id
|
|
||||||
* @return uid. -1 if not found.
|
|
||||||
*/
|
|
||||||
private static int getUid(Context context, ComponentName componentName, int userId) {
|
|
||||||
int uid = -1;
|
|
||||||
if (componentName == null) {
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
uid = context.getPackageManager().getApplicationInfoAsUser(
|
|
||||||
componentName.getPackageName(), 0, userId).uid;
|
|
||||||
} catch (NameNotFoundException e) {
|
|
||||||
}
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logPictureInPictureMenuVisible(Context context, boolean menuStateFull) {
|
|
||||||
MetricsLogger.visibility(context, MetricsEvent.ACTION_PICTURE_IN_PICTURE_MENU,
|
|
||||||
menuStateFull);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logPictureInPictureEnter(Context context,
|
|
||||||
int uid, String shortComponentName, boolean supportsEnterPipOnTaskSwitch) {
|
|
||||||
MetricsLogger.action(context, MetricsEvent.ACTION_PICTURE_IN_PICTURE_ENTERED,
|
|
||||||
supportsEnterPipOnTaskSwitch);
|
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED, uid,
|
|
||||||
shortComponentName,
|
|
||||||
FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED__STATE__ENTERED);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logPictureInPictureFullScreen(Context context, int uid,
|
|
||||||
String shortComponentName) {
|
|
||||||
MetricsLogger.action(context,
|
|
||||||
MetricsEvent.ACTION_PICTURE_IN_PICTURE_EXPANDED_TO_FULLSCREEN);
|
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED,
|
|
||||||
uid,
|
|
||||||
shortComponentName,
|
|
||||||
FrameworkStatsLog.PICTURE_IN_PICTURE_STATE_CHANGED__STATE__EXPANDED_TO_FULL_SCREEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logAppOverlayEnter(int uid, String packageName, boolean changed, int type, boolean usingAlertWindow) {
|
public static void logAppOverlayEnter(int uid, String packageName, boolean changed, int type, boolean usingAlertWindow) {
|
||||||
if (changed) {
|
if (changed) {
|
||||||
if (type != LayoutParams.TYPE_APPLICATION_OVERLAY) {
|
if (type != LayoutParams.TYPE_APPLICATION_OVERLAY) {
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
private final Handler mUpdateHandler;
|
private final Handler mUpdateHandler;
|
||||||
private final PipBoundsHandler mPipBoundsHandler;
|
private final PipBoundsHandler mPipBoundsHandler;
|
||||||
private final PipAnimationController mPipAnimationController;
|
private final PipAnimationController mPipAnimationController;
|
||||||
|
private final PipUiEventLogger mPipUiEventLoggerLogger;
|
||||||
private final List<PipTransitionCallback> mPipTransitionCallbacks = new ArrayList<>();
|
private final List<PipTransitionCallback> mPipTransitionCallbacks = new ArrayList<>();
|
||||||
private final Rect mLastReportedBounds = new Rect();
|
private final Rect mLastReportedBounds = new Rect();
|
||||||
private final int mEnterExitAnimationDuration;
|
private final int mEnterExitAnimationDuration;
|
||||||
@@ -206,7 +207,8 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
@NonNull PipSurfaceTransactionHelper surfaceTransactionHelper,
|
@NonNull PipSurfaceTransactionHelper surfaceTransactionHelper,
|
||||||
@Nullable Divider divider,
|
@Nullable Divider divider,
|
||||||
@NonNull DisplayController displayController,
|
@NonNull DisplayController displayController,
|
||||||
@NonNull PipAnimationController pipAnimationController) {
|
@NonNull PipAnimationController pipAnimationController,
|
||||||
|
@NonNull PipUiEventLogger pipUiEventLogger) {
|
||||||
mMainHandler = new Handler(Looper.getMainLooper());
|
mMainHandler = new Handler(Looper.getMainLooper());
|
||||||
mUpdateHandler = new Handler(PipUpdateThread.get().getLooper(), mUpdateCallbacks);
|
mUpdateHandler = new Handler(PipUpdateThread.get().getLooper(), mUpdateCallbacks);
|
||||||
mPipBoundsHandler = boundsHandler;
|
mPipBoundsHandler = boundsHandler;
|
||||||
@@ -214,6 +216,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
.getInteger(R.integer.config_pipResizeAnimationDuration);
|
.getInteger(R.integer.config_pipResizeAnimationDuration);
|
||||||
mSurfaceTransactionHelper = surfaceTransactionHelper;
|
mSurfaceTransactionHelper = surfaceTransactionHelper;
|
||||||
mPipAnimationController = pipAnimationController;
|
mPipAnimationController = pipAnimationController;
|
||||||
|
mPipUiEventLoggerLogger = pipUiEventLogger;
|
||||||
mSurfaceControlTransactionFactory = SurfaceControl.Transaction::new;
|
mSurfaceControlTransactionFactory = SurfaceControl.Transaction::new;
|
||||||
mSplitDivider = divider;
|
mSplitDivider = divider;
|
||||||
displayController.addDisplayWindowListener(this);
|
displayController.addDisplayWindowListener(this);
|
||||||
@@ -276,6 +279,8 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mPipUiEventLoggerLogger.log(
|
||||||
|
PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_EXPAND_TO_FULLSCREEN);
|
||||||
final Configuration initialConfig = mInitialState.remove(mToken.asBinder());
|
final Configuration initialConfig = mInitialState.remove(mToken.asBinder());
|
||||||
final boolean orientationDiffers = initialConfig.windowConfiguration.getRotation()
|
final boolean orientationDiffers = initialConfig.windowConfiguration.getRotation()
|
||||||
!= mPipBoundsHandler.getDisplayRotation();
|
!= mPipBoundsHandler.getDisplayRotation();
|
||||||
@@ -375,6 +380,9 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
mInitialState.put(mToken.asBinder(), new Configuration(mTaskInfo.configuration));
|
mInitialState.put(mToken.asBinder(), new Configuration(mTaskInfo.configuration));
|
||||||
mPictureInPictureParams = mTaskInfo.pictureInPictureParams;
|
mPictureInPictureParams = mTaskInfo.pictureInPictureParams;
|
||||||
|
|
||||||
|
mPipUiEventLoggerLogger.setTaskInfo(mTaskInfo);
|
||||||
|
mPipUiEventLoggerLogger.log(PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_ENTER);
|
||||||
|
|
||||||
if (mShouldDeferEnteringPip) {
|
if (mShouldDeferEnteringPip) {
|
||||||
if (DEBUG) Log.d(TAG, "Defer entering PiP animation, fixed rotation is ongoing");
|
if (DEBUG) Log.d(TAG, "Defer entering PiP animation, fixed rotation is ongoing");
|
||||||
// if deferred, hide the surface till fixed rotation is completed
|
// if deferred, hide the surface till fixed rotation is completed
|
||||||
@@ -507,6 +515,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
mPictureInPictureParams = null;
|
mPictureInPictureParams = null;
|
||||||
mInPip = false;
|
mInPip = false;
|
||||||
mExitingPip = false;
|
mExitingPip = false;
|
||||||
|
mPipUiEventLoggerLogger.setTaskInfo(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -622,7 +631,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
* {@link PictureInPictureParams} would affect the bounds.
|
* {@link PictureInPictureParams} would affect the bounds.
|
||||||
*/
|
*/
|
||||||
private boolean applyPictureInPictureParams(@NonNull PictureInPictureParams params) {
|
private boolean applyPictureInPictureParams(@NonNull PictureInPictureParams params) {
|
||||||
final boolean changed = (mPictureInPictureParams == null) ? true : !Objects.equals(
|
final boolean changed = (mPictureInPictureParams == null) || !Objects.equals(
|
||||||
mPictureInPictureParams.getAspectRatioRational(), params.getAspectRatioRational());
|
mPictureInPictureParams.getAspectRatioRational(), params.getAspectRatioRational());
|
||||||
if (changed) {
|
if (changed) {
|
||||||
mPictureInPictureParams = params;
|
mPictureInPictureParams = params;
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.systemui.pip;
|
||||||
|
|
||||||
|
import android.app.TaskInfo;
|
||||||
|
|
||||||
|
import com.android.internal.logging.UiEvent;
|
||||||
|
import com.android.internal.logging.UiEventLogger;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class that ends PiP log to UiEvent, see also go/uievent
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class PipUiEventLogger {
|
||||||
|
|
||||||
|
private final UiEventLogger mUiEventLogger;
|
||||||
|
|
||||||
|
private TaskInfo mTaskInfo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PipUiEventLogger(UiEventLogger uiEventLogger) {
|
||||||
|
mUiEventLogger = uiEventLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskInfo(TaskInfo taskInfo) {
|
||||||
|
mTaskInfo = taskInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends log via UiEvent, reference go/uievent for how to debug locally
|
||||||
|
*/
|
||||||
|
public void log(PipUiEventEnum event) {
|
||||||
|
if (mTaskInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mUiEventLogger.log(event, mTaskInfo.userId, mTaskInfo.topActivity.getPackageName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enums for logging the PiP events to UiEvent
|
||||||
|
*/
|
||||||
|
public enum PipUiEventEnum implements UiEventLogger.UiEventEnum {
|
||||||
|
@UiEvent(doc = "Activity enters picture-in-picture mode")
|
||||||
|
PICTURE_IN_PICTURE_ENTER(603),
|
||||||
|
|
||||||
|
@UiEvent(doc = "Expands from picture-in-picture to fullscreen")
|
||||||
|
PICTURE_IN_PICTURE_EXPAND_TO_FULLSCREEN(604),
|
||||||
|
|
||||||
|
@UiEvent(doc = "Removes picture-in-picture by tap close button")
|
||||||
|
PICTURE_IN_PICTURE_TAP_TO_REMOVE(605),
|
||||||
|
|
||||||
|
@UiEvent(doc = "Removes picture-in-picture by drag to dismiss area")
|
||||||
|
PICTURE_IN_PICTURE_DRAG_TO_REMOVE(606),
|
||||||
|
|
||||||
|
@UiEvent(doc = "Shows picture-in-picture menu")
|
||||||
|
PICTURE_IN_PICTURE_SHOW_MENU(607),
|
||||||
|
|
||||||
|
@UiEvent(doc = "Hides picture-in-picture menu")
|
||||||
|
PICTURE_IN_PICTURE_HIDE_MENU(608),
|
||||||
|
|
||||||
|
@UiEvent(doc = "Changes the aspect ratio of picture-in-picture window. This is inherited"
|
||||||
|
+ " from previous Tron-based logging and currently not in use.")
|
||||||
|
PICTURE_IN_PICTURE_CHANGE_ASPECT_RATIO(609),
|
||||||
|
|
||||||
|
@UiEvent(doc = "User resize of the picture-in-picture window")
|
||||||
|
PICTURE_IN_PICTURE_RESIZE(610);
|
||||||
|
|
||||||
|
private final int mId;
|
||||||
|
|
||||||
|
PipUiEventEnum(int id) {
|
||||||
|
mId = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return mId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,6 +46,7 @@ import com.android.systemui.pip.BasePipManager;
|
|||||||
import com.android.systemui.pip.PipBoundsHandler;
|
import com.android.systemui.pip.PipBoundsHandler;
|
||||||
import com.android.systemui.pip.PipSnapAlgorithm;
|
import com.android.systemui.pip.PipSnapAlgorithm;
|
||||||
import com.android.systemui.pip.PipTaskOrganizer;
|
import com.android.systemui.pip.PipTaskOrganizer;
|
||||||
|
import com.android.systemui.pip.PipUiEventLogger;
|
||||||
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
|
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
|
||||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||||
import com.android.systemui.shared.system.InputConsumerController;
|
import com.android.systemui.shared.system.InputConsumerController;
|
||||||
@@ -241,7 +242,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
|||||||
PipBoundsHandler pipBoundsHandler,
|
PipBoundsHandler pipBoundsHandler,
|
||||||
PipSnapAlgorithm pipSnapAlgorithm,
|
PipSnapAlgorithm pipSnapAlgorithm,
|
||||||
PipTaskOrganizer pipTaskOrganizer,
|
PipTaskOrganizer pipTaskOrganizer,
|
||||||
SysUiState sysUiState) {
|
SysUiState sysUiState,
|
||||||
|
PipUiEventLogger pipUiEventLogger) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mActivityManager = ActivityManager.getService();
|
mActivityManager = ActivityManager.getService();
|
||||||
|
|
||||||
@@ -262,7 +264,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
|||||||
mInputConsumerController);
|
mInputConsumerController);
|
||||||
mTouchHandler = new PipTouchHandler(context, mActivityManager,
|
mTouchHandler = new PipTouchHandler(context, mActivityManager,
|
||||||
mMenuController, mInputConsumerController, mPipBoundsHandler, mPipTaskOrganizer,
|
mMenuController, mInputConsumerController, mPipBoundsHandler, mPipTaskOrganizer,
|
||||||
floatingContentCoordinator, deviceConfig, pipSnapAlgorithm, sysUiState);
|
floatingContentCoordinator, deviceConfig, pipSnapAlgorithm, sysUiState,
|
||||||
|
pipUiEventLogger);
|
||||||
mAppOpsListener = new PipAppOpsListener(context, mActivityManager,
|
mAppOpsListener = new PipAppOpsListener(context, mActivityManager,
|
||||||
mTouchHandler.getMotionHelper());
|
mTouchHandler.getMotionHelper());
|
||||||
displayController.addDisplayChangingController(mRotationController);
|
displayController.addDisplayChangingController(mRotationController);
|
||||||
|
|||||||
@@ -53,12 +53,12 @@ import com.android.systemui.R;
|
|||||||
import com.android.systemui.model.SysUiState;
|
import com.android.systemui.model.SysUiState;
|
||||||
import com.android.systemui.pip.PipBoundsHandler;
|
import com.android.systemui.pip.PipBoundsHandler;
|
||||||
import com.android.systemui.pip.PipTaskOrganizer;
|
import com.android.systemui.pip.PipTaskOrganizer;
|
||||||
|
import com.android.systemui.pip.PipUiEventLogger;
|
||||||
import com.android.systemui.util.DeviceConfigProxy;
|
import com.android.systemui.util.DeviceConfigProxy;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper on top of PipTouchHandler that handles inputs OUTSIDE of the PIP window, which is used to
|
* Helper on top of PipTouchHandler that handles inputs OUTSIDE of the PIP window, which is used to
|
||||||
@@ -110,13 +110,15 @@ public class PipResizeGestureHandler {
|
|||||||
private InputMonitor mInputMonitor;
|
private InputMonitor mInputMonitor;
|
||||||
private InputEventReceiver mInputEventReceiver;
|
private InputEventReceiver mInputEventReceiver;
|
||||||
private PipTaskOrganizer mPipTaskOrganizer;
|
private PipTaskOrganizer mPipTaskOrganizer;
|
||||||
|
private PipUiEventLogger mPipUiEventLogger;
|
||||||
|
|
||||||
private int mCtrlType;
|
private int mCtrlType;
|
||||||
|
|
||||||
public PipResizeGestureHandler(Context context, PipBoundsHandler pipBoundsHandler,
|
public PipResizeGestureHandler(Context context, PipBoundsHandler pipBoundsHandler,
|
||||||
PipMotionHelper motionHelper, DeviceConfigProxy deviceConfig,
|
PipMotionHelper motionHelper, DeviceConfigProxy deviceConfig,
|
||||||
PipTaskOrganizer pipTaskOrganizer, Function<Rect, Rect> movementBoundsSupplier,
|
PipTaskOrganizer pipTaskOrganizer, Function<Rect, Rect> movementBoundsSupplier,
|
||||||
Runnable updateMovementBoundsRunnable, SysUiState sysUiState) {
|
Runnable updateMovementBoundsRunnable, SysUiState sysUiState,
|
||||||
|
PipUiEventLogger pipUiEventLogger) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDisplayId = context.getDisplayId();
|
mDisplayId = context.getDisplayId();
|
||||||
mMainExecutor = context.getMainExecutor();
|
mMainExecutor = context.getMainExecutor();
|
||||||
@@ -126,6 +128,7 @@ public class PipResizeGestureHandler {
|
|||||||
mMovementBoundsSupplier = movementBoundsSupplier;
|
mMovementBoundsSupplier = movementBoundsSupplier;
|
||||||
mUpdateMovementBoundsRunnable = updateMovementBoundsRunnable;
|
mUpdateMovementBoundsRunnable = updateMovementBoundsRunnable;
|
||||||
mSysUiState = sysUiState;
|
mSysUiState = sysUiState;
|
||||||
|
mPipUiEventLogger = pipUiEventLogger;
|
||||||
|
|
||||||
context.getDisplay().getRealSize(mMaxSize);
|
context.getDisplay().getRealSize(mMaxSize);
|
||||||
reloadResources();
|
reloadResources();
|
||||||
@@ -338,6 +341,8 @@ public class PipResizeGestureHandler {
|
|||||||
resetState();
|
resetState();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
mPipUiEventLogger.log(
|
||||||
|
PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_RESIZE);
|
||||||
} else {
|
} else {
|
||||||
resetState();
|
resetState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import android.graphics.drawable.TransitionDrawable;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Pair;
|
|
||||||
import android.util.Size;
|
import android.util.Size;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.IPinnedStackController;
|
import android.view.IPinnedStackController;
|
||||||
@@ -55,13 +54,13 @@ import androidx.dynamicanimation.animation.DynamicAnimation;
|
|||||||
import androidx.dynamicanimation.animation.SpringForce;
|
import androidx.dynamicanimation.animation.SpringForce;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.os.logging.MetricsLoggerWrapper;
|
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.model.SysUiState;
|
import com.android.systemui.model.SysUiState;
|
||||||
import com.android.systemui.pip.PipAnimationController;
|
import com.android.systemui.pip.PipAnimationController;
|
||||||
import com.android.systemui.pip.PipBoundsHandler;
|
import com.android.systemui.pip.PipBoundsHandler;
|
||||||
import com.android.systemui.pip.PipSnapAlgorithm;
|
import com.android.systemui.pip.PipSnapAlgorithm;
|
||||||
import com.android.systemui.pip.PipTaskOrganizer;
|
import com.android.systemui.pip.PipTaskOrganizer;
|
||||||
|
import com.android.systemui.pip.PipUiEventLogger;
|
||||||
import com.android.systemui.shared.system.InputConsumerController;
|
import com.android.systemui.shared.system.InputConsumerController;
|
||||||
import com.android.systemui.util.DeviceConfigProxy;
|
import com.android.systemui.util.DeviceConfigProxy;
|
||||||
import com.android.systemui.util.DismissCircleView;
|
import com.android.systemui.util.DismissCircleView;
|
||||||
@@ -94,6 +93,8 @@ public class PipTouchHandler {
|
|||||||
private final WindowManager mWindowManager;
|
private final WindowManager mWindowManager;
|
||||||
private final IActivityManager mActivityManager;
|
private final IActivityManager mActivityManager;
|
||||||
private final PipBoundsHandler mPipBoundsHandler;
|
private final PipBoundsHandler mPipBoundsHandler;
|
||||||
|
private final PipUiEventLogger mPipUiEventLogger;
|
||||||
|
|
||||||
private PipResizeGestureHandler mPipResizeGestureHandler;
|
private PipResizeGestureHandler mPipResizeGestureHandler;
|
||||||
private IPinnedStackController mPinnedStackController;
|
private IPinnedStackController mPinnedStackController;
|
||||||
|
|
||||||
@@ -198,11 +199,7 @@ public class PipTouchHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPipDismiss() {
|
public void onPipDismiss() {
|
||||||
Pair<ComponentName, Integer> topPipActivity = PipUtils.getTopPipActivity(mContext,
|
mPipUiEventLogger.log(PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_TAP_TO_REMOVE);
|
||||||
mActivityManager);
|
|
||||||
if (topPipActivity.first != null) {
|
|
||||||
MetricsLoggerWrapper.logPictureInPictureDismissByTap(mContext, topPipActivity);
|
|
||||||
}
|
|
||||||
mTouchState.removeDoubleTapTimeoutCallback();
|
mTouchState.removeDoubleTapTimeoutCallback();
|
||||||
mMotionHelper.dismissPip();
|
mMotionHelper.dismissPip();
|
||||||
}
|
}
|
||||||
@@ -223,7 +220,8 @@ public class PipTouchHandler {
|
|||||||
FloatingContentCoordinator floatingContentCoordinator,
|
FloatingContentCoordinator floatingContentCoordinator,
|
||||||
DeviceConfigProxy deviceConfig,
|
DeviceConfigProxy deviceConfig,
|
||||||
PipSnapAlgorithm pipSnapAlgorithm,
|
PipSnapAlgorithm pipSnapAlgorithm,
|
||||||
SysUiState sysUiState) {
|
SysUiState sysUiState,
|
||||||
|
PipUiEventLogger pipUiEventLogger) {
|
||||||
// Initialize the Pip input consumer
|
// Initialize the Pip input consumer
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mActivityManager = activityManager;
|
mActivityManager = activityManager;
|
||||||
@@ -238,7 +236,7 @@ public class PipTouchHandler {
|
|||||||
mPipResizeGestureHandler =
|
mPipResizeGestureHandler =
|
||||||
new PipResizeGestureHandler(context, pipBoundsHandler, mMotionHelper,
|
new PipResizeGestureHandler(context, pipBoundsHandler, mMotionHelper,
|
||||||
deviceConfig, pipTaskOrganizer, this::getMovementBounds,
|
deviceConfig, pipTaskOrganizer, this::getMovementBounds,
|
||||||
this::updateMovementBounds, sysUiState);
|
this::updateMovementBounds, sysUiState, pipUiEventLogger);
|
||||||
mTouchState = new PipTouchState(ViewConfiguration.get(context), mHandler,
|
mTouchState = new PipTouchState(ViewConfiguration.get(context), mHandler,
|
||||||
() -> mMenuController.showMenuWithDelay(MENU_STATE_FULL, mMotionHelper.getBounds(),
|
() -> mMenuController.showMenuWithDelay(MENU_STATE_FULL, mMotionHelper.getBounds(),
|
||||||
true /* allowMenuTimeout */, willResizeMenu(), shouldShowResizeHandle()),
|
true /* allowMenuTimeout */, willResizeMenu(), shouldShowResizeHandle()),
|
||||||
@@ -259,6 +257,8 @@ public class PipTouchHandler {
|
|||||||
pipTaskOrganizer, pipSnapAlgorithm, this::onAccessibilityShowMenu,
|
pipTaskOrganizer, pipSnapAlgorithm, this::onAccessibilityShowMenu,
|
||||||
this::updateMovementBounds, mHandler);
|
this::updateMovementBounds, mHandler);
|
||||||
|
|
||||||
|
mPipUiEventLogger = pipUiEventLogger;
|
||||||
|
|
||||||
mTargetView = new DismissCircleView(context);
|
mTargetView = new DismissCircleView(context);
|
||||||
mTargetViewContainer = new FrameLayout(context);
|
mTargetViewContainer = new FrameLayout(context);
|
||||||
mTargetViewContainer.setBackgroundDrawable(
|
mTargetViewContainer.setBackgroundDrawable(
|
||||||
@@ -303,11 +303,8 @@ public class PipTouchHandler {
|
|||||||
hideDismissTarget();
|
hideDismissTarget();
|
||||||
});
|
});
|
||||||
|
|
||||||
Pair<ComponentName, Integer> topPipActivity = PipUtils.getTopPipActivity(mContext,
|
mPipUiEventLogger.log(
|
||||||
mActivityManager);
|
PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_DRAG_TO_REMOVE);
|
||||||
if (topPipActivity.first != null) {
|
|
||||||
MetricsLoggerWrapper.logPictureInPictureDismissByDrag(mContext, topPipActivity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -852,8 +849,10 @@ public class PipTouchHandler {
|
|||||||
// If pip menu has dismissed, we should register the A11y ActionReplacingConnection for pip
|
// If pip menu has dismissed, we should register the A11y ActionReplacingConnection for pip
|
||||||
// as well, or it can't handle a11y focus and pip menu can't perform any action.
|
// as well, or it can't handle a11y focus and pip menu can't perform any action.
|
||||||
onRegistrationChanged(menuState == MENU_STATE_NONE);
|
onRegistrationChanged(menuState == MENU_STATE_NONE);
|
||||||
if (menuState != MENU_STATE_CLOSE) {
|
if (menuState == MENU_STATE_NONE) {
|
||||||
MetricsLoggerWrapper.logPictureInPictureMenuVisible(mContext, menuState == MENU_STATE_FULL);
|
mPipUiEventLogger.log(PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_HIDE_MENU);
|
||||||
|
} else if (menuState == MENU_STATE_FULL) {
|
||||||
|
mPipUiEventLogger.log(PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_SHOW_MENU);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.android.systemui.model.SysUiState;
|
|||||||
import com.android.systemui.pip.PipBoundsHandler;
|
import com.android.systemui.pip.PipBoundsHandler;
|
||||||
import com.android.systemui.pip.PipSnapAlgorithm;
|
import com.android.systemui.pip.PipSnapAlgorithm;
|
||||||
import com.android.systemui.pip.PipTaskOrganizer;
|
import com.android.systemui.pip.PipTaskOrganizer;
|
||||||
|
import com.android.systemui.pip.PipUiEventLogger;
|
||||||
import com.android.systemui.shared.system.InputConsumerController;
|
import com.android.systemui.shared.system.InputConsumerController;
|
||||||
import com.android.systemui.util.DeviceConfigProxy;
|
import com.android.systemui.util.DeviceConfigProxy;
|
||||||
import com.android.systemui.util.FloatingContentCoordinator;
|
import com.android.systemui.util.FloatingContentCoordinator;
|
||||||
@@ -85,6 +86,9 @@ public class PipTouchHandlerTest extends SysuiTestCase {
|
|||||||
@Mock
|
@Mock
|
||||||
private SysUiState mSysUiState;
|
private SysUiState mSysUiState;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private PipUiEventLogger mPipUiEventLogger;
|
||||||
|
|
||||||
private PipSnapAlgorithm mPipSnapAlgorithm;
|
private PipSnapAlgorithm mPipSnapAlgorithm;
|
||||||
private PipMotionHelper mMotionHelper;
|
private PipMotionHelper mMotionHelper;
|
||||||
private PipResizeGestureHandler mPipResizeGestureHandler;
|
private PipResizeGestureHandler mPipResizeGestureHandler;
|
||||||
@@ -104,7 +108,7 @@ public class PipTouchHandlerTest extends SysuiTestCase {
|
|||||||
mPipTouchHandler = new PipTouchHandler(mContext, mActivityManager,
|
mPipTouchHandler = new PipTouchHandler(mContext, mActivityManager,
|
||||||
mPipMenuActivityController, mInputConsumerController, mPipBoundsHandler,
|
mPipMenuActivityController, mInputConsumerController, mPipBoundsHandler,
|
||||||
mPipTaskOrganizer, mFloatingContentCoordinator, mDeviceConfigProxy,
|
mPipTaskOrganizer, mFloatingContentCoordinator, mDeviceConfigProxy,
|
||||||
mPipSnapAlgorithm, mSysUiState);
|
mPipSnapAlgorithm, mSysUiState, mPipUiEventLogger);
|
||||||
mMotionHelper = Mockito.spy(mPipTouchHandler.getMotionHelper());
|
mMotionHelper = Mockito.spy(mPipTouchHandler.getMotionHelper());
|
||||||
mPipResizeGestureHandler = Mockito.spy(mPipTouchHandler.getPipResizeGestureHandler());
|
mPipResizeGestureHandler = Mockito.spy(mPipTouchHandler.getPipResizeGestureHandler());
|
||||||
mPipTouchHandler.setPipMotionHelper(mMotionHelper);
|
mPipTouchHandler.setPipMotionHelper(mMotionHelper);
|
||||||
|
|||||||
@@ -3706,33 +3706,40 @@ message MetricsEvent {
|
|||||||
// OS: O
|
// OS: O
|
||||||
BACKUP_SETTINGS = 818;
|
BACKUP_SETTINGS = 818;
|
||||||
|
|
||||||
|
// DEPRECATED: The metrics has been migrated to UiEvent per go/uievent.
|
||||||
// ACTION: Picture-in-picture was explicitly entered for an activity
|
// ACTION: Picture-in-picture was explicitly entered for an activity
|
||||||
// VALUE: true if it was entered while hiding as a result of moving to
|
// VALUE: true if it was entered while hiding as a result of moving to
|
||||||
// another task, false otherwise
|
// another task, false otherwise
|
||||||
ACTION_PICTURE_IN_PICTURE_ENTERED = 819;
|
ACTION_PICTURE_IN_PICTURE_ENTERED = 819 [deprecated=true];
|
||||||
|
|
||||||
|
// DEPRECATED: The metrics has been migrated to UiEvent per go/uievent.
|
||||||
// ACTION: The activity currently in picture-in-picture was expanded back to fullscreen
|
// ACTION: The activity currently in picture-in-picture was expanded back to fullscreen
|
||||||
// PACKAGE: The package name of the activity that was expanded back to fullscreen
|
// PACKAGE: The package name of the activity that was expanded back to fullscreen
|
||||||
ACTION_PICTURE_IN_PICTURE_EXPANDED_TO_FULLSCREEN = 820;
|
ACTION_PICTURE_IN_PICTURE_EXPANDED_TO_FULLSCREEN = 820 [deprecated=true];
|
||||||
|
|
||||||
|
// DEPRECATED: The metrics no longer used after migration to UiEvent per go/uievent.
|
||||||
// ACTION: The activity currently in picture-in-picture was minimized
|
// ACTION: The activity currently in picture-in-picture was minimized
|
||||||
// VALUE: True if the PiP was minimized, false otherwise
|
// VALUE: True if the PiP was minimized, false otherwise
|
||||||
ACTION_PICTURE_IN_PICTURE_MINIMIZED = 821;
|
ACTION_PICTURE_IN_PICTURE_MINIMIZED = 821 [deprecated=true];
|
||||||
|
|
||||||
|
// DEPRECATED: The metrics has been migrated to UiEvent per go/uievent.
|
||||||
// ACTION: Picture-in-picture was dismissed via the dismiss button
|
// ACTION: Picture-in-picture was dismissed via the dismiss button
|
||||||
// VALUE: 0 if dismissed by tap, 1 if dismissed by drag
|
// VALUE: 0 if dismissed by tap, 1 if dismissed by drag
|
||||||
ACTION_PICTURE_IN_PICTURE_DISMISSED = 822;
|
ACTION_PICTURE_IN_PICTURE_DISMISSED = 822 [deprecated=true];
|
||||||
|
|
||||||
// ACTION: The visibility of the picture-in-picture meny
|
// DEPRECATED: The metrics has been migrated to UiEvent per go/uievent.
|
||||||
|
// ACTION: The visibility of the picture-in-picture menu
|
||||||
// VALUE: Whether or not the menu is visible
|
// VALUE: Whether or not the menu is visible
|
||||||
ACTION_PICTURE_IN_PICTURE_MENU = 823;
|
ACTION_PICTURE_IN_PICTURE_MENU = 823 [deprecated=true];
|
||||||
|
|
||||||
|
// DEPRECATED: The metrics has been migrated to UiEvent per go/uievent.
|
||||||
// Enclosing category for group of PICTURE_IN_PICTURE_ASPECT_RATIO_FOO events,
|
// Enclosing category for group of PICTURE_IN_PICTURE_ASPECT_RATIO_FOO events,
|
||||||
// logged when the aspect ratio changes
|
// logged when the aspect ratio changes
|
||||||
ACTION_PICTURE_IN_PICTURE_ASPECT_RATIO_CHANGED = 824;
|
ACTION_PICTURE_IN_PICTURE_ASPECT_RATIO_CHANGED = 824 [deprecated=true];
|
||||||
|
|
||||||
|
// DEPRECATED: The metrics no longer used after migration to UiEvent per go/uievent.
|
||||||
// The current aspect ratio of the PiP, logged when it changes.
|
// The current aspect ratio of the PiP, logged when it changes.
|
||||||
PICTURE_IN_PICTURE_ASPECT_RATIO = 825;
|
PICTURE_IN_PICTURE_ASPECT_RATIO = 825 [deprecated=true];
|
||||||
|
|
||||||
// FIELD - length in dp of ACTION_LS_* gestures, or zero if not applicable
|
// FIELD - length in dp of ACTION_LS_* gestures, or zero if not applicable
|
||||||
// CATEGORY: GLOBAL_SYSTEM_UI
|
// CATEGORY: GLOBAL_SYSTEM_UI
|
||||||
|
|||||||
@@ -146,7 +146,6 @@ import android.view.DisplayInfo;
|
|||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.app.IVoiceInteractor;
|
import com.android.internal.app.IVoiceInteractor;
|
||||||
import com.android.internal.os.logging.MetricsLoggerWrapper;
|
|
||||||
import com.android.internal.util.function.pooled.PooledConsumer;
|
import com.android.internal.util.function.pooled.PooledConsumer;
|
||||||
import com.android.internal.util.function.pooled.PooledFunction;
|
import com.android.internal.util.function.pooled.PooledFunction;
|
||||||
import com.android.internal.util.function.pooled.PooledLambda;
|
import com.android.internal.util.function.pooled.PooledLambda;
|
||||||
@@ -3043,8 +3042,6 @@ class ActivityStack extends Task {
|
|||||||
getDisplayArea().positionStackAtTop(this, false /* includingParents */);
|
getDisplayArea().positionStackAtTop(this, false /* includingParents */);
|
||||||
|
|
||||||
mStackSupervisor.scheduleUpdatePictureInPictureModeIfNeeded(task, this);
|
mStackSupervisor.scheduleUpdatePictureInPictureModeIfNeeded(task, this);
|
||||||
MetricsLoggerWrapper.logPictureInPictureFullScreen(mAtmService.mContext,
|
|
||||||
task.effectiveUid, task.realActivity.flattenToString());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ import android.database.ContentObserver;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.metrics.LogMaker;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -239,12 +238,9 @@ import com.android.internal.annotations.VisibleForTesting;
|
|||||||
import com.android.internal.app.AssistUtils;
|
import com.android.internal.app.AssistUtils;
|
||||||
import com.android.internal.app.IVoiceInteractor;
|
import com.android.internal.app.IVoiceInteractor;
|
||||||
import com.android.internal.app.ProcessMap;
|
import com.android.internal.app.ProcessMap;
|
||||||
import com.android.internal.logging.MetricsLogger;
|
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
|
||||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||||
import com.android.internal.notification.SystemNotificationChannels;
|
import com.android.internal.notification.SystemNotificationChannels;
|
||||||
import com.android.internal.os.TransferPipe;
|
import com.android.internal.os.TransferPipe;
|
||||||
import com.android.internal.os.logging.MetricsLoggerWrapper;
|
|
||||||
import com.android.internal.policy.IKeyguardDismissCallback;
|
import com.android.internal.policy.IKeyguardDismissCallback;
|
||||||
import com.android.internal.policy.KeyguardDismissCallback;
|
import com.android.internal.policy.KeyguardDismissCallback;
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
@@ -4109,10 +4105,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
final ActivityStack stack = r.getRootTask();
|
final ActivityStack stack = r.getRootTask();
|
||||||
stack.setPictureInPictureAspectRatio(aspectRatio);
|
stack.setPictureInPictureAspectRatio(aspectRatio);
|
||||||
stack.setPictureInPictureActions(actions);
|
stack.setPictureInPictureActions(actions);
|
||||||
MetricsLoggerWrapper.logPictureInPictureEnter(mContext,
|
|
||||||
r.info.applicationInfo.uid, r.shortComponentName,
|
|
||||||
r.supportsEnterPipOnTaskSwitch);
|
|
||||||
logPictureInPictureArgs(params);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4156,7 +4148,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
r.pictureInPictureArgs.getAspectRatio());
|
r.pictureInPictureArgs.getAspectRatio());
|
||||||
stack.setPictureInPictureActions(r.pictureInPictureArgs.getActions());
|
stack.setPictureInPictureActions(r.pictureInPictureArgs.getActions());
|
||||||
}
|
}
|
||||||
logPictureInPictureArgs(params);
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
@@ -4170,18 +4161,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logPictureInPictureArgs(PictureInPictureParams params) {
|
|
||||||
if (params.hasSetActions()) {
|
|
||||||
MetricsLogger.histogram(mContext, "tron_varz_picture_in_picture_actions_count",
|
|
||||||
params.getActions().size());
|
|
||||||
}
|
|
||||||
if (params.hasSetAspectRatio()) {
|
|
||||||
LogMaker lm = new LogMaker(MetricsEvent.ACTION_PICTURE_IN_PICTURE_ASPECT_RATIO_CHANGED);
|
|
||||||
lm.addTaggedData(MetricsEvent.PICTURE_IN_PICTURE_ASPECT_RATIO, params.getAspectRatio());
|
|
||||||
MetricsLogger.action(lm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the state of the system and the activity associated with the given {@param token} to
|
* Checks the state of the system and the activity associated with the given {@param token} to
|
||||||
* verify that picture-in-picture is supported for that activity.
|
* verify that picture-in-picture is supported for that activity.
|
||||||
|
|||||||
Reference in New Issue
Block a user