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 {
|
||||
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…
x
Reference in New Issue
Block a user