SystemUI: Preventing media album bitmaps from impacting performance

targets the same approach as minari's: b59b6f3eef. but dont force 500px, this approach prevents media bitmaps from impacting performance on high dpi devices without increasing the max bitmap size on low pixel devices and touching unnecessary stuffs

Ghost: reduce max size

Change-Id: I3fae0e9671893566dd402a221e04f44b5f073329
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
This commit is contained in:
rmp22
2025-11-27 16:39:18 +08:00
committed by Ghosuto
parent 4981fedc45
commit 087ee89b80
2 changed files with 11 additions and 3 deletions

View File

@@ -197,8 +197,12 @@ public final class MediaSession {
}
mContext = context;
mMaxBitmapSize = context.getResources().getDimensionPixelSize(
int bitmapSize = context.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.config_mediaMetadataBitmapMaxSize);
mMaxBitmapSize = Math.min(bitmapSize, 300);
mCbStub = new CallbackStub(this);
MediaSessionManager manager = (MediaSessionManager) context
.getSystemService(Context.MEDIA_SESSION_SERVICE);

View File

@@ -72,6 +72,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import kotlin.math.min
/** Loads media information from media style [StatusBarNotification] classes. */
@SysUISingleton
@@ -90,8 +91,11 @@ constructor(
private val mediaProcessingJobs = ConcurrentHashMap<String, Job>()
private val artworkWidth: Int =
context.resources.getDimensionPixelSize(
com.android.internal.R.dimen.config_mediaMetadataBitmapMaxSize
min(
context.resources.getDimensionPixelSize(
com.android.internal.R.dimen.config_mediaMetadataBitmapMaxSize
),
300
)
private val artworkHeight: Int =
context.resources.getDimensionPixelSize(R.dimen.qs_media_session_height_expanded)