Loading packages/NeuralNetworks/framework/platform/java/android/service/ondeviceintelligence/OnDeviceSandboxedInferenceService.java +18 −18 Original line number Diff line number Diff line Loading @@ -146,26 +146,27 @@ public abstract class OnDeviceSandboxedInferenceService extends Service { */ public static final String MODEL_UNLOADED_BROADCAST_INTENT = "android.service.ondeviceintelligence.MODEL_UNLOADED"; /** * Defines keys for the {@link #updateProcessingState(Bundle, OutcomeReceiver)} * bundle in {@link #onUpdateProcessingState(Bundle, OutcomeReceiver)}. * Key for the {@code processingState} bundle in * {@link #onUpdateProcessingState(Bundle, OutcomeReceiver)}, where the value is a * {@link PersistableBundle} containing the device config flags matching the * configured device-config namespace under * {@link com.android.internal.R.string#config_defaultOnDeviceIntelligenceDeviceConfigNamespace}. * * @hide */ @FlaggedApi(FLAG_ON_DEVICE_INTELLIGENCE_25Q4) @SystemApi public static final class UpdateProcessingStateKeys { private UpdateProcessingStateKeys() {} public static final String KEY_DEVICE_CONFIG_UPDATE = "android.service.ondeviceintelligence.KEY_DEVICE_CONFIG_UPDATE"; /** * Key for the {@code processingState} bundle in * {@link #onUpdateProcessingState(Bundle, OutcomeReceiver)}, where the value is a * {@link PersistableBundle} containing the device config flags matching the * configured device-config namespace under * {@link R.string.config_defaultOnDeviceIntelligenceDeviceConfigNamespace}. * @deprecated Use {@link #KEY_DEVICE_CONFIG_UPDATE} instead. * @hide */ public static final String KEY_DEVICE_CONFIG_UPDATE = "device_config_update"; } @Deprecated public static final String DEPRECATED_KEY_DEVICE_CONFIG_UPDATE = "device_config_update"; /** * Listener for inference service lifecycle events. Loading Loading @@ -425,11 +426,10 @@ public abstract class OnDeviceSandboxedInferenceService extends Service { * configuration, files or state. * * @param processingState contains updated state and params that are to be applied to the * processing environment. * The expected keys are constants defined * in {@link UpdateProcessingStateKeys}. * There can be other custom keys sent via * {@link OnDeviceIntelligenceService} but these would be * processing environment. The expected keys are constants defined in * this class, for e.g. {@link #KEY_DEVICE_CONFIG_UPDATE}. * There can be other custom keys sent via {@link * OnDeviceIntelligenceService} but these would be * specific to configured remote package implementation. * @param callback callback to populate the update status and if there are params * associated with the status. Loading packages/NeuralNetworks/service/platform/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java +10 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.server.ondeviceintelligence; import static android.service.ondeviceintelligence.OnDeviceSandboxedInferenceService.UpdateProcessingStateKeys.KEY_DEVICE_CONFIG_UPDATE; import static android.service.ondeviceintelligence.OnDeviceSandboxedInferenceService.MODEL_LOADED_BUNDLE_KEY; import static android.service.ondeviceintelligence.OnDeviceSandboxedInferenceService.MODEL_UNLOADED_BUNDLE_KEY; import static android.service.ondeviceintelligence.OnDeviceSandboxedInferenceService.MODEL_LOADED_BROADCAST_INTENT; Loading Loading @@ -133,7 +132,6 @@ public class OnDeviceIntelligenceManagerService extends SystemService { private static final String SYSTEM_PACKAGE = "android"; private static final long MAX_AGE_MS = TimeUnit.HOURS.toMillis(3); private final Executor resourceClosingExecutor = Executors.newCachedThreadPool(); private final Executor callbackExecutor = Executors.newCachedThreadPool(); private final Executor broadcastExecutor = Executors.newCachedThreadPool(); Loading Loading @@ -737,7 +735,10 @@ public class OnDeviceIntelligenceManagerService extends SystemService { AndroidFuture<Void> result = null; try { // Reserved for use by system-server. processingState.remove(KEY_DEVICE_CONFIG_UPDATE); processingState.remove( OnDeviceSandboxedInferenceService.KEY_DEVICE_CONFIG_UPDATE); processingState.remove( OnDeviceSandboxedInferenceService.DEPRECATED_KEY_DEVICE_CONFIG_UPDATE); ensureRemoteInferenceServiceInitialized(); result = mRemoteInferenceService.post( service -> service.updateProcessingState( Loading Loading @@ -900,7 +901,12 @@ public class OnDeviceIntelligenceManagerService extends SystemService { persistableBundle.putString(key, props.getString(key, "")); } Bundle bundle = new Bundle(); bundle.putParcelable(KEY_DEVICE_CONFIG_UPDATE, persistableBundle); bundle.putParcelable(OnDeviceSandboxedInferenceService .KEY_DEVICE_CONFIG_UPDATE, persistableBundle); bundle.putParcelable(OnDeviceSandboxedInferenceService .DEPRECATED_KEY_DEVICE_CONFIG_UPDATE, persistableBundle); ensureRemoteInferenceServiceInitialized(); mRemoteInferenceService.run(service -> service.updateProcessingState( bundle, Loading Loading
packages/NeuralNetworks/framework/platform/java/android/service/ondeviceintelligence/OnDeviceSandboxedInferenceService.java +18 −18 Original line number Diff line number Diff line Loading @@ -146,26 +146,27 @@ public abstract class OnDeviceSandboxedInferenceService extends Service { */ public static final String MODEL_UNLOADED_BROADCAST_INTENT = "android.service.ondeviceintelligence.MODEL_UNLOADED"; /** * Defines keys for the {@link #updateProcessingState(Bundle, OutcomeReceiver)} * bundle in {@link #onUpdateProcessingState(Bundle, OutcomeReceiver)}. * Key for the {@code processingState} bundle in * {@link #onUpdateProcessingState(Bundle, OutcomeReceiver)}, where the value is a * {@link PersistableBundle} containing the device config flags matching the * configured device-config namespace under * {@link com.android.internal.R.string#config_defaultOnDeviceIntelligenceDeviceConfigNamespace}. * * @hide */ @FlaggedApi(FLAG_ON_DEVICE_INTELLIGENCE_25Q4) @SystemApi public static final class UpdateProcessingStateKeys { private UpdateProcessingStateKeys() {} public static final String KEY_DEVICE_CONFIG_UPDATE = "android.service.ondeviceintelligence.KEY_DEVICE_CONFIG_UPDATE"; /** * Key for the {@code processingState} bundle in * {@link #onUpdateProcessingState(Bundle, OutcomeReceiver)}, where the value is a * {@link PersistableBundle} containing the device config flags matching the * configured device-config namespace under * {@link R.string.config_defaultOnDeviceIntelligenceDeviceConfigNamespace}. * @deprecated Use {@link #KEY_DEVICE_CONFIG_UPDATE} instead. * @hide */ public static final String KEY_DEVICE_CONFIG_UPDATE = "device_config_update"; } @Deprecated public static final String DEPRECATED_KEY_DEVICE_CONFIG_UPDATE = "device_config_update"; /** * Listener for inference service lifecycle events. Loading Loading @@ -425,11 +426,10 @@ public abstract class OnDeviceSandboxedInferenceService extends Service { * configuration, files or state. * * @param processingState contains updated state and params that are to be applied to the * processing environment. * The expected keys are constants defined * in {@link UpdateProcessingStateKeys}. * There can be other custom keys sent via * {@link OnDeviceIntelligenceService} but these would be * processing environment. The expected keys are constants defined in * this class, for e.g. {@link #KEY_DEVICE_CONFIG_UPDATE}. * There can be other custom keys sent via {@link * OnDeviceIntelligenceService} but these would be * specific to configured remote package implementation. * @param callback callback to populate the update status and if there are params * associated with the status. Loading
packages/NeuralNetworks/service/platform/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java +10 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.server.ondeviceintelligence; import static android.service.ondeviceintelligence.OnDeviceSandboxedInferenceService.UpdateProcessingStateKeys.KEY_DEVICE_CONFIG_UPDATE; import static android.service.ondeviceintelligence.OnDeviceSandboxedInferenceService.MODEL_LOADED_BUNDLE_KEY; import static android.service.ondeviceintelligence.OnDeviceSandboxedInferenceService.MODEL_UNLOADED_BUNDLE_KEY; import static android.service.ondeviceintelligence.OnDeviceSandboxedInferenceService.MODEL_LOADED_BROADCAST_INTENT; Loading Loading @@ -133,7 +132,6 @@ public class OnDeviceIntelligenceManagerService extends SystemService { private static final String SYSTEM_PACKAGE = "android"; private static final long MAX_AGE_MS = TimeUnit.HOURS.toMillis(3); private final Executor resourceClosingExecutor = Executors.newCachedThreadPool(); private final Executor callbackExecutor = Executors.newCachedThreadPool(); private final Executor broadcastExecutor = Executors.newCachedThreadPool(); Loading Loading @@ -737,7 +735,10 @@ public class OnDeviceIntelligenceManagerService extends SystemService { AndroidFuture<Void> result = null; try { // Reserved for use by system-server. processingState.remove(KEY_DEVICE_CONFIG_UPDATE); processingState.remove( OnDeviceSandboxedInferenceService.KEY_DEVICE_CONFIG_UPDATE); processingState.remove( OnDeviceSandboxedInferenceService.DEPRECATED_KEY_DEVICE_CONFIG_UPDATE); ensureRemoteInferenceServiceInitialized(); result = mRemoteInferenceService.post( service -> service.updateProcessingState( Loading Loading @@ -900,7 +901,12 @@ public class OnDeviceIntelligenceManagerService extends SystemService { persistableBundle.putString(key, props.getString(key, "")); } Bundle bundle = new Bundle(); bundle.putParcelable(KEY_DEVICE_CONFIG_UPDATE, persistableBundle); bundle.putParcelable(OnDeviceSandboxedInferenceService .KEY_DEVICE_CONFIG_UPDATE, persistableBundle); bundle.putParcelable(OnDeviceSandboxedInferenceService .DEPRECATED_KEY_DEVICE_CONFIG_UPDATE, persistableBundle); ensureRemoteInferenceServiceInitialized(); mRemoteInferenceService.run(service -> service.updateProcessingState( bundle, Loading