Add navigtaion bar icons to simulate older platforms.

LayoutLib can simulate older versions of the platform to a very limited
extent. This change adds the old navigtaion bar icons back and moves the
latest ones to directories suffixed with "-v21". The code handles this
resolution in a very crude way.

This also removes a bunch of unused code and fixes some style warnings.

Change-Id: Ib6e7bfd8dfb34b2ccd87f660ca979eb5ef14bae7
diff --git a/tools/layoutlib/bridge/resources/bars/hdpi-v21/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/hdpi-v21/ic_sysbar_back.png
new file mode 100644
index 0000000..b28624f
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/hdpi-v21/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/hdpi-v21/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/hdpi-v21/ic_sysbar_home.png
new file mode 100644
index 0000000..3f3e288
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/hdpi-v21/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/hdpi-v21/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/hdpi-v21/ic_sysbar_recent.png
new file mode 100644
index 0000000..06dcd20
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/hdpi-v21/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_back.png
index b28624f..84e6bc8 100644
--- a/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_home.png
index 3f3e288..38e4f45 100644
--- a/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_home.png
+++ b/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_recent.png
index 06dcd20..bf9f300 100644
--- a/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_recent.png
+++ b/tools/layoutlib/bridge/resources/bars/hdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi-v21/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi-v21/ic_sysbar_back.png
new file mode 100644
index 0000000..e464347
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi-v21/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi/ic_sysbar_back.png
index e464347..782ebfe 100644
--- a/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi/ic_sysbar_recent.png
new file mode 100644
index 0000000..677b471
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/ldrtl-hdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi-v21/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi-v21/ic_sysbar_back.png
new file mode 100644
index 0000000..1b578a6
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi-v21/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi/ic_sysbar_back.png
index 1b578a6..a1b8062 100644
--- a/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi/ic_sysbar_recent.png
new file mode 100644
index 0000000..fcdbefe
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/ldrtl-mdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi-v21/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi-v21/ic_sysbar_back.png
new file mode 100644
index 0000000..373e84a
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi-v21/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi/ic_sysbar_back.png
index 373e84a..633d864 100644
--- a/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi/ic_sysbar_recent.png
new file mode 100644
index 0000000..4665e2a
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/ldrtl-xhdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/mdpi-v21/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/mdpi-v21/ic_sysbar_back.png
new file mode 100644
index 0000000..f878093
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/mdpi-v21/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/mdpi-v21/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/mdpi-v21/ic_sysbar_home.png
new file mode 100644
index 0000000..8e9583b
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/mdpi-v21/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/mdpi-v21/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/mdpi-v21/ic_sysbar_recent.png
new file mode 100644
index 0000000..e2a89c3
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/mdpi-v21/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_back.png
index f878093..a00bc5b 100644
--- a/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_home.png
index 8e9583b..dc3183b 100644
--- a/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_home.png
+++ b/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_recent.png
index e2a89c3..b07f611 100644
--- a/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_recent.png
+++ b/tools/layoutlib/bridge/resources/bars/mdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/xhdpi-v21/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/xhdpi-v21/ic_sysbar_back.png
new file mode 100644
index 0000000..ec2951d
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/xhdpi-v21/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/xhdpi-v21/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/xhdpi-v21/ic_sysbar_home.png
new file mode 100644
index 0000000..254f757
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/xhdpi-v21/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/xhdpi-v21/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/xhdpi-v21/ic_sysbar_recent.png
new file mode 100644
index 0000000..8a8e941
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/xhdpi-v21/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_back.png
index ec2951d..bd60cd6 100644
--- a/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_home.png
index 254f757..c5bc5c9 100644
--- a/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_home.png
+++ b/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_recent.png
index 8a8e941..f621d9c 100644
--- a/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_recent.png
+++ b/tools/layoutlib/bridge/resources/bars/xhdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java
index 86797e5..24664c7 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java
@@ -26,7 +26,6 @@
 import com.android.layoutlib.bridge.impl.ResourceHelper;
 import com.android.resources.Density;
 import com.android.resources.LayoutDirection;
-import com.android.resources.ResourceType;
 
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
@@ -59,11 +58,14 @@
  */
 abstract class CustomBar extends LinearLayout {
 
+    private final int mSimulatedPlatformVersion;
+
     protected abstract TextView getStyleableTextView();
 
-    protected CustomBar(Context context, Density density, int orientation, String layoutPath,
-            String name) throws XmlPullParserException {
+    protected CustomBar(Context context, int orientation, String layoutPath,
+            String name, int simulatedPlatformVersion) throws XmlPullParserException {
         super(context);
+        mSimulatedPlatformVersion = simulatedPlatformVersion;
         setOrientation(orientation);
         if (orientation == LinearLayout.HORIZONTAL) {
             setGravity(Gravity.CENTER_VERTICAL);
@@ -100,7 +102,8 @@
             pathOut[0] = "/bars/" + density.getResourceValue() + "/" + iconName;
         }
 
-        InputStream stream = getClass().getResourceAsStream(pathOut[0]);
+        // TODO: Change this with a more generic method.
+        InputStream stream = getIconWithApi(pathOut, iconName);
         if (stream == null && tryOtherDensities) {
             for (Density d : Density.values()) {
                 if (d != density) {
@@ -121,6 +124,19 @@
         return stream;
     }
 
+    private InputStream getIconWithApi(String[] pathOut, String iconName) {
+        if (mSimulatedPlatformVersion == 0) {
+            String path = pathOut[0];
+            String dirName = path.substring(0, path.lastIndexOf('/'));
+            pathOut[0] = dirName + "-v21" + "/" + iconName;
+            InputStream stream = getClass().getResourceAsStream(pathOut[0]);
+            if (stream != null) {
+                return stream;
+            }
+        }
+        return getClass().getResourceAsStream(pathOut[0]);
+    }
+
     protected void loadIcon(int index, String iconName, Density density) {
         loadIcon(index, iconName, density, false);
     }
@@ -158,65 +174,6 @@
         }
     }
 
-    protected void loadIcon(int index, String iconReference) {
-        ResourceValue value = getResourceValue(iconReference);
-        if (value != null) {
-            loadIcon(index, value);
-        }
-    }
-
-    protected void loadIconById(int id, String iconReference) {
-        ResourceValue value = getResourceValue(iconReference);
-        if (value != null) {
-            loadIconById(id, value);
-        }
-    }
-
-
-    protected Drawable loadIcon(int index, ResourceType type, String name) {
-        BridgeContext bridgeContext = (BridgeContext) mContext;
-        RenderResources res = bridgeContext.getRenderResources();
-
-        // find the resource
-        ResourceValue value = res.getFrameworkResource(type, name);
-
-        // resolve it if needed
-        value = res.resolveResValue(value);
-        return loadIcon(index, value);
-    }
-
-    private Drawable loadIcon(int index, ResourceValue value) {
-        View child = getChildAt(index);
-        if (child instanceof ImageView) {
-            ImageView imageView = (ImageView) child;
-
-            return loadIcon(imageView, value);
-        }
-
-        return null;
-    }
-
-    private Drawable loadIconById(int id, ResourceValue value) {
-        View child = findViewById(id);
-        if (child instanceof ImageView) {
-            ImageView imageView = (ImageView) child;
-
-            return loadIcon(imageView, value);
-        }
-
-        return null;
-    }
-
-
-    private Drawable loadIcon(ImageView imageView, ResourceValue value) {
-        Drawable drawable = ResourceHelper.getDrawable(value, (BridgeContext) mContext);
-        if (drawable != null) {
-            imageView.setImageDrawable(drawable);
-        }
-
-        return drawable;
-    }
-
     protected TextView setText(int index, String stringReference) {
         View child = getChildAt(index);
         if (child instanceof TextView) {
@@ -228,17 +185,6 @@
         return null;
     }
 
-    protected TextView setTextById(int id, String stringReference) {
-        View child = findViewById(id);
-        if (child instanceof TextView) {
-            TextView textView = (TextView) child;
-            setText(textView, stringReference);
-            return textView;
-        }
-
-        return null;
-    }
-
     private void setText(TextView textView, String stringReference) {
         ResourceValue value = getResourceValue(stringReference);
         if (value != null) {
@@ -256,7 +202,7 @@
         ResourceValue value = res.findItemInTheme(themeEntryName, true /*isFrameworkAttr*/);
         value = res.resolveResValue(value);
 
-        if (value instanceof StyleResourceValue == false) {
+        if (!(value instanceof StyleResourceValue)) {
             return;
         }
 
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java
index 112c267..283ff57 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java
@@ -27,8 +27,9 @@
 public class NavigationBar extends CustomBar {
 
     public NavigationBar(Context context, Density density, int orientation, boolean isRtl,
-            boolean rtlEnabled) throws XmlPullParserException {
-        super(context, density, orientation, "/bars/navigation_bar.xml", "navigation_bar.xml");
+            boolean rtlEnabled, int simulatedPlatformVersion) throws XmlPullParserException {
+        super(context, orientation, "/bars/navigation_bar.xml", "navigation_bar.xml",
+                simulatedPlatformVersion);
 
         setBackgroundColor(0xFF000000);
 
@@ -44,8 +45,11 @@
             recent = 1;
         }
 
+        //noinspection SpellCheckingInspection
         loadIcon(back,   "ic_sysbar_back.png",   density, isRtl);
+        //noinspection SpellCheckingInspection
         loadIcon(2,      "ic_sysbar_home.png",   density, isRtl);
+        //noinspection SpellCheckingInspection
         loadIcon(recent, "ic_sysbar_recent.png", density, isRtl);
     }
 
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java
index 2421f29..c9dd777 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java
@@ -18,13 +18,10 @@
 
 import com.android.layoutlib.bridge.impl.Config;
 import com.android.resources.Density;
-import com.android.resources.ResourceType;
 
 import org.xmlpull.v1.XmlPullParserException;
 
 import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LevelListDrawable;
 import android.view.Gravity;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -34,7 +31,8 @@
     public StatusBar(Context context, Density density, int direction, boolean RtlEnabled,
             int simulatedPlatformVersion) throws XmlPullParserException {
         // FIXME: if direction is RTL but it's not enabled in application manifest, mirror this bar.
-        super(context, density, LinearLayout.HORIZONTAL, "/bars/status_bar.xml", "status_bar.xml");
+        super(context, LinearLayout.HORIZONTAL, "/bars/status_bar.xml", "status_bar.xml",
+                simulatedPlatformVersion);
 
         // FIXME: use FILL_H?
         setGravity(Gravity.START | Gravity.TOP | Gravity.RIGHT);
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/TitleBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/TitleBar.java
index c27859f..ff952bd 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/TitleBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/TitleBar.java
@@ -16,8 +16,6 @@
 
 package com.android.layoutlib.bridge.bars;
 
-import com.android.resources.Density;
-
 import org.xmlpull.v1.XmlPullParserException;
 
 import android.content.Context;
@@ -28,9 +26,10 @@
 
     private TextView mTextView;
 
-    public TitleBar(Context context, Density density, String label)
+    public TitleBar(Context context, String label, int simulatedPlatformVersion)
             throws XmlPullParserException {
-        super(context, density, LinearLayout.HORIZONTAL, "/bars/title_bar.xml", "title_bar.xml");
+        super(context, LinearLayout.HORIZONTAL, "/bars/title_bar.xml", "title_bar.xml",
+                simulatedPlatformVersion);
 
         // Cannot access the inside items through id because no R.id values have been
         // created for them.
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index 75db8e1..8a58d35 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -246,6 +246,7 @@
                 backgroundView = mViewRoot = mContentRoot = new FrameLayout(context);
                 mViewRoot.setLayoutDirection(layoutDirection);
             } else {
+                int simulatedPlatformVersion = params.getSimulatedPlatformVersion();
                 if (hasSoftwareButtons() && mNavigationBarOrientation == LinearLayout.VERTICAL) {
                     /*
                      * This is a special case where the navigation bar is on the right.
@@ -270,10 +271,11 @@
                     mViewRoot = topLayout;
                     topLayout.setOrientation(LinearLayout.HORIZONTAL);
 
-                    if (Config.showOnScreenNavBar(params.getSimulatedPlatformVersion())) {
+                    if (Config.showOnScreenNavBar(simulatedPlatformVersion)) {
                         try {
                             NavigationBar navigationBar = createNavigationBar(context,
-                                    hardwareConfig.getDensity(), isRtl, params.isRtlSupported());
+                                    hardwareConfig.getDensity(), isRtl, params.isRtlSupported(),
+                                    simulatedPlatformVersion);
                             topLayout.addView(navigationBar);
                         } catch (XmlPullParserException ignored) {
                         }
@@ -330,7 +332,7 @@
                     try {
                         StatusBar statusBar = createStatusBar(context, hardwareConfig.getDensity(),
                                 layoutDirection, params.isRtlSupported(),
-                                params.getSimulatedPlatformVersion());
+                                simulatedPlatformVersion);
                         topLayout.addView(statusBar);
                     } catch (XmlPullParserException ignored) {
 
@@ -356,7 +358,8 @@
                 } else if (mTitleBarSize > 0) {
                     try {
                         TitleBar titleBar = createTitleBar(context,
-                                hardwareConfig.getDensity(), params.getAppLabel());
+                                params.getAppLabel(),
+                                simulatedPlatformVersion);
                         backgroundLayout.addView(titleBar);
                     } catch (XmlPullParserException ignored) {
 
@@ -373,13 +376,14 @@
                     backgroundLayout.addView(mContentRoot);
                 }
 
-                if (Config.showOnScreenNavBar(params.getSimulatedPlatformVersion()) &&
+                if (Config.showOnScreenNavBar(simulatedPlatformVersion) &&
                         mNavigationBarOrientation == LinearLayout.HORIZONTAL &&
                         mNavigationBarSize > 0) {
                     // system bar
                     try {
                         NavigationBar navigationBar = createNavigationBar(context,
-                                hardwareConfig.getDensity(), isRtl, params.isRtlSupported());
+                                hardwareConfig.getDensity(), isRtl, params.isRtlSupported(),
+                                simulatedPlatformVersion);
                         topLayout.addView(navigationBar);
                     } catch (XmlPullParserException ignored) {
 
@@ -1591,10 +1595,11 @@
      *        is RTL aware.
      */
     private NavigationBar createNavigationBar(BridgeContext context, Density density,
-            boolean isRtl, boolean isRtlSupported) throws XmlPullParserException {
+            boolean isRtl, boolean isRtlSupported, int simulatedPlatformVersion)
+            throws XmlPullParserException {
         NavigationBar navigationBar = new NavigationBar(context,
                 density, mNavigationBarOrientation, isRtl,
-                isRtlSupported);
+                isRtlSupported, simulatedPlatformVersion);
         if (mNavigationBarOrientation == LinearLayout.VERTICAL) {
             navigationBar.setLayoutParams(new LinearLayout.LayoutParams(mNavigationBarSize,
                     LayoutParams.MATCH_PARENT));
@@ -1605,9 +1610,10 @@
         return navigationBar;
     }
 
-    private TitleBar createTitleBar(BridgeContext context, Density density, String title)
+    private TitleBar createTitleBar(BridgeContext context, String title,
+            int simulatedPlatformVersion)
             throws XmlPullParserException {
-        TitleBar titleBar = new TitleBar(context, density, title);
+        TitleBar titleBar = new TitleBar(context, title, simulatedPlatformVersion);
         titleBar.setLayoutParams(
                 new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, mTitleBarSize));
         return titleBar;