@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAdminReceiverComponent = new ComponentName(this, DeviceAdminTestReceiver.class.getName()); disableComponent(); mPrepareTestButton.setText(R.string.provisioning_byod_start); mPrepareTestButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { startByodProvisioning(); } }); // If we are started by managed provisioning (fresh managed provisioning after encryption // reboot), redirect the user back to the main test list. This is because the test result // is only saved by the parent TestListActivity, and if we did allow the user to proceed // here, the test result would be lost when this activity finishes. if (ByodHelperActivity.ACTION_PROFILE_OWNER_STATUS.equals(getIntent().getAction())) { startActivity(new Intent(this, TestListActivity.class)); // Calling super.finish() because we delete managed profile in our overridden of finish(), // which is not what we want to do here. super.finish(); } else { queryProfileOwner(false); } }
@Override public void finish() { // Pass and fail buttons are known to call finish() when clicked, and this is when we want to // clean up the provisioned profile. requestDeleteProfileOwner(); super.finish(); }