Merge changes from topic "am-12e7fe13-967e-46ae-a64e-5fde5ef1e19e"

* changes:
  [automerger] Clean up some method names in CarDrawerController. am: 3b8bebcd0a
  Clean up some method names in CarDrawerController.
diff --git a/car/src/main/java/android/support/car/drawer/CarDrawerActivity.java b/car/src/main/java/android/support/car/drawer/CarDrawerActivity.java
index 7100218..f46c652 100644
--- a/car/src/main/java/android/support/car/drawer/CarDrawerActivity.java
+++ b/car/src/main/java/android/support/car/drawer/CarDrawerActivity.java
@@ -46,7 +46,7 @@
  *
  * <p>The rootAdapter can implement nested-navigation, in its click-handling, by passing the
  * CarDrawerAdapter for the next level to
- * {@link CarDrawerController#switchToAdapter(CarDrawerAdapter)}.
+ * {@link CarDrawerController#pushAdapter(CarDrawerAdapter)}.
  *
  * <p>Any Activity's based on this class need to set their theme to CarDrawerActivityTheme or a
  * derivative.
diff --git a/car/src/main/java/android/support/car/drawer/CarDrawerController.java b/car/src/main/java/android/support/car/drawer/CarDrawerController.java
index 823abd8..7b23714 100644
--- a/car/src/main/java/android/support/car/drawer/CarDrawerController.java
+++ b/car/src/main/java/android/support/car/drawer/CarDrawerController.java
@@ -113,7 +113,13 @@
             return;
         }
 
-        mAdapterStack.push(rootAdapter);
+        // The root adapter is always the last item in the stack.
+        if (mAdapterStack.size() > 0) {
+            mAdapterStack.set(0, rootAdapter);
+        } else {
+            mAdapterStack.push(rootAdapter);
+        }
+
         setToolbarTitleFrom(rootAdapter);
         mDrawerList.setAdapter(rootAdapter);
     }
@@ -129,10 +135,10 @@
      *
      * @param adapter Adapter for next level of content in the drawer.
      */
-    public final void switchToAdapter(CarDrawerAdapter adapter) {
+    public final void pushAdapter(CarDrawerAdapter adapter) {
         mAdapterStack.peek().setTitleChangeListener(null);
         mAdapterStack.push(adapter);
-        switchToAdapterInternal(adapter);
+        setDisplayAdapter(adapter);
         runLayoutAnimation(DRILL_DOWN_ANIM);
     }
 
@@ -274,10 +280,11 @@
     }
 
     /**
-     * Sets the navigation drawer's title to be the one supplied by the given adapter and updates
-     * the navigation drawer list with the adapter's contents.
+     * Sets the given adapter as the one displaying the current contents of the drawer.
+     *
+     * <p>The drawer's title will also be derived from the given adapter.
      */
-    private void switchToAdapterInternal(CarDrawerAdapter adapter) {
+    private void setDisplayAdapter(CarDrawerAdapter adapter) {
         setToolbarTitleFrom(adapter);
         // NOTE: We don't use swapAdapter() since different levels in the Drawer may switch between
         // car_drawer_list_item_normal, car_drawer_list_item_small and car_list_empty layouts.
@@ -299,7 +306,7 @@
         CarDrawerAdapter adapter = mAdapterStack.pop();
         adapter.setTitleChangeListener(null);
         adapter.cleanup();
-        switchToAdapterInternal(mAdapterStack.peek());
+        setDisplayAdapter(mAdapterStack.peek());
         runLayoutAnimation(NAVIGATE_UP_ANIM);
         return true;
     }
@@ -311,7 +318,7 @@
             adapter.setTitleChangeListener(null);
             adapter.cleanup();
         }
-        switchToAdapterInternal(mAdapterStack.peek());
+        setDisplayAdapter(mAdapterStack.peek());
         runLayoutAnimation(NAVIGATE_UP_ANIM);
     }