Fix for force closes where user rotates phone immediately after
submitting status update.

There is a common case where a user rotates the phone immediately
after submitting a status update. This causes the dialog and spinner
to be detached from the window manager. Any subsequent calls to
dismiss() on either the dialog or the spinner will cause the whole
app to force close.

This is easily resolved by implementing the onDetachedFromWindow
callback, and then stopping the dismiss calls.
Fixing Token refresh issue in SDK

Summary:
The TokenRefresh intent is exposed as a service, but we were validating it as
an activity.  Fixign that and refactoring code. This code should have never
worked.

Note that without the FB app the refresh token feature will not work.  If that
is necessary, it's not part of this diff.

Test Plan: Verify that hackbook can login & refresh token on the emulator.

Reviewers: mmarucheck, yariv, ttung, raghuc1, trvish, pfung

Reviewed By: mmarucheck

CC: gregschechte, jacl, lshepard

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

Task ID: 926377
Disable logging by default

Summary:
Logging was turned on unconditionally before, which led to apps leaking
sensitive data.  This change puts the logging api behind an explicit gate that
developers have to turn on.

It's unfortunate that this isn't automatic - ideally this would automatically
turn on for non-release signed bits.  I couldn't find such a check in Android
framework.  If android experts have better ways of tackling this, i'm all ears.
But bear in mind this is a security fix and needs to go out asap.

Test Plan: Launched in default mode and verified no logging in emulator.
Turned on log gate and verified logging.

Reviewers: mmarucheck, lshepard, yariv, raghuc1

Reviewed By: mmarucheck

CC: gregschechte, jacl

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

Task ID: 933141
Fixed null pointer issue.

Summary:
We need to call unbindService on a Context.  In some cases, mAuthActivity
is null.  Since applicationsContext is passed in to the constructor
and never modified, it should not be null.  So we call unbindService
on applicationsContext instead.

Test Plan: Try SSO with pre-1.8 FB app.

Reviewers: vijaye, jacl, caabernathy

Reviewed By: vijaye

CC: selekman, constantin, lshepard

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

Revert Plan: Safe to revert

Task ID: 982981
Merge small pull requests

Summary:
To give credit for changes, I am listing author/pull request here
for changes incorporated in this checkin.

I am submitting these changes directly to master to preserve a
linear history, to allow for minor edits, and to credit multiple
people when more than one change was merged to fix a single issue.

=== Summary by submitter of pull requests in this commit ===
andypalmer:
- 160: ClassCastExceptions in Util.java
grant land:
- 216: Fix ArrayOutOfBoundsException when clicking "Don't Allow" in FbDialog one
iamnoah:
- 117: Fixed a NPE
lvillani:
- 261: Add support for Android build system.
nikreiman:
- 218: Fix exception when trying to decode invalid string
plowman:
- 246: Fix for Issue #160: ClassCastExceptions filling up the logs.

To investigate pull request 260, I enabled orientation changes in Hackbook.
This did not demonstrate the issue, but doesn't hurt anything and makes it
easier to test on the x86 emulator.

I also fixed some build issues in Hackbook around SDK version required and
the path to the SDK.

Test Plan:
Full clean builds of facebook and Hackbook.
Verify creating Eclipse project per public docs still works.
Upload photo in Android Hackbook.

Reviewers: caabernathy, jacl, vijaye, yariv

Reviewed By: jacl

CC: ekoneil, gregschechte

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

Revert Plan: Safe to revert

Task ID: 1028564
Disable password saving in FbDialog

Summary:
By default, Android WebViews store passwords in a per-application
sqlite database.  This changes the default for the Facebook SDK.

Test Plan:
- Build from command-line.
- Uninstall Facebook app, run Hackbook, log in, adb shell, inspect
  webview database to verify no password was saved.

Revert Plan: OK

Reviewers: clang, jacl, vijaye

Reviewed By: vijaye

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

Task ID: 1108189
Enable caching last-token-updated timestamp

Summary:
There was only a single method for setting the access token on the
Facebook class (setAccessToken()).  This did not distinguish between
setting a token loaded from cache vs.  setting a new token resulting
from authorization.

Since setAccessToken() updates the last-token-updated timestamp, and
since this timestamp is used to determine when to refresh the token,
it always looked like the token had just been updated when the app's
Activity started.  This meant the Facebook class would never try to
refresh the token.

To fix this, the Facebook class now supports getting the value of the
last-token-updated timestamp, and also supports restoring this along
with the token value and expiration timestamp in a single operation.

This also updates Hackbook to demonstrate caching.

Test Plan:
- ant build Hackbook
- Ran Hackbook, verified that we could get and restore the timestamp.

Revert Plan:
safe to revert

Tags:

Reviewers: clang, vijaye, caabernathy

Reviewed By: clang

CC: msdkexp@

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

Task ID: 1363221
Added build files
Merge remote-tracking branch 'official/master' into viewnotattached

Conflicts:
	facebook/build.xml
	facebook/project.properties
Tweaked target version