Fix to NullPointerException when activity is relaunched

When ChooseTypeAndAccountActivity is relaunched and resumed
by ActivityManager a call is made to onActivityResult without
first triggering onResume. This leads to mAccounts object
still being null.

Fixed by properly setting mAccounts object if it is null prior
to use after function onCreate has been called.

Change-Id: Ife7e1e052c473970d923fa43ee6189eb62a1113b
Service: Keep services needing restart.

Services needing restart after crash include:
1) service with 'persistent == true'
2) service explicitly reuqired restart by returning START_STICKY
   or START_REDELIVER_INTENT from onStartCommand

Change-Id: Idc490a1ceb1e151a3eb7f34b7b4cf8058a06f34a
Signed-off-by: Liangcai Li <liangcail@nvidia.com>

Conflicts:
	services/java/com/android/server/am/ActiveServices.java
PhoneStatusBar: Use an inline observer instead of a class for battery style.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Guidelines cleanup for some immersive stuffs.

PS2: Also fix a logic derp when calculating display size.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: Iec47fcd47b0ae93e404ff146c9cdbcfd8cbd0007
Tethering: fix NPE when retrieving active interfaces

When in airplane mode getActiveNetworkInfo() may return null.

Change-Id: Icba37abb51b9378c8af73d9f6587e04c588dd85e
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>
PackageManager: Fix reconnection logic in Installer.

Change-Id: Id4b352647ed51aaf64bb85dff9030a25e295758f
Merge "Service: Keep services needing restart." into kitkat
Merge "PhoneStatusBar: Use an inline observer instead of a class for battery style." into kitkat
Merge "Guidelines cleanup for some immersive stuffs." into kitkat
Merge "PackageManager: Fix reconnection logic in Installer." into kitkat
Merge "Fix to NullPointerException when activity is relaunched" into kitkat
Give public access to immersive mode static vars

They are needed by recents

Change-Id: I641f0d9cf5d7263a1433147b8f57ec5fa8286396
Merge "Tethering: fix NPE when retrieving active interfaces" into kitkat
Merge branch 'pa_upstream/kitkat'

Signed-off-by: ayysir <dresadd09691@gmail.com>