Fixed a bug where the text directionality was inconsistent

The title would not be fully right aligned because it wasn't
layouted with match_parent because there could be a second visible
text when there is a progressbar.

Change-Id: I73d97d9a8addaec0e3b849349f220c764fa45db0
Fixes: 27893267
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index d747005..05a6a70 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -58,6 +58,7 @@
 import android.view.Gravity;
 import android.view.NotificationHeaderView;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.ProgressBar;
 import android.widget.RemoteViews;
 
@@ -3194,11 +3195,14 @@
 
             bindNotificationHeader(contentView);
             bindLargeIcon(contentView);
+            boolean showProgress = handleProgressBar(hasProgress, contentView, ex);
             if (title != null) {
                 contentView.setViewVisibility(R.id.title, View.VISIBLE);
                 contentView.setTextViewText(R.id.title, title);
+                contentView.setViewLayoutWidth(R.id.title, showProgress
+                        ? ViewGroup.LayoutParams.WRAP_CONTENT
+                        : ViewGroup.LayoutParams.MATCH_PARENT);
             }
-            boolean showProgress = handleProgressBar(hasProgress, contentView, ex);
             if (text != null) {
                 int textId = showProgress ? com.android.internal.R.id.text_line_1
                         : com.android.internal.R.id.text;