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
This commit is contained in:
Your Name
2022-10-06 00:48:19 +00:00
parent dc06f11eb0
commit 2fa61e0462

View File

@@ -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) {