From 4d1fdf87ced6da63392fe7dee904a86450323236 Mon Sep 17 00:00:00 2001 From: DrDisagree Date: Wed, 4 Sep 2024 22:46:39 +0600 Subject: [PATCH] OP QS Header: Use app icon if media icon not available Signed-off-by: DrDisagree --- .../iconify/xposed/modules/OpQsHeader.kt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/drdisagree/iconify/xposed/modules/OpQsHeader.kt b/app/src/main/java/com/drdisagree/iconify/xposed/modules/OpQsHeader.kt index 9932fe5f9..8625d8f94 100644 --- a/app/src/main/java/com/drdisagree/iconify/xposed/modules/OpQsHeader.kt +++ b/app/src/main/java/com/drdisagree/iconify/xposed/modules/OpQsHeader.kt @@ -1354,10 +1354,19 @@ class OpQsHeader(context: Context?) : ModPack(context!!) { withContext(Dispatchers.Main) { val appIcon = mNotificationMediaManager?.let { - callMethod( - it, - "getMediaIcon" - ) as Icon? + try { + callMethod(it, "getMediaIcon") as Icon? + } catch (ignored: Throwable) { + try { + mMediaController?.packageName?.let { packageName -> + val drawable = + mContext.packageManager.getApplicationIcon(packageName) + Icon.createWithBitmap((drawable as BitmapDrawable).bitmap) + } + } catch (ignored: Throwable) { + null + } + } } if (appIcon != null && mMediaTitle != null) { if (mAppIcon.drawable != appIcon.loadDrawable(mContext)) {