Class ShadowSpeechRecognizerProxy

java.lang.Object
org.robolectric.shadows.ShadowSpeechRecognizer
org.robolectric.shadows.ShadowSpeechRecognizerProxy

@Implements(className="android.speech.SpeechRecognizerProxy", isInAndroidSdk=false, minSdk=35) public class ShadowSpeechRecognizerProxy extends ShadowSpeechRecognizer
Robolectric shadow for SpeechRecognizerProxy.

Prior to Android V, SpeechRecognizer contained all functionality within one class. The ShadowSpeechRecognizer shadow would work correctly to shadow both static and instance functions of the class. With Android V, the instance of SpeechRecognizer returned from SpeechRecognizer.createSpeechRecognizer(Context) is an instance of SpeechRecognizerProxy which delegates all calls to SpeechRecognizerImpl.

This shadow (for the proxy subclass) works in coordination with ShadowSpeechRecognizerImpl to ensure that the functionality of ShadowSpeechRecognizer still works in tests prior to Android V and on Android V+.

Customizations for this implementation:

  • Does not intercept any public API since all calls will be placed to SpeechRecognizerImpl
  • Instead of returning its own state, returns the state of the delegate (ShadowSpeechRecognizerImpl)
  • No change in direct accessor since it is not required
  • Field Details

  • Constructor Details

    • ShadowSpeechRecognizerProxy

      public ShadowSpeechRecognizerProxy()
  • Method Details