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
|
||||
@TargetApi(Build.VERSION_CODES.S)
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onCreate 1");
|
||||
mStartupLatencyLogger = createStartupLatencyLogger(
|
||||
sIsNewProcess
|
||||
? LockedUserState.get(this).isUserUnlockedAtLauncherStartup()
|
||||
@@ -582,6 +583,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
}
|
||||
setTitle(R.string.home_screen);
|
||||
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
|
||||
protected void onStop() {
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onStop 1");
|
||||
super.onStop();
|
||||
if (mDeferOverlayCallbacks) {
|
||||
checkIfOverlayStillDeferred();
|
||||
@@ -1067,10 +1070,12 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
mAppWidgetHolder.setActivityStarted(false);
|
||||
NotificationListener.removeNotificationsChangedListener(getPopupDataProvider());
|
||||
FloatingIconView.resetIconLoadResult();
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onStop 2");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onStart 1");
|
||||
TraceHelper.INSTANCE.beginSection(ON_START_EVT);
|
||||
super.onStart();
|
||||
if (!mDeferOverlayCallbacks) {
|
||||
@@ -1079,6 +1084,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
mAppWidgetHolder.setActivityStarted(true);
|
||||
TraceHelper.INSTANCE.endSection();
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onStart 2");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1249,6 +1255,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onResume 1");
|
||||
TraceHelper.INSTANCE.beginSection(ON_RESUME_EVT);
|
||||
super.onResume();
|
||||
|
||||
@@ -1260,10 +1267,12 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
DragView.removeAllViews(this);
|
||||
TraceHelper.INSTANCE.endSection();
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onResume 2");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onPause 1");
|
||||
// Ensure that items added to Launcher are queued until Launcher returns
|
||||
ItemInstallQueue.INSTANCE.get(this).pauseModelPush(FLAG_ACTIVITY_PAUSED);
|
||||
|
||||
@@ -1276,6 +1285,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
mOverlayManager.onActivityPaused(this);
|
||||
}
|
||||
mAppWidgetHolder.setActivityResumed(false);
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onPause 2");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1740,6 +1750,8 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
TestProtocol.testLogD(
|
||||
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onSaveInstanceState 1");
|
||||
outState.putIntArray(RUNTIME_STATE_CURRENT_SCREEN_IDS,
|
||||
mWorkspace.getCurrentPageScreenIds().getArray().toArray());
|
||||
outState.putInt(RUNTIME_STATE, mStateManager.getState().ordinal);
|
||||
@@ -1771,10 +1783,13 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
super.onSaveInstanceState(outState);
|
||||
mOverlayManager.onActivitySaveInstanceState(this, outState);
|
||||
TestProtocol.testLogD(
|
||||
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onSaveInstanceState 2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onDestroy 1");
|
||||
super.onDestroy();
|
||||
ACTIVITY_TRACKER.onActivityDestroyed(this);
|
||||
|
||||
@@ -1797,6 +1812,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
LauncherAppState.getIDP(this).removeOnChangeListener(this);
|
||||
|
||||
mOverlayManager.onActivityDestroyed(this);
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE, "Launcher.onDestroy 2");
|
||||
}
|
||||
|
||||
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 FLAKY_ACTIVITY_COUNT = "b/260260325";
|
||||
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_STOP_EMULATE_DISPLAY = "stop-emulate-display";
|
||||
|
||||
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.platform.test.annotations.PlatinumTest;
|
||||
import android.platform.test.rule.ScreenRecordRule;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
@@ -53,7 +54,9 @@ public class AddWidgetTest extends AbstractLauncherUiTest {
|
||||
@PlatinumTest(focusArea = "launcher")
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@ScreenRecordRule.ScreenRecord // b/289161193
|
||||
public void testDragIcon() throws Throwable {
|
||||
mLauncher.enableDebugTracing(); // b/289161193
|
||||
new FavoriteItemsTransaction(mTargetContext).commitAndLoadHome(mLauncher);
|
||||
|
||||
waitForLauncherCondition("Workspace didn't finish loading", l -> !l.isWorkspaceLoading());
|
||||
@@ -79,6 +82,7 @@ public class AddWidgetTest extends AbstractLauncherUiTest {
|
||||
DEFAULT_UI_TIMEOUT);
|
||||
assertNotNull("Widget not found on the workspace", widget);
|
||||
widget.launch(getAppPackageName());
|
||||
mLauncher.disableDebugTracing(); // b/289161193
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,8 @@ import android.os.Bundle;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
@@ -71,33 +73,57 @@ public class SimpleActivityRule<T extends Activity> implements TestRule {
|
||||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle bundle) {
|
||||
if (activity != null && mClass.isInstance(activity)) {
|
||||
TestProtocol.testLogD(
|
||||
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityCreated");
|
||||
mActivity = (T) activity;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
if (activity == mActivity) {
|
||||
TestProtocol.testLogD(
|
||||
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityStarted");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed(Activity activity) {
|
||||
if (activity == mActivity) {
|
||||
TestProtocol.testLogD(
|
||||
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityResumed");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(Activity activity) {
|
||||
if (activity == mActivity) {
|
||||
TestProtocol.testLogD(
|
||||
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityPaused");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
if (activity == mActivity) {
|
||||
TestProtocol.testLogD(
|
||||
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onAcgtivityStopped");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
||||
if (activity == mActivity) {
|
||||
TestProtocol.testLogD(TestProtocol.ACTIVITY_LIFECYCLE_RULE,
|
||||
"MyStatement.onActivitySaveInstanceState");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
if (activity == mActivity) {
|
||||
TestProtocol.testLogD(
|
||||
TestProtocol.ACTIVITY_LIFECYCLE_RULE, "MyStatement.onActivityDestroyed");
|
||||
mActivity = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user