[1/3] Subtle Vibration when outgoing call is connected

Other parts of these patches are on packages/services/Telephony & packages/apps/InCallUI repos

Change-Id: I5b4ba3db4e5d0507058a6be53e5ee722a6bd72c6
AudioService: fix cross deadlock in VolumeStreamState

Synchronize modifications of volume index by VolumeStreamState
class mutex instead of using synchronized methods.
This avoids possible cross deadlock when modifying volume on
two stream types simultaneously and one is slave to the other.

Bug: 13730145.

https://android-review.googlesource.com/#/c/94255/

Change-Id: I13406c71010ce0c2e2f08f660b6101f310396c98
Signed-off-by: houst0nn <houstonn@gmail.com>
Check for null in LocalSocketImpl.SocketInputStream.available()

Calling available() on a local socket after close() will cause a native
crash. Other methods that pass LocalSocketImpl.fd to native code copy
the fd and check for null.

https://android-review.googlesource.com/#/c/90900/

Change-Id: I2d0b573f34ae47a23009760bbb1c02933ab0a20e
Signed-off-by: houst0nn <houstonn@gmail.com>
Activity chooser "Always" button is not working

When ResolverActivity is created with a custom list of matching
applications (rList) as in NFC case, and the alwaysUseOption is
set to true, the prferredActivity is not saved even if the user
presses the "always" button.

When a list is provided the variable mBaseResolveList will be
!= null. This will set mOrigResolveList = null.

When an activity is choosen and one of the buttons are pressed
onIntentSelected is called. The first thing this method does
is to check mAdapter.mOrigResolveList != null, however in this
case mOrigResolveList is always null, and the value is not
saved as PreferredActivity.

This problem was introduced in
6d8dfbd8149942f25f2b9643a12f1fb38f3be834.

https://android-review.googlesource.com/#/c/95336/

Change-Id: I9eac41b7861b5e68ad3978af0dc0285f2a34eb88
Signed-off-by: houst0nn <houstonn@gmail.com>
Minor cleanup of UsageStatsService

code cleanup, whitespaces

https://android-review.googlesource.com/#/c/92738/

Change-Id: Idea0e29f347d14e48e87aad38a261d0493bd5fd3
Signed-off-by: houst0nn <houstonn@gmail.com>
Quicksettings: Update all of the battery tile, not just mModel refresh

Change-Id: I9a5dfb0d13245c8151e24ddec2cf5c6636bc4580
Signed-off-by: Evan Anderson <evan@thelinuxman.us>
Quicksettings: Avoid possible NPEs & improve controllers handling

Controller patch based on Clark Sheff's one: recreate controllers at start() only.
https://github.com/CyanogenMod/android_frameworks_base/commit/e95bc124c629cef485bb7ac4ce55137bf500f772

Shutdown all controllers and nullify quicksettings when recreating status bar
view at makeStatusBarView() before a controller and/or mQS instance is called.

Contributors:
@linuxman94
@BigBrother1984

Signed-off-by: Evan Anderson <evan@thelinuxman.us>
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I607dacf79f09fe208d481435cba8ca8c072758d6
Merge "Quicksettings: Update all of the battery tile, not just mModel refresh" into kitkat
Automatic Translation Import

Change-Id: I19aacae3c150690f64d414f002aa3b529bb5621d
Quicksettings: Fix battery tile showing 0% in certain conditions

Battery tile would show 0% sometimes because
the callback isn't sent until battery was updated.

Instead we store state via global variables and force
the first update.

Also includes simplification of code.

Change-Id: Ia346c883308cbdab5a7cccdbd579e4d605b831e8
Signed-off-by: Evan Anderson <evan@thelinuxman.us>
Apps: Add blacklist interface [1/2]

Include peek and floating mode implementations.
Applies to every floating mode launch way.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: Ica523625c9061cf9c8d6c3d7df4acf6a125c4ead
Fix the issue that the top of fullscreen dialog is clipped away

The visibility of status bar comes from the top fullscreen window,
not from the focused window.
That has to be taken into account during the calculation of the
decor rect. You can use mTopIsFullscreen for this purpose.

Change-Id: I6159eb2ee389885cf5ab507157f9451841364d2f
server: Handle broadcast intent and receiver

Ensure the receivers of broadcast intent is not launched before boot
completion by adding an intent flag, since connectivity events can
happen before boot has completed.

Change-Id: Id6fc9e34c89d947d768def38e5c5bb0df54a3a7b
Perform NTP lookup at Mobile data connections

If NITZ isn't supported by the current carrier the Android framework
relies instead on a remote NTP server to set the system clock. The
NetworkTimeUpdateService class polls for NTP time during the first 4
minutes after boot, failing to get NTP time within these minutes will
increase the polling interval to 24 hours. Hence, if a data connection
isn't activated directly after boot it can take a long time for the
system clock to be updated. To prevent this situation, NTP lookup is
scheduled as soon as a Mobile data connection has been established.

Change-Id: I046e0330147e7ace4b720a7e70f9d5047d42cfe6
SystemUI: Fix missing top task in recent panel.

If preloadRecentTasksList was not called or was called too
late and RecentsActivty already started and last top activity has
excludeFromRecents flag setted it might be missing
from recent application list.

Change-Id: Idf7153824805ceea9fcaf04ac645b73a5e93a4d9
Fix a NPE when putting a null-Bundle in an Intent

Happens frequently e.g. with GoogleAccountAuthenticator

Change-Id: I284bf153f40ee9cc3e70bce6efcc3b9e6706361b
Fix null pointer exception in PhoneWindowManager

mKeyguardDelegate is null and is causing fatal exception

Change-Id: Iae14b969b7ff9ab0003e615f2f82eaac65a77985
Keydispatching timeout while finish Activity

If there is input to be handled during finish activity we can get a
keydispatching timeout ANR. The reason is that finish activity is some
times not possible, and the activity is instead put on a finish queue.
The activity will then be finished sometime in the future. When we add
the activity to the finish queue, key dispatching is paused, and there
is an ANR timer waiting for it to be resumed again. Since it can take a
long time before the activity is actually finished, we need to resume
the key dispatching to avoid the ANR.

Change-Id: Icea4ab3b5ad05c8bfbadf8f5cece1a59ec621469
Fix to NullPointerException on move back in ActivityStack.

In ActivityTask.moveTaskToBackLocked NullPointerException may occur
when moving back with only current Activity in stack. This due to a
condition that may trigger despite a TaskRecord being null and then
attempt accessing the TaskRecord.mOnTopOfHome variable.

TaskRecord task may be set to null when no resumed activity remain.

Resolved by assuring that flag mOnTopOfHome is instead set to false
for current TaskRecord in case where there are no remaining activities
above home.

The above bug has already been corrected in the following commit,
ada62fca51d314cefe2c5da4e007df5b9abf320d, but it does not set the
cottect value to mTopOfHome for the current taks, see below.

Variable mOnTopOfHome will not be set to false in situations where
stack is of size 1 or less and task is null, perhaps from already
having finished current activity.

To avoid current TaskRecord maintaining value mOnTopOfHome to true
after launching Home this variable is set to false.

Impact should not be major due to correction earlier that makes sure
that there is always a TaskRecord.mOnTopOfHome set to true above Home
activity but if not correctly set for current task still gives a
possibility of bad behavior.

Change-Id: Ie86ad99c188aaa05b0de9d58eaa16c42b6fc4341
Fix fatal exception due to missing looper for current thread.

While creating handler for the thread, there was fatal exception getting
thrown because the present thread does not have a looper. So passing the
applications looper to be used , while creating the handler to avoid this
exception.

Change-Id: Id2e3ed61f5691c8319eb7bc20ad970eb6758e765
(cherry picked from commit f5d1769b4357fb8d86fc31f7115b55b567a20ed1)
(cherry picked from commit d0a7c5833b90fe4d8fe8f968b53a7028720ffd8c)