@Override
  boolean tryAuthorize(final LoginClient.Request request) {
    Bundle parameters = new Bundle();
    if (!Utility.isNullOrEmpty(request.getPermissions())) {
      String scope = TextUtils.join(",", request.getPermissions());
      parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
      addLoggingExtra(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
    }

    DefaultAudience audience = request.getDefaultAudience();
    parameters.putString(
        ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, audience.getNativeProtocolAudience());

    AccessToken previousToken = AccessToken.getCurrentAccessToken();
    String previousTokenString = previousToken != null ? previousToken.getToken() : null;
    if (previousTokenString != null && (previousTokenString.equals(loadCookieToken()))) {
      parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousTokenString);
      // Don't log the actual access token, just its presence or absence.
      addLoggingExtra(
          ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_YES);
    } else {
      // The call to clear cookies will create the first instance of CookieSyncManager if
      // necessary
      Utility.clearFacebookCookies(loginClient.getActivity());
      addLoggingExtra(
          ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_NO);
    }

    WebDialog.OnCompleteListener listener =
        new WebDialog.OnCompleteListener() {
          @Override
          public void onComplete(Bundle values, FacebookException error) {
            onWebDialogComplete(request, values, error);
          }
        };

    e2e = LoginClient.getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    FragmentActivity fragmentActivity = loginClient.getActivity();
    WebDialog.Builder builder =
        new AuthDialogBuilder(fragmentActivity, request.getApplicationId(), parameters)
            .setE2E(e2e)
            .setIsRerequest(request.isRerequest())
            .setReauthenticate(request.isReauthenticate())
            .setOnCompleteListener(listener)
            .setTheme(FacebookSdk.getWebDialogTheme());
    loginDialog = builder.build();

    FacebookDialogFragment dialogFragment = new FacebookDialogFragment();
    dialogFragment.setRetainInstance(true);
    dialogFragment.setDialog(loginDialog);
    dialogFragment.show(fragmentActivity.getSupportFragmentManager(), FacebookDialogFragment.TAG);

    return true;
  }
 public void writeToParcel(Parcel parcel, int i)
 {
     Object obj = null;
     String s;
     if (loginBehavior != null)
     {
         s = loginBehavior.name();
     } else
     {
         s = null;
     }
     parcel.writeString(s);
     parcel.writeStringList(new ArrayList(permissions));
     s = obj;
     if (defaultAudience != null)
     {
         s = defaultAudience.name();
     }
     parcel.writeString(s);
     parcel.writeString(applicationId);
     parcel.writeString(authId);
     if (isRerequest)
     {
         i = 1;
     } else
     {
         i = 0;
     }
     parcel.writeByte((byte)i);
 }
 private _cls1(Parcel parcel)
 {
     Object obj1 = null;
     super();
     isRerequest = false;
     Object obj = parcel.readString();
     String s;
     boolean flag;
     if (obj != null)
     {
         obj = LoginBehavior.valueOf(((String) (obj)));
     } else
     {
         obj = null;
     }
     loginBehavior = ((LoginBehavior) (obj));
     obj = new ArrayList();
     parcel.readStringList(((java.util.List) (obj)));
     permissions = new HashSet(((java.util.Collection) (obj)));
     s = parcel.readString();
     obj = obj1;
     if (s != null)
     {
         obj = DefaultAudience.valueOf(s);
     }
     defaultAudience = ((DefaultAudience) (obj));
     applicationId = parcel.readString();
     authId = parcel.readString();
     if (parcel.readByte() != 0)
     {
         flag = true;
     } else
     {
         flag = false;
     }
     isRerequest = flag;
 }