@SuppressWarnings("deprecation")
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    EventBus.getDefault().register(this);
    setContentView(R.layout.activity_install);
    ButterKnife.bind(this);

    mFairyAnimation = (AnimationDrawable) mImageViewFairy.getDrawable();
    android.support.v4.app.FragmentManager fm = getSupportFragmentManager();
    mTaskFragment = (TaskFragment) fm.findFragmentByTag(TAG_TASK_FRAGMENT);

    // If the Fragment is non-null, then it is currently being
    // retained across a configuration change.
    if (mTaskFragment == null) {
      Log.i(LOG_TAG, "ensuring permission for: " + this);
      ensurePermission(
          Manifest.permission.WRITE_EXTERNAL_STORAGE, R.string.permission_explanation_install);
    } else {
      InstallResult result = mTaskFragment.getInstallResult();
      if (result != null) {
        markAsDone(result);
      } else {
        startInstallAnimation();
      }
    }
  }
 @Override
 protected synchronized void onDestroy() {
   super.onDestroy();
   EventBus.getDefault().unregister(this);
 }