Merge "Add debug tracing Launcher's lifecycle callbacks" into udc-qpr-dev am: 19c22c20b2
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23918985 Change-Id: I9202aada056b4b3cdf4561ddc3815d6a415b1167 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
dbfaef52f8
@@ -424,6 +424,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.S)
|
@TargetApi(Build.VERSION_CODES.S)
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onCreate 1");
|
||||||
mStartupLatencyLogger = createStartupLatencyLogger(
|
mStartupLatencyLogger = createStartupLatencyLogger(
|
||||||
sIsNewProcess
|
sIsNewProcess
|
||||||
? LockedUserState.get(this).isUserUnlockedAtLauncherStartup()
|
? LockedUserState.get(this).isUserUnlockedAtLauncherStartup()
|
||||||
@@ -582,6 +583,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
}
|
}
|
||||||
setTitle(R.string.home_screen);
|
setTitle(R.string.home_screen);
|
||||||
mStartupLatencyLogger.logEnd(LAUNCHER_LATENCY_STARTUP_ACTIVITY_ON_CREATE);
|
mStartupLatencyLogger.logEnd(LAUNCHER_LATENCY_STARTUP_ACTIVITY_ON_CREATE);
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onCreate 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1056,6 +1058,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onStop 1");
|
||||||
super.onStop();
|
super.onStop();
|
||||||
if (mDeferOverlayCallbacks) {
|
if (mDeferOverlayCallbacks) {
|
||||||
checkIfOverlayStillDeferred();
|
checkIfOverlayStillDeferred();
|
||||||
@@ -1067,10 +1070,12 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
mAppWidgetHolder.setActivityStarted(false);
|
mAppWidgetHolder.setActivityStarted(false);
|
||||||
NotificationListener.removeNotificationsChangedListener(getPopupDataProvider());
|
NotificationListener.removeNotificationsChangedListener(getPopupDataProvider());
|
||||||
FloatingIconView.resetIconLoadResult();
|
FloatingIconView.resetIconLoadResult();
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onStop 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onStart 1");
|
||||||
TraceHelper.INSTANCE.beginSection(ON_START_EVT);
|
TraceHelper.INSTANCE.beginSection(ON_START_EVT);
|
||||||
super.onStart();
|
super.onStart();
|
||||||
if (!mDeferOverlayCallbacks) {
|
if (!mDeferOverlayCallbacks) {
|
||||||
@@ -1079,6 +1084,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
|
|
||||||
mAppWidgetHolder.setActivityStarted(true);
|
mAppWidgetHolder.setActivityStarted(true);
|
||||||
TraceHelper.INSTANCE.endSection();
|
TraceHelper.INSTANCE.endSection();
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onStart 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1249,6 +1255,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onResume 1");
|
||||||
TraceHelper.INSTANCE.beginSection(ON_RESUME_EVT);
|
TraceHelper.INSTANCE.beginSection(ON_RESUME_EVT);
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
@@ -1260,10 +1267,12 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
|
|
||||||
DragView.removeAllViews(this);
|
DragView.removeAllViews(this);
|
||||||
TraceHelper.INSTANCE.endSection();
|
TraceHelper.INSTANCE.endSection();
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onResume 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onPause 1");
|
||||||
// Ensure that items added to Launcher are queued until Launcher returns
|
// Ensure that items added to Launcher are queued until Launcher returns
|
||||||
ItemInstallQueue.INSTANCE.get(this).pauseModelPush(FLAG_ACTIVITY_PAUSED);
|
ItemInstallQueue.INSTANCE.get(this).pauseModelPush(FLAG_ACTIVITY_PAUSED);
|
||||||
|
|
||||||
@@ -1276,6 +1285,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
mOverlayManager.onActivityPaused(this);
|
mOverlayManager.onActivityPaused(this);
|
||||||
}
|
}
|
||||||
mAppWidgetHolder.setActivityResumed(false);
|
mAppWidgetHolder.setActivityResumed(false);
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onPause 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1740,6 +1750,8 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
|
TestProtocol.testLogD(
|
||||||
|
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onSaveInstanceState 1");
|
||||||
outState.putIntArray(RUNTIME_STATE_CURRENT_SCREEN_IDS,
|
outState.putIntArray(RUNTIME_STATE_CURRENT_SCREEN_IDS,
|
||||||
mWorkspace.getCurrentPageScreenIds().getArray().toArray());
|
mWorkspace.getCurrentPageScreenIds().getArray().toArray());
|
||||||
outState.putInt(RUNTIME_STATE, mStateManager.getState().ordinal);
|
outState.putInt(RUNTIME_STATE, mStateManager.getState().ordinal);
|
||||||
@@ -1771,10 +1783,13 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
|
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
mOverlayManager.onActivitySaveInstanceState(this, outState);
|
mOverlayManager.onActivitySaveInstanceState(this, outState);
|
||||||
|
TestProtocol.testLogD(
|
||||||
|
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onSaveInstanceState 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onDestroy 1");
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
ACTIVITY_TRACKER.onActivityDestroyed(this);
|
ACTIVITY_TRACKER.onActivityDestroyed(this);
|
||||||
|
|
||||||
@@ -1797,6 +1812,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
LauncherAppState.getIDP(this).removeOnChangeListener(this);
|
LauncherAppState.getIDP(this).removeOnChangeListener(this);
|
||||||
|
|
||||||
mOverlayManager.onActivityDestroyed(this);
|
mOverlayManager.onActivityDestroyed(this);
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onDestroy 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
public LauncherAccessibilityDelegate getAccessibilityDelegate() {
|
public LauncherAccessibilityDelegate getAccessibilityDelegate() {
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ public final class TestProtocol {
|
|||||||
public static final String TWO_TASKBAR_LONG_CLICKS = "b/262282528";
|
public static final String TWO_TASKBAR_LONG_CLICKS = "b/262282528";
|
||||||
public static final String FLAKY_ACTIVITY_COUNT = "b/260260325";
|
public static final String FLAKY_ACTIVITY_COUNT = "b/260260325";
|
||||||
public static final String ICON_MISSING = "b/282963545";
|
public static final String ICON_MISSING = "b/282963545";
|
||||||
|
public static final String ACTIVITY_LIFECYCLE_RULE = "b/289161193";
|
||||||
|
|
||||||
public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
|
public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
|
||||||
public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";
|
public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull;
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import android.platform.test.annotations.PlatinumTest;
|
import android.platform.test.annotations.PlatinumTest;
|
||||||
|
import android.platform.test.rule.ScreenRecordRule;
|
||||||
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
import androidx.test.filters.LargeTest;
|
import androidx.test.filters.LargeTest;
|
||||||
@@ -53,7 +54,9 @@ public class AddWidgetTest extends AbstractLauncherUiTest {
|
|||||||
@PlatinumTest(focusArea = "launcher")
|
@PlatinumTest(focusArea = "launcher")
|
||||||
@Test
|
@Test
|
||||||
@PortraitLandscape
|
@PortraitLandscape
|
||||||
|
@ScreenRecordRule.ScreenRecord // b/289161193
|
||||||
public void testDragIcon() throws Throwable {
|
public void testDragIcon() throws Throwable {
|
||||||
|
mLauncher.enableDebugTracing(); // b/289161193
|
||||||
new FavoriteItemsTransaction(mTargetContext).commitAndLoadHome(mLauncher);
|
new FavoriteItemsTransaction(mTargetContext).commitAndLoadHome(mLauncher);
|
||||||
|
|
||||||
waitForLauncherCondition("Workspace didn't finish loading", l -> !l.isWorkspaceLoading());
|
waitForLauncherCondition("Workspace didn't finish loading", l -> !l.isWorkspaceLoading());
|
||||||
@@ -79,6 +82,7 @@ public class AddWidgetTest extends AbstractLauncherUiTest {
|
|||||||
DEFAULT_UI_TIMEOUT);
|
DEFAULT_UI_TIMEOUT);
|
||||||
assertNotNull("Widget not found on the workspace", widget);
|
assertNotNull("Widget not found on the workspace", widget);
|
||||||
widget.launch(getAppPackageName());
|
widget.launch(getAppPackageName());
|
||||||
|
mLauncher.disableDebugTracing(); // b/289161193
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import androidx.test.InstrumentationRegistry;
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
|
||||||
|
import com.android.launcher3.testing.shared.TestProtocol;
|
||||||
|
|
||||||
import org.junit.rules.TestRule;
|
import org.junit.rules.TestRule;
|
||||||
import org.junit.runner.Description;
|
import org.junit.runner.Description;
|
||||||
import org.junit.runners.model.Statement;
|
import org.junit.runners.model.Statement;
|
||||||
@@ -71,33 +73,57 @@ public class SimpleActivityRule<T extends Activity> implements TestRule {
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Activity activity, Bundle bundle) {
|
public void onActivityCreated(Activity activity, Bundle bundle) {
|
||||||
if (activity != null && mClass.isInstance(activity)) {
|
if (activity != null && mClass.isInstance(activity)) {
|
||||||
|
TestProtocol.testLogD(
|
||||||
|
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityCreated");
|
||||||
mActivity = (T) activity;
|
mActivity = (T) activity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityStarted(Activity activity) {
|
public void onActivityStarted(Activity activity) {
|
||||||
|
if (activity == mActivity) {
|
||||||
|
TestProtocol.testLogD(
|
||||||
|
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityStarted");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResumed(Activity activity) {
|
public void onActivityResumed(Activity activity) {
|
||||||
|
if (activity == mActivity) {
|
||||||
|
TestProtocol.testLogD(
|
||||||
|
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityResumed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityPaused(Activity activity) {
|
public void onActivityPaused(Activity activity) {
|
||||||
|
if (activity == mActivity) {
|
||||||
|
TestProtocol.testLogD(
|
||||||
|
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityPaused");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityStopped(Activity activity) {
|
public void onActivityStopped(Activity activity) {
|
||||||
|
if (activity == mActivity) {
|
||||||
|
TestProtocol.testLogD(
|
||||||
|
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onAcgtivityStopped");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
||||||
|
if (activity == mActivity) {
|
||||||
|
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE,
|
||||||
|
"MyStatement.onActivitySaveInstanceState");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityDestroyed(Activity activity) {
|
public void onActivityDestroyed(Activity activity) {
|
||||||
if (activity == mActivity) {
|
if (activity == mActivity) {
|
||||||
|
TestProtocol.testLogD(
|
||||||
|
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityDestroyed");
|
||||||
mActivity = null;
|
mActivity = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user