Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 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.Context; |
| 20 | import android.os.Bundle; |
| 21 | import android.service.voice.VoiceInteractionSession; |
| 22 | import android.util.Log; |
| 23 | |
| 24 | public class MainInteractionSession extends VoiceInteractionSession { |
| 25 | static final String TAG = "MainInteractionSession"; |
| 26 | |
| 27 | MainInteractionSession(Context context) { |
| 28 | super(context); |
| 29 | } |
| 30 | |
| 31 | @Override |
| 32 | public boolean[] onGetSupportedCommands(Caller caller, String[] commands) { |
| 33 | return new boolean[commands.length]; |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | public void onConfirm(Caller caller, Request request, String prompt, Bundle extras) { |
| 38 | Log.i(TAG, "onConform: prompt=" + prompt + " extras=" + extras); |
| 39 | request.sendConfirmResult(true, null); |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public void onCommand(Caller caller, Request request, String command, Bundle extras) { |
| 44 | Log.i(TAG, "onCommand: command=" + command + " extras=" + extras); |
| 45 | request.sendCommandResult(null); |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public void onCancel(Request request) { |
| 50 | Log.i(TAG, "onCancel"); |
| 51 | request.sendCancelResult(); |
| 52 | } |
| 53 | } |