Search in sources :

Example 1 with KeyphraseRecognitionEvent

use of android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent in project android_frameworks_base by ResurrectionRemix.

the class SoundTriggerTest method testKeyphraseRecognitionEventParcelUnparcel_zeroData.

@SmallTest
public void testKeyphraseRecognitionEventParcelUnparcel_zeroData() throws Exception {
    KeyphraseRecognitionExtra[] kpExtra = new KeyphraseRecognitionExtra[0];
    KeyphraseRecognitionEvent re = new KeyphraseRecognitionEvent(SoundTrigger.RECOGNITION_STATUS_FAILURE, 2, true, 2, 3, 4, false, null, new byte[1], kpExtra);
    // Write to a parcel
    Parcel parcel = Parcel.obtain();
    re.writeToParcel(parcel, 0);
    // Read from it
    parcel.setDataPosition(0);
    KeyphraseRecognitionEvent unparceled = KeyphraseRecognitionEvent.CREATOR.createFromParcel(parcel);
    // Verify that they are the same
    assertEquals(re, unparceled);
}
Also used : KeyphraseRecognitionExtra(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra) KeyphraseRecognitionEvent(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent) Parcel(android.os.Parcel) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 2 with KeyphraseRecognitionEvent

use of android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent in project android_frameworks_base by DirtyUnicorns.

the class SoundTriggerTest method testKeyphraseRecognitionEventParcelUnparcel_largeData.

@LargeTest
public void testKeyphraseRecognitionEventParcelUnparcel_largeData() throws Exception {
    byte[] data = new byte[200 * 1024];
    mRandom.nextBytes(data);
    KeyphraseRecognitionExtra[] kpExtra = new KeyphraseRecognitionExtra[4];
    ConfidenceLevel cl1 = new ConfidenceLevel(1, 90);
    ConfidenceLevel cl2 = new ConfidenceLevel(2, 30);
    kpExtra[0] = new KeyphraseRecognitionExtra(1, SoundTrigger.RECOGNITION_MODE_USER_IDENTIFICATION, 0, new ConfidenceLevel[] { cl1, cl2 });
    kpExtra[1] = new KeyphraseRecognitionExtra(1, SoundTrigger.RECOGNITION_MODE_VOICE_TRIGGER, 0, new ConfidenceLevel[] { cl2 });
    kpExtra[2] = new KeyphraseRecognitionExtra(1, SoundTrigger.RECOGNITION_MODE_VOICE_TRIGGER, 0, null);
    kpExtra[3] = new KeyphraseRecognitionExtra(1, SoundTrigger.RECOGNITION_MODE_VOICE_TRIGGER, 0, new ConfidenceLevel[0]);
    KeyphraseRecognitionEvent re = new KeyphraseRecognitionEvent(SoundTrigger.RECOGNITION_STATUS_FAILURE, 1, true, 2, 3, 4, false, null, data, kpExtra);
    // Write to a parcel
    Parcel parcel = Parcel.obtain();
    re.writeToParcel(parcel, 0);
    // Read from it
    parcel.setDataPosition(0);
    KeyphraseRecognitionEvent unparceled = KeyphraseRecognitionEvent.CREATOR.createFromParcel(parcel);
    // Verify that they are the same
    assertEquals(re, unparceled);
}
Also used : KeyphraseRecognitionExtra(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra) ConfidenceLevel(android.hardware.soundtrigger.SoundTrigger.ConfidenceLevel) KeyphraseRecognitionEvent(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent) Parcel(android.os.Parcel) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 3 with KeyphraseRecognitionEvent

use of android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent in project android_frameworks_base by DirtyUnicorns.

the class SoundTriggerTest method testKeyphraseRecognitionEventParcelUnparcel_zeroData.

@SmallTest
public void testKeyphraseRecognitionEventParcelUnparcel_zeroData() throws Exception {
    KeyphraseRecognitionExtra[] kpExtra = new KeyphraseRecognitionExtra[0];
    KeyphraseRecognitionEvent re = new KeyphraseRecognitionEvent(SoundTrigger.RECOGNITION_STATUS_FAILURE, 2, true, 2, 3, 4, false, null, new byte[1], kpExtra);
    // Write to a parcel
    Parcel parcel = Parcel.obtain();
    re.writeToParcel(parcel, 0);
    // Read from it
    parcel.setDataPosition(0);
    KeyphraseRecognitionEvent unparceled = KeyphraseRecognitionEvent.CREATOR.createFromParcel(parcel);
    // Verify that they are the same
    assertEquals(re, unparceled);
}
Also used : KeyphraseRecognitionExtra(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra) KeyphraseRecognitionEvent(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent) Parcel(android.os.Parcel) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 4 with KeyphraseRecognitionEvent

use of android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent in project platform_frameworks_base by android.

the class SoundTriggerTest method testKeyphraseRecognitionEventParcelUnparcel_zeroData.

@SmallTest
public void testKeyphraseRecognitionEventParcelUnparcel_zeroData() throws Exception {
    KeyphraseRecognitionExtra[] kpExtra = new KeyphraseRecognitionExtra[0];
    KeyphraseRecognitionEvent re = new KeyphraseRecognitionEvent(SoundTrigger.RECOGNITION_STATUS_FAILURE, 2, true, 2, 3, 4, false, null, new byte[1], kpExtra);
    // Write to a parcel
    Parcel parcel = Parcel.obtain();
    re.writeToParcel(parcel, 0);
    // Read from it
    parcel.setDataPosition(0);
    KeyphraseRecognitionEvent unparceled = KeyphraseRecognitionEvent.CREATOR.createFromParcel(parcel);
    // Verify that they are the same
    assertEquals(re, unparceled);
}
Also used : KeyphraseRecognitionExtra(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra) KeyphraseRecognitionEvent(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent) Parcel(android.os.Parcel) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 5 with KeyphraseRecognitionEvent

use of android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent in project android_frameworks_base by crdroidandroid.

the class SoundTriggerTest method testKeyphraseRecognitionEventParcelUnparcel_zeroData.

@SmallTest
public void testKeyphraseRecognitionEventParcelUnparcel_zeroData() throws Exception {
    KeyphraseRecognitionExtra[] kpExtra = new KeyphraseRecognitionExtra[0];
    KeyphraseRecognitionEvent re = new KeyphraseRecognitionEvent(SoundTrigger.RECOGNITION_STATUS_FAILURE, 2, true, 2, 3, 4, false, null, new byte[1], kpExtra);
    // Write to a parcel
    Parcel parcel = Parcel.obtain();
    re.writeToParcel(parcel, 0);
    // Read from it
    parcel.setDataPosition(0);
    KeyphraseRecognitionEvent unparceled = KeyphraseRecognitionEvent.CREATOR.createFromParcel(parcel);
    // Verify that they are the same
    assertEquals(re, unparceled);
}
Also used : KeyphraseRecognitionExtra(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra) KeyphraseRecognitionEvent(android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent) Parcel(android.os.Parcel) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

KeyphraseRecognitionEvent (android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent)12 Parcel (android.os.Parcel)12 KeyphraseRecognitionExtra (android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra)8 SmallTest (android.test.suitebuilder.annotation.SmallTest)8 ConfidenceLevel (android.hardware.soundtrigger.SoundTrigger.ConfidenceLevel)4 LargeTest (android.test.suitebuilder.annotation.LargeTest)4