From 39387cbdf92ac36d6b5199c709323ec0f213b327 Mon Sep 17 00:00:00 2001 From: Guojing Yuan Date: Mon, 7 Mar 2022 23:04:42 +0000 Subject: [PATCH] Update CDM binding flags When bindImportant is false, the binding flag will be BIND_ALMOST_PERCEPTIBLE (oom_score_adj = PERCEPTIBLE_MEDIUM_APP = 225). The target service will be treated as important as a perceptible app (IMPORTANCE_VISIBLE = 200), and will be unbound when the app is removed from task manager. When bindImportant is true, the binding flag will be BIND_IMPORTANT (oom_score_adj = PERCEPTIBLE_MEDIUM_APP = -700). The target service will have the highest priority to avoid being killed (IMPORTANCE_FOREGROUND = 100). One time permission's importance level to keep session alive is IMPORTANCE_FOREGROUND_SERVICE = 125. In order to kill the one time permission session, the service importance level should be higher than 125. Fix: 211757348 Test: CDM tests Change-Id: I41d72f1e6e362e987b49106e1a4169364a3392a2 --- .../CompanionApplicationController.java | 13 +++++-- .../CompanionDeviceManagerService.java | 5 ++- .../CompanionDeviceServiceConnector.java | 38 +++++++++++++++---- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/services/companion/java/com/android/server/companion/CompanionApplicationController.java b/services/companion/java/com/android/server/companion/CompanionApplicationController.java index f32eebc2a31f6..2a83a3c431ec8 100644 --- a/services/companion/java/com/android/server/companion/CompanionApplicationController.java +++ b/services/companion/java/com/android/server/companion/CompanionApplicationController.java @@ -49,7 +49,7 @@ import java.util.Map; * The following is the list of the APIs provided by {@link CompanionApplicationController} (to be * utilized by {@link CompanionDeviceManagerService}): *