mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08: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
This commit is contained in:
parent
e4fb663b23
commit
f768ff970c
@ -332,7 +332,7 @@ public class DefaultMediaNotificationProvider implements MediaNotification.Provi
|
|||||||
try {
|
try {
|
||||||
builder.setLargeIcon(Futures.getDone(bitmapFuture));
|
builder.setLargeIcon(Futures.getDone(bitmapFuture));
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
Log.w(TAG, "Failed to load bitmap", e);
|
Log.w(TAG, getBitmapLoadErrorMessage(e));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pendingOnBitmapLoadedFutureCallback =
|
pendingOnBitmapLoadedFutureCallback =
|
||||||
@ -634,7 +634,7 @@ public class DefaultMediaNotificationProvider implements MediaNotification.Provi
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable t) {
|
public void onFailure(Throwable t) {
|
||||||
if (!discarded) {
|
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);
|
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 {
|
try {
|
||||||
artworkBitmap = Futures.getDone(bitmapFuture);
|
artworkBitmap = Futures.getDone(bitmapFuture);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
Log.w(TAG, "Failed to load bitmap", e);
|
Log.w(TAG, getBitmapLoadErrorMessage(e));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pendingBitmapLoadCallback =
|
pendingBitmapLoadCallback =
|
||||||
@ -1199,7 +1199,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
if (this != pendingBitmapLoadCallback) {
|
if (this != pendingBitmapLoadCallback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Failed to load bitmap", t);
|
Log.w(TAG, getBitmapLoadErrorMessage(t));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Futures.addCallback(
|
Futures.addCallback(
|
||||||
@ -1270,4 +1270,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
return hasMessages(MSG_DOUBLE_TAP_TIMED_OUT);
|
return hasMessages(MSG_DOUBLE_TAP_TIMED_OUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getBitmapLoadErrorMessage(Throwable throwable) {
|
||||||
|
return "Failed to load bitmap: " + throwable.getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user