Merge "Made sure that templated views support RTL" into rvc-dev
This commit is contained in:
@@ -6221,6 +6221,17 @@ public class Notification implements Parcelable
|
|||||||
}
|
}
|
||||||
return loadHeaderAppName();
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import android.annotation.NonNull;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.ContextWrapper;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
@@ -716,6 +718,10 @@ public class NotificationContentInflater implements NotificationRowContentBinder
|
|||||||
sbn.getNotification());
|
sbn.getNotification());
|
||||||
|
|
||||||
Context packageContext = sbn.getPackageContext(mContext);
|
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();
|
Notification notification = sbn.getNotification();
|
||||||
if (notification.isMediaNotification()) {
|
if (notification.isMediaNotification()) {
|
||||||
MediaNotificationProcessor processor = new MediaNotificationProcessor(mContext,
|
MediaNotificationProcessor processor = new MediaNotificationProcessor(mContext,
|
||||||
@@ -782,6 +788,19 @@ public class NotificationContentInflater implements NotificationRowContentBinder
|
|||||||
// try to purge unnecessary cached entries.
|
// try to purge unnecessary cached entries.
|
||||||
mRow.getImageResolver().purgeCache();
|
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
|
@VisibleForTesting
|
||||||
|
|||||||
Reference in New Issue
Block a user