Resolve CompoundButton's foreground drawable for layout direction change

This CL adds a step to resolve CompoundButton's foreground drawable when
layout direction has been changed. Prior this CL, only background drawable
of the button resolves its layout direciton in respond to system wide
layout direction change. This CL makes the foreground and background
drawables consistent in layout direciton.

Bug: 16376848
Change-Id: I9a4eb1e010e6ab61ef8684005508bd36486ec1f3
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index 770077d..602e1ab 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -245,6 +245,17 @@
     }
 
     /**
+     * @hide
+     */
+    @Override
+    public void onResolveDrawables(@ResolvedLayoutDir int layoutDirection) {
+        super.onResolveDrawables(layoutDirection);
+        if (mButtonDrawable != null) {
+            mButtonDrawable.setLayoutDirection(layoutDirection);
+        }
+    }
+
+    /**
      * @return the drawable used as the compound button image
      * @see #setButtonDrawable(Drawable)
      * @see #setButtonDrawable(int)