Allow permission dialog to show more than 2 lines.

Test: manually using the permission prompt in StorageTestApp
Bug: 174495520
Screenshots:
For S (master at HEAD)
Before: https://screenshot.googleplex.com/7wDYYtdymm4tB3P
After:
[1] https://screenshot.googleplex.com/BQwPrqnHodDJaZ2
[2] https://screenshot.googleplex.com/4RiFs2aPdmcQtnE

For R
Before: https://screenshot.googleplex.com/77KNDZLyYi2wsdB.png
After:
[1] https://screenshot.googleplex.com/9pby7QJqeZqigSr.png
[2] https://screenshot.googleplex.com/7MQkrN88KaqPmno.png

Change-Id: Id7d68b7733b953a6f360677808ea1a44d5dd5b95
(cherry picked from commit 4ab4a2f52a516d125064584eb7e443e4dcfe4999)
Merged-In: I6dac872ee35be5d410f7f7331efb740e1ae19336
(cherry picked from commit a2663476a16177afd1240e924e90c80ceaf601ce)
diff --git a/src/com/android/providers/media/PermissionActivity.java b/src/com/android/providers/media/PermissionActivity.java
index 944353f..700c633 100644
--- a/src/com/android/providers/media/PermissionActivity.java
+++ b/src/com/android/providers/media/PermissionActivity.java
@@ -165,13 +165,26 @@
         }
 
         final AlertDialog.Builder builder = new AlertDialog.Builder(this);
-        builder.setTitle(resolveTitleText());
+        // We set the title in message so that the text doesn't get truncated
+        builder.setMessage(resolveTitleText());
         builder.setPositiveButton(R.string.allow, this::onPositiveAction);
         builder.setNegativeButton(R.string.deny, this::onNegativeAction);
         builder.setCancelable(false);
         builder.setView(bodyView);
 
         final AlertDialog dialog = builder.show();
+
+        // The title is being set as a message above.
+        // We need to style it like the default AlertDialog title
+        TextView dialogMessage = (TextView) dialog.findViewById(
+                android.R.id.message);
+        if (dialogMessage != null) {
+            dialogMessage.setTextAppearance(
+                    android.R.style.TextAppearance_DeviceDefault_DialogWindowTitle);
+        } else {
+            Log.w(TAG, "Couldn't find message element");
+        }
+
         final WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
         params.width = getResources().getDimensionPixelSize(R.dimen.permission_dialog_width);
         dialog.getWindow().setAttributes(params);