Merge "Support latency metrics for recents gesture"
This commit is contained in:
@@ -226,7 +226,7 @@ public class RecentsAnimationPerfTest extends WindowManagerPerfTestBase
|
||||
mMeasuredTimeNs = 0;
|
||||
|
||||
final long startTime = SystemClock.elapsedRealtimeNanos();
|
||||
atm.startRecentsActivity(sRecentsIntent, null /* unused */, anim);
|
||||
atm.startRecentsActivity(sRecentsIntent, 0 /* eventTime */, anim);
|
||||
final long elapsedTimeNsOfStart = SystemClock.elapsedRealtimeNanos() - startTime;
|
||||
mMeasuredTimeNs += elapsedTimeNsOfStart;
|
||||
state.addExtraResult("start", elapsedTimeNsOfStart);
|
||||
|
||||
@@ -3777,6 +3777,7 @@ message AppStartOccurred {
|
||||
LAUNCHER = 1;
|
||||
NOTIFICATION = 2;
|
||||
LOCKSCREEN = 3;
|
||||
RECENTS_ANIMATION = 4;
|
||||
}
|
||||
// The type of the startup source.
|
||||
optional SourceType source_type = 16;
|
||||
|
||||
@@ -1910,6 +1910,8 @@ public class ActivityOptions {
|
||||
public static final int TYPE_NOTIFICATION = 2;
|
||||
/** Launched from lockscreen, including notification while the device is locked. */
|
||||
public static final int TYPE_LOCKSCREEN = 3;
|
||||
/** Launched from recents gesture handler. */
|
||||
public static final int TYPE_RECENTS_ANIMATION = 4;
|
||||
|
||||
@IntDef(flag = true, prefix = { "TYPE_" }, value = {
|
||||
TYPE_LAUNCHER,
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.app.GrantedUriPermission;
|
||||
import android.app.IApplicationThread;
|
||||
import android.app.IActivityController;
|
||||
import android.app.IAppTask;
|
||||
import android.app.IAssistDataReceiver;
|
||||
import android.app.IInstrumentationWatcher;
|
||||
import android.app.IProcessObserver;
|
||||
import android.app.IServiceConnection;
|
||||
@@ -70,7 +69,6 @@ import android.os.RemoteCallback;
|
||||
import android.os.StrictMode;
|
||||
import android.os.WorkSource;
|
||||
import android.service.voice.IVoiceInteractionSession;
|
||||
import android.view.IRecentsAnimationRunner;
|
||||
import android.view.RemoteAnimationDefinition;
|
||||
import android.view.RemoteAnimationAdapter;
|
||||
import com.android.internal.app.IVoiceInteractor;
|
||||
@@ -470,11 +468,6 @@ interface IActivityManager {
|
||||
@UnsupportedAppUsage
|
||||
boolean isInLockTaskMode();
|
||||
@UnsupportedAppUsage
|
||||
void startRecentsActivity(in Intent intent, in IAssistDataReceiver assistDataReceiver,
|
||||
in IRecentsAnimationRunner recentsAnimationRunner);
|
||||
@UnsupportedAppUsage
|
||||
void cancelRecentsAnimation(boolean restoreHomeStackPosition);
|
||||
@UnsupportedAppUsage
|
||||
int startActivityFromRecents(int taskId, in Bundle options);
|
||||
@UnsupportedAppUsage
|
||||
void startSystemLockTaskMode(int taskId);
|
||||
|
||||
@@ -123,7 +123,7 @@ interface IActivityTaskManager {
|
||||
in ProfilerInfo profilerInfo, in Bundle options, int userId);
|
||||
int startAssistantActivity(in String callingPackage, in String callingFeatureId, int callingPid,
|
||||
int callingUid, in Intent intent, in String resolvedType, in Bundle options, int userId);
|
||||
void startRecentsActivity(in Intent intent, in IAssistDataReceiver assistDataReceiver,
|
||||
void startRecentsActivity(in Intent intent, in long eventTime,
|
||||
in IRecentsAnimationRunner recentsAnimationRunner);
|
||||
int startActivityFromRecents(int taskId, in Bundle options);
|
||||
int startActivityAsCaller(in IApplicationThread caller, in String callingPackage,
|
||||
|
||||
@@ -34,7 +34,6 @@ import android.app.ActivityManager.TaskSnapshot;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.app.AppGlobals;
|
||||
import android.app.IAssistDataReceiver;
|
||||
import android.app.WindowConfiguration;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
@@ -43,7 +42,6 @@ import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -228,21 +226,10 @@ public class ActivityManagerWrapper {
|
||||
/**
|
||||
* Starts the recents activity. The caller should manage the thread on which this is called.
|
||||
*/
|
||||
public void startRecentsActivity(Intent intent, final AssistDataReceiver assistDataReceiver,
|
||||
public void startRecentsActivity(Intent intent, long eventTime,
|
||||
final RecentsAnimationListener animationHandler, final Consumer<Boolean> resultCallback,
|
||||
Handler resultCallbackHandler) {
|
||||
try {
|
||||
IAssistDataReceiver receiver = null;
|
||||
if (assistDataReceiver != null) {
|
||||
receiver = new IAssistDataReceiver.Stub() {
|
||||
public void onHandleAssistData(Bundle resultData) {
|
||||
assistDataReceiver.onHandleAssistData(resultData);
|
||||
}
|
||||
public void onHandleAssistScreenshot(Bitmap screenshot) {
|
||||
assistDataReceiver.onHandleAssistScreenshot(screenshot);
|
||||
}
|
||||
};
|
||||
}
|
||||
IRecentsAnimationRunner runner = null;
|
||||
if (animationHandler != null) {
|
||||
runner = new IRecentsAnimationRunner.Stub() {
|
||||
@@ -272,7 +259,7 @@ public class ActivityManagerWrapper {
|
||||
}
|
||||
};
|
||||
}
|
||||
ActivityTaskManager.getService().startRecentsActivity(intent, receiver, runner);
|
||||
ActivityTaskManager.getService().startRecentsActivity(intent, eventTime, runner);
|
||||
if (resultCallback != null) {
|
||||
resultCallbackHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -153,7 +153,6 @@ import android.app.ContentProviderHolder;
|
||||
import android.app.IActivityController;
|
||||
import android.app.IActivityManager;
|
||||
import android.app.IApplicationThread;
|
||||
import android.app.IAssistDataReceiver;
|
||||
import android.app.IInstrumentationWatcher;
|
||||
import android.app.INotificationManager;
|
||||
import android.app.IProcessObserver;
|
||||
@@ -286,7 +285,6 @@ import android.util.proto.ProtoOutputStream;
|
||||
import android.util.proto.ProtoUtils;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.IRecentsAnimationRunner;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
@@ -2840,18 +2838,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
return mActivityTaskManager.startActivityFromRecents(taskId, bOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startRecentsActivity(Intent intent, IAssistDataReceiver assistDataReceiver,
|
||||
IRecentsAnimationRunner recentsAnimationRunner) {
|
||||
mActivityTaskManager.startRecentsActivity(
|
||||
intent, assistDataReceiver, recentsAnimationRunner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelRecentsAnimation(boolean restoreHomeStackPosition) {
|
||||
mActivityTaskManager.cancelRecentsAnimation(restoreHomeStackPosition);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the internal entry point for handling Activity.finish().
|
||||
*
|
||||
|
||||
@@ -1585,10 +1585,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
* Start the recents activity to perform the recents animation.
|
||||
*
|
||||
* @param intent The intent to start the recents activity.
|
||||
* @param eventTime When the (touch) event is triggered to start recents activity.
|
||||
* @param recentsAnimationRunner Pass {@code null} to only preload the activity.
|
||||
*/
|
||||
@Override
|
||||
public void startRecentsActivity(Intent intent, @Deprecated IAssistDataReceiver unused,
|
||||
public void startRecentsActivity(Intent intent, long eventTime,
|
||||
@Nullable IRecentsAnimationRunner recentsAnimationRunner) {
|
||||
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "startRecentsActivity()");
|
||||
final int callingPid = Binder.getCallingPid();
|
||||
@@ -1608,7 +1609,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
if (recentsAnimationRunner == null) {
|
||||
anim.preloadRecentsActivity();
|
||||
} else {
|
||||
anim.startRecentsActivity(recentsAnimationRunner);
|
||||
anim.startRecentsActivity(recentsAnimationRunner, eventTime);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -161,7 +161,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks,
|
||||
}
|
||||
}
|
||||
|
||||
void startRecentsActivity(IRecentsAnimationRunner recentsAnimationRunner) {
|
||||
void startRecentsActivity(IRecentsAnimationRunner recentsAnimationRunner, long eventTime) {
|
||||
ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS, "startRecentsActivity(): intent=%s", mTargetIntent);
|
||||
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "RecentsAnimation#startRecentsActivity");
|
||||
|
||||
@@ -249,8 +249,13 @@ class RecentsAnimation implements RecentsAnimationCallbacks,
|
||||
// we fetch the visible tasks to be controlled by the animation
|
||||
mService.mRootWindowContainer.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS);
|
||||
|
||||
ActivityOptions options = null;
|
||||
if (eventTime > 0) {
|
||||
options = ActivityOptions.makeBasic();
|
||||
options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_RECENTS_ANIMATION, eventTime);
|
||||
}
|
||||
mStackSupervisor.getActivityMetricsLogger().notifyActivityLaunched(launchingState,
|
||||
START_TASK_TO_FRONT, targetActivity, null /* options */);
|
||||
START_TASK_TO_FRONT, targetActivity, options);
|
||||
|
||||
// Register for stack order changes
|
||||
mDefaultTaskDisplayArea.registerStackOrderChangedListener(this);
|
||||
|
||||
@@ -1188,7 +1188,7 @@ public class RecentTasksTest extends WindowTestsBase {
|
||||
() -> mAtm.unregisterTaskStackListener(null));
|
||||
assertSecurityException(expectCallable, () -> mAtm.getTaskDescription(0));
|
||||
assertSecurityException(expectCallable, () -> mAtm.cancelTaskWindowTransition(0));
|
||||
assertSecurityException(expectCallable, () -> mAtm.startRecentsActivity(null, null,
|
||||
assertSecurityException(expectCallable, () -> mAtm.startRecentsActivity(null, 0,
|
||||
null));
|
||||
assertSecurityException(expectCallable, () -> mAtm.cancelRecentsAnimation(true));
|
||||
assertSecurityException(expectCallable, () -> mAtm.stopAppSwitches());
|
||||
|
||||
@@ -147,7 +147,7 @@ public class RecentsAnimationTest extends WindowTestsBase {
|
||||
|
||||
Intent recentsIntent = new Intent().setComponent(mRecentsComponent);
|
||||
// Null animation indicates to preload.
|
||||
mAtm.startRecentsActivity(recentsIntent, null /* assistDataReceiver */,
|
||||
mAtm.startRecentsActivity(recentsIntent, 0 /* eventTime */,
|
||||
null /* recentsAnimationRunner */);
|
||||
|
||||
Task recentsStack = defaultTaskDisplayArea.getStack(WINDOWING_MODE_FULLSCREEN,
|
||||
@@ -167,7 +167,7 @@ public class RecentsAnimationTest extends WindowTestsBase {
|
||||
|
||||
spyOn(recentsActivity);
|
||||
// Start when the recents activity exists. It should ensure the configuration.
|
||||
mAtm.startRecentsActivity(recentsIntent, null /* assistDataReceiver */,
|
||||
mAtm.startRecentsActivity(recentsIntent, 0 /* eventTime */,
|
||||
null /* recentsAnimationRunner */);
|
||||
|
||||
verify(recentsActivity).ensureActivityConfiguration(anyInt() /* globalChanges */,
|
||||
@@ -381,7 +381,7 @@ public class RecentsAnimationTest extends WindowTestsBase {
|
||||
|
||||
Intent recentsIntent = new Intent();
|
||||
recentsIntent.setComponent(recentsComponent);
|
||||
mAtm.startRecentsActivity(recentsIntent, null /* assistDataReceiver */,
|
||||
mAtm.startRecentsActivity(recentsIntent, 0 /* eventTime */,
|
||||
mock(IRecentsAnimationRunner.class));
|
||||
return recentsAnimation[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user