Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -38570,6 +38570,7 @@ package android.speech { public class SpeechRecognizer { method public void cancel(); method @NonNull public static android.speech.SpeechRecognizer createOnDeviceSpeechRecognizer(@NonNull android.content.Context); method public static android.speech.SpeechRecognizer createSpeechRecognizer(android.content.Context); method public static android.speech.SpeechRecognizer createSpeechRecognizer(android.content.Context, android.content.ComponentName); method public void destroy(); core/java/android/content/Context.java +11 −3 Original line number Diff line number Diff line Loading @@ -64,7 +64,6 @@ import android.os.HandlerExecutor; import android.os.IBinder; import android.os.Looper; import android.os.StatFs; import android.os.StrictMode; import android.os.UserHandle; import android.os.UserManager; import android.os.storage.StorageManager; Loading Loading @@ -3575,6 +3574,7 @@ public abstract class Context { LIGHTS_SERVICE, //@hide: PEOPLE_SERVICE, //@hide: DEVICE_STATE_SERVICE, //@hide: SPEECH_RECOGNITION_SERVICE, UWB_SERVICE, MEDIA_METRICS_SERVICE, }) Loading Loading @@ -5409,6 +5409,14 @@ public abstract class Context { */ public static final String MEDIA_METRICS_SERVICE = "media_metrics"; /** * Use with {@link #getSystemService(String)} to access system speech recognition service. * * @see #getSystemService(String) * @hide */ public static final String SPEECH_RECOGNITION_SERVICE = "speech_recognition"; /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. Loading Loading @@ -6469,7 +6477,7 @@ public abstract class Context { * {@link WindowManager}, {@link android.view.LayoutInflater LayoutInflater} or * {@link android.app.WallpaperManager WallpaperManager}. Accessing UI components from non-UI * contexts throws {@link android.os.strictmode.Violation} if * {@link StrictMode.VmPolicy.Builder#detectIncorrectContextUse()} is enabled. * {@link android.os.StrictMode.VmPolicy.Builder#detectIncorrectContextUse()} is enabled. * <p> * Examples of UI contexts are * an {@link android.app.Activity Activity}, a context created from Loading @@ -6479,7 +6487,7 @@ public abstract class Context { * * @see #getDisplay() * @see #getSystemService(String) * @see StrictMode.VmPolicy.Builder#detectIncorrectContextUse() * @see android.os.StrictMode.VmPolicy.Builder#detectIncorrectContextUse() */ public static boolean isUiContext(@NonNull Context context) { return context.isUiContext(); Loading core/java/android/speech/IRecognitionServiceManager.aidl 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.speech; import android.speech.IRecognitionServiceManagerCallback; /** * Binder service allowing speech recognition proxied by the system. * * {@hide} */ interface IRecognitionServiceManager { void createSession(in IRecognitionServiceManagerCallback callback); } core/java/android/speech/IRecognitionServiceManagerCallback.aidl 0 → 100644 +29 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.speech; import android.speech.IRecognitionService; /** * Callback for the service allowing speech recognition proxied by the system. * * {@hide} */ oneway interface IRecognitionServiceManagerCallback { void onSuccess(in IRecognitionService service); void onError(); } core/java/android/speech/RecognitionService.java +12 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Process; import android.os.RemoteException; import android.util.Log; Loading @@ -50,7 +51,9 @@ public abstract class RecognitionService extends Service { /** * Name under which a RecognitionService component publishes information about itself. * This meta-data should reference an XML resource containing a * <code><{@link android.R.styleable#RecognitionService recognition-service}></code> tag. * <code><{@link android.R.styleable#RecognitionService recognition-service}></code> or * <code><{@link android.R.styleable#RecognitionService on-device-recognition-service} * ></code> tag. */ public static final String SERVICE_META_DATA = "android.speech"; Loading Loading @@ -182,6 +185,13 @@ public abstract class RecognitionService extends Service { private boolean checkPermissions(IRecognitionListener listener, boolean forDataDelivery, @NonNull String packageName, @Nullable String featureId) { if (DBG) Log.d(TAG, "checkPermissions"); final int callingUid = Binder.getCallingUid(); if (callingUid == Process.SYSTEM_UID) { // Assuming system has verified permissions of the caller. return true; } if (forDataDelivery) { if (PermissionChecker.checkCallingOrSelfPermissionForDataDelivery(this, android.Manifest.permission.RECORD_AUDIO, packageName, featureId, Loading Loading @@ -342,6 +352,7 @@ public abstract class RecognitionService extends Service { * Return the Linux uid assigned to the process that sent you the current transaction that * is being processed. This is obtained from {@link Binder#getCallingUid()}. */ // TODO(b/176578753): need to make sure this is fixed when proxied through system. public int getCallingUid() { return mCallingUid; } Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -38570,6 +38570,7 @@ package android.speech { public class SpeechRecognizer { method public void cancel(); method @NonNull public static android.speech.SpeechRecognizer createOnDeviceSpeechRecognizer(@NonNull android.content.Context); method public static android.speech.SpeechRecognizer createSpeechRecognizer(android.content.Context); method public static android.speech.SpeechRecognizer createSpeechRecognizer(android.content.Context, android.content.ComponentName); method public void destroy();
core/java/android/content/Context.java +11 −3 Original line number Diff line number Diff line Loading @@ -64,7 +64,6 @@ import android.os.HandlerExecutor; import android.os.IBinder; import android.os.Looper; import android.os.StatFs; import android.os.StrictMode; import android.os.UserHandle; import android.os.UserManager; import android.os.storage.StorageManager; Loading Loading @@ -3575,6 +3574,7 @@ public abstract class Context { LIGHTS_SERVICE, //@hide: PEOPLE_SERVICE, //@hide: DEVICE_STATE_SERVICE, //@hide: SPEECH_RECOGNITION_SERVICE, UWB_SERVICE, MEDIA_METRICS_SERVICE, }) Loading Loading @@ -5409,6 +5409,14 @@ public abstract class Context { */ public static final String MEDIA_METRICS_SERVICE = "media_metrics"; /** * Use with {@link #getSystemService(String)} to access system speech recognition service. * * @see #getSystemService(String) * @hide */ public static final String SPEECH_RECOGNITION_SERVICE = "speech_recognition"; /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. Loading Loading @@ -6469,7 +6477,7 @@ public abstract class Context { * {@link WindowManager}, {@link android.view.LayoutInflater LayoutInflater} or * {@link android.app.WallpaperManager WallpaperManager}. Accessing UI components from non-UI * contexts throws {@link android.os.strictmode.Violation} if * {@link StrictMode.VmPolicy.Builder#detectIncorrectContextUse()} is enabled. * {@link android.os.StrictMode.VmPolicy.Builder#detectIncorrectContextUse()} is enabled. * <p> * Examples of UI contexts are * an {@link android.app.Activity Activity}, a context created from Loading @@ -6479,7 +6487,7 @@ public abstract class Context { * * @see #getDisplay() * @see #getSystemService(String) * @see StrictMode.VmPolicy.Builder#detectIncorrectContextUse() * @see android.os.StrictMode.VmPolicy.Builder#detectIncorrectContextUse() */ public static boolean isUiContext(@NonNull Context context) { return context.isUiContext(); Loading
core/java/android/speech/IRecognitionServiceManager.aidl 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.speech; import android.speech.IRecognitionServiceManagerCallback; /** * Binder service allowing speech recognition proxied by the system. * * {@hide} */ interface IRecognitionServiceManager { void createSession(in IRecognitionServiceManagerCallback callback); }
core/java/android/speech/IRecognitionServiceManagerCallback.aidl 0 → 100644 +29 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.speech; import android.speech.IRecognitionService; /** * Callback for the service allowing speech recognition proxied by the system. * * {@hide} */ oneway interface IRecognitionServiceManagerCallback { void onSuccess(in IRecognitionService service); void onError(); }
core/java/android/speech/RecognitionService.java +12 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Process; import android.os.RemoteException; import android.util.Log; Loading @@ -50,7 +51,9 @@ public abstract class RecognitionService extends Service { /** * Name under which a RecognitionService component publishes information about itself. * This meta-data should reference an XML resource containing a * <code><{@link android.R.styleable#RecognitionService recognition-service}></code> tag. * <code><{@link android.R.styleable#RecognitionService recognition-service}></code> or * <code><{@link android.R.styleable#RecognitionService on-device-recognition-service} * ></code> tag. */ public static final String SERVICE_META_DATA = "android.speech"; Loading Loading @@ -182,6 +185,13 @@ public abstract class RecognitionService extends Service { private boolean checkPermissions(IRecognitionListener listener, boolean forDataDelivery, @NonNull String packageName, @Nullable String featureId) { if (DBG) Log.d(TAG, "checkPermissions"); final int callingUid = Binder.getCallingUid(); if (callingUid == Process.SYSTEM_UID) { // Assuming system has verified permissions of the caller. return true; } if (forDataDelivery) { if (PermissionChecker.checkCallingOrSelfPermissionForDataDelivery(this, android.Manifest.permission.RECORD_AUDIO, packageName, featureId, Loading Loading @@ -342,6 +352,7 @@ public abstract class RecognitionService extends Service { * Return the Linux uid assigned to the process that sent you the current transaction that * is being processed. This is obtained from {@link Binder#getCallingUid()}. */ // TODO(b/176578753): need to make sure this is fixed when proxied through system. public int getCallingUid() { return mCallingUid; } Loading