Skip to content

Commit c8f3003

Browse files
thebarnabyAndroid (Google) Code Review
authored andcommitted
Merge "Make Test Voice Interactor support new requirements." into lmp-dev
2 parents 1d1720f + 0134fd8 commit c8f3003

File tree

6 files changed

+149
-1
lines changed

6 files changed

+149
-1
lines changed

tests/VoiceInteraction/AndroidManifest.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
<category android:name="android.intent.category.LAUNCHER" />
1313
</intent-filter>
1414
</activity>
15+
<activity android:name="SettingsActivity"
16+
android:label="Voice Interaction Settings"
17+
android:excludeFromRecents="true"
18+
android:noHistory="true">
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
<category android:name="android.intent.category.DEFAULT" />
22+
</intent-filter>
23+
</activity>
1524
<service android:name="MainInteractionService"
25+
android:label="Test Voice Interaction Service"
1626
android:permission="android.permission.BIND_VOICE_INTERACTION"
1727
android:process=":interactor">
1828
<meta-data android:name="android.voice_interaction"
@@ -25,6 +35,14 @@
2535
android:permission="android.permission.BIND_VOICE_INTERACTION"
2636
android:process=":session">
2737
</service>
38+
<service android:name="MainRecognitionService"
39+
android:label="Test Voice Interaction Service">
40+
<intent-filter>
41+
<action android:name="android.speech.RecognitionService" />
42+
<category android:name="android.intent.category.DEFAULT" />
43+
</intent-filter>
44+
<meta-data android:name="android.speech" android:resource="@xml/recognition_service" />
45+
</service>
2846
<activity android:name="TestInteractionActivity" android:label="Voice Interaction Target"
2947
android:theme="@android:style/Theme.Material.Light.Voice">
3048
<intent-filter>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2014 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:textAppearance="?android:attr/textAppearanceMedium"
20+
android:text="Preferences placeholder" />

tests/VoiceInteraction/res/xml/interaction_service.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@
1818
-->
1919

2020
<voice-interaction-service xmlns:android="http://schemas.android.com/apk/res/android"
21-
android:sessionService="com.android.test.voiceinteraction.MainInteractionSessionService" />
21+
android:sessionService="com.android.test.voiceinteraction.MainInteractionSessionService"
22+
android:recognitionService="com.android.test.voiceinteraction.MainRecognitionService"
23+
android:settingsActivity="com.android.test.voiceinteraction.SettingsActivity" />
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright (c) 2014, The Android Open Source Project
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
-->
19+
20+
<recognition-service xmlns:android="http://schemas.android.com/apk/res/android"
21+
android:settingsActivity="com.android.test.voiceinteraction.SettingsActivity" />
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (C) 2014 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.android.test.voiceinteraction;
18+
19+
import android.content.Intent;
20+
import android.speech.RecognitionService;
21+
import android.util.Log;
22+
23+
/**
24+
* Stub recognition service needed to be a complete voice interactor.
25+
*/
26+
public class MainRecognitionService extends RecognitionService {
27+
28+
private static final String TAG = "MainRecognitionService";
29+
30+
@Override
31+
public void onCreate() {
32+
super.onCreate();
33+
Log.i(TAG, "onCreate");
34+
}
35+
36+
@Override
37+
protected void onStartListening(Intent recognizerIntent, Callback listener) {
38+
Log.d(TAG, "onStartListening");
39+
}
40+
41+
@Override
42+
protected void onCancel(Callback listener) {
43+
Log.d(TAG, "onCancel");
44+
}
45+
46+
@Override
47+
protected void onStopListening(Callback listener) {
48+
Log.d(TAG, "onStopListening");
49+
}
50+
51+
@Override
52+
public void onDestroy() {
53+
super.onDestroy();
54+
Log.d(TAG, "onDestroy");
55+
}
56+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (C) 2014 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.android.test.voiceinteraction;
18+
19+
import android.app.Activity;
20+
import android.os.Bundle;
21+
22+
/**
23+
* Stub activity to test out settings selection for voice interactor.
24+
*/
25+
public class SettingsActivity extends Activity {
26+
@Override
27+
public void onCreate(Bundle savedInstanceState) {
28+
super.onCreate(savedInstanceState);
29+
setContentView(R.layout.settings);
30+
}
31+
}

0 commit comments

Comments
 (0)