Clear out old views when setting new content in settings

Bug: 27529989
Change-Id: Id44ca442c2117bc5df7929bcd79434c0ae23cded
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerActivity.java b/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerActivity.java
index c3a5089..ff70190 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerActivity.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerActivity.java
@@ -176,8 +176,11 @@
 
     @Override
     public void setContentView(@LayoutRes int layoutResID) {
-        LayoutInflater.from(this).inflate(layoutResID,
-                (ViewGroup) findViewById(R.id.content_frame));
+        final ViewGroup parent = (ViewGroup) findViewById(R.id.content_frame);
+        if (parent != null) {
+            parent.removeAllViews();
+        }
+        LayoutInflater.from(this).inflate(layoutResID, parent);
     }
 
     @Override