Merge "Revert "DO NOT MERGE Verify Parcel object list does not get double freed after a setDataSize"" into oreo-cts-dev
diff --git a/tests/tests/os/AndroidManifest.xml b/tests/tests/os/AndroidManifest.xml
index 835022c..7980da8 100644
--- a/tests/tests/os/AndroidManifest.xml
+++ b/tests/tests/os/AndroidManifest.xml
@@ -80,10 +80,6 @@
             android:name="android.os.cts.ParcelExceptionService"
             android:process=":remote"
             android:exported="true" />
-        <service
-            android:name="android.os.cts.ParcelTest$ParcelObjectFreeService"
-            android:process=":remote"
-            android:exported="true" />
 
         <service android:name="android.os.cts.LocalService">
             <intent-filter>
diff --git a/tests/tests/os/src/android/os/cts/ParcelTest.java b/tests/tests/os/src/android/os/cts/ParcelTest.java
index c49fcca..d9231d2 100644
--- a/tests/tests/os/src/android/os/cts/ParcelTest.java
+++ b/tests/tests/os/src/android/os/cts/ParcelTest.java
@@ -28,7 +28,6 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
-import android.app.Service;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -3277,68 +3276,4 @@
         assertNull("Binder should have been overwritten by the exception",
                 reply.readStrongBinder());
     }
-
-    public static class ParcelObjectFreeService extends Service {
-
-        @Override
-        public IBinder onBind(Intent intent) {
-            return new Binder();
-        }
-
-        @Override
-        public void onCreate() {
-            super.onCreate();
-
-            Parcel parcel = Parcel.obtain();
-
-            // Construct parcel with object in it.
-            parcel.writeInt(1);
-            final int pos = parcel.dataPosition();
-            parcel.writeStrongBinder(new Binder());
-
-            // wipe out the object by setting data size
-            parcel.setDataSize(pos);
-
-            // recycle the parcel. This should not cause a native segfault
-            parcel.recycle();
-        }
-
-        public static class Connection extends AbstractFuture<IBinder>
-                implements ServiceConnection {
-
-            @Override
-            public void onServiceConnected(ComponentName name, IBinder service) {
-                set(service);
-            }
-
-            @Override
-            public void onServiceDisconnected(ComponentName name) {
-            }
-
-            @Override
-            public IBinder get() throws InterruptedException, ExecutionException {
-                try {
-                    return get(5, TimeUnit.SECONDS);
-                } catch (TimeoutException e) {
-                    return null;
-                }
-            }
-        }
-    }
-
-    public void testObjectDoubleFree() throws Exception {
-
-        final Intent intent = new Intent();
-        intent.setComponent(new ComponentName(
-                "android.os.cts", "android.os.cts.ParcelTest$ParcelObjectFreeService"));
-
-        final ParcelObjectFreeService.Connection connection =
-                new ParcelObjectFreeService.Connection();
-
-        mContext.startService(intent);
-        assertTrue(mContext.bindService(intent, connection,
-                Context.BIND_ABOVE_CLIENT | Context.BIND_EXTERNAL_SERVICE));
-
-        assertNotNull("Service should have started without crashing.", connection.get());
-    }
 }