summaryrefslogtreecommitdiffstats
path: root/packages/Keyguard/test/SampleTrustAgent/src
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2014-05-16 16:06:28 +0200
committerAdrian Roos <roosa@google.com>2014-05-16 16:06:28 +0200
commit7e03dfcb796ef1a6000a5fd5fda03c9e15ea62e1 (patch)
tree2058b03d3495ac0ecab4869d798c4838d0ab63be /packages/Keyguard/test/SampleTrustAgent/src
parentb0650e8ff3113f9b9dbb6d249339dbd7921b4517 (diff)
downloadframeworks_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/test/SampleTrustAgent/src')
-rw-r--r--packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java14
-rw-r--r--packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java3
2 files changed, 8 insertions, 9 deletions
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);