diff options
| author | 2022-06-10 10:56:05 +0200 | |
|---|---|---|
| committer | 2022-06-16 12:46:15 +0000 | |
| commit | 87cce2f51e97081c1a5f4ff7c1fc697dc322755f (patch) | |
| tree | 88ef93fe43223922e5859b7574762e30a6fe05ea | |
| parent | 0aa1b8ed79ac7182ca216b275aba18ab41f2e779 (diff) | |
Size restrict right icon size in notification
This is to prevent large bitmaps from using too much memory in
notifications.
Bug:210690571
Bug:218845090
Test: Tested on device
atest android.app.cts.NotificationTemplateTest
Change-Id: I2f3d04546af58edbe7bae2b7d856ab3d87365fdf
| -rw-r--r-- | core/res/res/layout/notification_template_material_base.xml | 4 | ||||
| -rw-r--r-- | core/res/res/layout/notification_template_right_icon.xml | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml index 0756d68063f5..fd787f6ea470 100644 --- a/core/res/res/layout/notification_template_material_base.xml +++ b/core/res/res/layout/notification_template_material_base.xml @@ -138,7 +138,7 @@ </LinearLayout> - <ImageView + <com.android.internal.widget.CachingIconView android:id="@+id/right_icon" android:layout_width="@dimen/notification_right_icon_size" android:layout_height="@dimen/notification_right_icon_size" @@ -150,6 +150,8 @@ android:clipToOutline="true" android:importantForAccessibility="no" android:scaleType="centerCrop" + android:maxDrawableWidth="@dimen/notification_right_icon_size" + android:maxDrawableHeight="@dimen/notification_right_icon_size" /> <FrameLayout diff --git a/core/res/res/layout/notification_template_right_icon.xml b/core/res/res/layout/notification_template_right_icon.xml index f163ed5f955a..8b3b795f7473 100644 --- a/core/res/res/layout/notification_template_right_icon.xml +++ b/core/res/res/layout/notification_template_right_icon.xml @@ -13,7 +13,7 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> -<ImageView +<com.android.internal.widget.CachingIconView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/right_icon" android:layout_width="@dimen/notification_right_icon_size" @@ -25,4 +25,6 @@ android:clipToOutline="true" android:importantForAccessibility="no" android:scaleType="centerCrop" + android:maxDrawableWidth="@dimen/notification_right_icon_size" + android:maxDrawableHeight="@dimen/notification_right_icon_size" /> |