' wifi: Fix StringIndexOutOfBoundsException for incorrectly encoded SSIDs

If the last character of a SSID is a unescaped backslash then WifiSsid
convertToBytes() will throw a StringIndexOutOfBoundsException and takes the
whole ROM down.

The issue was reported by andreip in the HTC One X XDA thread. His SSID was
set to "/ Andrew \".

04-10 21:33:54.265 E/AndroidRuntime(10479): *** FATAL EXCEPTION IN SYSTEM PROCESS: WifiStateMachine
04-10 21:33:54.265 E/AndroidRuntime(10479): java.lang.StringIndexOutOfBoundsException: length=10; index=10
04-10 21:33:54.265 E/AndroidRuntime(10479):     at android.net.wifi.WifiSsid.convertToBytes(WifiSsid.java:89)
04-10 21:33:54.265 E/AndroidRuntime(10479):     at android.net.wifi.WifiSsid.createFromAsciiEncoded(WifiSsid.java:54)
04-10 21:33:54.265 E/AndroidRuntime(10479):     at android.net.wifi.WifiStateMachine.setScanResults(WifiStateMachine.java:1522)
04-10 21:33:54.265 E/AndroidRuntime(10479):     at android.net.wifi.WifiStateMachine.access$7100(WifiStateMachine.java:103)
04-10 21:33:54.265 E/AndroidRuntime(10479):     at android.net.wifi.WifiStateMachine$SupplicantStartedState.processMessage(WifiStateMachine.java:2511)
04-10 21:33:54.265 E/AndroidRuntime(10479):     at com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:905)
04-10 21:33:54.265 E/AndroidRuntime(10479):     at com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:760)
04-10 21:33:54.265 E/AndroidRuntime(10479):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-10 21:33:54.265 E/AndroidRuntime(10479):     at android.os.Looper.loop(Looper.java:137)
04-10 21:33:54.265 E/AndroidRuntime(10479):     at android.os.HandlerThread.run(HandlerThread.java:60)

Change-Id: I8273decacfffea4e4cae3bb957c925833dab09e2

 Fix Photosphere/Camera FCs

Photosphere is setting a few parameters "blindly"
while the API says it should check the device capabilities first.

On TF101 (and probably other devices) the camera HAL doesn't handle
FLASH_MODE & SCENE_MODE and so it sends the required RuntimeException
for these, which makes Photosphere FC the Camera app.

=> Fix: check device capabilities & ignore these 2 parameters if the device doesn't support them.

Fix based on following Team EOS patch: https://review.teameos.org/#/c/1598/

Change-Id: Idd80299802e9213a3c40414ace3d516d39f47783'