diff options
8 files changed, 47 insertions, 47 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 627b70355f50..8ca2b77d299c 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -3339,9 +3339,9 @@ package android.app.wearable { public class WearableSensingManager { method @FlaggedApi("android.app.wearable.enable_data_request_observer_api") @Nullable public static android.app.wearable.WearableSensingDataRequest getDataRequestFromIntent(@NonNull android.content.Intent); + method @FlaggedApi("android.app.wearable.enable_provide_wearable_connection_api") @RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void provideConnection(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void provideData(@NonNull android.os.PersistableBundle, @Nullable android.os.SharedMemory, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void provideDataStream(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); - method @FlaggedApi("android.app.wearable.enable_provide_wearable_connection_api") @RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void provideWearableConnection(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @FlaggedApi("android.app.wearable.enable_data_request_observer_api") @RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void registerDataRequestObserver(int, @NonNull android.app.PendingIntent, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @FlaggedApi("android.app.wearable.enable_hotword_wearable_sensing_api") @RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void startHotwordRecognition(@Nullable android.content.ComponentName, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @FlaggedApi("android.app.wearable.enable_hotword_wearable_sensing_api") @RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void stopHotwordRecognition(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); @@ -13765,7 +13765,7 @@ package android.service.wearable { method @FlaggedApi("android.app.wearable.enable_data_request_observer_api") @BinderThread public void onDataRequestObserverUnregistered(int, @NonNull String, @NonNull android.service.wearable.WearableSensingDataRequester, @NonNull java.util.function.Consumer<java.lang.Integer>); method @BinderThread public abstract void onDataStreamProvided(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @BinderThread public abstract void onQueryServiceStatus(@NonNull java.util.Set<java.lang.Integer>, @NonNull String, @NonNull java.util.function.Consumer<android.service.ambientcontext.AmbientContextDetectionServiceStatus>); - method @FlaggedApi("android.app.wearable.enable_provide_wearable_connection_api") @BinderThread public void onSecureWearableConnectionProvided(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.function.Consumer<java.lang.Integer>); + method @FlaggedApi("android.app.wearable.enable_provide_wearable_connection_api") @BinderThread public void onSecureConnectionProvided(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @BinderThread public abstract void onStartDetection(@NonNull android.app.ambientcontext.AmbientContextEventRequest, @NonNull String, @NonNull java.util.function.Consumer<android.service.ambientcontext.AmbientContextDetectionServiceStatus>, @NonNull java.util.function.Consumer<android.service.ambientcontext.AmbientContextDetectionResult>); method @FlaggedApi("android.app.wearable.enable_hotword_wearable_sensing_api") @BinderThread public void onStartHotwordRecognition(@NonNull java.util.function.Consumer<android.service.voice.HotwordAudioStream>, @NonNull java.util.function.Consumer<java.lang.Integer>); method public abstract void onStopDetection(@NonNull String); diff --git a/core/java/android/app/wearable/IWearableSensingManager.aidl b/core/java/android/app/wearable/IWearableSensingManager.aidl index f67802279e26..7d3b28511537 100644 --- a/core/java/android/app/wearable/IWearableSensingManager.aidl +++ b/core/java/android/app/wearable/IWearableSensingManager.aidl @@ -30,7 +30,7 @@ import android.os.SharedMemory; */ interface IWearableSensingManager { @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE)") - void provideWearableConnection(in ParcelFileDescriptor parcelFileDescriptor, in RemoteCallback callback); + void provideConnection(in ParcelFileDescriptor parcelFileDescriptor, in RemoteCallback callback); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE)") void provideDataStream(in ParcelFileDescriptor parcelFileDescriptor, in RemoteCallback callback); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE)") diff --git a/core/java/android/app/wearable/WearableSensingManager.java b/core/java/android/app/wearable/WearableSensingManager.java index 637f6776bd1b..fd72c491bf16 100644 --- a/core/java/android/app/wearable/WearableSensingManager.java +++ b/core/java/android/app/wearable/WearableSensingManager.java @@ -127,7 +127,7 @@ public class WearableSensingManager { /** * The value of the status code that indicates an error occurred in the encrypted channel backed - * by the provided connection. See {@link #provideWearableConnection(ParcelFileDescriptor, + * by the provided connection. See {@link #provideConnection(ParcelFileDescriptor, * Executor, Consumer)}. */ @FlaggedApi(Flags.FLAG_ENABLE_PROVIDE_WEARABLE_CONNECTION_API) @@ -223,13 +223,13 @@ public class WearableSensingManager { */ @RequiresPermission(Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) @FlaggedApi(Flags.FLAG_ENABLE_PROVIDE_WEARABLE_CONNECTION_API) - public void provideWearableConnection( + public void provideConnection( @NonNull ParcelFileDescriptor wearableConnection, @NonNull @CallbackExecutor Executor executor, @NonNull @StatusCode Consumer<Integer> statusConsumer) { try { RemoteCallback callback = createStatusCallback(executor, statusConsumer); - mService.provideWearableConnection(wearableConnection, callback); + mService.provideConnection(wearableConnection, callback); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/core/java/android/service/wearable/IWearableSensingService.aidl b/core/java/android/service/wearable/IWearableSensingService.aidl index 22d8fda9cb8e..dffadf0cda70 100644 --- a/core/java/android/service/wearable/IWearableSensingService.aidl +++ b/core/java/android/service/wearable/IWearableSensingService.aidl @@ -28,7 +28,7 @@ import android.os.SharedMemory; * @hide */ oneway interface IWearableSensingService { - void provideSecureWearableConnection(in ParcelFileDescriptor parcelFileDescriptor, in RemoteCallback callback); + void provideSecureConnection(in ParcelFileDescriptor parcelFileDescriptor, in RemoteCallback callback); void provideDataStream(in ParcelFileDescriptor parcelFileDescriptor, in RemoteCallback callback); void provideData(in PersistableBundle data, in SharedMemory sharedMemory, in RemoteCallback callback); void registerDataRequestObserver(int dataType, in RemoteCallback dataRequestCallback, int dataRequestObserverId, in String packageName, in RemoteCallback statusCallback); diff --git a/core/java/android/service/wearable/WearableSensingService.java b/core/java/android/service/wearable/WearableSensingService.java index 808c3ae7b6bc..a2770172d3ca 100644 --- a/core/java/android/service/wearable/WearableSensingService.java +++ b/core/java/android/service/wearable/WearableSensingService.java @@ -112,11 +112,11 @@ public abstract class WearableSensingService extends Service { return new IWearableSensingService.Stub() { /** {@inheritDoc} */ @Override - public void provideSecureWearableConnection( + public void provideSecureConnection( ParcelFileDescriptor secureWearableConnection, RemoteCallback callback) { Objects.requireNonNull(secureWearableConnection); Consumer<Integer> consumer = createWearableStatusConsumer(callback); - WearableSensingService.this.onSecureWearableConnectionProvided( + WearableSensingService.this.onSecureConnectionProvided( secureWearableConnection, consumer); } @@ -311,12 +311,12 @@ public abstract class WearableSensingService extends Service { /** * Called when a secure connection to the wearable is available. See {@link - * WearableSensingManager#provideWearableConnection(ParcelFileDescriptor, Executor, Consumer)} + * WearableSensingManager#provideConnection(ParcelFileDescriptor, Executor, Consumer)} * for details about the secure connection. * * <p>When the {@code secureWearableConnection} is closed, the system will send a {@link * WearableSensingManager#STATUS_CHANNEL_ERROR} status code to the status consumer provided by - * the caller of {@link WearableSensingManager#provideWearableConnection(ParcelFileDescriptor, + * the caller of {@link WearableSensingManager#provideConnection(ParcelFileDescriptor, * Executor, Consumer)}. * * <p>The implementing class should override this method. It should return an appropriate status @@ -327,7 +327,7 @@ public abstract class WearableSensingService extends Service { */ @FlaggedApi(Flags.FLAG_ENABLE_PROVIDE_WEARABLE_CONNECTION_API) @BinderThread - public void onSecureWearableConnectionProvided( + public void onSecureConnectionProvided( @NonNull ParcelFileDescriptor secureWearableConnection, @NonNull Consumer<Integer> statusConsumer) { statusConsumer.accept(WearableSensingManager.STATUS_UNSUPPORTED_OPERATION); diff --git a/services/core/java/com/android/server/wearable/RemoteWearableSensingService.java b/services/core/java/com/android/server/wearable/RemoteWearableSensingService.java index 3077fb8aaee9..e230b95fe907 100644 --- a/services/core/java/com/android/server/wearable/RemoteWearableSensingService.java +++ b/services/core/java/com/android/server/wearable/RemoteWearableSensingService.java @@ -43,16 +43,16 @@ final class RemoteWearableSensingService extends ServiceConnector.Impl<IWearable com.android.server.wearable.RemoteWearableSensingService.class.getSimpleName(); private final static boolean DEBUG = false; - private final Object mSecureWearableConnectionLock = new Object(); + private final Object mSecureConnectionLock = new Object(); - // mNextSecureWearableConnectionContext will only be non-null when we are waiting for the + // mNextSecureConnectionContext will only be non-null when we are waiting for the // WearableSensingService process to restart. It will be set to null after it is passed into // WearableSensingService. - @GuardedBy("mSecureWearableConnectionLock") - private SecureWearableConnectionContext mNextSecureWearableConnectionContext; + @GuardedBy("mSecureConnectionLock") + private SecureWearableConnectionContext mNextSecureConnectionContext; - @GuardedBy("mSecureWearableConnectionLock") - private boolean mSecureWearableConnectionProvided = false; + @GuardedBy("mSecureConnectionLock") + private boolean mSecureConnectionProvided = false; RemoteWearableSensingService(Context context, ComponentName serviceName, int userId) { @@ -77,23 +77,23 @@ final class RemoteWearableSensingService extends ServiceConnector.Impl<IWearable * @param secureWearableConnection The secure connection to the wearable * @param callback The callback for service status */ - public void provideSecureWearableConnection( + public void provideSecureConnection( ParcelFileDescriptor secureWearableConnection, RemoteCallback callback) { if (DEBUG) { - Slog.i(TAG, "#provideSecureWearableConnection"); + Slog.i(TAG, "#provideSecureConnection"); } if (!Flags.enableRestartWssProcess()) { Slog.d( TAG, "FLAG_ENABLE_RESTART_WSS_PROCESS is disabled. Do not attempt to restart the" + " WearableSensingService process"); - provideSecureWearableConnectionInternal(secureWearableConnection, callback); + provideSecureConnectionInternal(secureWearableConnection, callback); return; } - synchronized (mSecureWearableConnectionLock) { - if (mNextSecureWearableConnectionContext != null) { + synchronized (mSecureConnectionLock) { + if (mNextSecureConnectionContext != null) { // A process restart is in progress, #binderDied is about to be called. Replace - // the previous mNextSecureWearableConnectionContext with the current one + // the previous mNextSecureConnectionContext with the current one Slog.i( TAG, "A new wearable connection is provided before the process restart triggered" @@ -101,33 +101,33 @@ final class RemoteWearableSensingService extends ServiceConnector.Impl<IWearable + " connection."); if (Flags.enableProvideWearableConnectionApi()) { WearableSensingManagerPerUserService.notifyStatusCallback( - mNextSecureWearableConnectionContext.mStatusCallback, + mNextSecureConnectionContext.mStatusCallback, WearableSensingManager.STATUS_CHANNEL_ERROR); } - mNextSecureWearableConnectionContext = + mNextSecureConnectionContext = new SecureWearableConnectionContext(secureWearableConnection, callback); return; } - if (!mSecureWearableConnectionProvided) { + if (!mSecureConnectionProvided) { // no need to kill the process - provideSecureWearableConnectionInternal(secureWearableConnection, callback); - mSecureWearableConnectionProvided = true; + provideSecureConnectionInternal(secureWearableConnection, callback); + mSecureConnectionProvided = true; return; } - mNextSecureWearableConnectionContext = + mNextSecureConnectionContext = new SecureWearableConnectionContext(secureWearableConnection, callback); // Killing the process causes the binder to die. #binderDied will then be triggered killWearableSensingServiceProcess(); } } - private void provideSecureWearableConnectionInternal( + private void provideSecureConnectionInternal( ParcelFileDescriptor secureWearableConnection, RemoteCallback callback) { Slog.d(TAG, "Providing secure wearable connection."); var unused = post( service -> { - service.provideSecureWearableConnection( + service.provideSecureConnection( secureWearableConnection, callback); try { // close the local fd after it has been sent to the WSS process @@ -141,15 +141,15 @@ final class RemoteWearableSensingService extends ServiceConnector.Impl<IWearable @Override public void binderDied() { super.binderDied(); - synchronized (mSecureWearableConnectionLock) { - if (mNextSecureWearableConnectionContext != null) { + synchronized (mSecureConnectionLock) { + if (mNextSecureConnectionContext != null) { // This will call #post, which will recreate the process and bind to it - provideSecureWearableConnectionInternal( - mNextSecureWearableConnectionContext.mSecureWearableConnection, - mNextSecureWearableConnectionContext.mStatusCallback); - mNextSecureWearableConnectionContext = null; + provideSecureConnectionInternal( + mNextSecureConnectionContext.mSecureConnection, + mNextSecureConnectionContext.mStatusCallback); + mNextSecureConnectionContext = null; } else { - mSecureWearableConnectionProvided = false; + mSecureConnectionProvided = false; Slog.w(TAG, "Binder died but there is no secure wearable connection to provide."); } } @@ -307,12 +307,12 @@ final class RemoteWearableSensingService extends ServiceConnector.Impl<IWearable } private static class SecureWearableConnectionContext { - final ParcelFileDescriptor mSecureWearableConnection; + final ParcelFileDescriptor mSecureConnection; final RemoteCallback mStatusCallback; SecureWearableConnectionContext( ParcelFileDescriptor secureWearableConnection, RemoteCallback statusCallback) { - this.mSecureWearableConnection = secureWearableConnection; + this.mSecureConnection = secureWearableConnection; this.mStatusCallback = statusCallback; } } diff --git a/services/core/java/com/android/server/wearable/WearableSensingManagerPerUserService.java b/services/core/java/com/android/server/wearable/WearableSensingManagerPerUserService.java index 2b43203628d9..34b9fe968994 100644 --- a/services/core/java/com/android/server/wearable/WearableSensingManagerPerUserService.java +++ b/services/core/java/com/android/server/wearable/WearableSensingManagerPerUserService.java @@ -189,9 +189,9 @@ final class WearableSensingManagerPerUserService extends * Creates a CompanionDeviceManager secure channel and sends a proxy to the wearable sensing * service. */ - public void onProvideWearableConnection( + public void onProvideConnection( ParcelFileDescriptor wearableConnection, RemoteCallback callback) { - Slog.i(TAG, "onProvideWearableConnection in per user service."); + Slog.i(TAG, "onProvideConnection in per user service."); synchronized (mLock) { if (!setUpServiceIfNeeded()) { Slog.w(TAG, "Detection service is not available at this moment."); @@ -217,7 +217,7 @@ final class WearableSensingManagerPerUserService extends Slog.i(TAG, "calling over to remote service."); synchronized (mLock) { ensureRemoteServiceInitiated(); - mRemoteService.provideSecureWearableConnection( + mRemoteService.provideSecureConnection( secureTransport, callback); } } diff --git a/services/core/java/com/android/server/wearable/WearableSensingManagerService.java b/services/core/java/com/android/server/wearable/WearableSensingManagerService.java index d05482d75083..5f6ffd988c84 100644 --- a/services/core/java/com/android/server/wearable/WearableSensingManagerService.java +++ b/services/core/java/com/android/server/wearable/WearableSensingManagerService.java @@ -399,9 +399,9 @@ public class WearableSensingManagerService extends private final class WearableSensingManagerInternal extends IWearableSensingManager.Stub { @Override - public void provideWearableConnection( + public void provideConnection( ParcelFileDescriptor wearableConnection, RemoteCallback callback) { - Slog.i(TAG, "WearableSensingManagerInternal provideWearableConnection."); + Slog.i(TAG, "WearableSensingManagerInternal provideConnection."); Objects.requireNonNull(wearableConnection); Objects.requireNonNull(callback); mContext.enforceCallingOrSelfPermission( @@ -413,7 +413,7 @@ public class WearableSensingManagerService extends return; } callPerUserServiceIfExist( - service -> service.onProvideWearableConnection(wearableConnection, callback), + service -> service.onProvideConnection(wearableConnection, callback), callback); } |