diff options
author | Adrian Roos <roosa@google.com> | 2014-10-24 14:35:26 +0200 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2014-10-24 14:35:26 +0200 |
commit | 2ace72544ad237bb2327d9241af459c239619161 (patch) | |
tree | e78f664c1a59b0ef1fb6b95d229ac6e624075c10 /packages/Keyguard/test/SampleTrustAgent/src/com | |
parent | bcd076525ccb8a3dfe7d1002bcae059661c1d111 (diff) | |
download | frameworks_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/com')
-rw-r--r-- | packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java | 20 |
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())); + } } |