Finish trampoline activity for ConfirmDeviceCredential immediately

Make sure to finish ConfirmDeviceCredentialActivity directly, and use
Intent.FLAG_ACTIVITY_FORWARD_RESULT, so we can't even end up in a
state where we have the trampoline activity but not the real activity.

Bug: 23849216
Change-Id: I7a5be5af74ca85c11df1f61a69c3fd5cf558e1fb
This commit is contained in:
Jorim Jaggi
2015-09-10 20:12:19 -07:00
parent 69671dafc8
commit 74a2283d24
3 changed files with 18 additions and 20 deletions

View File

@@ -58,23 +58,12 @@ public class ConfirmDeviceCredentialActivity extends Activity {
String title = intent.getStringExtra(KeyguardManager.EXTRA_TITLE);
String details = intent.getStringExtra(KeyguardManager.EXTRA_DESCRIPTION);
// Ignore rotates and ensure we only launch this once
if (savedInstanceState == null) {
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
if (!helper.launchConfirmationActivity(0 /* request code */, null /* title */, title,
details, false /* returnCredentials */, true /* isExternal */)) {
Log.d(TAG, "No pattern, password or PIN set.");
setResult(Activity.RESULT_OK);
finish();
}
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
if (!helper.launchConfirmationActivity(0 /* request code */, null /* title */, title,
details, false /* returnCredentials */, true /* isExternal */)) {
Log.d(TAG, "No pattern, password or PIN set.");
setResult(Activity.RESULT_OK);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
boolean credentialsConfirmed = (resultCode == Activity.RESULT_OK);
Log.d(TAG, "Device credentials confirmed: " + credentialsConfirmed);
setResult(credentialsConfirmed ? Activity.RESULT_OK : Activity.RESULT_CANCELED);
finish();
}
}