Revert "Test an order of ActivityCallbacks and corresponding Activity's methods"

This reverts commit aae10c62b8d172a7c49e77474c6a88ef48680616.

Bug: 34415265
Bug: 34914977
Change-Id: Ib1d7d4f055859d7b84ec371d9e940f782715f65f
Test: chrome launches
(cherry picked from commit 24200411473729b7b4637c81784589374742453d)
diff --git a/tests/tests/app/AndroidManifest.xml b/tests/tests/app/AndroidManifest.xml
index b42df79..be903e3 100644
--- a/tests/tests/app/AndroidManifest.xml
+++ b/tests/tests/app/AndroidManifest.xml
@@ -23,7 +23,6 @@
 
         <activity android:name=".ApplyOverrideConfigurationActivity"
                   android:configChanges="orientation|screenSize" />
-        <activity android:name=".ActivityCallbacksTestActivity"/>
     </application>
 
     <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
diff --git a/tests/tests/app/src/android/app/cts/ActivityCallbacksTest.java b/tests/tests/app/src/android/app/cts/ActivityCallbacksTest.java
deleted file mode 100644
index dde60ce..0000000
--- a/tests/tests/app/src/android/app/cts/ActivityCallbacksTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2017 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 android.app.cts;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import android.app.Activity;
-import android.app.Application;
-import android.app.cts.ActivityCallbacksTestActivity.Event;
-import android.app.cts.ActivityCallbacksTestActivity.Source;
-import android.content.Context;
-import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Pair;
-
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.ArrayList;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-@RunWith(AndroidJUnit4.class)
-public class ActivityCallbacksTest {
-
-    private static final long TIMEOUT_SECS = 2;
-
-    @Rule
-    public ActivityTestRule<ActivityCallbacksTestActivity> mActivityRule =
-            new ActivityTestRule<>(ActivityCallbacksTestActivity.class, false, false);
-
-    private Application.ActivityLifecycleCallbacks mActivityCallbacks;
-
-    @After
-    public void tearDown() {
-        if (mActivityCallbacks != null) {
-            Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
-            Application application = (Application) targetContext.getApplicationContext();
-            application.unregisterActivityLifecycleCallbacks(mActivityCallbacks);
-        }
-    }
-
-    @Test
-    public void testActivityCallbackOrder() throws InterruptedException {
-        Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
-        Application application = (Application) targetContext.getApplicationContext();
-        ArrayList<Pair<Source, Event>> actualEvents = new ArrayList<>();
-        CountDownLatch latch = new CountDownLatch(1);
-        mActivityCallbacks = new Application.ActivityLifecycleCallbacks() {
-
-            @Override
-            public void onActivityPreCreated(Activity activity, Bundle savedInstanceState) {
-                ActivityCallbacksTestActivity a = (ActivityCallbacksTestActivity) activity;
-                a.collectEvent(Source.ACTIVITY_CALLBACK, Event.ON_PRE_CREATE);
-            }
-
-            @Override
-            public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
-                ActivityCallbacksTestActivity a = (ActivityCallbacksTestActivity) activity;
-                a.collectEvent(Source.ACTIVITY_CALLBACK, Event.ON_CREATE);
-            }
-
-            @Override
-            public void onActivityStarted(Activity activity) {
-                ActivityCallbacksTestActivity a = (ActivityCallbacksTestActivity) activity;
-                a.collectEvent(Source.ACTIVITY_CALLBACK, Event.ON_START);
-            }
-
-            @Override
-            public void onActivityResumed(Activity activity) {
-                ActivityCallbacksTestActivity a = (ActivityCallbacksTestActivity) activity;
-                a.collectEvent(Source.ACTIVITY_CALLBACK, Event.ON_RESUME);
-                a.finish();
-            }
-
-            @Override
-            public void onActivityPaused(Activity activity) {
-                ActivityCallbacksTestActivity a = (ActivityCallbacksTestActivity) activity;
-                a.collectEvent(Source.ACTIVITY_CALLBACK, Event.ON_PAUSE);
-            }
-
-            @Override
-            public void onActivityStopped(Activity activity) {
-                ActivityCallbacksTestActivity a = (ActivityCallbacksTestActivity) activity;
-                a.collectEvent(Source.ACTIVITY_CALLBACK, Event.ON_STOP);
-            }
-
-            @Override
-            public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
-
-            }
-
-            @Override
-            public void onActivityDestroyed(Activity activity) {
-                ActivityCallbacksTestActivity a = (ActivityCallbacksTestActivity) activity;
-                a.collectEvent(Source.ACTIVITY_CALLBACK, Event.ON_DESTROY);
-                actualEvents.addAll(a.getCollectedEvents());
-                latch.countDown();
-            }
-        };
-
-        application.registerActivityLifecycleCallbacks(mActivityCallbacks);
-
-        mActivityRule.launchActivity(null);
-        assertTrue("Failed to await for an activity to finish ",
-                latch.await(TIMEOUT_SECS, TimeUnit.SECONDS));
-
-        ArrayList<Pair<Source, Event>> expectedEvents = new ArrayList<>();
-        for (Event e: Event.values()) {
-            if (e != Event.ON_PRE_CREATE) {
-                expectedEvents.add(new Pair<>(Source.ACTIVITY, e));
-            }
-            expectedEvents.add(new Pair<>(Source.ACTIVITY_CALLBACK, e));
-        }
-
-        assertEquals(expectedEvents, actualEvents);
-    }
-
-
-}
diff --git a/tests/tests/app/src/android/app/cts/ActivityCallbacksTestActivity.java b/tests/tests/app/src/android/app/cts/ActivityCallbacksTestActivity.java
deleted file mode 100644
index 2da04f8..0000000
--- a/tests/tests/app/src/android/app/cts/ActivityCallbacksTestActivity.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2017 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 android.app.cts;
-
-import android.annotation.Nullable;
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Pair;
-
-import java.util.ArrayList;
-
-public class ActivityCallbacksTestActivity extends Activity {
-
-    enum Event {
-        ON_PRE_CREATE,
-        ON_CREATE,
-        ON_START,
-        ON_RESUME,
-        ON_PAUSE,
-        ON_STOP,
-        ON_DESTROY,
-    }
-
-    enum Source {
-        ACTIVITY,
-        ACTIVITY_CALLBACK
-    }
-
-    private ArrayList<Pair<Source, Event>> mCollectedEvents = new ArrayList<>();
-
-    void collectEvent(Source source, Event event) {
-        mCollectedEvents.add(new Pair<>(source, event));
-    }
-
-    ArrayList<Pair<Source, Event>> getCollectedEvents() {
-        return mCollectedEvents;
-    }
-
-    @Override
-    protected void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        collectEvent(Source.ACTIVITY, Event.ON_CREATE);
-    }
-
-    @Override
-    protected void onStart() {
-        super.onStart();
-        collectEvent(Source.ACTIVITY, Event.ON_START);
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        collectEvent(Source.ACTIVITY, Event.ON_RESUME);
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        collectEvent(Source.ACTIVITY, Event.ON_PAUSE);
-    }
-
-    @Override
-    protected void onStop() {
-        super.onStop();
-        collectEvent(Source.ACTIVITY, Event.ON_STOP);
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        collectEvent(Source.ACTIVITY, Event.ON_DESTROY);
-    }
-}