From 5d568eda6211220ddecd1e9bbcf476bfad2ec9e9 Mon Sep 17 00:00:00 2001 From: Kathy Xiaoming Chen Date: Thu, 18 Nov 2021 16:46:32 -0800 Subject: AmbientContext (aka Ambient PCC) Framework API, with a client API for apps to subscribe for AmbientContextEvents, and a provider API for AiAi to implement and provide the detected events. Client apps need the ACCESS_AMBIENT_CONTEXT_EVENT permission to use the service. The permission protection level is internal|role. API overview: http://go/ambient-framework-api PRD: http://go/ambient-attribution-prd Design doc: http://go/ambient-service-api Test: CTS test Bug: 192476579 Change-Id: I9daede83af34f215c278cb0530238faba1be5c70 Ignore-AOSP-First: to prevent new feature leak. --- services/java/com/android/server/SystemServer.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'services/java/com') diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 233f2ff574df..e750ce00c8b2 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -103,6 +103,7 @@ import com.android.internal.util.EmergencyAffordanceManager; import com.android.internal.util.FrameworkStatsLog; import com.android.internal.widget.ILockSettings; import com.android.server.am.ActivityManagerService; +import com.android.server.ambientcontext.AmbientContextManagerService; import com.android.server.appbinding.AppBindingService; import com.android.server.art.ArtManagerLocal; import com.android.server.attention.AttentionManagerService; @@ -1809,6 +1810,7 @@ public final class SystemServer implements Dumpable { startRotationResolverService(context, t); startSystemCaptionsManagerService(context, t); startTextToSpeechManagerService(context, t); + startAmbientContextService(t); // System Speech Recognition Service t.traceBegin("StartSpeechRecognitionManagerService"); @@ -3160,6 +3162,17 @@ public final class SystemServer implements Dumpable { } + private void startAmbientContextService(@NonNull TimingsTraceAndSlog t) { + if (!AmbientContextManagerService.isDetectionServiceConfigured()) { + Slog.d(TAG, "AmbientContextDetectionService is not configured on this device"); + return; + } + + t.traceBegin("StartAmbientContextService"); + mSystemServiceManager.startService(AmbientContextManagerService.class); + t.traceEnd(); + } + private static void startSystemUi(Context context, WindowManagerService windowManager) { PackageManagerInternal pm = LocalServices.getService(PackageManagerInternal.class); Intent intent = new Intent(); -- cgit v1.2.3-59-g8ed1b