diff options
author | Adrian Roos <roosa@google.com> | 2014-05-16 16:06:28 +0200 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2014-05-16 16:06:28 +0200 |
commit | 7e03dfcb796ef1a6000a5fd5fda03c9e15ea62e1 (patch) | |
tree | 2058b03d3495ac0ecab4869d798c4838d0ab63be /packages/Keyguard | |
parent | b0650e8ff3113f9b9dbb6d249339dbd7921b4517 (diff) | |
download | frameworks_base-7e03dfcb796ef1a6000a5fd5fda03c9e15ea62e1.zip frameworks_base-7e03dfcb796ef1a6000a5fd5fda03c9e15ea62e1.tar.gz frameworks_base-7e03dfcb796ef1a6000a5fd5fda03c9e15ea62e1.tar.bz2 |
Apply revised TrustAgent API
Bug: 14997466
Change-Id: I81042e058a20f28603a11471882f3dcfc4f8b13c
Diffstat (limited to 'packages/Keyguard')
3 files changed, 9 insertions, 10 deletions
diff --git a/packages/Keyguard/test/SampleTrustAgent/res/xml/sample_trust_agent.xml b/packages/Keyguard/test/SampleTrustAgent/res/xml/sample_trust_agent.xml index b48e011..b363ab4 100644 --- a/packages/Keyguard/test/SampleTrustAgent/res/xml/sample_trust_agent.xml +++ b/packages/Keyguard/test/SampleTrustAgent/res/xml/sample_trust_agent.xml @@ -14,5 +14,5 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> -<trust_agent xmlns:android="http://schemas.android.com/apk/res/android" +<trust-agent xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity=".SampleTrustAgentSettings" /> 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 25406d6..a51ea75 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 @@ -31,7 +31,7 @@ public class SampleTrustAgent extends TrustAgentService { LocalBroadcastManager mLocalBroadcastManager; - private static final String ACTION_ENABLE_TRUST = "action.sample_trust_agent.enable_trust"; + private static final String ACTION_GRANT_TRUST = "action.sample_trust_agent.grant_trust"; private static final String ACTION_REVOKE_TRUST = "action.sample_trust_agent.revoke_trust"; private static final String EXTRA_MESSAGE = "extra.message"; @@ -45,14 +45,14 @@ public class SampleTrustAgent extends TrustAgentService { public void onCreate() { super.onCreate(); IntentFilter filter = new IntentFilter(); - filter.addAction(ACTION_ENABLE_TRUST); + filter.addAction(ACTION_GRANT_TRUST); filter.addAction(ACTION_REVOKE_TRUST); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); mLocalBroadcastManager.registerReceiver(mReceiver, filter); } @Override - protected void onUnlockAttempt(boolean successful) { + public void onUnlockAttempt(boolean successful) { if (getReportUnlockAttempts(this)) { Toast.makeText(this, "onUnlockAttempt(successful=" + successful + ")", Toast.LENGTH_SHORT).show(); @@ -69,8 +69,8 @@ public class SampleTrustAgent extends TrustAgentService { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); - if (ACTION_ENABLE_TRUST.equals(action)) { - enableTrust(intent.getStringExtra(EXTRA_MESSAGE), + if (ACTION_GRANT_TRUST.equals(action)) { + grantTrust(intent.getStringExtra(EXTRA_MESSAGE), intent.getLongExtra(EXTRA_DURATION, 0), false /* initiatedByUser */); } else if (ACTION_REVOKE_TRUST.equals(action)) { @@ -79,9 +79,9 @@ public class SampleTrustAgent extends TrustAgentService { } }; - public static void sendEnableTrust(Context context, + public static void sendGrantTrust(Context context, String message, long durationMs, Bundle extra) { - Intent intent = new Intent(ACTION_ENABLE_TRUST); + Intent intent = new Intent(ACTION_GRANT_TRUST); intent.putExtra(EXTRA_MESSAGE, message); intent.putExtra(EXTRA_DURATION, durationMs); intent.putExtra(EXTRA_EXTRA, extra); diff --git a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java index 0a6f675..8e293fb 100644 --- a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java +++ b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java @@ -19,7 +19,6 @@ package com.android.trustagent.test; import android.annotation.Nullable; import android.app.Activity; import android.os.Bundle; -import android.preference.CheckBoxPreference; import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; @@ -53,7 +52,7 @@ public class SampleTrustAgentSettings extends Activity implements View.OnClickLi public void onClick(View v) { int id = v.getId(); if (id == R.id.enable_trust) { - SampleTrustAgent.sendEnableTrust(this, "SampleTrustAgent", TRUST_DURATION_MS, + SampleTrustAgent.sendGrantTrust(this, "SampleTrustAgent", TRUST_DURATION_MS, null /* extra */); } else if (id == R.id.revoke_trust) { SampleTrustAgent.sendRevokeTrust(this); |