Tweak download notifications

1. Add string for STATE_CANCELED. Lint doesn't like that the
   switch statement on the state IntDef doesn't have a case
   for STATE_CANCELED. May as well add one, even if we're not
   planning on our demo app showing notifications for this
   state.
2. Replace non-human-readable error message with one provided
   by ErrorMessageProvider.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184120892
This commit is contained in:
olly 2018-02-01 04:36:26 -08:00 committed by Oliver Woodman
parent e8fb3078d6
commit 1950152378
2 changed files with 9 additions and 11 deletions

View file

@ -17,17 +17,15 @@ package com.google.android.exoplayer2.util;
import android.util.Pair; import android.util.Pair;
/** /** Converts throwables into error codes and user readable error messages. */
* Converts exceptions into error codes and user readable error messages. public interface ErrorMessageProvider<T extends Throwable> {
*/
public interface ErrorMessageProvider<T extends Exception> {
/** /**
* Returns a pair consisting of an error code and a user readable error message for the given * Returns a pair consisting of an error code and a user readable error message for the given
* exception. * throwable.
* *
* @param exception The exception for which an error code and message should be generated. * @param throwable The throwable for which an error code and message should be generated.
* @return A pair consisting of an error code and a user readable error message.
*/ */
Pair<Integer, String> getErrorMessage(T exception); Pair<Integer, String> getErrorMessage(T throwable);
} }

View file

@ -24,9 +24,9 @@ android {
} }
lintOptions { lintOptions {
// Truth depends on JUnit, which depends on java.lang.management, which is not part of // Truth depends on JUnit, which depends on java.lang.management, which
// Android. Remove this when JUnit 4.13 or later is used. See: // is not part of Android. Remove this when JUnit 4.13 or later is used.
// https://github.com/junit-team/junit4/pull/1187. // See: https://github.com/junit-team/junit4/pull/1187.
disable 'InvalidPackage' disable 'InvalidPackage'
} }
} }