yashsingh1/xdaforums huggingface dataset:
[Milestone XT720 Android Development] Mioze7Ae:
My instincts say that approach won't work because the interface to the MotoLEDs is by function calls not by broadcasts. So, you'll be able to stick the code in the ROM using led.jar, but nothing will be able to use it because they won't know about it at compile time. That's what my gut's telling me anyway.

As noted by brianlili, it looks like the gallery button behaviour is controlled entirely by :

./app/CameraMoto/smali/com/motorola/Camera/ModeButtonIntentReceiver.smali

I think this code registers to listen for the gallery key and then keeps state and decides who to launch.
[Milestone XT720 Android Development] Mioze7Ae:
Aha! Nice work! I see that github's news feed misses things...
[Milestone XT720 Android Development] mchlbenner:
Hi

Keep one thing in mind the things I'm trying is by mobile only labtop dead.

I tried what said with no luck.

I will later again for know out of ideas.
[Milestone XT720 Android Development] peshovec:
MediaGallery works

Ok, have figured it out

the MediaGallery.apk (and VideoPlayer) from the stock finally are working.

about external jar, still search how to integrate them with framework.jar the right way....

But for now thing are so:

in the AndroidManifest.xml in MediaGallery.apk there is:

<uses-library
android:name="com.motorola.aui"
>
</uses-library>

so i just insert into com.motorola.aui.jar additional led and mediastorage

after editing platform.xml

<library name="com.motorola.aui"
file="/system/framework/com.motorola.aui.jar"/>

MediaGallery works (the option Display on Tv is available and is starting to search the hdmi device:), same applies to the VideoPlayer

will try to figure out how to make the change in platform.xml persistent (e.g. without need for modifying it later) and will replace the test build

update:

ok new test build

update-cm-7.1.0-MilestoneXT720-beta-25012012-signed.zip — testing, stock hdmi out need feedbacks

tv out from mediagallery works (hdmi cable via hdmi-dvi to advi monitor)

please test and report (also in this build i forgot to remote gallery launch service, so media key will work somehow...)

no additional changes to platform.xml are needed anymore
[Milestone XT720 Android Development] brianlili:
That is great. Is that means both fjfalcon's build and yours update the same time? Please ask fjfalcon to make the change, which means let media key activete mediagallery instead of gallery3d. After this, this part works exactally as in stock's rom! Great improvement.

And hope Mioze7Ae compiling all this to his CM6 build.

:)
[Milestone XT720 Android Development] peshovec:
there is something i still have no time to dig into it and to figure it out...

I don't use excellent fjfalcon`s mediabutton receiver... but media key works:) (rotate between gallery 3d, image and video capture)

when the new test build is ready will test it and will give feedback again

editing:

oups:) somehow i missed to disable the launchgallery service :) that explains the above strange behaivor:)
[Milestone XT720 Android Development] brianlili:
Yeah, I think mediagallery suits for xt720 better than gallery3d, and, more important thing is, you make motovideoplayer working on CM7, that is wonderful.
[Milestone XT720 Android Development] Mioze7Ae:
Well all we have to do then is get MotoCamera working because that's where the mediabutton reciever is ;) I'll get your changes into CM6. Great work!
[Milestone XT720 Android Development] peshovec:
Ok, i decide to go for that, so finally installed CameraMoto.apk (some fighting was needed, also it crash because of libpanorama_jni.so , but...)

pressing the mode key does nothing, but,

pressing down camera key and holding does:

launch cyano camera (as expected)

and launch motostock camera (which still crashes, but...)

so is it possible this ModeButtonIntentReceiver.smali to be just for launching cameraMoto, when holding down the camera key?

update:

placeholder to remember:)

~/android/stockframe/out$ vim ./com/android/server/am/ActivityManagerService.smali

grep -E -i "(camera|gallery|led_set)" ./com/android/server/am/ActivityManagerService.smali
const-string v8, "com.motorola.gallery"
invoke-static {v7, v8}, Lcom/motorola/hardware/LED;->led_set(II)I
const-string v8, "com.motorola.Camera"
invoke-static {v7, v8}, Lcom/motorola/hardware/LED;->led_set(II)I
invoke-static {v7, v8}, Lcom/motorola/hardware/LED;->led_set(II)I

and

frameworks/base$ vim ./services/java/com/android/server/am/ActivityManagerService.java

grep -E -i "(camera|gallery|led_set)" ./services/java/com/android/server/am/ActivityManagerService.java
mSuppressHomeLock = "com.android.camera".equals(app.processName);
[Milestone XT720 Android Development] Mioze7Ae:
Hmm. I tried getting mediagallery on CM6, but I get random app crashes. Also when I plug in hdmi cord MediaGallery crashes. I must have missed something. ;) Ah, I get VideoPlayer to show up from 3D Gallery and that does have the display on TV option, but I get "hdmi cable not detected" after a while even when HDMI cable is attached. Still, it's a good start!

Edit: yup, missing some stuff libhdmi.so, ExtDispService.apk etc.... those don't sound important, do they :p
[Milestone XT720 Android Development] peshovec:
it is not so straightforward you have to have libdispext.so and extdispservice.apk (and com.motorola.aui.jar and etc...)

take a deep look at the logcat...

when trying to detect hdmi, you should be able to see, 5V put on the hdmi etc...

anyway i am not able to test on real hdmi device..

anyway it the whole is still in testing stage (i have mediagallery force close when rotate in landscape and if i am in preview)

also please see that i have added some info in my post, basically media button is working, because i somehow missed to disable launchgaleery service :D

edit: hihi we both edited at the same time:)
[Milestone XT720 Android Development] Mioze7Ae:
Ok, it looks like for HDMI out all that's needed is:

/system/app/ExtDispService.apk

/system/app/VideoPlayerMoto.apk

/system/lib/libextdisp.so

/system/lib/libhdmi.so

The aui, leds etc are needed for MediaGallery, but I can't get that to not crash all the time yet. So I've pushed the hdmi support only part to CM6 (tested).

https://github.com/CyanogenModXT720...mmit/949414f5efa85ce7e379ae08c66c6d02c7c94a82

I've tested this on my computer display and video works. I don't know if audio is supposed to go out too because I've never tried hdmi out before in stock and also I wouldn't know if it was working or not because my monitor doesn't have speakers anyway.

It looks like the main CM7 was only missing ExtDispService.apk and VideoPlayerMoto.apk, so I've pushed those there too to get hdmi support (but not tested yet)

https://github.com/CyanogenModXT720...mmit/18308c73c3fa560504f627b9bd055e7e6d0b274f

Edit: doesn't work in CM7. Some library clash, I think:

E/extdisp ( 2012): tvout_init : dlopen error!

E/extdisp ( 2012): tvout_init error!
[Milestone XT720 Android Development] peshovec:
tvout errors are ok:)

hdmi out has to be good

took me some time to make it (partially)work in the test build,

just to remind (took me some time in the past), the apks and the jars has to be signed for the platform (test build is using keys from nadlabak ...)

MediaGallery crash if started in landscape (it is written in the logcat which display orientation is detected), or when rotate from portrait to landscape, but only in thumbnail preview. If picture sliding is in use, dosen't crash regardless of orientation

Also the MediaGallery search for it's intents in the framework and in com.motorola.aui.jar, thats why i put leds and MediaStorage smalis in aui one.

So crashes are avoided (except some landscape rotating)
[Milestone XT720 Android Development] Mioze7Ae:
What I mean by the hdmi part doesn't work on CM7 is that every thing links and runs, but when you actually connect an hdmi display and try to send video, no video goes to the display and VideoPlayer exits or decides to continue playing on the phone instead. The logcat isn't very informative unfortunately. The next time you try videoplayer doesn't go the whole hdmi connection thing asking if you want to ignore incoming calls. You have to reboot to get another chance at that part. Anyway this "just works" on CM6 and I assumed it would be the same on CM7, but I'm wrong so I've backed out that commit. I think it's probably related to froyo->gingerbread changes in the media libraries/infrastructure, so probably we need to scrounge gingerbread-compatible ones from defy or droid2. You're right -- I think the tvout stuff is harmless about missing libtvout.so (for tv on the headphone jack, I assume). Anyway you don't see the problems until you actually connect a display. :(
[Milestone XT720 Android Development] brianlili:
HDMI stream include both audio and video, I'm pretty sure about that.
[Milestone XT720 Android Development] peshovec:
Mio, can you try CameraMoto.apk in CM6 ?

i had partially success in CM7 (probably libpanorama_jni.so requires something non gingerbread...)

from here:

https://github.com/CyanogenModXT720/android_device_motorola_sholest/commits/pesh-modif

commit "try hard to use CameraMoto.apk" should be enough (you will have to resign the apk and the jar, i have included facedetect and led in the jar)

and from here:

https://github.com/CyanogenModXT720/android_frameworks_base/commits/nadlabak-moto

commit "add com.motorola.android.camera library", which just define the location of the required library (e.g. jar, in which i included additional smalis)
[Milestone XT720 Android Development] Mioze7Ae:
I started working on it earlier and already hit the next snag--the aosp framework needs some extensions. The first one I ran into is a change needed to the android.hardware.Camera class in framework.jar--basically it has to be extended to include support for registering callbacks for the face detection code (android/hardware/Camera I think-- I can't remember exactly and I'm away from my dev computer at the moment). It doesn't look too bad and I've started some of it but then got distracted wondering how many of these there were going to be and so I started writing a dependency analysis script to datamine the smali and find all the dependencies...

Nadlabak actually set up CM6 to inject things into framework.jar using smali https://github.com/CyanogenModXT720...a_sholest/blob/froyo/releasetools/squisher.sh and the device/motorola/sholest/smali directory so I used that to add LED to framework.jar (I don't think I pushed it yet) but it doesn't look like he continued that feature in CM7. The missing extensions to the base classes (facedetect and possibly more) can't be done reliably from smali, I don't think.
[Milestone XT720 Android Development] peshovec:
yep, i hit the framework changes too...

I will speak about MediaGallery (CameraMoto is related too)

gallery (camera) require library com.motorola.aui (com.motorola.android.camera)

in the platform.xml are defined the corresponding jars.

so far so good.

MediaGallery also tries to use MediaStorage and LED (which are defined in motorola frameworks, but not in aosp frameworks), so i tried to push their smalis in com.motorola.aui.jar, as the gallery application will load it.

so far so good:)

it seems to work:

D/Gallery Luncher( 6303): startActivity=com.motorola.gallery.ImageGallery
.....
D/ImageGallery( 6303): ImageGallery onResume was called!
D/LED ( 6303): libmot_led loaded success
.....
D/MediaUploader( 6326): UploaderApplication.onCreate
.....
D/ImageGallery( 6303): check thumbnails thread finishing; took 3153

before adding MediaStorage and LED to com.motorola.aui.jar there was errors that they are missing...

also when i start MediaGallery, the corresponding led turns on (e.g. the led inserted smalis are working)

so as i have some proof, that this may work, i start digging the same way about CameraMoto.apk (this time with com.motorola.android.camera )

e.g. to insert into the loaded "library" (jar) the missing classes...

but although i have added all the needed libs (*.so) libpanoroma_jni.so fails to load, and the camera crashes (before that i see live preview, settings icons etc..)

actually it seems that crash is here:

.method static constructor <clinit>()V
.registers 3

.prologue
.line 50
const/4 v1, 0x0

sput-object v1, Lcom/motorola/android/camera/Panorama;->mCam:Landroid/hardware/Camera;

.line 397
:try_start_3
const-string v1, "panorama_jni"

invoke-static {v1}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
:try_end_8
.catch Ljava/lang/UnsatisfiedLinkError; {:try_start_3 .. :try_end_8} :catch_9

.line 402
:goto_8
return-void

.line 399
:catch_9
move-exception v1

move-object v0, v1

.line 400
.local v0, ule:Ljava/lang/UnsatisfiedLinkError;
const-string v1, "Panorama"

const-string v2, "WARNING: Could not load libpanorama_jni.so"

invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

goto :goto_8
.end method

in com/motorola/android/camera/Panorama.smali

which is included in the com.motorola.android.camera.jar

so it seems inserting smalis is working...

but, the callbacks are still missing

i suspect the following:

the method seems to be defined in the CameraMoto.apk

but i am afraid that android.hardware.Camera.setZoomCallback actually point to :

frameworks/base/core/java/android/hardware$ vim Camera.java

....
package android.hardware;

which doesn't define such method...

will try to substitute the onFaceUpdateCallback with AutoFocusCallback :)
[Milestone XT720 Android Development] Mioze7Ae:
I've pushed my first attempt at FaceDetectCallback (compiles and doesn't complain in logcat)

https://github.com/CyanogenModXT720...mmit/95a7b6fa8735d0cbac416cb904901d5ff5de5194

I started on the ZoomCallback, but I've just realized that ZoomCallback isn't in the Korean 2.2 -- it uses OnZoomChangeListener instead which is part of the froyo API. Essentially I think ZoomCallback was a Motorola extension for missing functionality in eclair and Google implemented the same functionality as OnZoomChangeListener for froyo or possibly it was first implemented as ZoomCallback and later renamed by Google. So I'm going to switch to the Korean froyo 2.2 for camera now. I'm going to recheck that the FaceDetectCallback didn't change.

Just a quick check that you remembered libpanorama.so in addition to libpanorama_jni.so?

Edit: now seeing the same libpanorama problems after switching to korean libraries

Edit2: There seems to be parts of panorama inside libscalado.so, but I can't see where that gets linked/loaded...

Edit3: Duh, it's listed as a dependency for libpanorama.so

Edit4: Add these libraries from Korean and it doesn't crash immediately: libscalado.so, libcaps.so (does crash later though but I think that's because LED is different in Korean and mine currently uses the CBW). I also took all the /system/lib/lib*camera*.so from Korean. This phone is a mess at the moment, I'm going to have to go reflash... :D

Edit5: The lib*camera*so stuff doesn't seem to be necessary--with the original ones it behaves the same. Anyway this seems closer to working :D :D On CM6 I get a black screen, but you can drag the focus box around and stuff. Can't get the flash to fire, though. I've pushed most of the stuff to new froyo-experimental branches on (device|vendor)/motorola/sholest
[Milestone XT720 Android Development] peshovec:
Mio, as you have (partially) working CamerMoto.apk

can you run some tests?

1. press and hold the camera key

what happens (i expect both cyano and moto camera to try to start, as in the test build)

2. press the media button

what happens (i suspect nothing, as in the test build).

if something happens, that means that really CameraMoto.apk has listener to it.

if you have access to stock rom, remove CameraMoto.apk,

3. press and hold camera key

what happens (i expect nothing)

4. press the media button

what happens (i expect gallery launching)

If my expectations are right, that means that the CameraMoto listener is just for launching the camera, when holding the camera key. And that the media button listener is probably in the ActivityManagerServices ...
[Milestone XT720 Android Development] Mioze7Ae:
I forgot to backport fjfalcon's new media key support in the CM6 framework so the media key intent isn't being generated. I'll add that next.

I'm pretty convinced that CameraMoto.apk:smali/com/motorola/Camera/ModeButtonIntentReceiver.smali is doing this -- it has code to launch MediaGallery, Camcorder and Camera there and as far as I can tell it's the only thing that registers to listen for the media button intent that gets emitted by the framework when the button is pressed. It may make sense to implement it there so that you can toggle quickly between Camera and Camcorder since you're switching views within CameraMoto so this probably allows them to avoid shutting the app down and starting it up again to go from Camera to Camcorder. That's my theory anyway.
[Milestone XT720 Android Development] peshovec:
aha, i see :)

then the smali`s grepped code is for turning leds off, when (if) galery and camera are terminated :)...

but i still not fully understand, why (after installing CameraMoto.apk), the media button receiver doesn't work.

Do you know how to emulate the intent sent from framework when media button is pressed, using /system/bin/am ? (have tried several combination with no luck)
[Milestone XT720 Android Development] Mioze7Ae:
The signaling inside system/framework/android.policy/com/android/internal/policy/impl/PhoneWindow.smali is more complex than what fjfalcon added to CM7. Search in there for "MEDIA_MODE" to find the relevant parts. I don't understand it yet, so I haven't been able to fabricate the correct intents with am. The intent is motorola.intent.action.MEDIA_MODE_KEY, but I don't understand what goes into the extra fields. PhoneWindow fills in to two extra fields, but I don't know if they are both used by MotoCamera or not. Probably the answer for what's needed is in the receiver.
[Milestone XT720 Android Development] fjfalcon:
Why we use method to port - why we can't write it opensource?

I think we can just write this led control from source.. and get everything working.
[Milestone XT720 Android Development] peshovec:
yup,

I like how moto solved the problem with the leds turn off if the application crash (they put in the activity manager logic, which turns the led off, when the corresponding process die...)

btw, the code from packages/apps/Music, which observes headphones button press, is actually working for other keys too (i have tested for the media key) even if no headphones are connected
[Milestone XT720 Android Development] bagongs:
Hi all,

I flashed yesterday the 25/01/2012 version, over fresh modsbf part1. It was a mess :D

the fonts were soooo small, the gravity sensor didn't work (sometimes it worked in the opposite way: horizontal screen when the phone was vertical and vice versa). And many processes continued to crash so I couldn't even test the rom....

....maybe I should have flashed modsbf part 2 as well? maybe it is just not compatible with modsbf?
[Milestone XT720 Android Development] mchlbenner:
He has his fronts set at 160 and you set them 240 yourself and you need a cm7 bootfix for sensors to work right.
[Milestone XT720 Android Development] peshovec:
Ok, may be 160 dpi is too small :)

i have updated the first post with update 5.

basically you have to put in /sdcard/OpenRecovery/scripts 3 scripts:

lcd_240.sh

lcd_190.sh

lcd_160.sh

each of them will change /system/build.prop with the desired dpi density

240 is the default (i called it screen space waste:)

190 is good, but some market apps complain that they are incompatible (the root is the not so standard 190 dpi)

160 is the default in the test build, too small for many people, but introduce no incompatible apps in the market

to apply, after copying the scripts, just chose one of them from the scripts menu inside OpenRecovery

N.B. make a backup of your /system/build.prop (just in case), before that please
[Milestone XT720 Android Development] R-D:
Cant search right now, but there is a hacked market apk which ignores DPI setting, I saw it for CM9 for the HP TouchPad.
[Milestone XT720 Android Development] eejin2:
Can the lcd density script work on any rom?
[Milestone XT720 Android Development] eejin2:
How do I change the font size but keep the icon size at default?
[Milestone XT720 Android Development] SaurusX:
peshovec, you're awesome. You helped me get HDMI video working in CM7 on the DroidX with your explanations in the OP. I hope you get some confirmation about the HDMI audio on the XT720, but I found that the audio solution for the DroidX involved a bit of framework reprogramming. The TI omap programming already in place was a total red herring and led to nothing.
[Milestone XT720 Android Development] peshovec:
you have made very good summary at rootzwiki

still did not test the HDMI audio trough....

trying to slide the above onscreen
[Milestone XT720 Android Development] peshovec:
uploaded new build, focused on memory testing.

If you'd like to contribute leave the heapsize to 28 (it is so by default).

Report used/free memory after fresh boot (leave to say 30 minutes, device to load everything it should).

The memory information under application -> running is fixed, so now used + free will always be 224 or 225 (one of the both, it is rounding)

Report used/free memory after 2 days or something ? (actually the threshold depends of the usage pattern)

If you are able, please do the above with(out) jit enabled (e.g. one time with jit disable, and one time with jit enabled)

If you don't mind share some basics for your usage pattern. for example my basics:

1. background data on

2. 3g all the time, wifi on all the time

3. push notification on corporate and gmail

4. sync always on (corporate contact/calendar, google contact)

And please observe if you have suspicious device wakes. e.g. looking battery usage (settings->about->battery use and tap on the graph above), look for "Awake" to be solid bar, and missing solid bar "Screen on" below it

p.s. Have in mind, that the launcher is weak/strong as was the stock one:) e.g. will redraw much. I just put most of the used application on the screen. This way the launcher redraw doesn't bother me...
[Milestone XT720 Android Development] Mioze7Ae:
Here's a patch (apply as OR update) for peshovec's update-cm-7.1.0-MilestoneXT720-beta-04042012-signed.zip that adds support for xt720mod.sbf (sensorfix.ko) and sets default density back to 240.

So far memory use seems to be much, much more sane than I've experienced in the compiled CM7's for XT720 that I've tried. nadlabak's sneaky process reassignment/vm merging tricks seem to work quite well. I'm not hating it yet and by now I'd usually have a growing bad feeling about CM7 ;) I am seeing more FC's than I expect but the logcats do seem to be pointing at problems in the apps rather than say the framework etc.
[Milestone XT720 Android Development] Mioze7Ae:
Peshovec: fyi this CM7 is very, very good. I'm having to reconsider my avoidance of CM7. Kudos!
[Milestone XT720 Android Development] space4ace:
I tried one of Peshovec's CM7 and didn't really like it, but now I feel I should try it again, thanks to your reply and your patch.

Thanks Mioze7Ae!
[Milestone XT720 Android Development] Mioze7Ae:
It's very Spartan--a lot of things have been disabled, so don't judge it based on missing features.
[Milestone XT720 Android Development] 3rdstring:
I get an invalid zip file with both windows native zip functionality & 7zip on this patch. Has anyone else seen this?
[Milestone XT720 Android Development] Mioze7Ae:
It looks like the update is corrupted (md5sums doesn't match). I don't know how to fix it from my phone, so it will be a few hours for a fix. Sorry.
[Milestone XT720 Android Development] Mioze7Ae:
I re-uploaded the peshovec-patch-20120404-2123.zip attachment in post #41 (and then verified after downloading from xda). Sorry for the hassle.
[Milestone XT720 Android Development] LibertyMonger:
WOW This ROM is superfast and amazing! Great work peshovec!

Camera works great as well! This is definitely a winner!