diff options
| author | 2020-03-13 20:58:52 +0000 | |
|---|---|---|
| committer | 2020-03-13 20:58:52 +0000 | |
| commit | 83cf85516398723338aeded19800c838fa21f665 (patch) | |
| tree | deb411bf9e51315796ad5b468e427c02d07df1ab | |
| parent | aa49e5b7504c31535b117831b60640f1f77c1eba (diff) | |
| parent | 22afab63bd1eb4621851baa24663b0135850ffbd (diff) | |
Merge "Made sure that templated views support RTL" into rvc-dev
| -rw-r--r-- | core/java/android/app/Notification.java | 11 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java | 19 |
2 files changed, 30 insertions, 0 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 32e7d84e6083..f59ccfb13636 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -6221,6 +6221,17 @@ public class Notification implements Parcelable } return loadHeaderAppName(); } + + /** + * @return if this builder uses a template + * + * @hide + */ + public boolean usesTemplate() { + return (mN.contentView == null && mN.headsUpContentView == null + && mN.bigContentView == null) + || (mStyle != null && mStyle.displayCustomViewInline()); + } } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java index 6dd4ff9235c4..91cf285f2262 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java @@ -25,6 +25,8 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.app.Notification; import android.content.Context; +import android.content.ContextWrapper; +import android.content.pm.ApplicationInfo; import android.os.AsyncTask; import android.os.CancellationSignal; import android.service.notification.StatusBarNotification; @@ -716,6 +718,10 @@ public class NotificationContentInflater implements NotificationRowContentBinder sbn.getNotification()); Context packageContext = sbn.getPackageContext(mContext); + if (recoveredBuilder.usesTemplate()) { + // For all of our templates, we want it to be RTL + packageContext = new RtlEnabledContext(packageContext); + } Notification notification = sbn.getNotification(); if (notification.isMediaNotification()) { MediaNotificationProcessor processor = new MediaNotificationProcessor(mContext, @@ -782,6 +788,19 @@ public class NotificationContentInflater implements NotificationRowContentBinder // try to purge unnecessary cached entries. mRow.getImageResolver().purgeCache(); } + + private class RtlEnabledContext extends ContextWrapper { + private RtlEnabledContext(Context packageContext) { + super(packageContext); + } + + @Override + public ApplicationInfo getApplicationInfo() { + ApplicationInfo applicationInfo = super.getApplicationInfo(); + applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_RTL; + return applicationInfo; + } + } } @VisibleForTesting |