Debian Codegraph @

core/java/android/service/voice/VoiceInteractionManagerInternal.java

raw symbols SCIP
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.annotation.UserIdInt;
21 import android.os.Bundle;
22 import android.os.IBinder;
23
24 import com.android.internal.annotations.Immutable;
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 */
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 */
44 public abstract boolean supportsLocalVoiceInteraction();
45
46 public abstract void stopLocalVoiceInteraction(IBinder callingActivity);
47
48 /**
49 * Returns whether the given package is currently in an active session
50 */
51 public abstract boolean hasActiveSession(String packageName);
52
53 /**
54 * Returns the package name of the active session.
55 *
56 * @param callingVoiceInteractor the voice interactor binder from the calling VoiceInteractor.
57 */
58 public abstract String getVoiceInteractorPackageName(IBinder callingVoiceInteractor);
59
60 /**
61 * Gets the identity of the currently active HotwordDetectionService.
62 *
63 * @see HotwordDetectionServiceIdentity
64 */
65 @Nullable
66 public abstract HotwordDetectionServiceIdentity getHotwordDetectionServiceIdentity();
67
68 /**
69 * Called by {@code UMS.convertPreCreatedUserIfPossible()} when a new user is not created from
70 * scratched, but converted from the pool of existing pre-created users.
71 */
72 // TODO(b/226201975): remove method once RoleService supports pre-created users
73 public abstract void onPreCreatedUserConversion(@UserIdInt int userId);
74
75 /**
76 * Provides the uids of the currently active
77 * {@link android.service.voice.HotwordDetectionService} and its owning package. The
78 * HotwordDetectionService is an isolated service, so it has a separate uid.
79 */
80 @Immutable
81 public static class HotwordDetectionServiceIdentity {
82 private final int mIsolatedUid;
83 private final int mOwnerUid;
84
85 public HotwordDetectionServiceIdentity(int isolatedUid, int ownerUid) {
86 mIsolatedUid = isolatedUid;
87 mOwnerUid = ownerUid;
88 }
89
90 /** Gets the uid of the currently active isolated process hosting the service. */
91 public int getIsolatedUid() {
92 return mIsolatedUid;
93 }
94
95 /** Gets the uid of the package that provides the HotwordDetectionService. */
96 public int getOwnerUid() {
97 return mOwnerUid;
98 }
99 }
100 }