summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Albert Dai <albertdai@google.com> 2023-11-02 21:03:25 +0000
committer Albert Dai <albertdai@google.com> 2023-11-02 23:49:14 +0000
commita1e77df7ede200c0b22db47bc45097fc2c26d879 (patch)
treead814aba487438c8c199fe569620814796e96458
parentc668fc9e58253086882d603a43f2c9233dddb163 (diff)
Bind voice interactor as visible foreground service when it is being used.
It can help the voice interactor and its binding processes being in at least foreground cpuset instead of restricted when the device is dreaming. When the device is dreaming and the voice interactor is being used, BIND_SCHEDULE_LIKE_TOP_APP can only make voice interactor being in top-app cpuset but does not change the proc state. BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE can change the proc state of voice interactor to be FOREGROUND_SERVICE. Bug 301613300 Test: invoke Assistant on a docked and locked Pixel Tablet, confirm :search cpuset becomes foreground. Change-Id: I758535824b0d79790f028e19a1e78398233b3389
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
index 216f45acd5bd..d722f2f1aa0c 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
@@ -279,6 +279,7 @@ final class VoiceInteractionSessionConnection implements ServiceConnection,
mFullyBound = mContext.bindServiceAsUser(mBindIntent, mFullConnection,
Context.BIND_AUTO_CREATE | Context.BIND_TREAT_LIKE_ACTIVITY
| Context.BIND_SCHEDULE_LIKE_TOP_APP
+ | Context.BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE
| Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS,
new UserHandle(mUser));
}