diff --git a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java index 593478c65a1c6..06d9395cd7d6f 100644 --- a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java +++ b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java @@ -95,7 +95,7 @@ protected boolean updateLocked(boolean disabled) { @GuardedBy("mLock") void provideContextImageLocked(int taskId, @NonNull Bundle imageContextRequestExtras) { - RemoteContentSuggestionsService service = getRemoteServiceLocked(); + RemoteContentSuggestionsService service = ensureRemoteServiceLocked(); if (service != null) { ActivityManager.TaskSnapshot snapshot = mActivityTaskManagerInternal.getTaskSnapshotNoRestore(taskId, false); @@ -118,7 +118,7 @@ void provideContextImageLocked(int taskId, @NonNull Bundle imageContextRequestEx void suggestContentSelectionsLocked( @NonNull SelectionsRequest selectionsRequest, @NonNull ISelectionsCallback selectionsCallback) { - RemoteContentSuggestionsService service = getRemoteServiceLocked(); + RemoteContentSuggestionsService service = ensureRemoteServiceLocked(); if (service != null) { service.suggestContentSelections(selectionsRequest, selectionsCallback); } @@ -128,7 +128,7 @@ void suggestContentSelectionsLocked( void classifyContentSelectionsLocked( @NonNull ClassificationsRequest classificationsRequest, @NonNull IClassificationsCallback callback) { - RemoteContentSuggestionsService service = getRemoteServiceLocked(); + RemoteContentSuggestionsService service = ensureRemoteServiceLocked(); if (service != null) { service.classifyContentSelections(classificationsRequest, callback); } @@ -136,7 +136,7 @@ void classifyContentSelectionsLocked( @GuardedBy("mLock") void notifyInteractionLocked(@NonNull String requestId, @NonNull Bundle bundle) { - RemoteContentSuggestionsService service = getRemoteServiceLocked(); + RemoteContentSuggestionsService service = ensureRemoteServiceLocked(); if (service != null) { service.notifyInteraction(requestId, bundle); } @@ -153,12 +153,12 @@ private void updateRemoteServiceLocked() { @GuardedBy("mLock") @Nullable - private RemoteContentSuggestionsService getRemoteServiceLocked() { + private RemoteContentSuggestionsService ensureRemoteServiceLocked() { if (mRemoteService == null) { final String serviceName = getComponentNameLocked(); if (serviceName == null) { if (mMaster.verbose) { - Slog.v(TAG, "getRemoteServiceLocked(): not set"); + Slog.v(TAG, "ensureRemoteServiceLocked(): not set"); } return null; } @@ -170,8 +170,8 @@ private RemoteContentSuggestionsService getRemoteServiceLocked() { @Override public void onServiceDied( @NonNull RemoteContentSuggestionsService service) { - // TODO(b/120865921): properly implement Slog.w(TAG, "remote content suggestions service died"); + updateRemoteServiceLocked(); } }, mMaster.isBindInstantServiceAllowed(), mMaster.verbose); }