SetupWizard: skip missing subactivities
when a subactivity is missing the setup wizard crashes and puts the user back to the previous page this patch allows the user to continue as if they skipped Change-Id: Icb4937b1751d9612c32cb3012f9fc05de2640891
This commit is contained in:
committed by
Michael Bestas
parent
ed1a968160
commit
9e8aa8c9ff
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package org.lineageos.setupwizard;
|
package org.lineageos.setupwizard;
|
||||||
|
|
||||||
import static android.content.Intent.FLAG_ACTIVITY_FORWARD_RESULT;
|
|
||||||
|
|
||||||
import static com.google.android.setupcompat.util.ResultCodes.RESULT_ACTIVITY_NOT_FOUND;
|
import static com.google.android.setupcompat.util.ResultCodes.RESULT_ACTIVITY_NOT_FOUND;
|
||||||
|
|
||||||
import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_ACTION_ID;
|
import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_ACTION_ID;
|
||||||
@@ -77,23 +75,14 @@ public abstract class SubBaseActivity extends BaseSetupWizardActivity {
|
|||||||
subactivityIntent.putExtra(EXTRA_SCRIPT_URI, intent.getStringExtra(EXTRA_SCRIPT_URI));
|
subactivityIntent.putExtra(EXTRA_SCRIPT_URI, intent.getStringExtra(EXTRA_SCRIPT_URI));
|
||||||
subactivityIntent.putExtra(EXTRA_ACTION_ID, intent.getStringExtra(EXTRA_ACTION_ID));
|
subactivityIntent.putExtra(EXTRA_ACTION_ID, intent.getStringExtra(EXTRA_ACTION_ID));
|
||||||
}
|
}
|
||||||
boolean activityForwardsResult =
|
|
||||||
(subactivityIntent.getFlags() & FLAG_ACTIVITY_FORWARD_RESULT) != 0;
|
|
||||||
if (activityForwardsResult) {
|
|
||||||
try {
|
try {
|
||||||
startActivity(subactivityIntent);
|
startActivityForResult(subactivityIntent);
|
||||||
finishAction(RESULT_OK);
|
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Log.w(TAG, "activity not found; start next screen and finish; intent="
|
Log.w(TAG, "activity not found; start next screen and finish; intent=" + intent);
|
||||||
+ intent);
|
|
||||||
mIsSubactivityNotFound = true;
|
mIsSubactivityNotFound = true;
|
||||||
finishAction(RESULT_ACTIVITY_NOT_FOUND);
|
finishAction(RESULT_ACTIVITY_NOT_FOUND);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
startActivityForResult(subactivityIntent);
|
|
||||||
mIsSubactivityNotFound = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(ActivityResult activityResult) {
|
protected void onActivityResult(ActivityResult activityResult) {
|
||||||
|
Reference in New Issue
Block a user