frameworks/base: Added property to disable Camcorder/Camera sounds

Change-Id: I05d7da1d639529f21e06da09b07c87597c4f1029

Conflicts:

	services/camera/libcameraservice/CameraService.cpp
camera: Support non-standard FFC orientations

Most of the FFC-related code assumes a number of rotation and
reorientation hooks are required before the image can be
displayed and/or saved.
If the FFC claims an orientation of 90 degrees (same as a back-cam)
skip all of those, and treat it like a back-facing camera.

Change-Id: Ia0a77a94d0fe56790330ec581610adaec975edb9
Add WEBP to the list of Image formats that support Compression. (by Vikas Arora)

Change-Id: I460eec756643eab9adc44ccbd815ca5e1dd191de
Fix media scanning in case readdir() returns type DT_UNKNOWN.

In that case, a stat() fallback was present in the code. The stat()
call, however, wasn't run on the file in question, but the containing
directory. Consequently, the file was treated as a directory, which
resulted in the scan being aborted due to opendir() failing. Example
logcat output:

D/MediaScanner( 2434): opendir
/system/media/audio/alarms/Alarm_Beep_01.ogg/ failed, errno: 20
E/MediaScanner( 2434): Error processing
'/system/media/audio/alarms/Alarm_Beep_01.ogg/' - skipping
D/MediaScanner( 2434): stat() failed for
/system/media/audio/alarms/Alarm_Beep_01.ogg/: Not a directory
D/MediaScanner( 2434): stat() failed for
/system/media/audio/alarms/Alarm_Beep_01.ogg/: Not a directory
D/MediaScanner( 2434): stat() failed for
/system/media/audio/alarms/Alarm_Beep_01.ogg/: Not a directory
[...]

Fix that issue by amending the file name to the buffer prior to calling
stat().
Allow font scaling setting persist

This hopefully fixes issue 3530. Bugs intruduced by previous commits, i.e.:
- font not visible if user preference for scaling has not been set
- font not visible for dialog (Volume dialog, toasts etc.)
should be fixed now. I have tested that commit quite extensively yet please
check if it doesn't introduce any unnoticed bugs before merging.

Change-Id: I67c28acd9629129d3f3b76177a063327529725ac
Make Norwegian use HH:MM time format instead of HH.MM.

Fixes bug #3798.
Check for NULL in addTracks()

Change-Id: If14da1dee2abd9fd86897cc658f66ae1eccf6d9f
bt: Fix NPE in BroadcastReceiver

java.lang.RuntimeException: Error receiving broadcast Intent {
act=android.bluetooth.device.action.CONNECTION_ACCESS_REPLY (has extras)
} in android.bluetooth.BluetoothDeviceProfileState$1@407e8ed0
	at
android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:722)
	at android.os.Handler.handleCallback(Handler.java:587)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:130)
	at com.android.server.ServerThread.run(SystemServer.java:630)
Caused by: java.lang.NullPointerException
	at
android.bluetooth.BluetoothDeviceProfileState$1.onReceive(BluetoothDeviceProfileState.java:119)
	at
android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709)
	... 4 more

Change-Id: I3590f41040383a2fb0f54f305ac2e7fe526c2070
Set translatable=false

Change-Id: I49b879d0a8f2551d0c9aa13a86dcb2df9a15d51b
Change Finnish time format to use ':' instead of '.'

Change-Id: I3965f3d1fceab501b505cff2663578628dcb1f53
frameworks/base: bluetooth: AVRCP 1.3 feature changes

Bluetooth module will listen metadata/event change intents
from Music app and post data to Bluez stack.

Change-Id: Icbfb1712dde98c9677f57c869bcfffed2bb42a14
Revert "Change Finnish time format to use ':' instead of '.'"

This reverts commit bfe42aa6c3d30c85fad28881ef72bce79c20f6f6.
Log Wifi NativeCommand exceptions

Change-Id: I216b1965ea2c7d4924da63c1829957b68d9e900f
telephony: MccTable: Updates for worldwide needs

* Spare 2 bits from country code to language code
  7 bits for each character of country code would be enough.
  LANG_STRINGS[]'s max index is now increased to 63 (from 15).
  FYI, there are at least 3 dozens of languages in frameworks.

* Lookup country's primary time zone from xml
  There are hundreds of time zones. Import all of them into
  MccTable wouldn't be a good idea. Now it gets the time zone
  ID from com.android.internal.R.xml.time_zones_by_country for
  MCCs without time zone assigned. As I see, the first entry
  matched in the xml would be the primary time zone for the
  specified country. We only need to assign time zones for
  countries that have more than one MCC and its time zone.

* Add a script to update MccTable.java automatically
  By executing tools/genmcctable, any changes to mcc_table in
  Python code will be updated to the auto generated section of
  Java code.

* Minor Changes
 - Fix indent of Java comment generated by Python
 - Set Chinese as the default language of Taiwan

Change-Id: I8724d9e8d5b733a91d5ec9f42ff33b17c9d23eb0
Support Korean SMS encoding

Korean users on KT weren't able to send and receive text messages because
their carrier uses a non-standard encoding on them. This patch checks if the
current SIM inserted is from a Korean carrier when automatic decoding
fails, and supplies the correct encoding in that case.

Change-Id: I1ab858faaa853016697349848bd4f0a413c57adc
Give consistent names to properties controlling camera shutter sound (framework part).

There is a property named "ro.camera.sound.force" which control if camera sound should be played
even if phone is in silent mode. This is standard property and it is not affected by this change.

Another property (used for HTC vivo/vivow/mecha devices) disables camera shutter sound on system level.
Currently it is named "persist.camera.shutter.disable". Renamed to "ro.camera.sound.disabled" to
keep consistent naming with previous option. Also, this property is intended to be read only
and therefore should live in "ro.*" namespace.

Adding support for third property, "persist.sys.camera-mute" which will allow control over camera
shutter sound if it is not disabled by prevoius property.

Change-Id: I02a71237b662ac36d3cfaf466199fc624f594bc0
Fix for the race in Wallpaperservice

Wallpaperservice has a race among message handler of
DO_DETACH and service's onDestroy. In certain cases,
the engine kept track in mActiveEngies is removed by
message handler of DO_DETACH and service's onDestroy
doesn't get an entry in mActiveEngines and isn't able
to invoke detach on it. This keeps the broadcast
receiver mReceiver active and causes the framework to
report a leak and unregister the receiver.

Meanwhile, the message handler of DO_DETACH continues
and invokes detach on the mEngine, which tries to
unregister the receiver, mReceiver and framework throws
an exception "Receiver not registered" and causes the
framework to reboot.

In case of system_server, WindowManagerPolicy and
android.server.ServerThread contest for access of
shared members. Fix is to protect the critical section
with a synchronized block.

Change-Id: I506b9453aecb0a121c2029443ae9c175d7c12af6
Fix A2DP not connecting while asleep.

This is a port of an older fix, which was probably lost in merging:

https://github.com/zewt/android_frameworks_base/commit/111ed5d16f95163fb58bb87407c9ab7268e0893a

This bug happens on a stock 2.3.4 Nexus S; it's not a CM-specific problem.
This fix should probably go upstream at some point.

Original log:

> Some BlueTooth devices will initiate a HFP connection, and then leave it
> to the phone to initiate A2DP.  This was handled with MESSAGE_CONNECT_TO.
>
> However, this was sent using mHandler.sendMessageDelayed, which won't
> wake the phone if it's asleep.  This caused some BT devices to cleanly
> connect using HFP, but to not connect A2DP until the phone is manually
> woken up to allow the MESSAGE_CONNECT_TO message to be delivered.
>
> Replace this message with an AlarmManager alarm, which will wake the
> device properly.  Improves connection with Sony MEX-BT3800U.
>
> (Connecting is still not completely reliable; connecting sometimes still
> mysteriously fails, but this helps a lot.)

(The problem is now with CONNECT_OTHER_PROFILES.)

In case anyone in upstream QA wants to take the initiative to buy the
device for future testing, see: http://www.amazon.com/dp/B0032FOJPM.
Note that in order to reproduce this problem, the phone must actually
be asleep; any unrelated application holding a stray wakelock can mask
this bug.

This may not be the ideal way to approach this: it uses AlarmManager to
schedule the connection, but the scheduled intent then queues the actual
connection to the event loop.  In principle, the phone may go to sleep
again in the interim.  It would be better to actually handle the connection
from the intent handler, as the original patch did, so we can be sure a
wakelock is held for the duration.

It's not clear to me how to do that with the HierarchicalStateMachine,
however, and I havn't yet had any problems with doing it like this; at any
rate it shouldn't cause any regressions.

Change-Id: I41353abd87127cd04d68b15754655c57d3928499
Signed-off-by: Glenn Maynard <glenn@zewt.org>
frameworks/base/opengl: Change copybit image width to buffer stride

Change copybit image width to buffer stride when copybit is used.

Change-Id: I3a8fca52c015d91fe567e7bb4e7669ce6d8a7d82
CRs-fixed: 251015
libagl: Allow use of copybit to accelerate 2D rendering

This appears to fix the 2D performance issues on msm7225 and msm7227,
no more stutter in animations or transitions
Enable with TARGET_LIBAGL_USE_GRALLOC_COPYBITS := true

Change-Id: If1e06dc2b7836e370053d1c664fe5192619e3015