Fix improper SIM Missing automatic navigation
* Properly allow the user to go backwards to prior to the SIM Missing page, if it had ever appeared and then a SIM became available. * Ignore the activity result. Wizard remains on SIM Missing page until user chooses to leave or returns to wizard with SIM present. Change-Id: I3edac6cbb03d76c66b04673d6104e98189ce365c
This commit is contained in:
committed by
Michael Bestas
parent
8792be5031
commit
12c7da294f
@@ -6,18 +6,45 @@
|
||||
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
import android.os.Bundle;
|
||||
import static com.google.android.setupcompat.util.ResultCodes.RESULT_ACTIVITY_NOT_FOUND;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.activity.result.ActivityResult;
|
||||
|
||||
import com.google.android.setupdesign.transition.TransitionHelper;
|
||||
|
||||
import org.lineageos.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
public class SimMissingActivity extends BaseSetupWizardActivity {
|
||||
public class SimMissingActivity extends SubBaseActivity {
|
||||
|
||||
protected void onStartSubactivity() {
|
||||
if (!SetupWizardUtils.simMissing(this)) {
|
||||
nextAction(RESULT_OK);
|
||||
return;
|
||||
}
|
||||
getGlifLayout().setDescriptionText(getString(R.string.sim_missing_summary));
|
||||
setNextAllowed(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getGlifLayout().setDescriptionText(getString(R.string.sim_missing_summary));
|
||||
if (!SetupWizardUtils.simMissing(this)) {
|
||||
finishAction(RESULT_OK);
|
||||
protected void onActivityResult(ActivityResult activityResult) {
|
||||
int resultCode = activityResult.getResultCode();
|
||||
Intent data = activityResult.getData();
|
||||
if (resultCode != RESULT_CANCELED) {
|
||||
nextAction(resultCode, data);
|
||||
} else if (mIsSubactivityNotFound) {
|
||||
finishAction(RESULT_ACTIVITY_NOT_FOUND);
|
||||
} else if (data != null && data.getBooleanExtra("onBackPressed", false)) {
|
||||
if (SetupWizardUtils.simMissing(this)) {
|
||||
onStartSubactivity();
|
||||
} else {
|
||||
finishAction(RESULT_CANCELED, data);
|
||||
}
|
||||
TransitionHelper.applyBackwardTransition(this,
|
||||
TransitionHelper.TRANSITION_FADE_THROUGH, true);
|
||||
} else if (!SetupWizardUtils.simMissing(this)) {
|
||||
nextAction(RESULT_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -264,7 +264,7 @@ public class SetupWizardUtils {
|
||||
} else {
|
||||
disableComponent(context, ScreenLockActivity.class);
|
||||
}
|
||||
if (!hasTelephony(context) || !simMissing(context)) {
|
||||
if (!hasTelephony(context)) {
|
||||
disableComponent(context, SimMissingActivity.class);
|
||||
}
|
||||
if ((!hasWifi(context) && !hasTelephony(context)) ||
|
||||
|
Reference in New Issue
Block a user