SetupWizard: Better handling of launching into other activities
Change-Id: I4d8dc4a1b25e45c6ff35042239a0adf4c16458f1
(cherry picked from commit ed5d46703e)
This commit is contained in:
committed by
Gerrit Code Review
parent
88aba00aa3
commit
dbc1ceb8ca
@@ -114,14 +114,10 @@ public class GmsAccountPage extends SetupPage {
|
||||
getCallbacks().onPreviousPage();
|
||||
} else {
|
||||
super.doLoadAction(fragmentManager, action);
|
||||
launchGmsAccountSetup();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFragmentReady() {
|
||||
launchGmsAccountSetup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS) {
|
||||
@@ -217,6 +213,7 @@ public class GmsAccountPage extends SetupPage {
|
||||
bundle, null, new AccountManagerCallback<Bundle>() {
|
||||
@Override
|
||||
public void run(AccountManagerFuture<Bundle> future) {
|
||||
boolean error = false;
|
||||
try {
|
||||
Bundle result = future.getResult();
|
||||
Intent intent = result
|
||||
@@ -225,20 +222,23 @@ public class GmsAccountPage extends SetupPage {
|
||||
ActivityOptions.makeCustomAnimation(mContext,
|
||||
android.R.anim.fade_in,
|
||||
android.R.anim.fade_out);
|
||||
if (!mFragment.isDetached()) {
|
||||
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
|
||||
SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
|
||||
SetupStats.Label.PAGE, SetupStats.Label.GMS_ACCOUNT);
|
||||
mFragment.startActivityForResult(intent,
|
||||
SetupWizardApp.REQUEST_CODE_SETUP_GMS, options.toBundle());
|
||||
} else {
|
||||
if (getCallbacks().isCurrentPage(GmsAccountPage.this)) {
|
||||
getCallbacks().onNextPage();
|
||||
}
|
||||
}
|
||||
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
|
||||
SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
|
||||
SetupStats.Label.PAGE, SetupStats.Label.GMS_ACCOUNT);
|
||||
mFragment.startActivityForResult(intent,
|
||||
SetupWizardApp.REQUEST_CODE_SETUP_GMS, options.toBundle());
|
||||
} catch (OperationCanceledException e) {
|
||||
error = true;
|
||||
} catch (IOException e) {
|
||||
error = true;
|
||||
} catch (AuthenticatorException e) {
|
||||
Log.e(TAG, "Error launching gms account", e);
|
||||
error = true;
|
||||
} finally {
|
||||
if (error && getCallbacks().
|
||||
isCurrentPage(GmsAccountPage.this)) {
|
||||
getCallbacks().onNextPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
|
||||
Reference in New Issue
Block a user