Remove a redundant TODO in Util
PiperOrigin-RevId: 601820851
This commit is contained in:
parent
2fc5590e7a
commit
eb3173aa90
@ -3338,11 +3338,10 @@ public final class Util {
|
|||||||
* <p>For example: android.media.MediaCodec.error_1 or android.media.MediaDrm.error_neg_2.
|
* <p>For example: android.media.MediaCodec.error_1 or android.media.MediaDrm.error_neg_2.
|
||||||
*
|
*
|
||||||
* @param diagnosticsInfo A string from which to parse the error code.
|
* @param diagnosticsInfo A string from which to parse the error code.
|
||||||
* @return The parser error code, or 0 if an error code could not be parsed.
|
* @return The parsed error code, or 0 if an error code could not be parsed.
|
||||||
*/
|
*/
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public static int getErrorCodeFromPlatformDiagnosticsInfo(@Nullable String diagnosticsInfo) {
|
public static int getErrorCodeFromPlatformDiagnosticsInfo(@Nullable String diagnosticsInfo) {
|
||||||
// TODO (internal b/192337376): Change 0 for ERROR_UNKNOWN once available.
|
|
||||||
if (diagnosticsInfo == null) {
|
if (diagnosticsInfo == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3354,7 +3353,7 @@ public final class Util {
|
|||||||
String digitsSection = strings[length - 1];
|
String digitsSection = strings[length - 1];
|
||||||
boolean isNegative = length >= 3 && "neg".equals(strings[length - 2]);
|
boolean isNegative = length >= 3 && "neg".equals(strings[length - 2]);
|
||||||
try {
|
try {
|
||||||
int errorCode = Integer.parseInt(Assertions.checkNotNull(digitsSection));
|
int errorCode = Integer.parseInt(checkNotNull(digitsSection));
|
||||||
return isNegative ? -errorCode : errorCode;
|
return isNegative ? -errorCode : errorCode;
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1258,7 +1258,6 @@ public class UtilTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getErrorCodeFromPlatformDiagnosticsInfo_withInvalidInput_returnsZero() {
|
public void getErrorCodeFromPlatformDiagnosticsInfo_withInvalidInput_returnsZero() {
|
||||||
// TODO (internal b/192337376): Change 0 for ERROR_UNKNOWN once available.
|
|
||||||
assertThat(Util.getErrorCodeFromPlatformDiagnosticsInfo("")).isEqualTo(0);
|
assertThat(Util.getErrorCodeFromPlatformDiagnosticsInfo("")).isEqualTo(0);
|
||||||
assertThat(Util.getErrorCodeFromPlatformDiagnosticsInfo("android.media.MediaDrm.empty"))
|
assertThat(Util.getErrorCodeFromPlatformDiagnosticsInfo("android.media.MediaDrm.empty"))
|
||||||
.isEqualTo(0);
|
.isEqualTo(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user