From 0814d41c73fe3ebc2d1269f1a4fc73d0cf4cb230 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 6 Nov 2014 18:40:15 -0800 Subject: Change Configure structure to List Adding the new structure was making it difficult for LMP devices to have common source with upcoming API version. Fixes bug 17008504 Change-Id: I704503cf0ebff113874c87ab11e37735dbe7b8d7 --- .../android/service/trust/TrustAgentService.java | 29 ++-------------------- .../android/trustagent/test/SampleTrustAgent.java | 11 ++++---- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/core/java/android/service/trust/TrustAgentService.java b/core/java/android/service/trust/TrustAgentService.java index 00d60c0..d6c997f 100644 --- a/core/java/android/service/trust/TrustAgentService.java +++ b/core/java/android/service/trust/TrustAgentService.java @@ -94,31 +94,6 @@ public class TrustAgentService extends Service { private static final int MSG_TRUST_TIMEOUT = 3; /** - * Container class for a list of configuration options and helper methods - */ - public static final class Configuration { - public final List options; - public Configuration(List opts) { - options = opts; - } - - /** - * Very basic method to determine if all bundles have the given feature, regardless - * of type. - * @param option String to search for. - * @return true if found in all bundles. - */ - public boolean hasOption(String option) { - if (options == null || options.size() == 0) return false; - final int N = options.size(); - for (int i = 0; i < N; i++) { - if (!options.get(i).containsKey(option)) return false; - } - return true; - } - } - - /** * Class containing raw data for a given configuration request. */ private static final class ConfigurationData { @@ -147,7 +122,7 @@ public class TrustAgentService extends Service { break; case MSG_CONFIGURE: ConfigurationData data = (ConfigurationData) msg.obj; - boolean result = onConfigure(new Configuration(data.options)); + boolean result = onConfigure(data.options); try { synchronized (mLock) { mCallback.onConfigureCompleted(result, data.token); @@ -212,7 +187,7 @@ public class TrustAgentService extends Service { * @param options bundle containing all options or null if none. * @return true if the {@link TrustAgentService} supports configuration options. */ - public boolean onConfigure(Configuration options) { + public boolean onConfigure(List options) { return false; } diff --git a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java index 09c7165..f28d0e4 100644 --- a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java +++ b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java @@ -28,6 +28,8 @@ import android.support.v4.content.LocalBroadcastManager; import android.util.Log; import android.widget.Toast; +import java.util.List; + public class SampleTrustAgent extends TrustAgentService implements SharedPreferences.OnSharedPreferenceChangeListener { @@ -90,11 +92,10 @@ public class SampleTrustAgent extends TrustAgentService } @Override - public boolean onConfigure(Configuration config) { - if (config != null && config.options != null) { - for (int i = 0; i < config.options.size(); i++) { - PersistableBundle options = config.options.get(i); - Log.v(TAG, "Policy options received: " + options.toString()); + public boolean onConfigure(List options) { + if (options != null) { + for (int i = 0; i < options.size(); i++) { + Log.v(TAG, "Policy options received: " + options.get(i)); } } else { Log.w(TAG, "onConfigure() called with no options"); -- cgit v1.1