From 2fa61e04624ec9ccbfb9945b7b911ca564b6b6fb Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 6 Oct 2022 00:48:19 +0000 Subject: [PATCH] Allow Android Auto to move to trusted. Seems like there is a bug with how TrustManagerService deals with automotive now that there is the possibility for renewable trust, preventing the automotive companion from being unlocked by the phone. To fix this, we'll update canMoveToTrusted to also allow automotive trustagents to automatically move to trusted (if the right other conditions are met). Test: Manually for automotive Fixes: 250703401 Change-Id: I906be77a2f09582095d24797aebdb0eda420eee6 --- .../java/com/android/server/trust/TrustManagerService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java index 7170773edca4f..2888b9a2d3ccf 100644 --- a/services/core/java/com/android/server/trust/TrustManagerService.java +++ b/services/core/java/com/android/server/trust/TrustManagerService.java @@ -602,9 +602,12 @@ public class TrustManagerService extends SystemService { synchronized (mUserTrustState) { wasTrusted = (mUserTrustState.get(userId) == TrustState.TRUSTED); wasTrustable = (mUserTrustState.get(userId) == TrustState.TRUSTABLE); + boolean isAutomotive = getContext().getPackageManager().hasSystemFeature( + PackageManager.FEATURE_AUTOMOTIVE); boolean renewingTrust = wasTrustable && ( (flags & TrustAgentService.FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE) != 0); - boolean canMoveToTrusted = alreadyUnlocked || isFromUnlock || renewingTrust; + boolean canMoveToTrusted = + alreadyUnlocked || isFromUnlock || renewingTrust || isAutomotive; boolean upgradingTrustForCurrentUser = (userId == mCurrentUser); if (trustedByAtLeastOneAgent && wasTrusted) {