mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Reduce log output for failing bitmap loads
Do not log the exception stack traces raised by the BitmapLoader when a
bitmap fails to load, e.g. when the artwork's URI scheme is not
supported by the SimpleBitmapLoader. The logs are kept in place but only
a single line is printed.
#minor-release
PiperOrigin-RevId: 492191461
(cherry picked from commit f768ff970c)
This commit is contained in:
parent
102873b6e1
commit
1a9b1c4d35
2 changed files with 12 additions and 4 deletions
|
|
@ -332,7 +332,7 @@ public class DefaultMediaNotificationProvider implements MediaNotification.Provi
|
|||
try {
|
||||
builder.setLargeIcon(Futures.getDone(bitmapFuture));
|
||||
} catch (ExecutionException e) {
|
||||
Log.w(TAG, "Failed to load bitmap", e);
|
||||
Log.w(TAG, getBitmapLoadErrorMessage(e));
|
||||
}
|
||||
} else {
|
||||
pendingOnBitmapLoadedFutureCallback =
|
||||
|
|
@ -634,7 +634,7 @@ public class DefaultMediaNotificationProvider implements MediaNotification.Provi
|
|||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
if (!discarded) {
|
||||
Log.d(TAG, "Failed to load bitmap", t);
|
||||
Log.w(TAG, getBitmapLoadErrorMessage(t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -655,4 +655,8 @@ public class DefaultMediaNotificationProvider implements MediaNotification.Provi
|
|||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getBitmapLoadErrorMessage(Throwable throwable) {
|
||||
return "Failed to load bitmap: " + throwable.getMessage();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||
try {
|
||||
artworkBitmap = Futures.getDone(bitmapFuture);
|
||||
} catch (ExecutionException e) {
|
||||
Log.w(TAG, "Failed to load bitmap", e);
|
||||
Log.w(TAG, getBitmapLoadErrorMessage(e));
|
||||
}
|
||||
} else {
|
||||
pendingBitmapLoadCallback =
|
||||
|
|
@ -1199,7 +1199,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||
if (this != pendingBitmapLoadCallback) {
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "Failed to load bitmap", t);
|
||||
Log.w(TAG, getBitmapLoadErrorMessage(t));
|
||||
}
|
||||
};
|
||||
Futures.addCallback(
|
||||
|
|
@ -1270,4 +1270,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||
return hasMessages(MSG_DOUBLE_TAP_TIMED_OUT);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getBitmapLoadErrorMessage(Throwable throwable) {
|
||||
return "Failed to load bitmap: " + throwable.getMessage();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue