Loading core/api/system-current.txt +31 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ package android { field public static final String BIND_TRUST_AGENT = "android.permission.BIND_TRUST_AGENT"; field public static final String BIND_TV_REMOTE_SERVICE = "android.permission.BIND_TV_REMOTE_SERVICE"; field public static final String BIND_WALLPAPER_EFFECTS_GENERATION_SERVICE = "android.permission.BIND_WALLPAPER_EFFECTS_GENERATION_SERVICE"; field public static final String BIND_WEARABLE_SENSING_SERVICE = "android.permission.BIND_WEARABLE_SENSING_SERVICE"; field public static final String BLUETOOTH_MAP = "android.permission.BLUETOOTH_MAP"; field public static final String BRICK = "android.permission.BRICK"; field public static final String BRIGHTNESS_SLIDER_USAGE = "android.permission.BRIGHTNESS_SLIDER_USAGE"; Loading Loading @@ -199,6 +200,7 @@ package android { field public static final String MANAGE_USER_OEM_UNLOCK_STATE = "android.permission.MANAGE_USER_OEM_UNLOCK_STATE"; field public static final String MANAGE_WALLPAPER_EFFECTS_GENERATION = "android.permission.MANAGE_WALLPAPER_EFFECTS_GENERATION"; field public static final String MANAGE_WEAK_ESCROW_TOKEN = "android.permission.MANAGE_WEAK_ESCROW_TOKEN"; field public static final String MANAGE_WEARABLE_SENSING_SERVICE = "android.permission.MANAGE_WEARABLE_SENSING_SERVICE"; field public static final String MANAGE_WIFI_COUNTRY_CODE = "android.permission.MANAGE_WIFI_COUNTRY_CODE"; field public static final String MARK_DEVICE_ORGANIZATION_OWNED = "android.permission.MARK_DEVICE_ORGANIZATION_OWNED"; field public static final String MEDIA_RESOURCE_OVERRIDE_PID = "android.permission.MEDIA_RESOURCE_OVERRIDE_PID"; Loading Loading @@ -2876,6 +2878,21 @@ package android.app.wallpapereffectsgeneration { } package android.app.wearable { public class WearableSensingManager { 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>); field public static final int STATUS_ACCESS_DENIED = 5; // 0x5 field public static final int STATUS_SERVICE_UNAVAILABLE = 3; // 0x3 field public static final int STATUS_SUCCESS = 1; // 0x1 field public static final int STATUS_UNKNOWN = 0; // 0x0 field public static final int STATUS_UNSUPPORTED = 2; // 0x2 field public static final int STATUS_WEARABLE_UNAVAILABLE = 4; // 0x4 } } package android.apphibernation { public class AppHibernationManager { Loading Loading @@ -3130,6 +3147,7 @@ package android.content { field public static final String UWB_SERVICE = "uwb"; field public static final String VR_SERVICE = "vrmanager"; field public static final String WALLPAPER_EFFECTS_GENERATION_SERVICE = "wallpaper_effects_generation"; field public static final String WEARABLE_SENSING_SERVICE = "wearable_sensing"; field public static final String WIFI_NL80211_SERVICE = "wifinl80211"; field @Deprecated public static final String WIFI_RTT_SERVICE = "rttmanager"; field public static final String WIFI_SCANNING_SERVICE = "wifiscanner"; Loading Loading @@ -10574,6 +10592,7 @@ package android.provider { field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier"; field public static final String NAMESPACE_TRANSPARENCY_METADATA = "transparency_metadata"; field public static final String NAMESPACE_UWB = "uwb"; field public static final String NAMESPACE_WEARABLE_SENSING = "wearable_sensing"; field public static final String NAMESPACE_WINDOW_MANAGER_NATIVE_BOOT = "window_manager_native_boot"; } Loading Loading @@ -12356,6 +12375,18 @@ package android.service.watchdog { } package android.service.wearable { public abstract class WearableSensingService extends android.app.Service { ctor public WearableSensingService(); method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent); method @BinderThread public abstract void onDataProvided(@NonNull android.os.PersistableBundle, @Nullable android.os.SharedMemory, @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>); field public static final String SERVICE_INTERFACE = "android.service.wearable.WearableSensingService"; } } package android.telecom { @Deprecated public class AudioState implements android.os.Parcelable { core/java/android/app/wearable/IWearableSensingManager.aidl 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.app.wearable; import android.os.ParcelFileDescriptor; import android.os.PersistableBundle; import android.os.RemoteCallback; import android.os.SharedMemory; /** * Interface for a WearableSensingManager for managing wearable sensing service. * * @hide */ interface IWearableSensingManager { @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)") void provideData(in PersistableBundle data, in SharedMemory sharedMemory, in RemoteCallback callback); } No newline at end of file core/java/android/app/wearable/OWNERS 0 → 100644 +3 −0 Original line number Diff line number Diff line charliewang@google.com oni@google.com volnov@google.com No newline at end of file core/java/android/app/wearable/WearableSensingManager.java 0 → 100644 +193 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.app.wearable; import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.SystemService; import android.app.ambientcontext.AmbientContextEvent; import android.content.Context; import android.os.Binder; import android.os.ParcelFileDescriptor; import android.os.PersistableBundle; import android.os.RemoteCallback; import android.os.RemoteException; import android.os.SharedMemory; import android.service.wearable.WearableSensingService; import android.system.OsConstants; import java.util.concurrent.Executor; import java.util.function.Consumer; /** * Allows granted apps to manage the WearableSensingService. * Applications are responsible for managing the connection to Wearables. Applications can choose * to provide a data stream to the WearableSensingService to use for * computing {@link AmbientContextEvent}s. Applications can also optionally provide their own * defined data to power the detection of {@link AmbientContextEvent}s. * Methods on this class requires the caller to hold and be granted the * {@link Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE}. * * @hide */ @SystemApi @SystemService(Context.WEARABLE_SENSING_SERVICE) public class WearableSensingManager { /** * The bundle key for the service status query result, used in * {@code RemoteCallback#sendResult}. * * @hide */ public static final String STATUS_RESPONSE_BUNDLE_KEY = "android.app.wearable.WearableSensingStatusBundleKey"; /** * An unknown status. */ public static final int STATUS_UNKNOWN = 0; /** * The value of the status code that indicates success. */ public static final int STATUS_SUCCESS = 1; /** * The value of the status code that indicates one or more of the * requested events are not supported. */ public static final int STATUS_UNSUPPORTED = 2; /** * The value of the status code that indicates service not available. */ public static final int STATUS_SERVICE_UNAVAILABLE = 3; /** * The value of the status code that there's no connection to the wearable. */ public static final int STATUS_WEARABLE_UNAVAILABLE = 4; /** * The value of the status code that the app is not granted access. */ public static final int STATUS_ACCESS_DENIED = 5; /** @hide */ @IntDef(prefix = { "STATUS_" }, value = { STATUS_UNKNOWN, STATUS_SUCCESS, STATUS_UNSUPPORTED, STATUS_SERVICE_UNAVAILABLE, STATUS_WEARABLE_UNAVAILABLE, STATUS_ACCESS_DENIED }) public @interface StatusCode {} private final Context mContext; private final IWearableSensingManager mService; /** * {@hide} */ public WearableSensingManager(Context context, IWearableSensingManager service) { mContext = context; mService = service; } /** * Provides a data stream to the WearableSensingService that's backed by the * parcelFileDescriptor, and sends the result to the {@link Consumer} right after the call. * This is used by applications that will also provide an implementation of * an isolated WearableSensingService. If the data stream was provided successfully * {@link WearableSensingManager#STATUS_SUCCESS} will be provided. * * @param parcelFileDescriptor The data stream to provide * @param executor Executor on which to run the consumer callback * @param statusConsumer A consumer that handles the status codes, which is returned * right after the call. */ @RequiresPermission(Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void provideDataStream( @NonNull ParcelFileDescriptor parcelFileDescriptor, @NonNull @CallbackExecutor Executor executor, @NonNull @StatusCode Consumer<Integer> statusConsumer) { try { RemoteCallback callback = new RemoteCallback(result -> { int status = result.getInt(STATUS_RESPONSE_BUNDLE_KEY); final long identity = Binder.clearCallingIdentity(); try { executor.execute(() -> statusConsumer.accept(status)); } finally { Binder.restoreCallingIdentity(identity); } }); mService.provideDataStream(parcelFileDescriptor, callback); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Sets configuration and provides read-only data in a {@link PersistableBundle} that may be * used by the WearableSensingService, and sends the result to the {@link Consumer} * right after the call. It is dependent on the application to * define the type of data to provide. This is used by applications that will also * provide an implementation of an isolated WearableSensingService. If the data was * provided successfully {@link WearableSensingManager#STATUS_SUCCESS} will be povided. * * @param data Application configuration data to provide to the {@link WearableSensingService}. * PersistableBundle does not allow any remotable objects or other contents * that can be used to communicate with other processes. * @param sharedMemory The unrestricted data blob to * provide to the {@link WearableSensingService}. Use this to provide the * sensing models data or other such data to the trusted process. * The sharedMemory must be read only and protected with * {@link OsConstants.PROT_READ}. * Other operations will be removed by the system. * @param executor Executor on which to run the consumer callback * @param statusConsumer A consumer that handles the status codes, which is returned * right after the call */ @RequiresPermission(Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void provideData( @NonNull PersistableBundle data, @Nullable SharedMemory sharedMemory, @NonNull @CallbackExecutor Executor executor, @NonNull @StatusCode Consumer<Integer> statusConsumer) { try { RemoteCallback callback = new RemoteCallback(result -> { int status = result.getInt(STATUS_RESPONSE_BUNDLE_KEY); final long identity = Binder.clearCallingIdentity(); try { executor.execute(() -> statusConsumer.accept(status)); } finally { Binder.restoreCallingIdentity(identity); } }); mService.provideData(data, sharedMemory, callback); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } core/java/android/content/Context.java +11 −0 Original line number Diff line number Diff line Loading @@ -6063,6 +6063,17 @@ public abstract class Context { @SystemApi public static final String AMBIENT_CONTEXT_SERVICE = "ambient_context"; /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.app.wearable.WearableSensingManager}. * * @see #getSystemService(String) * @see WearableSensingManager * @hide */ @SystemApi public static final String WEARABLE_SENSING_SERVICE = "wearable_sensing"; /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.healthconnect.HealthConnectManager}. Loading Loading
core/api/system-current.txt +31 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ package android { field public static final String BIND_TRUST_AGENT = "android.permission.BIND_TRUST_AGENT"; field public static final String BIND_TV_REMOTE_SERVICE = "android.permission.BIND_TV_REMOTE_SERVICE"; field public static final String BIND_WALLPAPER_EFFECTS_GENERATION_SERVICE = "android.permission.BIND_WALLPAPER_EFFECTS_GENERATION_SERVICE"; field public static final String BIND_WEARABLE_SENSING_SERVICE = "android.permission.BIND_WEARABLE_SENSING_SERVICE"; field public static final String BLUETOOTH_MAP = "android.permission.BLUETOOTH_MAP"; field public static final String BRICK = "android.permission.BRICK"; field public static final String BRIGHTNESS_SLIDER_USAGE = "android.permission.BRIGHTNESS_SLIDER_USAGE"; Loading Loading @@ -199,6 +200,7 @@ package android { field public static final String MANAGE_USER_OEM_UNLOCK_STATE = "android.permission.MANAGE_USER_OEM_UNLOCK_STATE"; field public static final String MANAGE_WALLPAPER_EFFECTS_GENERATION = "android.permission.MANAGE_WALLPAPER_EFFECTS_GENERATION"; field public static final String MANAGE_WEAK_ESCROW_TOKEN = "android.permission.MANAGE_WEAK_ESCROW_TOKEN"; field public static final String MANAGE_WEARABLE_SENSING_SERVICE = "android.permission.MANAGE_WEARABLE_SENSING_SERVICE"; field public static final String MANAGE_WIFI_COUNTRY_CODE = "android.permission.MANAGE_WIFI_COUNTRY_CODE"; field public static final String MARK_DEVICE_ORGANIZATION_OWNED = "android.permission.MARK_DEVICE_ORGANIZATION_OWNED"; field public static final String MEDIA_RESOURCE_OVERRIDE_PID = "android.permission.MEDIA_RESOURCE_OVERRIDE_PID"; Loading Loading @@ -2876,6 +2878,21 @@ package android.app.wallpapereffectsgeneration { } package android.app.wearable { public class WearableSensingManager { 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>); field public static final int STATUS_ACCESS_DENIED = 5; // 0x5 field public static final int STATUS_SERVICE_UNAVAILABLE = 3; // 0x3 field public static final int STATUS_SUCCESS = 1; // 0x1 field public static final int STATUS_UNKNOWN = 0; // 0x0 field public static final int STATUS_UNSUPPORTED = 2; // 0x2 field public static final int STATUS_WEARABLE_UNAVAILABLE = 4; // 0x4 } } package android.apphibernation { public class AppHibernationManager { Loading Loading @@ -3130,6 +3147,7 @@ package android.content { field public static final String UWB_SERVICE = "uwb"; field public static final String VR_SERVICE = "vrmanager"; field public static final String WALLPAPER_EFFECTS_GENERATION_SERVICE = "wallpaper_effects_generation"; field public static final String WEARABLE_SENSING_SERVICE = "wearable_sensing"; field public static final String WIFI_NL80211_SERVICE = "wifinl80211"; field @Deprecated public static final String WIFI_RTT_SERVICE = "rttmanager"; field public static final String WIFI_SCANNING_SERVICE = "wifiscanner"; Loading Loading @@ -10574,6 +10592,7 @@ package android.provider { field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier"; field public static final String NAMESPACE_TRANSPARENCY_METADATA = "transparency_metadata"; field public static final String NAMESPACE_UWB = "uwb"; field public static final String NAMESPACE_WEARABLE_SENSING = "wearable_sensing"; field public static final String NAMESPACE_WINDOW_MANAGER_NATIVE_BOOT = "window_manager_native_boot"; } Loading Loading @@ -12356,6 +12375,18 @@ package android.service.watchdog { } package android.service.wearable { public abstract class WearableSensingService extends android.app.Service { ctor public WearableSensingService(); method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent); method @BinderThread public abstract void onDataProvided(@NonNull android.os.PersistableBundle, @Nullable android.os.SharedMemory, @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>); field public static final String SERVICE_INTERFACE = "android.service.wearable.WearableSensingService"; } } package android.telecom { @Deprecated public class AudioState implements android.os.Parcelable {
core/java/android/app/wearable/IWearableSensingManager.aidl 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.app.wearable; import android.os.ParcelFileDescriptor; import android.os.PersistableBundle; import android.os.RemoteCallback; import android.os.SharedMemory; /** * Interface for a WearableSensingManager for managing wearable sensing service. * * @hide */ interface IWearableSensingManager { @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)") void provideData(in PersistableBundle data, in SharedMemory sharedMemory, in RemoteCallback callback); } No newline at end of file
core/java/android/app/wearable/OWNERS 0 → 100644 +3 −0 Original line number Diff line number Diff line charliewang@google.com oni@google.com volnov@google.com No newline at end of file
core/java/android/app/wearable/WearableSensingManager.java 0 → 100644 +193 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.app.wearable; import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.SystemService; import android.app.ambientcontext.AmbientContextEvent; import android.content.Context; import android.os.Binder; import android.os.ParcelFileDescriptor; import android.os.PersistableBundle; import android.os.RemoteCallback; import android.os.RemoteException; import android.os.SharedMemory; import android.service.wearable.WearableSensingService; import android.system.OsConstants; import java.util.concurrent.Executor; import java.util.function.Consumer; /** * Allows granted apps to manage the WearableSensingService. * Applications are responsible for managing the connection to Wearables. Applications can choose * to provide a data stream to the WearableSensingService to use for * computing {@link AmbientContextEvent}s. Applications can also optionally provide their own * defined data to power the detection of {@link AmbientContextEvent}s. * Methods on this class requires the caller to hold and be granted the * {@link Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE}. * * @hide */ @SystemApi @SystemService(Context.WEARABLE_SENSING_SERVICE) public class WearableSensingManager { /** * The bundle key for the service status query result, used in * {@code RemoteCallback#sendResult}. * * @hide */ public static final String STATUS_RESPONSE_BUNDLE_KEY = "android.app.wearable.WearableSensingStatusBundleKey"; /** * An unknown status. */ public static final int STATUS_UNKNOWN = 0; /** * The value of the status code that indicates success. */ public static final int STATUS_SUCCESS = 1; /** * The value of the status code that indicates one or more of the * requested events are not supported. */ public static final int STATUS_UNSUPPORTED = 2; /** * The value of the status code that indicates service not available. */ public static final int STATUS_SERVICE_UNAVAILABLE = 3; /** * The value of the status code that there's no connection to the wearable. */ public static final int STATUS_WEARABLE_UNAVAILABLE = 4; /** * The value of the status code that the app is not granted access. */ public static final int STATUS_ACCESS_DENIED = 5; /** @hide */ @IntDef(prefix = { "STATUS_" }, value = { STATUS_UNKNOWN, STATUS_SUCCESS, STATUS_UNSUPPORTED, STATUS_SERVICE_UNAVAILABLE, STATUS_WEARABLE_UNAVAILABLE, STATUS_ACCESS_DENIED }) public @interface StatusCode {} private final Context mContext; private final IWearableSensingManager mService; /** * {@hide} */ public WearableSensingManager(Context context, IWearableSensingManager service) { mContext = context; mService = service; } /** * Provides a data stream to the WearableSensingService that's backed by the * parcelFileDescriptor, and sends the result to the {@link Consumer} right after the call. * This is used by applications that will also provide an implementation of * an isolated WearableSensingService. If the data stream was provided successfully * {@link WearableSensingManager#STATUS_SUCCESS} will be provided. * * @param parcelFileDescriptor The data stream to provide * @param executor Executor on which to run the consumer callback * @param statusConsumer A consumer that handles the status codes, which is returned * right after the call. */ @RequiresPermission(Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void provideDataStream( @NonNull ParcelFileDescriptor parcelFileDescriptor, @NonNull @CallbackExecutor Executor executor, @NonNull @StatusCode Consumer<Integer> statusConsumer) { try { RemoteCallback callback = new RemoteCallback(result -> { int status = result.getInt(STATUS_RESPONSE_BUNDLE_KEY); final long identity = Binder.clearCallingIdentity(); try { executor.execute(() -> statusConsumer.accept(status)); } finally { Binder.restoreCallingIdentity(identity); } }); mService.provideDataStream(parcelFileDescriptor, callback); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Sets configuration and provides read-only data in a {@link PersistableBundle} that may be * used by the WearableSensingService, and sends the result to the {@link Consumer} * right after the call. It is dependent on the application to * define the type of data to provide. This is used by applications that will also * provide an implementation of an isolated WearableSensingService. If the data was * provided successfully {@link WearableSensingManager#STATUS_SUCCESS} will be povided. * * @param data Application configuration data to provide to the {@link WearableSensingService}. * PersistableBundle does not allow any remotable objects or other contents * that can be used to communicate with other processes. * @param sharedMemory The unrestricted data blob to * provide to the {@link WearableSensingService}. Use this to provide the * sensing models data or other such data to the trusted process. * The sharedMemory must be read only and protected with * {@link OsConstants.PROT_READ}. * Other operations will be removed by the system. * @param executor Executor on which to run the consumer callback * @param statusConsumer A consumer that handles the status codes, which is returned * right after the call */ @RequiresPermission(Manifest.permission.MANAGE_WEARABLE_SENSING_SERVICE) public void provideData( @NonNull PersistableBundle data, @Nullable SharedMemory sharedMemory, @NonNull @CallbackExecutor Executor executor, @NonNull @StatusCode Consumer<Integer> statusConsumer) { try { RemoteCallback callback = new RemoteCallback(result -> { int status = result.getInt(STATUS_RESPONSE_BUNDLE_KEY); final long identity = Binder.clearCallingIdentity(); try { executor.execute(() -> statusConsumer.accept(status)); } finally { Binder.restoreCallingIdentity(identity); } }); mService.provideData(data, sharedMemory, callback); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } }
core/java/android/content/Context.java +11 −0 Original line number Diff line number Diff line Loading @@ -6063,6 +6063,17 @@ public abstract class Context { @SystemApi public static final String AMBIENT_CONTEXT_SERVICE = "ambient_context"; /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.app.wearable.WearableSensingManager}. * * @see #getSystemService(String) * @see WearableSensingManager * @hide */ @SystemApi public static final String WEARABLE_SENSING_SERVICE = "wearable_sensing"; /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.healthconnect.HealthConnectManager}. Loading