Merge "Import translations. DO NOT MERGE"
diff --git a/cmds/stagefright/SimplePlayer.cpp b/cmds/stagefright/SimplePlayer.cpp
index f850344..f269e80 100644
--- a/cmds/stagefright/SimplePlayer.cpp
+++ b/cmds/stagefright/SimplePlayer.cpp
@@ -259,7 +259,7 @@
             status_t err = onDoMoreStuff();
 
             if (err == OK) {
-                msg->post(5000ll);
+                msg->post(10000ll);
             }
             break;
         }
@@ -411,33 +411,53 @@
 }
 
 status_t SimplePlayer::onDoMoreStuff() {
+    ALOGV("onDoMoreStuff");
     for (size_t i = 0; i < mStateByTrackIndex.size(); ++i) {
         CodecState *state = &mStateByTrackIndex.editValueAt(i);
 
-        size_t index;
-        status_t err = state->mCodec->dequeueInputBuffer(&index);
+        status_t err;
+        do {
+            size_t index;
+            err = state->mCodec->dequeueInputBuffer(&index);
 
-        if (err == OK) {
-            state->mAvailInputBufferIndices.push_back(index);
-        }
+            if (err == OK) {
+                ALOGV("dequeued input buffer on track %d",
+                      mStateByTrackIndex.keyAt(i));
 
-        BufferInfo info;
-        err = state->mCodec->dequeueOutputBuffer(
-                &info.mIndex,
-                &info.mOffset,
-                &info.mSize,
-                &info.mPresentationTimeUs,
-                &info.mFlags);
+                state->mAvailInputBufferIndices.push_back(index);
+            } else {
+                ALOGV("dequeueInputBuffer on track %d returned %d",
+                      mStateByTrackIndex.keyAt(i), err);
+            }
+        } while (err == OK);
 
-        if (err == OK) {
-            state->mAvailOutputBufferInfos.push_back(info);
-        } else if (err == INFO_FORMAT_CHANGED) {
-            err = onOutputFormatChanged(mStateByTrackIndex.keyAt(i), state);
-            CHECK_EQ(err, (status_t)OK);
-        } else if (err == INFO_OUTPUT_BUFFERS_CHANGED) {
-            err = state->mCodec->getOutputBuffers(&state->mBuffers[1]);
-            CHECK_EQ(err, (status_t)OK);
-        }
+        do {
+            BufferInfo info;
+            err = state->mCodec->dequeueOutputBuffer(
+                    &info.mIndex,
+                    &info.mOffset,
+                    &info.mSize,
+                    &info.mPresentationTimeUs,
+                    &info.mFlags);
+
+            if (err == OK) {
+                ALOGV("dequeued output buffer on track %d",
+                      mStateByTrackIndex.keyAt(i));
+
+                state->mAvailOutputBufferInfos.push_back(info);
+            } else if (err == INFO_FORMAT_CHANGED) {
+                err = onOutputFormatChanged(mStateByTrackIndex.keyAt(i), state);
+                CHECK_EQ(err, (status_t)OK);
+            } else if (err == INFO_OUTPUT_BUFFERS_CHANGED) {
+                err = state->mCodec->getOutputBuffers(&state->mBuffers[1]);
+                CHECK_EQ(err, (status_t)OK);
+            } else {
+                ALOGV("dequeueOutputBuffer on track %d returned %d",
+                      mStateByTrackIndex.keyAt(i), err);
+            }
+        } while (err == OK
+                || err == INFO_FORMAT_CHANGED
+                || err == INFO_OUTPUT_BUFFERS_CHANGED);
     }
 
     for (;;) {
@@ -475,6 +495,8 @@
                     0);
             CHECK_EQ(err, (status_t)OK);
 
+            ALOGV("enqueued input data on track %d", trackIndex);
+
             err = mExtractor->advance();
             CHECK_EQ(err, (status_t)OK);
         }
@@ -500,7 +522,7 @@
 
                 if (lateByUs > 30000ll) {
                     ALOGI("track %d buffer late by %lld us, dropping.",
-                          i, lateByUs);
+                          mStateByTrackIndex.keyAt(i), lateByUs);
                     state->mCodec->releaseOutputBuffer(info->mIndex);
                 } else {
                     if (state->mAudioTrack != NULL) {
@@ -529,7 +551,8 @@
                     break;
                 }
             } else {
-                ALOGV("track %d buffer early by %lld us.", i, -lateByUs);
+                ALOGV("track %d buffer early by %lld us.",
+                      mStateByTrackIndex.keyAt(i), -lateByUs);
                 break;
             }
         }
diff --git a/cmds/stagefright/codec.cpp b/cmds/stagefright/codec.cpp
index 02dc8dd..ad246d2 100644
--- a/cmds/stagefright/codec.cpp
+++ b/cmds/stagefright/codec.cpp
@@ -394,7 +394,7 @@
         player->setDataSource(argv[0]);
         player->setSurface(surface->getSurfaceTexture());
         player->start();
-        sleep(10);
+        sleep(60);
         player->stop();
         player->reset();
 
diff --git a/core/java/android/view/ActionMode.java b/core/java/android/view/ActionMode.java
index 0349a2b..c1c7fe2 100644
--- a/core/java/android/view/ActionMode.java
+++ b/core/java/android/view/ActionMode.java
@@ -24,7 +24,7 @@
  * <div class="special reference">
  * <h3>Developer Guides</h3>
  * <p>For information about how to provide contextual actions with {@code ActionMode},
- * read the <a href="{@docRoot}guide/topics/ui/menu.html#context-menu">Menus</a>
+ * read the <a href="{@docRoot}guide/topics/ui/menus.html#context-menu">Menus</a>
  * developer guide.</p>
  * </div>
  */
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index ec95863..7054851 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -910,6 +910,8 @@
             if (canDraw()) {
                 if (!hasDirtyRegions()) {
                     dirty = null;
+                } else if (dirty != null) {
+                    dirty.intersect(0, 0, mWidth, mHeight);
                 }
                 attachInfo.mIgnoreDirtyState = true;
                 attachInfo.mDrawingTime = SystemClock.uptimeMillis();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 2602523..5774440 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -1020,6 +1020,7 @@
 
         if (mChoiceMode != CHOICE_MODE_NONE) {
             handled = true;
+            boolean checkedStateChanged = false;
 
             if (mChoiceMode == CHOICE_MODE_MULTIPLE ||
                     (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL && mChoiceActionMode != null)) {
@@ -1042,6 +1043,7 @@
                             position, id, newValue);
                     dispatchItemClick = false;
                 }
+                checkedStateChanged = true;
             } else if (mChoiceMode == CHOICE_MODE_SINGLE) {
                 boolean newValue = !mCheckStates.get(position, false);
                 if (newValue) {
@@ -1055,11 +1057,12 @@
                 } else if (mCheckStates.size() == 0 || !mCheckStates.valueAt(0)) {
                     mCheckedItemCount = 0;
                 }
+                checkedStateChanged = true;
             }
 
-            mDataChanged = true;
-            rememberSyncState();
-            requestLayout();
+            if (checkedStateChanged) {
+                updateOnScreenCheckedViews();
+            }
         }
 
         if (dispatchItemClick) {
@@ -1070,6 +1073,28 @@
     }
 
     /**
+     * Perform a quick, in-place update of the checked or activated state
+     * on all visible item views. This should only be called when a valid
+     * choice mode is active.
+     */
+    private void updateOnScreenCheckedViews() {
+        final int firstPos = mFirstPosition;
+        final int count = getChildCount();
+        final boolean useActivated = getContext().getApplicationInfo().targetSdkVersion
+                >= android.os.Build.VERSION_CODES.HONEYCOMB;
+        for (int i = 0; i < count; i++) {
+            final View child = getChildAt(i);
+            final int position = firstPos + i;
+
+            if (child instanceof Checkable) {
+                ((Checkable) child).setChecked(mCheckStates.get(position));
+            } else if (useActivated) {
+                child.setActivated(mCheckStates.get(position));
+            }
+        }
+    }
+
+    /**
      * @see #setChoiceMode(int)
      *
      * @return The current choice mode
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 6a887db..0950bdb 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1542,6 +1542,21 @@
   <java-symbol type="drawable" name="ic_volume" />
   <java-symbol type="drawable" name="stat_notify_sim_toolkit" />
 
+  <!-- From maps library -->
+  <java-symbol type="array" name="maps_starting_lat_lng" />
+  <java-symbol type="array" name="maps_starting_zoom" />
+  <java-symbol type="attr" name="mapViewStyle" />
+  <java-symbol type="attr" name="state_focused" />
+  <java-symbol type="attr" name="state_selected" />
+  <java-symbol type="attr" name="state_pressed" />
+  <java-symbol type="drawable" name="compass_arrow" />
+  <java-symbol type="drawable" name="compass_base" />
+  <java-symbol type="drawable" name="ic_maps_indicator_current_position_anim" />
+  <java-symbol type="drawable" name="loading_tile_android" />
+  <java-symbol type="drawable" name="maps_google_logo" />
+  <java-symbol type="drawable" name="no_tile_256" />
+  <java-symbol type="drawable" name="reticle" />
+
   <!-- From PinyinIME(!!!) -->
   <java-symbol type="string" name="inputMethod" />
 
diff --git a/docs/html/images/training/lint_icon.png b/docs/html/images/training/lint_icon.png
new file mode 100644
index 0000000..118a741
--- /dev/null
+++ b/docs/html/images/training/lint_icon.png
Binary files differ
diff --git a/docs/html/training/improving-layouts/optimizing-layout.jd b/docs/html/training/improving-layouts/optimizing-layout.jd
index 65c8af7..0eaf199 100644
--- a/docs/html/training/improving-layouts/optimizing-layout.jd
+++ b/docs/html/training/improving-layouts/optimizing-layout.jd
@@ -18,7 +18,7 @@
 <ol>
   <li><a href="#Inspect">Inspect Your Layout</a></li>
   <li><a href="#Revise">Revise Your Layout</a></li>
-  <li><a href="#Layoutopt">Use Layoutopt</a></li>
+  <li><a href="#Lint">Use Lint</a></li>
 </ol>
 
 <!-- other docs (NOT javadocs) -->
@@ -44,7 +44,7 @@
 android.widget.GridView}.</p>
 
 <p>In this lesson you'll learn to use <a
-href="{@docRoot}guide/developing/tools/hierarchy-viewer.html">Heirachy Viewer</a> and <a
+href="{@docRoot}guide/developing/tools/hierarchy-viewer.html">Hierarchy Viewer</a> and <a
 href="{@docRoot}guide/developing/tools/layoutopt.html">Layoutopt</a> to examine and optimize your
 layout.</p>
 
@@ -53,7 +53,7 @@
 <h2 id="Inspect">Inspect Your Layout</h2>
 
 <p>The Android SDK tools include a tool called <a
-href="{@docRoot}guide/developing/tools/hierarchy-viewer.html">Heirachy Viewer</a> that allows
+href="{@docRoot}guide/developing/tools/hierarchy-viewer.html">Hierarchy Viewer</a> that allows
 you to analyze your layout while your application is running. Using this tool helps you discover
 bottlenecks in the layout performance.</p>
 
@@ -130,27 +130,28 @@
 layout weight is necessary.</p>
 
 
-<h2 id="Layoutopt">Use Layoutopt</h2>
+<h2 id="Lint">Use Lint</h2>
 
-<p>It is always good practice to also run the <a
-href="{@docRoot}guide/developing/tools/layoutopt.html">layoutopt</a> tool on your final layout files
-to search for places in your view hierarchy that may be optimized. Layoutopt is also in your SDK
-{@code tools/} directory and takes a layout directory name or a space-separated list of layout files
-that you'd like to inspect.</p>
+<p>It is always good practice to run the <a href="http://tools.android.com/tips/lint">Lint</a> tool on your layout files to search for possible view hierarchy optimizations. Lint has replaced the Layoutopt tool and has much greater functionality. Some examples of Lint <a
+href="http://tools.android.com/tips/lint-checks">rules</a> are:</p>
 
-<p>When you run {@code layoutopt} on a layout file, it prints a line number for each issue found, a
-description of the issue, and for some types of issues it also suggests a resolution. For
-example:</p>
+<ul>
+<li>Use compound drawables - A {@link android.widget.LinearLayout} which contains an {@link android.widget.ImageView} and a {@link android.widget.TextView} can be more efficiently handled as a compound drawable.</li>
+<li>Merge root frame - If a {@link android.widget.FrameLayout} is the root of a layout and does not provide background or padding etc, it can be replaced with a merge tag which is slightly more efficient.</li>
+<li>Useless leaf - A layout that has no children or no background can often be removed (since it is invisible) for a flatter and more efficient layout hierarchy.</li>
+<li>Useless parent - A layout with children that has no siblings, is not a {@link android.widget.ScrollView} or a root layout, and does not have a background, can be removed and have its children moved directly into the parent for a flatter and more efficient layout hierarchy.</li>
+<li>Deep layouts - Layouts with too much nesting are bad for performance. Consider using flatter layouts such as {@link android.widget.RelativeLayout} or {@link android.widget.GridLayout} to improve performance. The default maximum depth is 10.</li>
+</ul>
 
-<pre class="no-pretty-print classic">
-$ layoutopt samples/
-samples/compound.xml
-   7:23 The root-level &lt;FrameLayout/&gt; can be replaced with &lt;merge/&gt;
-   11:21 This LinearLayout layout or its FrameLayout parent is useless
-samples/simple.xml
-   7:7 The root-level &lt;FrameLayout/&gt; can be replaced with &lt;merge/&gt;
-</pre>
+<p>Another benefit of Lint is that it is integrated into the Android Development Tools for Eclipse (ADT 16+). Lint automatically runs whenever you export an APK, edit and save an XML file or use the Layout Editor. To manually force Lint to run press the Lint button in the Eclipse toolbar.</p>
 
-<p>After you apply the suggested layout optimizations, run Hierarchy Viewer again to inspect the
-performance changes.</p>
+<img src="{@docRoot}images/training/lint_icon.png" alt="" />
+
+<p>When used inside Eclipse, Lint has the ability to automatically fix some issues, provide suggestions for others and jump directly to the offending code for review. If you don’t use Eclipse for your development, Lint can also be run from the command line. More information about Lint is available at <a href="http://tools.android.com/tips/lint">tools.android.com</a>.</p>
+
+
+
+
+
+
 
diff --git a/include/utils/KeyedVector.h b/include/utils/KeyedVector.h
index fcc3bcf..85535bd 100644
--- a/include/utils/KeyedVector.h
+++ b/include/utils/KeyedVector.h
@@ -122,7 +122,7 @@
 
 template<typename KEY, typename VALUE> inline
 const VALUE& KeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
-    ssize_t i = indexOfKey(key);
+    ssize_t i = this->indexOfKey(key);
     assert(i>=0);
     return mVector.itemAt(i).value;
 }
@@ -139,7 +139,7 @@
 
 template<typename KEY, typename VALUE> inline
 VALUE& KeyedVector<KEY,VALUE>::editValueFor(const KEY& key) {
-    ssize_t i = indexOfKey(key);
+    ssize_t i = this->indexOfKey(key);
     assert(i>=0);
     return mVector.editItemAt(i).value;
 }
@@ -190,7 +190,7 @@
 
 template<typename KEY, typename VALUE> inline
 const VALUE& DefaultKeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
-    ssize_t i = indexOfKey(key);
+    ssize_t i = this->indexOfKey(key);
     return i >= 0 ? KeyedVector<KEY,VALUE>::valueAt(i) : mDefault;
 }
 
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index c12a4b7e..8f35afb 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -2285,13 +2285,21 @@
                                     "Laying out navigation bar window: (%d,%d - %d,%d)",
                                     pf.left, pf.top, pf.right, pf.bottom));
                     }
-                } else if (attrs.type == TYPE_SECURE_SYSTEM_OVERLAY
+                } else if ((attrs.type == TYPE_SECURE_SYSTEM_OVERLAY
+                                || attrs.type == TYPE_BOOT_PROGRESS)
                         && ((fl & FLAG_FULLSCREEN) != 0)) {
                     // Fullscreen secure system overlays get what they ask for.
                     pf.left = df.left = mUnrestrictedScreenLeft;
                     pf.top = df.top = mUnrestrictedScreenTop;
                     pf.right = df.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;
                     pf.bottom = df.bottom = mUnrestrictedScreenTop+mUnrestrictedScreenHeight;
+                } else if (attrs.type == TYPE_BOOT_PROGRESS) {
+                    // Boot progress screen always covers entire display.
+                    pf.left = df.left = cf.left = mUnrestrictedScreenLeft;
+                    pf.top = df.top = cf.top = mUnrestrictedScreenTop;
+                    pf.right = df.right = cf.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;
+                    pf.bottom = df.bottom = cf.bottom
+                            = mUnrestrictedScreenTop+mUnrestrictedScreenHeight;
                 } else {
                     pf.left = df.left = cf.left = mRestrictedScreenLeft;
                     pf.top = df.top = cf.top = mRestrictedScreenTop;
diff --git a/services/java/com/android/server/wm/DimAnimator.java b/services/java/com/android/server/wm/DimAnimator.java
index a3293e8..a9d4e01 100644
--- a/services/java/com/android/server/wm/DimAnimator.java
+++ b/services/java/com/android/server/wm/DimAnimator.java
@@ -180,7 +180,9 @@
 
     public void printTo(String prefix, PrintWriter pw) {
         pw.print(prefix);
-        pw.print("mDimSurface="); pw.println(mDimSurface);
+        pw.print("mDimSurface="); pw.print(mDimSurface);
+                pw.print(" "); pw.print(mLastDimWidth); pw.print(" x ");
+                pw.println(mLastDimHeight);
         pw.print(prefix);
         pw.print("mDimShown="); pw.print(mDimShown);
         pw.print(" current="); pw.print(mDimCurrentAlpha);
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index dafc613..21cb3e8 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -8570,6 +8570,11 @@
                     if (mDimAnimator == null) {
                         mDimAnimator = new DimAnimator(mFxSession);
                     }
+                    if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) {
+                        mDimAnimator.show(mCurDisplayWidth, mCurDisplayHeight);
+                    } else {
+                        mDimAnimator.show(innerDw, innerDh);
+                    }
                     mDimAnimator.show(innerDw, innerDh);
                     mDimAnimator.updateParameters(mContext.getResources(),
                             w, currentTime);
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index 95a68d1..9ee6c84 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -21,6 +21,7 @@
 
 const char* const RESOURCES_ROOT_NAMESPACE = "http://schemas.android.com/apk/res/";
 const char* const RESOURCES_ANDROID_NAMESPACE = "http://schemas.android.com/apk/res/android";
+const char* const RESOURCES_AUTO_PACKAGE_NAMESPACE = "http://schemas.android.com/apk/res/auto";
 const char* const RESOURCES_ROOT_PRV_NAMESPACE = "http://schemas.android.com/apk/prv/res/";
 
 const char* const XLIFF_XMLNS = "urn:oasis:names:tc:xliff:document:1.2";
@@ -44,16 +45,21 @@
 }
 
 static const String16 RESOURCES_PREFIX(RESOURCES_ROOT_NAMESPACE);
+static const String16 RESOURCES_PREFIX_AUTO_PACKAGE(RESOURCES_AUTO_PACKAGE_NAMESPACE);
 static const String16 RESOURCES_PRV_PREFIX(RESOURCES_ROOT_PRV_NAMESPACE);
 static const String16 RESOURCES_TOOLS_NAMESPACE("http://schemas.android.com/tools");
 
-String16 getNamespaceResourcePackage(String16 namespaceUri, bool* outIsPublic)
+String16 getNamespaceResourcePackage(String16 appPackage, String16 namespaceUri, bool* outIsPublic)
 {
     //printf("%s starts with %s?\n", String8(namespaceUri).string(),
     //       String8(RESOURCES_PREFIX).string());
     size_t prefixSize;
     bool isPublic = true;
-    if (namespaceUri.startsWith(RESOURCES_PREFIX)) {
+    if(namespaceUri.startsWith(RESOURCES_PREFIX_AUTO_PACKAGE)) {
+        NOISY(printf("Using default application package: %s -> %s\n", String8(namespaceUri).string(), String8(appPackage).string()));
+        isPublic = true;
+        return appPackage;
+    } else if (namespaceUri.startsWith(RESOURCES_PREFIX)) {
         prefixSize = RESOURCES_PREFIX.size();
     } else if (namespaceUri.startsWith(RESOURCES_PRV_PREFIX)) {
         isPublic = false;
@@ -926,7 +932,7 @@
             const attribute_entry& e = mAttributes.itemAt(i);
             if (e.ns.size() <= 0) continue;
             bool nsIsPublic;
-            String16 pkg(getNamespaceResourcePackage(e.ns, &nsIsPublic));
+            String16 pkg(getNamespaceResourcePackage(String16(assets->getPackage()), e.ns, &nsIsPublic));
             NOISY(printf("Elem %s %s=\"%s\": namespace(%s) %s ===> %s\n",
                     String8(getElementName()).string(),
                     String8(e.name).string(),
diff --git a/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java b/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java
index 0a3cdc6..6ac5b02 100644
--- a/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java
+++ b/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java
@@ -18,6 +18,7 @@
 
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.ResourceValue;
+import com.android.internal.util.XmlUtils;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.BridgeConstants;
 import com.android.layoutlib.bridge.android.BridgeContext;
@@ -25,9 +26,6 @@
 
 import org.xmlpull.v1.XmlPullParser;
 
-import android.util.AttributeSet;
-import android.util.XmlPullAttributes;
-
 /**
  * A correct implementation of the {@link AttributeSet} interface on top of a XmlPullParser
  */
@@ -80,21 +78,40 @@
         return 0;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see android.util.XmlPullAttributes#getAttributeResourceValue(int, int)
-     */
     @Override
-    public int getAttributeResourceValue(int index, int defaultValue) {
-        String value = getAttributeValue(index);
+    public int getAttributeListValue(String namespace, String attribute,
+            String[] options, int defaultValue) {
+        String value = getAttributeValue(namespace, attribute);
+        if (value != null) {
+            ResourceValue r = getResourceValue(value);
 
-        return resolveResourceValue(value, defaultValue);
+            if (r != null) {
+                value = r.getValue();
+            }
+
+            return XmlUtils.convertValueToList(value, options, defaultValue);
+        }
+
+        return defaultValue;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see android.util.XmlPullAttributes#getAttributeResourceValue(java.lang.String, java.lang.String, int)
-     */
+    @Override
+    public boolean getAttributeBooleanValue(String namespace, String attribute,
+            boolean defaultValue) {
+        String value = getAttributeValue(namespace, attribute);
+        if (value != null) {
+            ResourceValue r = getResourceValue(value);
+
+            if (r != null) {
+                value = r.getValue();
+            }
+
+            return XmlUtils.convertValueToBoolean(value, defaultValue);
+        }
+
+        return defaultValue;
+    }
+
     @Override
     public int getAttributeResourceValue(String namespace, String attribute, int defaultValue) {
         String value = getAttributeValue(namespace, attribute);
@@ -102,12 +119,151 @@
         return resolveResourceValue(value, defaultValue);
     }
 
-    private int resolveResourceValue(String value, int defaultValue) {
+    @Override
+    public int getAttributeIntValue(String namespace, String attribute,
+            int defaultValue) {
+        String value = getAttributeValue(namespace, attribute);
+        if (value != null) {
+            ResourceValue r = getResourceValue(value);
+
+            if (r != null) {
+                value = r.getValue();
+            }
+
+            return XmlUtils.convertValueToInt(value, defaultValue);
+        }
+
+        return defaultValue;
+    }
+
+    @Override
+    public int getAttributeUnsignedIntValue(String namespace, String attribute,
+            int defaultValue) {
+        String value = getAttributeValue(namespace, attribute);
+        if (value != null) {
+            ResourceValue r = getResourceValue(value);
+
+            if (r != null) {
+                value = r.getValue();
+            }
+
+            return XmlUtils.convertValueToUnsignedInt(value, defaultValue);
+        }
+
+        return defaultValue;
+    }
+
+    @Override
+    public float getAttributeFloatValue(String namespace, String attribute,
+            float defaultValue) {
+        String s = getAttributeValue(namespace, attribute);
+        if (s != null) {
+            ResourceValue r = getResourceValue(s);
+
+            if (r != null) {
+                s = r.getValue();
+            }
+
+            return Float.parseFloat(s);
+        }
+
+        return defaultValue;
+    }
+
+    @Override
+    public int getAttributeListValue(int index,
+            String[] options, int defaultValue) {
+        return XmlUtils.convertValueToList(
+            getAttributeValue(index), options, defaultValue);
+    }
+
+    @Override
+    public boolean getAttributeBooleanValue(int index, boolean defaultValue) {
+        String value = getAttributeValue(index);
+        if (value != null) {
+            ResourceValue r = getResourceValue(value);
+
+            if (r != null) {
+                value = r.getValue();
+            }
+
+            return XmlUtils.convertValueToBoolean(value, defaultValue);
+        }
+
+        return defaultValue;
+    }
+
+    @Override
+    public int getAttributeResourceValue(int index, int defaultValue) {
+        String value = getAttributeValue(index);
+
+        return resolveResourceValue(value, defaultValue);
+    }
+
+    @Override
+    public int getAttributeIntValue(int index, int defaultValue) {
+        String value = getAttributeValue(index);
+        if (value != null) {
+            ResourceValue r = getResourceValue(value);
+
+            if (r != null) {
+                value = r.getValue();
+            }
+
+            return XmlUtils.convertValueToInt(value, defaultValue);
+        }
+
+        return defaultValue;
+    }
+
+    @Override
+    public int getAttributeUnsignedIntValue(int index, int defaultValue) {
+        String value = getAttributeValue(index);
+        if (value != null) {
+            ResourceValue r = getResourceValue(value);
+
+            if (r != null) {
+                value = r.getValue();
+            }
+
+            return XmlUtils.convertValueToUnsignedInt(value, defaultValue);
+        }
+
+        return defaultValue;
+    }
+
+    @Override
+    public float getAttributeFloatValue(int index, float defaultValue) {
+        String s = getAttributeValue(index);
+        if (s != null) {
+            ResourceValue r = getResourceValue(s);
+
+            if (r != null) {
+                s = r.getValue();
+            }
+
+            return Float.parseFloat(s);
+        }
+
+        return defaultValue;
+    }
+
+    // -- private helper methods
+
+    /**
+     * Returns a resolved {@link ResourceValue} from a given value.
+     */
+    private ResourceValue getResourceValue(String value) {
         // now look for this particular value
         RenderResources resources = mContext.getRenderResources();
-        ResourceValue resource = resources.resolveResValue(
-                resources.findResValue(value, mPlatformFile));
+        return resources.resolveResValue(resources.findResValue(value, mPlatformFile));
+    }
 
+    /**
+     * Resolves and return a value to its associated integer.
+     */
+    private int resolveResourceValue(String value, int defaultValue) {
+        ResourceValue resource = getResourceValue(value);
         if (resource != null) {
             Integer id = null;
             if (mPlatformFile || resource.isFramework()) {
@@ -124,5 +280,4 @@
 
         return defaultValue;
     }
-
 }
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
index 33bf7bc..ff88209 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -24,8 +24,8 @@
 import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderSession;
 import com.android.ide.common.rendering.api.Result;
-import com.android.ide.common.rendering.api.SessionParams;
 import com.android.ide.common.rendering.api.Result.Status;
+import com.android.ide.common.rendering.api.SessionParams;
 import com.android.layoutlib.bridge.impl.FontLoader;
 import com.android.layoutlib.bridge.impl.RenderDrawable;
 import com.android.layoutlib.bridge.impl.RenderSessionImpl;
@@ -242,6 +242,8 @@
         if (fontLoader != null) {
             Typeface_Delegate.init(fontLoader);
         } else {
+            log.error(LayoutLog.TAG_BROKEN,
+                    "Failed create FontLoader in layout lib.", null);
             return false;
         }