Methods Summary |
---|
public void | onCheckedChanged(android.widget.CompoundButton buttonView, boolean isChecked)
if (buttonView == mReportUnlockAttempts) {
SampleTrustAgent.setReportUnlockAttempts(this, isChecked);
} else if (buttonView == mManagingTrust) {
SampleTrustAgent.setIsManagingTrust(this, isChecked);
} else if (buttonView == mReportDeviceLocked) {
SampleTrustAgent.setReportDeviceLocked(this, isChecked);
}
|
public void | onClick(android.view.View v)
int id = v.getId();
if (id == R.id.enable_trust) {
SampleTrustAgent.sendGrantTrust(this, "SampleTrustAgent", TRUST_DURATION_MS,
false /* initiatedByUser */);
} else if (id == R.id.revoke_trust) {
SampleTrustAgent.sendRevokeTrust(this);
} else if (id == R.id.crash) {
throw new RuntimeException("crash");
} else if (id == R.id.check_device_locked) {
updateTrustedState();
}
|
protected void | onCreate(android.os.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_device_locked).setOnClickListener(this);
mReportUnlockAttempts = (CheckBox) findViewById(R.id.report_unlock_attempts);
mReportUnlockAttempts.setOnCheckedChangeListener(this);
mReportDeviceLocked = (CheckBox) findViewById(R.id.report_device_locked);
mReportDeviceLocked.setOnCheckedChangeListener(this);
mManagingTrust = (CheckBox) findViewById(R.id.managing_trust);
mManagingTrust.setOnCheckedChangeListener(this);
mCheckDeviceLockedResult = (TextView) findViewById(R.id.check_device_locked_result);
|
protected void | onResume()
super.onResume();
mReportUnlockAttempts.setChecked(SampleTrustAgent.getReportUnlockAttempts(this));
mManagingTrust.setChecked(SampleTrustAgent.getIsManagingTrust(this));
updateTrustedState();
|
private void | updateTrustedState()
mCheckDeviceLockedResult.setText(Boolean.toString(
mKeyguardManager.isDeviceLocked()));
|