[Q] Compiling AOSP Standalone apps

frapeti

Inactive Recognized Developer
Mar 23, 2012
1,047
4,221
113
Cordoba, Argentina
www.groupon.com.ar
Hi, I've managed to edit, compile, and run the camera app on eclipse, to avoid compile the whole rom just to debug and try things.
(AOSP/CM9 to standalone app)

I just wanted to change the accesibility shutter button, but there are some issues:

I took sources from here: packages\apps\Camera (acual cm9 teamhacksung repo)
Then I removed all the AOSP references and added the correct libraries to make it work.
But the result of it was a different camera app, the differences are:
- The accesibility shutters works by default (power button) ☑
- There is no focus mode option in settings ☐
- Poor preview/picture quality ☑
- Glitched front face camera (green/black flickering) ☑
- etc ☐

(Seems like all the teamhacksung changes are not here)

Where do I need to take the sources to have our actual cm9 camera app to have the latest changes?

My objective is not to compile and finish this app in a standalone or a separated AOSP version, I just want to debug and edit stuff to see how is it working and then when I know that its working fine, push the edited files to the AOSP dir, and compile the whole rom.

Thanks in advance. :D

Here is the compiled .apk: http://www.mediafire.com/?9bi86dwgaln1abp

EDIT: Some issues are fixed by correcting the AndroidManifest.xml file.
EDIT2: All fixed http://forum.xda-developers.com/showpost.php?p=29418513&postcount=3
 
Last edited:

loSconosciuto

Senior Member
Nov 21, 2011
765
2,817
0
If your tree is updated and you just need to build a single part, you can use mmm

Code:
. build/envsetup.sh
lunch
mmm path/to/the/part/
So you don't have to worry about dependencies, libs etc and your sources are updated.

And if you just need to do changes in resources files, like xml files, images (like the wifi signal icon :D) etc, you can add them in the overlay directory.
For example, if you need to do changes in config.xml of the Camera app:
Code:
mkdir -p devices/samsung/galaxysl/overlay/packages/apps/Camera/res/values/
and there create your config.xml, adding only the strings you want to override.
 

frapeti

Inactive Recognized Developer
Mar 23, 2012
1,047
4,221
113
Cordoba, Argentina
www.groupon.com.ar
nice

Thanks, that's very useful info, so..
If I replace /device/samsung/galaxysl/overlay/packages/apps/Camera/res/values/config.xml (the only file) in my eclipse project it should work as the same app that when I do the mmm thing? :p

I will try that :D

EDIT: I've checked that config.xml and just toggle a flag (<bool name="wantsFocusModes">true</bool>)
So I just toggled that flag in my project and everything worked fine, also the alternative shutter.
The poor quality/front face bugs/glitches were becouse of my manifest file that I fixed later.

The question is: Why the accesibility/alternative shutter isnt working with the original one? The config.xml has nothing to do with the shutter >.< , maybe with permissions like this one:
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
Btw my new Camera.apk works as I wanted to :D :D :D

Also checked this:
http://wiki.cyanogenmod.com/wiki/Loading_source_in_eclipse
and this:
To import the formatter, go to the preferences, section Java > Code Style >
formatter, then click on import and choose
development/ide/eclipse/android-formatting.xml

To import the import order, to go into Java > Code Style > Organize Import,
then click on import and choose development/ide/eclipse/android.importorder
Here is my Camera.apk compiled with eclipse, replace the Camera.apk in /system/app with this one. (Sorry for the size)
http://www.mediafire.com/?8plrf0hxxh02262

I was the only one with this "alt. shutter issue" right? :p
 
Last edited:

loSconosciuto

Senior Member
Nov 21, 2011
765
2,817
0
Thanks, that's very useful info, so..
If I replace /device/samsung/galaxysl/overlay/packages/apps/Camera/res/values/config.xml (the only file) in my eclipse project it should work as the same app that when I do the mmm thing? :p

I will try that :D

EDIT: I've checked that config.xml and just toggle a flag (<bool name="wantsFocusModes">true</bool>)
So I just toggled that flag in my project and everything worked fine, also the alternative shutter.
The poor quality/front face bugs/glitches were becouse of my manifest file that I fixed later.

The question is: Why the accesibility/alternative shutter isnt working with the original one? The config.xml has nothing to do with the shutter >.< , maybe with permissions like this one:

Btw my new Camera.apk works as I wanted to :D :D :D

Also checked this:
http://wiki.cyanogenmod.com/wiki/Loading_source_in_eclipse
and this:


Here is my Camera.apk compiled with eclipse, replace the Camera.apk in /system/app with this one. (Sorry for the size)
http://www.mediafire.com/?8plrf0hxxh02262

I was the only one with this "alt. shutter issue" right? :p
No, you are not the only one. Actually it works, but you need to focus first.

I don't know if you built it with eclipse or mmm, but with mmm there's no png optimization and the resulting files are bigger.
 

vmpsr

Member
Jun 19, 2011
8
1
0
If your tree is updated and you just need to build a single part, you can use mmm

Code:
. build/envsetup.sh
lunch
mmm path/to/the/part/
So you don't have to worry about dependencies, libs etc and your sources are updated.

And if you just need to do changes in resources files, like xml files, images (like the wifi signal icon :D) etc, you can add them in the overlay directory.
For example, if you need to do changes in config.xml of the Camera app:
Code:
mkdir -p devices/samsung/galaxysl/overlay/packages/apps/Camera/res/values/
and there create your config.xml, adding only the strings you want to override.
Million thanks for the mmm trick and the link to cm web site! It is so hard to find information on building the sources.
 

panchalamitr

New member
Oct 31, 2019
2
0
0
Thank you so much for posting this question

Hi first of all billions of thanks, by getting an answer I can not build Settings.apk within few min,
My question is, I want to add activity in Settings.apk, for that I have done following code in AndroidManifest.xml

Code:
<activity android:name="com.android.settings.network.AirplaneModePreference"
            android:taskAffinity="com.android.settings"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:parentActivityName="Settings"
            android:label="Advance Airplane Mode">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
But still, when I want to start Activity in Settings.apk I am getting following an error

Code:
    Process: com.android.settings, PID: 24946
    android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings.network/com.android.settings.network.AirplaneModePreference}; have you declared this activity in your AndroidManifest.xml (which is in Settings/AndroidManifest.xml) ?
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2005)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1673)
        at android.app.Activity.startActivityForResult(Activity.java:4587)
        at android.app.Activity.startActivityForResult(Activity.java:4545)
        at android.app.Activity.startActivity(Activity.java:4906)
        at android.app.Activity.startActivity(Activity.java:4874)
        at android.content.ContextWrapper.startActivity(ContextWrapper.java:379)
        at android.support.v7.preference.Preference.performClick(Preference.java:1139)
        at com.android.settingslib.RestrictedPreference.performClick(RestrictedPreference.java:78)
        at android.support.v7.preference.Preference.performClick(Preference.java:1107)
        at android.support.v7.preference.Preference$1.onClick(Preference.java:172)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.access$3100(View.java:778)
        at android.view.View$PerformClick.run(View.java:25906)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6729)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Do you have any idea, then please let me know, thanks alot in advance