• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 android.service.voice;
18 
19 import android.annotation.Nullable;
20 import android.os.Bundle;
21 import android.os.IBinder;
22 
23 import com.android.internal.annotations.Immutable;
24 
25 
26 /**
27  * @hide
28  * Private interface to the VoiceInteractionManagerService for use by ActivityManagerService.
29  */
30 public abstract class VoiceInteractionManagerInternal {
31 
32     /**
33      * Start a new voice interaction session when requested from within an activity
34      * by Activity.startLocalVoiceInteraction()
35      * @param callingActivity The binder token representing the calling activity.
36      * @param options
37      */
startLocalVoiceInteraction(IBinder callingActivity, Bundle options)38     public abstract void startLocalVoiceInteraction(IBinder callingActivity, Bundle options);
39 
40     /**
41      * Returns whether the currently selected voice interaction service supports local voice
42      * interaction for launching from an Activity.
43      */
supportsLocalVoiceInteraction()44     public abstract boolean supportsLocalVoiceInteraction();
45 
stopLocalVoiceInteraction(IBinder callingActivity)46     public abstract void stopLocalVoiceInteraction(IBinder callingActivity);
47 
48     /**
49      * Returns whether the given package is currently in an active session
50      */
hasActiveSession(String packageName)51     public abstract boolean hasActiveSession(String packageName);
52 
53     /**
54      * Gets the identity of the currently active HotwordDetectionService.
55      *
56      * @see HotwordDetectionServiceIdentity
57      */
58     @Nullable
getHotwordDetectionServiceIdentity()59     public abstract HotwordDetectionServiceIdentity getHotwordDetectionServiceIdentity();
60 
61     /**
62      * Provides the uids of the currently active
63      * {@link android.service.voice.HotwordDetectionService} and its owning package. The
64      * HotwordDetectionService is an isolated service, so it has a separate uid.
65      */
66     @Immutable
67     public static class HotwordDetectionServiceIdentity {
68         private final int mIsolatedUid;
69         private final int mOwnerUid;
70 
HotwordDetectionServiceIdentity(int isolatedUid, int ownerUid)71         public HotwordDetectionServiceIdentity(int isolatedUid, int ownerUid) {
72             mIsolatedUid = isolatedUid;
73             mOwnerUid = ownerUid;
74         }
75 
76         /** Gets the uid of the currently active isolated process hosting the service. */
getIsolatedUid()77         public int getIsolatedUid() {
78             return mIsolatedUid;
79         }
80 
81         /** Gets the uid of the package that provides the HotwordDetectionService. */
getOwnerUid()82         public int getOwnerUid() {
83             return mOwnerUid;
84         }
85     }
86 }