MNC Perms: Button bar animate to max half window height

- Make sure that the button bar only animates to half way (max).
- Also make the buttons scrollable

Bug: 24265941
Bug: 24208967

Change-Id: I68d01c72658c0e7aff35b899b638da123c44d62e
diff --git a/res/values-watch/themes.xml b/res/values-watch/themes.xml
index e20e35c..b75f469 100644
--- a/res/values-watch/themes.xml
+++ b/res/values-watch/themes.xml
@@ -57,7 +57,7 @@
         <item name="android:maxLines">3</item>
         <item name="android:ellipsize">marquee</item>
         <item name="android:layout_height">60dp</item>
-        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_width">wrap_content</item>
         <item name="android:drawablePadding">12dp</item>
     </style>
 </resources>
diff --git a/src/com/android/packageinstaller/permission/ui/wear/ConfirmationViewHandler.java b/src/com/android/packageinstaller/permission/ui/wear/ConfirmationViewHandler.java
index d28866e..b1ff52b 100644
--- a/src/com/android/packageinstaller/permission/ui/wear/ConfirmationViewHandler.java
+++ b/src/com/android/packageinstaller/permission/ui/wear/ConfirmationViewHandler.java
@@ -182,8 +182,14 @@
                         if (mContent.getHeight() > mScrollingContainer.getHeight()) {
                             mButtonBarContainer.setTranslationZ(mButtonBarFloatingHeight);
                             mHideHandler.sendEmptyMessageDelayed(MSG_HIDE_BUTTON_BAR, 3000);
-                            generateButtonBarAnimator(mButtonBarContainer.getHeight(), 0, 0,
-                                    mButtonBarFloatingHeight, 1000);
+                            int maxButtonBarHeight = 0;
+                            if (mButtonBarContainer.getHeight() >= mRoot.getHeight() / 2) {
+                                // If the ButtonBar is bigger than half the screen, then don't
+                                // animate all the way.
+                                maxButtonBarHeight = mRoot.getHeight() / 2;
+                            }
+                            generateButtonBarAnimator(mButtonBarContainer.getHeight(),
+                                    maxButtonBarHeight, 0, mButtonBarFloatingHeight, 1000);
                         } else {
                             mButtonBarContainer.setTranslationY(0);
                             mButtonBarContainer.setTranslationZ(0);
@@ -282,4 +288,4 @@
         mButtonBarAnimator.setInterpolator(mInterpolator);
         mButtonBarAnimator.start();
     }
-}
\ No newline at end of file
+}