diff options
author | cretin45 <cretin45@gmail.com> | 2015-03-04 13:06:26 -0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2015-03-04 13:08:00 -0800 |
commit | ef4cd78d5f5ca98cb2fdaa9e86d564bacb7f5f45 (patch) | |
tree | fe4c0d9d9c958856d789f7d6740274d8516ac4d3 /src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java | |
parent | c9c13f20c9a86ad23381bef95a100189e0d08bca (diff) | |
download | packages_apps_SetupWizard-ef4cd78d5f5ca98cb2fdaa9e86d564bacb7f5f45.zip packages_apps_SetupWizard-ef4cd78d5f5ca98cb2fdaa9e86d564bacb7f5f45.tar.gz packages_apps_SetupWizard-ef4cd78d5f5ca98cb2fdaa9e86d564bacb7f5f45.tar.bz2 |
SetupWizard: Add metrics for internal builds that ship with CMStats
Change-Id: Id932a105c18332e32605530d1502ff99b7cf380a
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java')
-rw-r--r-- | src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java index a897db0..a9c50d1 100644 --- a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java +++ b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java @@ -36,6 +36,7 @@ import android.util.Log; import com.cyanogenmod.setupwizard.R; import com.cyanogenmod.setupwizard.SetupWizardApp; +import com.cyanogenmod.setupwizard.cmstats.SetupStats; import com.cyanogenmod.setupwizard.ui.LoadingFragment; import com.cyanogenmod.setupwizard.util.SetupWizardUtils; @@ -125,12 +126,15 @@ public class GmsAccountPage extends SetupPage { public boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS) { if (!mBackupEnabled && SetupWizardUtils.isOwner() && resultCode == Activity.RESULT_OK) { + SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, + SetupStats.Action.EXTERNAL_PAGE_RESULT, + SetupStats.Label.GMS_ACCOUNT, "success"); launchGmsRestorePage(); } else { - handleResult(resultCode); + handleResult(requestCode, resultCode); } } else if (requestCode == SetupWizardApp.REQUEST_CODE_RESTORE_GMS) { - handleResult(resultCode); + handleResult(requestCode, resultCode); setHidden(true); } return true; @@ -147,10 +151,25 @@ public class GmsAccountPage extends SetupPage { } } - private void handleResult(int resultCode) { + private void handleResult(int requestCode, int resultCode) { if (resultCode == Activity.RESULT_CANCELED) { + SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, + SetupStats.Action.EXTERNAL_PAGE_RESULT, + requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS ? + SetupStats.Label.GMS_ACCOUNT : SetupStats.Label.RESTORE, "canceled"); getCallbacks().onPreviousPage(); } else { + if (resultCode == Activity.RESULT_OK) { + SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, + SetupStats.Action.EXTERNAL_PAGE_RESULT, + requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS ? + SetupStats.Label.GMS_ACCOUNT : SetupStats.Label.RESTORE, "success"); + } else { + SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, + SetupStats.Action.EXTERNAL_PAGE_RESULT, + requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS ? + SetupStats.Label.GMS_ACCOUNT : SetupStats.Label.RESTORE, "skipped"); + } if (SetupWizardUtils.accountExists(mContext, SetupWizardApp.ACCOUNT_TYPE_GMS)) { setHidden(true); } @@ -174,6 +193,9 @@ public class GmsAccountPage extends SetupPage { ActivityOptions.makeCustomAnimation(mContext, android.R.anim.fade_in, android.R.anim.fade_out); + SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, + SetupStats.Action.EXTERNAL_PAGE_LAUNCH, + SetupStats.Label.PAGE, SetupStats.Label.RESTORE); mFragment.startActivityForResult( intent, SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle()); @@ -204,6 +226,9 @@ public class GmsAccountPage extends SetupPage { 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 { |