From a43fd03b9b23f9ad0deae9ee69ee80aaa1433cdb Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Mon, 9 Mar 2015 19:10:15 +0100 Subject: Notify TrustAgentService when device policy configuration no longer applies Also updates the outdated javadoc to match the current API. Bug: 19500731 Change-Id: I7976bbcc815b84e168718672377a963ffea68c51 --- core/java/android/service/trust/TrustAgentService.java | 14 ++++++++------ .../java/com/android/server/trust/TrustAgentWrapper.java | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/java/android/service/trust/TrustAgentService.java b/core/java/android/service/trust/TrustAgentService.java index 706b9342eefc..a3178e2d5cad 100644 --- a/core/java/android/service/trust/TrustAgentService.java +++ b/core/java/android/service/trust/TrustAgentService.java @@ -122,12 +122,14 @@ public class TrustAgentService extends Service { case MSG_CONFIGURE: ConfigurationData data = (ConfigurationData) msg.obj; boolean result = onConfigure(data.options); - try { - synchronized (mLock) { - mCallback.onConfigureCompleted(result, data.token); + if (data.token != null) { + try { + synchronized (mLock) { + mCallback.onConfigureCompleted(result, data.token); + } + } catch (RemoteException e) { + onError("calling onSetTrustAgentFeaturesEnabledCompleted()"); } - } catch (RemoteException e) { - onError("calling onSetTrustAgentFeaturesEnabledCompleted()"); } break; case MSG_TRUST_TIMEOUT: @@ -203,7 +205,7 @@ public class TrustAgentService extends Service { * PersistableBundle)}. *

Agents that support configuration options should overload this method and return 'true'. * - * @param options bundle containing all options or null if none. + * @param options The aggregated list of options or an empty list if no restrictions apply. * @return true if the {@link TrustAgentService} supports configuration options. */ public boolean onConfigure(List options) { diff --git a/services/core/java/com/android/server/trust/TrustAgentWrapper.java b/services/core/java/com/android/server/trust/TrustAgentWrapper.java index 57b204d9a1b5..772f8318417a 100644 --- a/services/core/java/com/android/server/trust/TrustAgentWrapper.java +++ b/services/core/java/com/android/server/trust/TrustAgentWrapper.java @@ -40,6 +40,7 @@ import android.util.Slog; import android.service.trust.ITrustAgentService; import android.service.trust.ITrustAgentServiceCallback; +import java.util.Collections; import java.util.List; /** @@ -359,6 +360,8 @@ public class TrustAgentWrapper { mSetTrustAgentFeaturesToken = new Binder(); mTrustAgentService.onConfigure(config, mSetTrustAgentFeaturesToken); } + } else { + mTrustAgentService.onConfigure(Collections.EMPTY_LIST, null); } final long maxTimeToLock = dpm.getMaximumTimeToLock(null); if (maxTimeToLock != mMaximumTimeToLock) { -- cgit v1.2.3-59-g8ed1b