From 60ea553423f8fd51c5d92ba4ccfc3bb8a3485eca Mon Sep 17 00:00:00 2001 From: Vishwath Mohan Date: Sat, 25 May 2019 12:23:02 -0700 Subject: [PATCH] Check when trust agents do not declare a settings activity. Trust agents are allowed to optionally specify a settings Activity in the meta-data file. This CL fixes the logic that parses the file to ensure that a missing settings activity does cause a NullPointerException. Bug: 133557168 Test: Registering a trust agent without a settings Activity works Change-Id: I0736a105fee77032acf2ac4b098717b6d49b4099 --- .../java/com/android/server/trust/TrustManagerService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java index 3a390536b4388..a2eb40b0c6fa9 100644 --- a/services/core/java/com/android/server/trust/TrustManagerService.java +++ b/services/core/java/com/android/server/trust/TrustManagerService.java @@ -518,8 +518,11 @@ public class TrustManagerService extends SystemService { agentInfo = mActiveAgents.valueAt(index); } - boolean directUnlock = resolveInfo.serviceInfo.directBootAware - && agentInfo.settings.canUnlockProfile; + boolean directUnlock = false; + if (agentInfo.settings != null) { + directUnlock = resolveInfo.serviceInfo.directBootAware + && agentInfo.settings.canUnlockProfile; + } if (directUnlock) { if (DEBUG) Slog.d(TAG, "refreshAgentList: trustagent " + name