summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip P. Moltmann <moltmann@google.com>2016-09-27 14:23:20 -0700
committerPhilip P. Moltmann <moltmann@google.com>2016-09-30 21:12:29 +0000
commitb4090d16e423700984d0a3e015938806bfd55327 (patch)
tree26358569e81bb04a20b12bce9ad5cdacba5d56b5
parent435a65b477f5bc079700d84ea216faf2adc7c823 (diff)
downloadandroid_packages_apps_PackageInstaller-b4090d16e423700984d0a3e015938806bfd55327.tar.gz
android_packages_apps_PackageInstaller-b4090d16e423700984d0a3e015938806bfd55327.tar.bz2
android_packages_apps_PackageInstaller-b4090d16e423700984d0a3e015938806bfd55327.zip
If the permission dialog would stick out, move it.
Also scroll the whole dialog if the screen is too small to for the dialog. Test: Executed steps in the bug. Dialog looks fine. Also toyed around with display scaling and font scaling to make sure dialog always looks ok (but might scroll) on very small displays. Fixes: 31442798 Change-Id: I74328afde38ec2170a14aaa8e77675ad2164460e (cherry picked from commit 3a5c306e5b6bf2285980aa34cb8eb00fbcf5ea2c)
-rw-r--r--res/layout/grant_permissions.xml5
-rw-r--r--src/com/android/packageinstaller/permission/ui/ManualLayoutFrame.java7
2 files changed, 11 insertions, 1 deletions
diff --git a/res/layout/grant_permissions.xml b/res/layout/grant_permissions.xml
index abb219a5..8ed9c5d6 100644
--- a/res/layout/grant_permissions.xml
+++ b/res/layout/grant_permissions.xml
@@ -25,6 +25,9 @@
android:paddingBottom="32dp"
android:clipToPadding="false">
+ <ScrollView android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
<LinearLayout
android:id="@+id/dialog_container"
android:layout_width="wrap_content"
@@ -116,4 +119,6 @@
</LinearLayout>
+ </ScrollView>
+
</com.android.packageinstaller.permission.ui.ManualLayoutFrame>
diff --git a/src/com/android/packageinstaller/permission/ui/ManualLayoutFrame.java b/src/com/android/packageinstaller/permission/ui/ManualLayoutFrame.java
index a20c9523..0b07c806 100644
--- a/src/com/android/packageinstaller/permission/ui/ManualLayoutFrame.java
+++ b/src/com/android/packageinstaller/permission/ui/ManualLayoutFrame.java
@@ -61,8 +61,13 @@ public class ManualLayoutFrame extends ViewGroup {
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ // We want to keep the content bottom at the same place to avoid movement of the "Allow"
+ // button.
+ // Try to keep the content bottom at the same height. If this would move the dialog out of
+ // the top of the screen move it down as much as possible, then keep it at that position for
+ // the rest of the sequence of permission dialogs.
View content = getChildAt(0);
- if (mContentBottom == 0) {
+ if (mContentBottom == 0 || content.getMeasuredHeight() > mContentBottom) {
mContentBottom = (getMeasuredHeight() + content.getMeasuredHeight()) / 2;
}
final int contentLeft = (getMeasuredWidth() - content.getMeasuredWidth()) / 2;