Fix stale remembered sets error.

We were forgetting to remove the remembered set in transition to
background. This resulted in remembered sets being added for
spaces which no longer existed. This finally caused an error when
a new space happened to have the same address as the old space,
resulting in a CHECK failure.

Also tuned the number of ParallelGC to prevent spurrious failures
and removed the ParallelGC from broken tests in the make file.

Bug: 16532086
Bug: 16406852

Change-Id: I00bbcbd7daa03c867732d165be62b72e6c43bce1

(cherry picked from c5a8347ac491a5f521945d3835a322123830456b)
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 4d842f1..9548022 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -1609,6 +1609,10 @@
         // Remove the main space so that we don't try to trim it, this doens't work for debug
         // builds since RosAlloc attempts to read the magic number from a protected page.
         RemoveSpace(main_space_);
+        RemoveRememberedSet(main_space_);
+        RemoveRememberedSet(main_space_backup_.get());
+        main_space_backup_.reset(nullptr);
+        main_space_ = nullptr;
         temp_space_ = space::BumpPointerSpace::CreateFromMemMap("Bump pointer space 2",
                                                                 mem_map.release());
         AddSpace(temp_space_);
diff --git a/test/ParallelGC/ParallelGC.java b/test/ParallelGC/ParallelGC.java
index eb9e04e..fd95c6c 100644
--- a/test/ParallelGC/ParallelGC.java
+++ b/test/ParallelGC/ParallelGC.java
@@ -39,7 +39,7 @@
 
     public void run() {
         List l = new ArrayList();
-        for (int i = 0; i < 1000; i++) {
+        for (int i = 0; i < 400; i++) {
             l.add(new ArrayList(i));
             System.out.print(id);
         }