summaryrefslogtreecommitdiffstats
path: root/packages/Keyguard/test/SampleTrustAgent/src
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2014-10-24 14:35:26 +0200
committerAdrian Roos <roosa@google.com>2014-10-24 14:35:26 +0200
commit2ace72544ad237bb2327d9241af459c239619161 (patch)
treee78f664c1a59b0ef1fb6b95d229ac6e624075c10 /packages/Keyguard/test/SampleTrustAgent/src
parentbcd076525ccb8a3dfe7d1002bcae059661c1d111 (diff)
downloadframeworks_base-2ace72544ad237bb2327d9241af459c239619161.zip
frameworks_base-2ace72544ad237bb2327d9241af459c239619161.tar.gz
frameworks_base-2ace72544ad237bb2327d9241af459c239619161.tar.bz2
SampleTrustAgent: Exercise KeyguardManager.isKeyguardInTrustedState
Bug: 18084166 Change-Id: I7d8695f4b576676cc6da1fe07fea05e72d04f33e
Diffstat (limited to 'packages/Keyguard/test/SampleTrustAgent/src')
-rw-r--r--packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java20
1 files changed, 20 insertions, 0 deletions
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 bea74ab..39a599e 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
@@ -18,10 +18,12 @@ package com.android.trustagent.test;
import android.annotation.Nullable;
import android.app.Activity;
+import android.app.KeyguardManager;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
+import android.widget.TextView;
public class SampleTrustAgentSettings extends Activity implements View.OnClickListener,
CompoundButton.OnCheckedChangeListener {
@@ -30,21 +32,31 @@ public class SampleTrustAgentSettings extends Activity implements View.OnClickLi
private CheckBox mReportUnlockAttempts;
private CheckBox mManagingTrust;
+ private TextView mCheckTrustedStateResult;
+
+ private KeyguardManager mKeyguardManager;
+
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
+ mKeyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
+
setContentView(R.layout.sample_trust_agent_settings);
findViewById(R.id.enable_trust).setOnClickListener(this);
findViewById(R.id.revoke_trust).setOnClickListener(this);
findViewById(R.id.crash).setOnClickListener(this);
+ findViewById(R.id.check_trusted).setOnClickListener(this);
mReportUnlockAttempts = (CheckBox) findViewById(R.id.report_unlock_attempts);
mReportUnlockAttempts.setOnCheckedChangeListener(this);
mManagingTrust = (CheckBox) findViewById(R.id.managing_trust);
mManagingTrust.setOnCheckedChangeListener(this);
+
+ mCheckTrustedStateResult = (TextView) findViewById(R.id.check_trusted_result);
}
@Override
@@ -52,6 +64,7 @@ public class SampleTrustAgentSettings extends Activity implements View.OnClickLi
super.onResume();
mReportUnlockAttempts.setChecked(SampleTrustAgent.getReportUnlockAttempts(this));
mManagingTrust.setChecked(SampleTrustAgent.getIsManagingTrust(this));
+ updateTrustedState();
}
@Override
@@ -64,6 +77,8 @@ public class SampleTrustAgentSettings extends Activity implements View.OnClickLi
SampleTrustAgent.sendRevokeTrust(this);
} else if (id == R.id.crash) {
throw new RuntimeException("crash");
+ } else if (id == R.id.check_trusted) {
+ updateTrustedState();
}
}
@@ -75,4 +90,9 @@ public class SampleTrustAgentSettings extends Activity implements View.OnClickLi
SampleTrustAgent.setIsManagingTrust(this, isChecked);
}
}
+
+ private void updateTrustedState() {
+ mCheckTrustedStateResult.setText(Boolean.toString(
+ mKeyguardManager.isKeyguardInTrustedState()));
+ }
}