Loading src/com/android/launcher3/Launcher.java +16 −0 Original line number Original line Diff line number Diff line Loading @@ -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() Loading Loading @@ -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"); } } /** /** Loading Loading @@ -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(); Loading @@ -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) { Loading @@ -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 Loading Loading @@ -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(); Loading @@ -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); Loading @@ -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"); } } /** /** Loading Loading @@ -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); Loading Loading @@ -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); Loading @@ -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() { Loading tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -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"; Loading tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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()); Loading @@ -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 } } /** /** Loading tests/src/com/android/launcher3/util/rule/SimpleActivityRule.java +26 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } } } } Loading Loading
src/com/android/launcher3/Launcher.java +16 −0 Original line number Original line Diff line number Diff line Loading @@ -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() Loading Loading @@ -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"); } } /** /** Loading Loading @@ -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(); Loading @@ -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) { Loading @@ -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 Loading Loading @@ -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(); Loading @@ -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); Loading @@ -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"); } } /** /** Loading Loading @@ -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); Loading Loading @@ -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); Loading @@ -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() { Loading
tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -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"; Loading
tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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()); Loading @@ -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 } } /** /** Loading
tests/src/com/android/launcher3/util/rule/SimpleActivityRule.java +26 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } } } } Loading