Updating projects to break on error when building with ant

Summary: This change will cause the build_and_test.sh script to break on warnings. However, it appears that the set of warnings doesn't fully match those in Eclipse or IntelliJ. So it's not a complete solution

Test Plan: Successful build

Reviewers: mmarucheck, mingfli, clang

Reviewed By: mmarucheck

CC: msdkexp@, platform-diffs@lists

Differential Revision: https://phabricator.fb.com/D605234

Task ID: 1799185
Consolidating image download code between LoginFragment and ImageDownloader.

Summary: Updating LoginFragment to use ImageDownloader instead of its own AsyncTask to download images

Test Plan: Tested the fragment in BooleanOG and Scrumptious

Reviewers: mmarucheck, mingfli, clang

Reviewed By: mmarucheck

CC: msdkexp@

Differential Revision: https://phabricator.fb.com/D606355

Task ID: 1771141
[android-sdk] Display activity circle when starting to load results.

Summary:
When the picker fragments were changed to use the new LoadingStrategy-based implementation, the call to
display the activity circle was removed. Both strategies should show the activity circle when data is being
loaded. They will hide/dim the activity circle at different times once results start arriving.

Test Plan:
- Ran FriendPickerSample and PlacePickerSample, observed activity circle being displayed appropriately.

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mmarucheck

CC: platform-diffs@lists

Differential Revision: https://phabricator.fb.com/D607316

Blame Revision: D566767

Task ID: 1816835
[android-sdk] Fixes several issues with picker samples and authentication.

Summary:
Both FriendPickerSample and PlacePickerSample tried to open a new active session every time their activity was
created. In non-SSO cases, this caused the login and TOS pages to be displayed twice. With the new logic, we will
try to re-open the session only if it is closed, so un-TOSing the app and re-running it will display an error the first
time through saying that the app is not authorized, then try to re-authenticate the user when they return to the main
activity.

FriendPickerSample now re-draws the list of selected friends when the activity is re-created, e.g., after rotation.

Test Plan:
- Ran both samples (in non-SSO mode), tried un-TOSing and re-running app, rotating app, etc.

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mmarucheck

Differential Revision: https://phabricator.fb.com/D607705

Task ID: 1816798, 1816774, 1817045
[android-sdk] Added Request.newUploadVideoRequest helper to set up for video upload.

Summary:
newUploadVideoRequest returns a Request that has been initialized to upload a video; the video is
specified via a File object passed to the method. The name of the underlying file is used as the name
of the uploaded attachment, so its extension should be appropriate to the format of the video file.

Test Plan:
- Added new unit test to upload a short video of a mysterious window in Palo Alto, CA.
- Verified after running unit test that video was encoded and displayed in test user's activity log.

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mmarucheck

Differential Revision: https://phabricator.fb.com/D607644

Task ID: 1441128
BoolOG error message if no logged in user

Summary:
If you navigate to the "Rock with Friends" tab in BooleanOG sample
but are not logged in, we want to show an error.

Test Plan:
- Tried scenario
- Unit tests

Revert Plan:
-safe

Tags:

Reviewers: clang, mingfli

Reviewed By: mingfli

CC: msdkexp@

Differential Revision: https://phabricator.fb.com/D607980

Task ID: 1816641
FriendPickerFragment should show check marks in single-select mode

Summary: See title

Test Plan:
- Run BooleanOG and verify check mark is displayed and persists
  across rotation.
- Unit tests

Revert Plan:
- safe

Tags:

Reviewers: clang, mingfli

Reviewed By: clang

CC: msdkexp@, platform-diffs@lists

Differential Revision: https://phabricator.fb.com/D608399

Task ID: 1816764
Save friend activity list in Boolean OG Sample

Summary:
If you rotate the friends view, we lose the friend activity list.
This saves and restores it.

Test Plan:
- Rotate Boolean OG sample on friend activity view
- Unit tests

Revert Plan:
- safe

Tags:

Reviewers: clang, mingfli

Reviewed By: clang

CC: msdkexp@

Differential Revision: https://phabricator.fb.com/D608389

Task ID: 1816803
Use executeOnExecutor when available                                                                           [0/44111] Summary: We want to allow Requests to run in parallel on multiple threads. However, this is a summary of behavior at different API-lev

Summary:
To enable this, we attempt to use executeOnExecutor if it is available,
and call it with AsyncTask.THREAD_POOL_EXECUTOR (or an Executor the app
specifies via Settings.setExecutor).

If that API is not available, we fall back to AsyncTask.execute.

Either way, for API-levels >=8 (which is what we support), we are
running Requests in parallel by default, and we provide a mechanism
for overriding this behavior whenever possible.

Test Plan:
- Unit tests
- Set a breakpoint for a test that exercises this and watch behavior
  for android-8 and android-16.

Revert Plan:
- safe

Tags:

Reviewers: clang, mingfli

Reviewed By: clang

CC: msdkexp@

Differential Revision: https://phabricator.fb.com/D607955
[android-sdk] Fix authentication logic in JustRequestSample.

Summary:
JustRequestSample contained logic that assumed the same Activity was present after authentication as before. Since
it is possible for the Activity to be recycled, it needs to be resilient to this case. Changed auth logic to not
assume that same Activity and remember whether a request was pending following authentication.

Test Plan:
- Ran JustRequestSample without Facebook app installed, verified that after logging in and TOSing app, pending request
was executed and results displayed.

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mmarucheck

Differential Revision: https://phabricator.fb.com/D608734

Task ID: 1816970
[android-sdk] Don't add access token in Facebook.dialog() when displaying auth dialog.

Summary:
When displaying the auth dialog, it is incorrect to specify an access token. Fixed Facebook.dialog() to not add the
access token in this case.

Test Plan:
- Modified Hackbook to display oauth dialog, verified that resulting URL did not contain the access token, even when
the current session was valid.

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mmarucheck

Differential Revision: https://phabricator.fb.com/D608980

Task ID: 1768806
[android-sdk] PlacePickerFragment should update search box when search text set programmatically.

Summary:
Scrumptious was reloading its places list each time the activity was re-created, e.g., during rotation. In
addition, the original query ("restaurant") was being overwritten because the search box UI had a different
idea of what the query text was (empty). Changed PlacePickerFragment.setSearchText to keep the search box UI
up to date with what the actual query text is.

Test Plan:
- Ran Scrumptious, saw "Restaurant" displayed in search box; rotating resulted in list state being
preserved.

- Ran PlacePickerSample and HelloFacebook, saw their existing behavior unchanged (since they did not set
any search text programmatically).

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mmarucheck

Differential Revision: https://phabricator.fb.com/D608855

Task ID: 1793769
[android-sdk] Fixed capitlization in Javadocs.

Summary: Cleaned up Javadocs to fix occurrences of "facebook" to "Facebook".

Test Plan:
- Inspection

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mingfli

Differential Revision: https://phabricator.fb.com/D608872

Task ID: 1782668
[android-sdk] Added FbDialog constructor that takes a theme.

Summary: FbDialog has a new constructor that takes a theme to allow apps to override the default (Theme_Translucent_NoTitleBar).

Test Plan:
Inspection

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mmarucheck

Differential Revision: https://phabricator.fb.com/D609714

Task ID: 1768835
[android-sdk] Moved TestSession from test project to main SDK.

Summary:
Because TestSession is potentially useful for third-party application developers to write Facebook-related unit
tests for their application, moving it into the SDK project and added documentation.

Test Plan:
- Ran unit tests

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mmarucheck

CC: ekoneil, caabernathy

Differential Revision: https://phabricator.fb.com/D609784

Task ID: 1406730
Fixed Hackbook issues

Summary:
- Fixed Hackbook module in IntelliJ.
- Suppressed deprecation warnings, since Hackbook is supposed to
  demonstrate deprecated API.
- Close Cursor in Hackbook's Utility class.

Test Plan:
- Build/run Hackbook

Revert Plan:
- safe

Tags:

Reviewers: clang, mingfli

Reviewed By: clang

CC: platform-diffs@lists

Differential Revision: https://phabricator.fb.com/D610279

Task ID: 1830270
consolidation image download code

Summary:
This diff does a few different things
1. Consolidates all image downloading code into one place
2. Makes ImageDownloader use a throttled queue to issue requests
3. Separates cache-reads from network calls so one queue doesn't constrain the other.
4. Continues to support old functionality (cached redirects, cancel etc)
5. Simplified PrioritizedWorkQueue to be priority-less

** MISSING **
1. I realize that I've commented out some unit tests :). I will continue to work on those while you review the diff
2. I want to rename PrioritizedWorkQueue to WorkQueue. However, doing so causes Git to think its a totally different file (I'm guessing the contents changed too much, along with the name). So I'm separating the rename into its own change
3. Yes, the code is complicated :-/. Clearly, I need to add unit tests to ImageDownloader. That will also be handled separately

Test Plan: Unit tests, Scrumptions, ProfilePictureSample, SwitchUserSample

Reviewers: mmarucheck, clang, mingfli

Reviewed By: clang

CC: msdkexp@, platform-diffs@lists

Differential Revision: https://phabricator.fb.com/D610659

Task ID: 1771141
[android-sdk] Added WebDialog class, deprecated FbDialog, which now is a thin wrapper around WebDialog.

Summary:
As we are deprecating classes and methods in the com.facebook.android namespace, including FbDialog, we add a
new class, WebDialog, in the com.facebook namespace. It has functionality similar to FbDialog, but includes a number of
helper methods to construct specific types of Facebook Web dialogs and has a simpler listener interface.

FbDialog is now a thin wrapper around WebDialog that preserves existing callback semantics.

Test Plan:
- Ran Hackbook, verified that dialogs display successfully (using both FbDialog and WebDialog)
- Ran several other samples, verified that Web-based authentication continues to work

Revert Plan:

Reviewers: mmarucheck, mingfli, karthiks

Reviewed By: mmarucheck

CC: ekoneil, caabernathy

Differential Revision: https://phabricator.fb.com/D610413

Task ID: 1831402
Returning a confirmation of the cancel request.

Summary: If callers to ImageDownloader are doing any sort of bookkeeping of requests they issue, it would be helpful to know when calls to cancelRequest are successful and when not.

Test Plan: Ran ProfilePictureSample which is the only place that exercises cancel right now

Reviewers: clang, mmarucheck, mingfli

Reviewed By: clang

CC: msdkexp@

Differential Revision: https://phabricator.fb.com/D612553

Task ID: 1771141
Fixed warnings.

Test Plan: - unit tests, build in IntelliJ and command-line

Reviewers: clang, jacl, mingfli

Reviewed By: jacl

CC: msdkexp@

Differential Revision: https://phabricator.fb.com/D613444