Showing posts with label FXP. Show all posts
Showing posts with label FXP. Show all posts

Sunday, October 11, 2015

Disable MMS auto-retrieve in the source

Okay, so this is no rocket science, but here's how to set the default to something sane, in the sources:
~/android/system-ics/packages/apps/Mms$ git diff res/xml/preferences.xml
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index bdae567..92bae55 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -64,7 +64,7 @@
                       android:key="pref_key_mms_read_reports"
                       android:summary="@string/pref_summary_mms_read_reports"
                       android:title="@string/pref_title_mms_read_reports" />
-    +                           android:key="pref_key_mms_auto_retrieval"
                       android:title="@string/pref_title_mms_auto_retrieval"
                       android:summary="@string/pref_summary_mms_auto_retrieval" />

Monday, August 10, 2015

Fix for Stagefright in Cyanogenmod 9.1 for Xperia Ray

Having recently gone from the stock Sony ROM to CM 9.1 I found the Stagefright stuff a good excuse to start hacking Cyanogenmod.
Long story short - I've backported the fixes for the Stagefright vulnerabilities to the cm9.1 branch and built a private ROM for my Ray out of that.

It works acceptably well on my device and while I'm quite sure the CM9.1 libstagefright code contains many horrors that might have been fixed along the long way from Android 4.0.4, at least now I should be relatively safe should a massive exploit be unleashed:
I'll try to push the changes upstream. In the meantime, here's the ROM (sha1sum: 54ae08ffb080767336faa430d7ad0a14558d6ad5).

Wednesday, August 5, 2015

More breakage:
hajma@c:~/android/system-ics$ brunch urushi
host C++: libdvm <= dalvik/vm/native/dalvik_system_Zygote.cpp
host C++: libdvm <= dalvik/vm/native/java_lang_Class.cpp
host C++: libdvm <= dalvik/vm/native/java_lang_Double.cpp
host C++: libdvm <= dalvik/vm/native/java_lang_Float.cpp
dalvik/vm/native/dalvik_system_Zygote.cpp: In function ‘int setrlimitsFromArray(ArrayObject*)’:
dalvik/vm/native/dalvik_system_Zygote.cpp:199:19: error: aggregate ‘setrlimitsFromArray(ArrayObject*)::rlimit rlim’ has incomplete type and cannot be defined
     struct rlimit rlim;
                   ^
dalvik/vm/native/dalvik_system_Zygote.cpp:222:43: error: ‘setrlimit’ was not declared in this scope
         err = setrlimit(contents[0], &rlim);
                                           ^
build/core/binary.mk:347: recipe for target 'out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o' failed
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] Error 1
make: *** Waiting for unfinished jobs....
hajma@c:~/android/system-ics$
and a fix:
diff --git a/vm/native/dalvik_system_Zygote.cpp b/vm/native/dalvik_system_Zygote.cpp
index 8224656..648bd58 100644
--- a/vm/native/dalvik_system_Zygote.cpp
+++ b/vm/native/dalvik_system_Zygote.cpp
@@ -21,7 +21,7 @@
 #include "native/InternalNativePriv.h"
 
 #include 
-#if (__GNUC__ == 4 && __GNUC_MINOR__ == 7)
+#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
 #include 
 #endif
 #include 

Tuesday, August 4, 2015

my next breakage is due to Debian Jessie having fresher and pickier version of make:

hajma@chrastavec:~/android/system-ics$ brunch urushi
including vendor/cm/vendorsetup.sh
Looking for dependencies

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=cm_urushi
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76L
============================================

build/core/main.mk:43: ********************************************************************************
build/core/main.mk:44: *  You are using version 4.0 of make.
build/core/main.mk:45: *  Android can only be built by versions 3.81 and 3.82.
build/core/main.mk:46: *  see http://source.android.com/source/download.html
build/core/main.mk:47: ********************************************************************************
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=cm_urushi
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76L
============================================
Checking build tools versions...
build/core/prebuilt.mk:143: *** recipe commences before first target.  Stop. 

Fortunately, the Firefox OS folks hit it too and have a patch.
The next step is to get the closed binaries. The script device/semc/urushi/extract-files.sh does that by downloading them from the phone via adb. I no longer have Sony firmware in my phone so there's no need to connect the phone when the Cyanogenmod zip I used to flash it has the same contents, right? The below patch changes the source to the zip:
hajma@c:~/android/system-ics/device/semc/urushi$ git diff ./extract-files.sh 
diff --git a/extract-files.sh b/extract-files.sh
index f3aaa2c..192ea96 100755
--- a/extract-files.sh
+++ b/extract-files.sh
@@ -5,10 +5,11 @@ DEVICE=urushi
 
 BASE=../../../vendor/$VENDOR/$DEVICE/proprietary
 
-while getopts ":nh" options
+while getopts ":nzh" options
 do
   case $options in
     n ) NC=1 ;;
+    z ) FROMZIP=1;;
     h ) echo "Usage: `basename $0` [OPTIONS] "
         echo "  -n  No clenup"
         echo "  -h  Show this help"
@@ -27,7 +28,11 @@ for FILE in `cat proprietary-files.txt | grep -v ^# | grep -v ^$`; do
     if [ ! -d $BASE/$DIR ]; then
         mkdir -p $BASE/$DIR
     fi
-    adb pull /system/$FILE $BASE/$FILE
+    if [ "$FROMZIP" = "1" ]; then
+        unzip $2 system/$FILE -d $BASE
+    else
+        adb pull /system/$FILE $BASE/$FILE
+    fi
 done
 
 ./setup-makefiles.sh
... and more breakage:
hajma@c:~/android/system-ics$ brunch urushi
...
make: *** No rule to make target 'vendor/cm/proprietary/lib/armeabi/libjackpal-androidterm4.so', needed by 'out/target/product/urushi/system/lib/libjackpal-androidterm4.so'.  Stop.
make: *** Waiting for unfinished jobs....
target thumb C: calibrator <= hardware/ti/wlan/mac80211/ti-utils/ini.c
hajma@c:~/android/system-ics$ 
The file was supposed to be delivered with get-prebuilts:
hajma@c:~/android/system-ics/vendor/cm$ ./get-prebuilts 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 3347k  100 3347k    0     0   175k      0  0:00:19  0:00:19 --:--:--  205k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   178  100   178    0     0    296      0 --:--:-- --:--:-- --:--:--   295
100  551k  100  551k    0     0   373k      0  0:00:01  0:00:01 --:--:-- 1375k
Archive:  ./proprietary/Term.apk
caution: filename not matched:  lib/armeabi/libjackpal-androidterm4.so
but the Term.apk now has a newer version:
hajma@c:~/android/system-ics/vendor/cm$ unzip -l proprietary/Term.apk |grep libjackpal-androidterm
    13532  2015-04-15 08:09   lib/armeabi/libjackpal-androidterm5.so
     5648  2015-04-15 08:09   lib/mips/libjackpal-androidterm5.so
     5240  2015-04-15 08:09   lib/x86/libjackpal-androidterm5.so
I'll have a look at updating the term later, for now I'll use the zip one:
hajma@c:~/android/system-ics/vendor/cm$ mkdir -p proprietary/lib/armeabi/
hajma@c:~/android/system-ics/vendor/cm$ unzip -j ~/Downloads/cm-9.1.0-urushi.zip -d proprietary/lib/armeabi system/lib/libjackpal-androidterm4.so
external/llvm/include/llvm/ADT/PointerUnion.h:64:39: error: comparison between ‘enum llvm::PointerLikeTypeTraits::’ and ‘enum llvm::PointerLikeTypeTraits::’ [-Werror=enum-compare]
       NumLowBitsAvailable = PT1BitsAv < PT2BitsAv ? PT1BitsAv : PT2BitsAv
while everybody on the Internet just removes -Wall from the makefile, it can be fixed in a simpler manner, as it has been workarounded before apparently:
hajma@c:~/android/system-ics/external/llvm$ git diff include/llvm/ADT/PointerUnion.h 
diff --git a/include/llvm/ADT/PointerUnion.h b/include/llvm/ADT/PointerUnion.h
index 3e3f214..6450bdb 100644
--- a/include/llvm/ADT/PointerUnion.h
+++ b/include/llvm/ADT/PointerUnion.h
@@ -54,7 +54,7 @@ namespace llvm {
     static inline void *getAsVoidPointer(void *P) { return P; }
     static inline void *getFromVoidPointer(void *P) { return P; }
     enum {
-#if (__GNUC__ == 4 && __GNUC_MINOR__ == 7)
+#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
       PT1BitsAv = static_cast< int >(PointerLikeTypeTraits<PT1>::NumLowBitsAvailable),
       PT2BitsAv = static_cast< int >(PointerLikeTypeTraits<PT2>::NumLowBitsAvailable),
 #else
... and more:
In file included from system/extras/ext4_utils/output_file.c:30:0:
/usr/include/zlib.h:34:19: fatal error: zconf.h: No such file or directory
 #include "zconf.h"
                   ^
compilation terminated.
The cause is ugly and the solution is uglier.
getting closer...
Boot image: out/target/product/urushi/boot.img
error: unsupported page size 131072
device/semc/msm7x30-common/custombootimg.mk:5: recipe for target 'out/target/product/urushi/boot.img' failed
make: *** [out/target/product/urushi/boot.img] Error 255
Now this is caused by a second part of a changeset missing in the cm9.1 branch ... this changeset has to be applied.

aaaand here it is:
Package complete: /home/hajma/android/system-ics/out/target/product/urushi/cm-9-20150804-UNOFFICIAL-urushi.zip
41ef84db95dc7b24f78c8d0788fc1bcd  cm-9-20150804-UNOFFICIAL-urushi.zip
I don't dare to flash this yet though ;-)

Monday, November 26, 2012

FXP14x: Unfortunately, Instagram has stopped [SOLVED]

Okay, I had to touch something somewhere and since a few days ago switching to the camera tab in Instagram crashes the whole thing.

I was quite confident it has something with the face-facing camera broken in FXP but as a fix was promised for FXP148 I stayed on the patient side.

I thundered 148 this morning and while the camera flash is fixed there, the rest keeps as broken as my English.

Here's the important part of logcat:

I/ActivityManager(  362): START {flg=0x10000 cmp=com.instagram.android/.activity.MediaCaptureActivity u=0} from pid 9175
I/CameraService( 4185): Opening camera 1
W/ServiceManager( 4185): Permission failure: com.sonyericsson.permission.CAMERA_EXTENDED from uid=10057 pid=9175
I/caladbolg( 4185):  380936309 cald_camctrl.c                    (6713)  9289 P [SVR]  380936248 + Cald_CamCtrl_PowerUp
I/caladbolg( 4185):  381160583 cald_camctrl.c                    (7484)  9289 P [SVR]  381160522 + Cald_CamCtrl_FSM_Func_PowerUp
I/caladbolg( 4185):  381203338 cald_hal_qct.c                    (2789)  9289 P [HAL]  381203247 + Cald_Hal_Qct_If_PowerUp
I/caladbolg( 4185):  381208679 cald_hal_qct.c                    (2847)  9289 P [HAL]  381208648 - Cald_Hal_Qct_If_PowerUp (0)
I/caladbolg( 4185):  381218536 cald_camctrl.c                    (7563)  9289 P [SVR]  381218475 - Cald_CamCtrl_FSM_Func_PowerUp (0)
I/caladbolg( 4185):  381218933 cald_camctrl.c                    (6720)  9289 P [SVR]  381218902 - Cald_CamCtrl_PowerUp (0)
I/AwesomePlayer( 4185): setDataSource_l('/system/media/audio/ui/camera_click.ogg')
W/WVMExtractor( 4185): Failed to open libwvm.so
I/AwesomePlayer( 4185): setDataSource_l('/system/media/audio/ui/VideoRecord.ogg')
W/WVMExtractor( 4185): Failed to open libwvm.so
D/Camera  ( 9175): app passed NULL surface
I/caladbolg( 4185):  381951782 cald_capctrl.c                    (6128)  9291 P [CAP]  381951751 + Cald_CapCtrl_FSM_Func_StartPreview
I/caladbolg( 4185):  381954376 cald_hal_qct.c                    (2983)  9291 P [HAL]  381954345 + Cald_Hal_Qct_If_StartPreview
I/caladbolg( 4185):  382005187 cald_hal_qct.c                    (3042)  9291 P [HAL]  382005157 - Cald_Hal_Qct_If_StartPreview (0)
I/caladbolg( 4185):  382005432 cald_capctrl.c                    (6358)  9291 P [CAP]  382005432 - Cald_CapCtrl_FSM_Func_StartPreview
F/libc    ( 4185): Fatal signal 11 (SIGSEGV) at 0x00008f28 (code=1), thread 9298 (cam_conf)
I/DEBUG   (  132): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  132): Build fingerprint: 'SEMC/MT11i_1254-2184/MT11i:4.0.4/4.1.B.0.431/UL5_3w:user/release-keys'
I/DEBUG   (  132): pid: 4185, tid: 9298, name: UNKNOWN  >>> /system/bin/mediaserver <<<
I/DEBUG   (  132): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00008f28
I/ActivityManager(  362): Process com.cyanogenmod.filemanager (pid 7528) has died.
I/DEBUG   (  132):     r0 2bb55c98  r1 00008e00  r2 2bb56800  r3 00000000
I/DEBUG   (  132):     r4 2bb608fc  r5 2bb1892c  r6 2bb54f50  r7 2d3469cc
I/DEBUG   (  132):     r8 2d346a58  r9 2d346a5c  sl ffffffff  fp 2d346c80
I/DEBUG   (  132):     ip 2bb1897c  sp 2d3469c8  lr 2bb0dc5b  pc 2bb08578  cpsr 00010030
I/DEBUG   (  132):     d0  0000000000000000  d1  0000000000000000
I/DEBUG   (  132):     d2  0000000000000000  d3  0000000000000000
I/DEBUG   (  132):     d4  0000000001e00000  d5  0000000000000000
I/DEBUG   (  132):     d6  0007080000000000  d7  3f8000003f800000
I/DEBUG   (  132):     d8  0000000000000000  d9  0000000000000000
I/DEBUG   (  132):     d10 0000000000000000  d11 0000000000000000
I/DEBUG   (  132):     d12 0000000000000000  d13 0000000000000000
I/DEBUG   (  132):     d14 0000000000000000  d15 0000000000000000
I/DEBUG   (  132):     d16 3a64696f72646e61  d17 7265676775626564
I/DEBUG   (  132):     d18 bfe0000000000000  d19 0000000000000000
I/DEBUG   (  132):     d20 0000000000000000  d21 0000000000000000
I/DEBUG   (  132):     d22 0000000000000000  d23 0000000000000000
I/DEBUG   (  132):     d24 3ff55d890c229271  d25 3fd8000000000000
I/DEBUG   (  132):     d26 400170a260000000  d27 40020307a0000000
I/DEBUG   (  132):     d28 4003ba2980000000  d29 400150da20000000
I/DEBUG   (  132):     d30 4003ba2980000000  d31 40055815a0000000
I/DEBUG   (  132):     scr 20000012
I/DEBUG   (  132): 
I/DEBUG   (  132): backtrace:
I/DEBUG   (  132):     #00  pc 00045578  /system/lib/liboemcamera.so (vfe_cmd_sharpnessscale+27)
I/DEBUG   (  132):     #01  pc 0004ac57  /system/lib/liboemcamera.so (vfe_util_update_asf_5x5+30)
I/DEBUG   (  132):     #02  pc 0004af9b  /system/lib/liboemcamera.so (vfe_util_sharpness_afilter+2)
I/DEBUG   (  132):     #03  pc 00040701  /system/lib/liboemcamera.so (vfe_process_VFE_ID_SOF_ACK+44)
I/DEBUG   (  132):     #04  pc 0003d06b  /system/lib/liboemcamera.so (vfe_proc_vfe_msg+74)
I/DEBUG   (  132):     #05  pc 0000c77d  /system/lib/liboemcamera.so (config_proc_vfe_event_message+12)
I/DEBUG   (  132):     #06  pc 0000c43b  /system/lib/liboemcamera.so (cam_conf+314)
I/DEBUG   (  132):     #07  pc 000130d4  /system/lib/libc.so (__thread_entry+48)
I/DEBUG   (  132):     #08  pc 0001283c  /system/lib/libc.so (pthread_create+180) 
 
Apparently the things crashes right after trying to open camera 1.
Unlike the rest of the civilized world, the computing area starts numbering with zero, so there's no doubt Instagram is trying to use the second (implying less important) camera - the face-facing one we already know is broken!

Cause found, how about the fix?

I suppose I could just clean the app's settings, but that's a too crude a measure for a 21st century gentleman.

A bit of searching reveals the file

/data/data/com.instagram.android/shared_prefs/com.instagram.android_preferences.xml 

sports a very interesting line:

<string name="pref_camera_id_key">1</string>

Flip the 1 to a zero:

<string name="pref_camera_id_key">0</string>

and viola!

 ... eh, voilà!
This fixed it.