[DEV][JB] Camera Development - Galaxy Ace S5830 Original Android Development

Hey,
As long as github is not updated, find set of sources to compile 'new' camera lib here: http://jellaxy.googlecode.com/files/halsources.zip. Structure in archive should be clear to all people who know how to compile Android.
If you do a 'clean' compile, cameraHAL might refuse to link, complaining about missing libcamera. In this case, apply this patch before compiling: https://github.com/lgics/cm_device_...mmit/5ee471c15ac5658ab5bed1866aa89a1f0141645d. But ADD ONLY lines for libcamera NOT for libril.
In dir 'device/samsung/msm7x27-common/camlibs/' you'll find libs from STOCK GB Rom. So procedure is:
- add -DSAMSUNG_CAMERA_QCOM to compiler options (either in BoardConfig.mk of cooper device or in BoardCommonConfig.mk of device/msm7x27-common)
- compile with new cameraHAL
- flash to device
- replace/add libs in /system/lib with that one from 'device/samsung/msm7x27-common/camlibs/' dir.
Good luck

Here is code from kernel driver
Code:
static int __msm_get_pic(struct msm_sync *sync, struct msm_ctrl_cmd *ctrl)
{
int rc = 0;
int tm;
unsigned long flags = 0;
struct msm_queue_cmd *qcmd = NULL;
tm = (int)ctrl->timeout_ms;
spin_lock_irqsave(&sync->abort_pict_lock, flags);
sync->get_pic_abort = 0;
spin_unlock_irqrestore(&sync->abort_pict_lock, flags);
rc = wait_event_interruptible_timeout(
sync->pict_q.wait,
!list_empty_careful(
&sync->pict_q.list) || sync->get_pic_abort,
msecs_to_jiffies(tm));
spin_lock_irqsave(&sync->abort_pict_lock, flags);
if (sync->get_pic_abort) {
sync->get_pic_abort = 0;
spin_unlock_irqrestore(&sync->abort_pict_lock, flags);
return -ENODATA;
}
spin_unlock_irqrestore(&sync->abort_pict_lock, flags);
if (list_empty_careful(&sync->pict_q.list)) {
if (rc == 0)
return -ETIMEDOUT;
This function return case is last line:
Code:
return -ETIMEDOUT
---------- Post added at 04:30 PM ---------- Previous post was at 04:25 PM ----------
Have you got a liboemcamera.so from froyo for GIO?
---------- Post added at 04:34 PM ---------- Previous post was at 04:30 PM ----------
lagloose said:
What i have found out is, that failure is caused by a 'copy_to_user' problem on line 1133 in file 'drivers/media/video/msm/msm_camera.c' of kernel source, which can be found here: https://github.com/Jellaxy/android_kernel_samsung_msm7x27
Click to expand...
Click to collapse
Why do you think so?

logcat error seems pretty famous on google as many app developers seems to have this errors.. are you guys using aosp camera application or you have modded it for adapting changes ?? so that people can refer directly to cm repo for camera code

madman said:
logcat error seems pretty famous on google as many app developers seems to have this errors.. are you guys using aosp camera application or you have modded it for adapting changes ?? so that people can refer directly to cm repo for camera code
Click to expand...
Click to collapse
CM9/CM10 Camera application. Problem is related to hal/kernel/liboemcamera modes.

Did the kernel have enabled:
Code:
CONFIG_UACCESS_WITH_MEMCPY: │
│ │
│ Implement faster copy_to_user and clear_user methods for CPU │
│ cores where a 8-word STM instruction give significantly higher │
│ memory write throughput than a sequence of individual 32bit stores. │
│ │
│ A possible side effect is a slight increase in scheduling latency │
│ between threads sharing the same address space if they invoke │
│ such copy operations with large buffers. │
│ │
│ However, if the CPU data cache is using a write-allocate mode, │
│ this option is unlikely to provide any performance gain. │
│ │
│ Symbol: UACCESS_WITH_MEMCPY [=y] │
│ Prompt: Use kernel mem{cpy,set}() for {copy_to,clear}_user() (EXPERIMENTAL) │
│ Defined at arch/arm/Kconfig:1474 │
│ Depends on: MMU [=y] && EXPERIMENTAL [=y] │
│ Location: │
│ -> Kernel Features
?

dragonnn said:
Did the kernel have enabled:
Code:
CONFIG_UACCESS_WITH_MEMCPY: │
│ │
│ Implement faster copy_to_user and clear_user methods for CPU │
│ cores where a 8-word STM instruction give significantly higher │
│ memory write throughput than a sequence of individual 32bit stores. │
│ │
│ A possible side effect is a slight increase in scheduling latency │
│ between threads sharing the same address space if they invoke │
│ such copy operations with large buffers. │
│ │
│ However, if the CPU data cache is using a write-allocate mode, │
│ this option is unlikely to provide any performance gain. │
│ │
│ Symbol: UACCESS_WITH_MEMCPY [=y] │
│ Prompt: Use kernel mem{cpy,set}() for {copy_to,clear}_user() (EXPERIMENTAL) │
│ Defined at arch/arm/Kconfig:1474 │
│ Depends on: MMU [=y] && EXPERIMENTAL [=y] │
│ Location: │
│ -> Kernel Features
?
Click to expand...
Click to collapse
Disabled

Wayland_ACE said:
Here is code from kernel driver
Code:
static int __msm_get_pic(struct msm_sync *sync, struct msm_ctrl_cmd *ctrl)
{
int rc = 0;
int tm;
unsigned long flags = 0;
struct msm_queue_cmd *qcmd = NULL;
tm = (int)ctrl->timeout_ms;
spin_lock_irqsave(&sync->abort_pict_lock, flags);
sync->get_pic_abort = 0;
spin_unlock_irqrestore(&sync->abort_pict_lock, flags);
rc = wait_event_interruptible_timeout(
sync->pict_q.wait,
!list_empty_careful(
&sync->pict_q.list) || sync->get_pic_abort,
msecs_to_jiffies(tm));
spin_lock_irqsave(&sync->abort_pict_lock, flags);
if (sync->get_pic_abort) {
sync->get_pic_abort = 0;
spin_unlock_irqrestore(&sync->abort_pict_lock, flags);
return -ENODATA;
}
spin_unlock_irqrestore(&sync->abort_pict_lock, flags);
if (list_empty_careful(&sync->pict_q.list)) {
if (rc == 0)
return -ETIMEDOUT;
This function return case is last line:
Code:
return -ETIMEDOUT
---------- Post added at 04:30 PM ---------- Previous post was at 04:25 PM ----------
Have you got a liboemcamera.so from froyo for GIO?
---------- Post added at 04:34 PM ---------- Previous post was at 04:30 PM ----------copy_to_user
Why do you think so?
Click to expand...
Click to collapse
Because i've created a 'debug' msm_camera.c' and spit out to dmesg, what copy_to_user returned. If copy_to_user fails, it returns the amount of bytes, it could not transfer from kernel to userspace. If it succeeds, it returns 0. And it did not return 0 ...

Wayland_ACE said:
Disabled
Click to expand...
Click to collapse
Small suggestion, try to enable it, I am using it in my kernel and It doesn't make problems, maybe it will help??

There is definitely some problem with the kernel..
which kernel are u using?? try rebuilding kernel using whisp sources if you can and porting the drivers (if needed) for ace..

Kernel prob for sure

case MSM_CAM_IOCTL_GET_PICTURE:
rc = msm_get_pic(pmsm->sync, argp);
Maybe non-related to issue, but that method should receive this args?
(struct msm_sync *sync, struct msm_ctrl_cmd *ctrl)
Click to expand...
Click to collapse
Only a doubt for understand more this error...

I saw the logcat and saw
Code:
can_write = 0
Is that the problem
Sent from a Samsung Galaxy Ace

CallMeVentus said:
I saw the logcat and saw
Code:
can_write = 0
Is that the problem
Sent from a Samsung Galaxy Ace
Click to expand...
Click to collapse
that might be case as i saw on google groups that camera app was not having write permissions to external media / cache

What happens when you take pictures with 3MP, not 5 ?

rohan007 said:
There is definitely some problem with the kernel..
which kernel are u using?? try rebuilding kernel using whisp sources if you can and porting the drivers (if needed) for ace..
Click to expand...
Click to collapse
Its not problem with karnel Fit has same problem, And only thing that is the same for Fit and Ace is 5MP camera i realy dont know why that is problem. Gio and Mini work without problem (both 3MP).

rohan007 said:
There is definitely some problem with the kernel..
which kernel are u using?? try rebuilding kernel using whisp sources if you can and porting the drivers (if needed) for ace..
Click to expand...
Click to collapse
What do you mean by 'Whisp sources' ?
In first post i have written which kernel source we use. Don't get me wrong, but you should know better because you are a member of 'jellaxy' on github ?

I'll upload new libcamera later

lagloose said:
What do you mean by 'Whisp sources' ?
In first post i have written which kernel source we use. Don't get me wrong, but you should know better because you are a member of 'jellaxy' on github ?
Click to expand...
Click to collapse
I wasn't online for a few days so I didn't knew u were using the same sources
Meanwhile me and whisp have been trying to change many things in libcamera and hopefully it would make camera work.. let's hope for the best
Sent from my GT-S5570 using xda app-developers app

rohan007 said:
I wasn't online for a few days so I didn't knew u were using the same sources
Meanwhile me and whisp have been trying to change many things in libcamera and hopefully it would make camera work.. let's hope for the best
Sent from my GT-S5570 using xda app-developers app
Click to expand...
Click to collapse
I'm curious what you did, and hope it, works
Sent from my GT-S5830 using xda app-developers app

Latest suggestion...
Perhaps it has something to do with the fact that only cooper does different sensor_config. See msm_camera.c lin 2424:
...
case MSM_CAM_IOCTL_GET_CAMERA_INFO:
rc = msm_get_camera_info(argp);
break;
#if defined(CONFIG_MACH_TASS) || defined(CONFIG_MACH_BENI) || defined(CONFIG_MACH_LUCAS) || defined (CONFIG_MACH_GIO) || defined(CONFIG_MACH_CALLISTO)
case MSM_CAM_IOCTL_PCAM_CTRL_8BIT:
sensor_rough_control(argp);
rc = 0;
break;
#elif defined(CONFIG_MACH_COOPER)
case MSM_CAM_IOCTL_PCAM_CTRL_8BIT:
sensor_ext_config(argp);
rc = 0;
break;
#endif
default:
rc = msm_ioctl_common(pmsm, cmd, argp);
break;
}
...
can't check this out now, i'm too tired after a lot of source code inspection..
Greetz

Related

[Q] COMILE ERROR : undefined reference to `__bad_udelay'

Is there anyone to give advice to me this compiling error?
When compile with CFLAG '-O2' option, it's successful but '-O3' can't be.
Compile Error message :
drivers/built-in.o: In function `mcsdl_delay':
Kernel/drivers/input/keyboard/melfas_download.c:1779: undefined reference to `__bad_udelay'
Kernel/drivers/input/keyboard/melfas_download.c:1779: undefined reference to `__bad_udelay'
Kernel/drivers/input/keyboard/melfas_download.c:1779: undefined reference to `__bad_udelay'
Kernel/drivers/input/keyboard/melfas_download.c:1779: undefined reference to `__bad_udelay'
Kernel/drivers/input/keyboard/melfas_download.c:1779: undefined reference to `__bad_udelay'
make: *** [.tmp_vmlinux1] Error 1
Compiling infor is following;
- galaxy S M110S
- Toolchain :codesourcery 2010.9-51 arm-none-eabi-
- compile option : -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-fno-delete-null-pointer-checks \
-mcpu=cortex-a8 \
-mfpu=neon -mfloat-abi=softfp
- KBUILD_CFLAGS += -O3
The body of 'melfas_download.c' about 1779line
Code:
//============================================================
//
// Delay Function
//
//============================================================
static void mcsdl_delay(UINT32 nCount)
{
#if 1
udelay(nCount); //1 Baseband delay function
#else
UINT32 i;
for(i=0;i<nCount;i++){
}
#endif
}

HTC Touch Diamond serials

It might be that I'm overlooking an existing thread about this subject but I want to create a list of HTC Touch Diamond serials for downloading STOCK ROMS from the HTC website.
Code:
╒════════╤═════════════════╤════════╤═════════════╕
│TYPE │LANGUAGE │CODE │SERIAL │
╞════════╪═════════════════╪════════╪═════════════╡
│Diamond │Dutch │NLD │HT822GN30038 │
│Diamond │EUR WWE │WWE │HT822GN30039 │
│Diamond │ME English Only │WWE_ME │HT822GN20000 │
│Diamond │Arabic_ME │ME │HT822GN20000 │
│Diamond │ │ │HT822GN10000 │ <- Works for the BBConect download from HTC
└────────┴─────────────────┴────────┴─────────────┘
If someone knows a serial for a language that is not in this list, let me know! I'll add it...

[Q][Kernel][DEVS] 3.0.8 Kernel Question

Please HELP
I ported SIO,
THis is what i get:
Code:
block/sio-iosched.c:315:3: error: unknown field 'elevator_queue_empty_fn' specified in initializer
block/sio-iosched.c:315:3: warning: initialization from incompatible pointer type [enabled by default]
block/sio-iosched.c:315:3: warning: (near initialization for 'iosched_sio.ops.elevator_activate_req_fn') [enabled by default]
make[1]: *** [block/sio-iosched.o] Error 1
make: *** [block] Error 2
I only dont understand elevator queue empty. I think i should add a queue for it?
You porting SIO from where?
Do you know the basic of C language?
Read this GNU GCC.
nicholaschw said:
Please HELP
I ported SIO,
THis is what i get:
Code:
block/sio-iosched.c:315:3: error: [B]unknown field[/B] 'elevator_queue_empty_fn' [B]specified in initializer[/B]
block/sio-iosched.c:315:3: warning: initialization from incompatible pointer type [enabled by default]
block/sio-iosched.c:315:3: warning: (near initialization for 'iosched_sio.ops.elevator_activate_req_fn') [enabled by default]
make[1]: *** [block/sio-iosched.o] Error 1
make: *** [block] Error 2
I only dont understand elevator queue empty. I think i should add a queue for it?
Click to expand...
Click to collapse
I'll explain.
Code:
//Test Application
typedef struct _user{
const char* name;
const char* password;
char age;
} user;
int main(){
//And we initialize it
struct _user someUser = {
//Lets initialize the variables
.name = "James Bond",
.password = "007",
.age = 21,
//Lets be rebel and break it
.unkownVariable = "Unkown Value"
};
//You are calling a field thats not there
//Exit Gracefully
return 0;
}
The code you tried porting into your kernel is made for a different kernel (not 3.0.8) or you simply forgot a inlcude somewhere,
xonar_ said:
I'll explain.
Code:
//Test Application
typedef struct _user{
const char* name;
const char* password;
char age;
} user;
int main(){
//And we initialize it
struct _user someUser = {
//Lets initialize the variables
.name = "James Bond",
.password = "007",
.age = 21,
//Lets be rebel and break it
.unkownVariable = "Unkown Value"
};
//You are calling a field thats not there
//Exit Gracefully
return 0;
}
The code you tried porting into your kernel is made for a different kernel (not 3.0.8) or you simply forgot a inlcude somewhere,
Click to expand...
Click to collapse
Jackpot. I ported from 2. 6. 3. 5. Help me. Everything is ready in github
Sent from my LG-P970 using Tapatalk 2
nicholaschw said:
Jackpot. I ported from 2. 6. 3. 5. Help me. Everything is ready in github
Sent from my LG-P970 using Tapatalk 2
Click to expand...
Click to collapse
Try looking at what the headers look like to look for the difference that broke it. It's possible that they just changed the name and just renaming it could fix. Its also possible that they made crucial design changes and it will stay broken unless you port it from another kernel with very similar headers. I'm going to be busy now for a few hours so I can't check it now.
Sent from my LG-P970

Dock resistors (Dock, Car, Headset)

I was searching for the correct resistor value to enable the advanced function on my generic compatible dock.
Looked at the kernel and found on drivers/misc/cable_detect_8xxx.c the function cable_detect_get_type
...
if (adc > 150 && adc < 220)
type = DOCK_STATE_CAR;
else if (adc > 370 && adc < 440)
type = DOCK_STATE_USB_HEADSET;
else if (adc > 440 && adc < 550)
type = DOCK_STATE_DMB;
else if (adc > 550 && adc < 900)
type = DOCK_STATE_DESK;
else
type = DOCK_STATE_UNDEFINED;
...
and second_detect
...
if ((pInfo->mhl_version_ctrl_flag) || (adc_value >= 776 && adc_value <= 1020))
#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
type = DOCK_STATE_MHL;
#else
type = DOCK_STATE_UNDEFINED;
#endif
else if(adc_value >= 1021 && adc_value <= 1224)
#ifdef CONFIG_USB_OTG_HOST_CHG
type = DOCK_STATE_HOST_CHG_DOCK;
#else
type = DOCK_STATE_AUDIO_DOCK;
#endif
else
#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
type = DOCK_STATE_USB_HOST;
#else
type = DOCK_STATE_UNDEFINED;
#endif
...
Need help to find how to convert these values to resistor values.
Thank you
CyberPK said:
I was searching for the correct resistor value to enable the advanced function on my generic compatible dock.
Looked at the kernel and found on drivers/misc/cable_detect_8xxx.c the function cable_detect_get_type
...
if (adc > 150 && adc < 220)
type = DOCK_STATE_CAR;
else if (adc > 370 && adc < 440)
type = DOCK_STATE_USB_HEADSET;
else if (adc > 440 && adc < 550)
type = DOCK_STATE_DMB;
else if (adc > 550 && adc < 900)
type = DOCK_STATE_DESK;
else
type = DOCK_STATE_UNDEFINED;
...
and second_detect
...
if ((pInfo->mhl_version_ctrl_flag) || (adc_value >= 776 && adc_value <= 1020))
#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
type = DOCK_STATE_MHL;
#else
type = DOCK_STATE_UNDEFINED;
#endif
else if(adc_value >= 1021 && adc_value <= 1224)
#ifdef CONFIG_USB_OTG_HOST_CHG
type = DOCK_STATE_HOST_CHG_DOCK;
#else
type = DOCK_STATE_AUDIO_DOCK;
#endif
else
#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
type = DOCK_STATE_USB_HOST;
#else
type = DOCK_STATE_UNDEFINED;
#endif
...
Need help to find how to convert these values to resistor values.
Thank you
Click to expand...
Click to collapse
Learn how analog to digital conversion works. If you cannot figure that out, you're in over your head.
Resistor values between pin4/5 for HTC ONE explained
jthatch12 said:
Learn how analog to digital conversion works. If you cannot figure that out, you're in over your head.
Click to expand...
Click to collapse
Thank you for your USELESS comment.
I've figured out that the values are the mV read on the pin4 after the application of a resistor between pin4 and pin5.
It is a simple Voltage divider (http://en.wikipedia.org/wiki/Voltage_divider)
Misured Voltage between pin4 and pin5 (Vin) = 1,8V = 1800 mV
Misured shortcut current between pin4 and pin5 = 0,18uA
Calculated pullup resistor (Z1): 100000 ohm
So tha math in simple:
Z2 = (Z1*adc)/(Vin-adc)
or
Z2 = Z1 / ((Vin/adc)-1)
DOCK_STATE_CAR -> 150mV < adc < 220mV -> 9091Ω < Z2 < 13924Ω | use 10000Ω
DOCK_STATE_USB_HEADSET -> 370mV < adc < 440mV -> 25874Ω < Z2 < 32353Ω | use 27000Ω
DOCK_STATE_DMB -> 440mV < adc < 550mV -> 32353Ω < Z2 < 44000Ω | use 39000Ω
DOCK_STATE_DESK -> 550mV < adc < 900mV -> 44000Ω < Z2 < 100000Ω | use 56000Ω or 68000Ω or 82000Ω
IF
-100mV < adc < 100mV -> -5263Ω < Z2 < 5882Ω ----> 0Ω < Z2 < 5882Ω | simply shortcut
ENABLE pin1 output of 5v and read again pin4 and pin5
MHL -> 776mV < adc < 1020mV
HOST_CHG_DOCK/DOCK_STATE_AUDIO_DOCK -> 1021mV < adc < 1224mV
USB HOST any other value
Regards
CyberPK said:
Thank you for your USELESS comment.
Click to expand...
Click to collapse
2.3 Flaming / Lack of respect: XDA is about sharing and this does not involve virtual yelling (flaming) or rudeness.
Click to expand...
Click to collapse
If you found his comment useless then just don't reply to it, no needs to start a fight here.
Please stay polite and respectful
thanks
alray said:
If you found his comment useless then just don't reply to it, no needs to start a fight here.
Please stay polite and respectful
thanks
Click to expand...
Click to collapse
ok... thank you...
FYI I was not " 2.3 Flaming / Lack of respect: XDA is about sharing and this does not involve virtual yelling (flaming) or rudeness." I was simply stating a fact. ADC stands for ANALOG TO DIGITAL CONVERSION.... shocker, I know. I am an electrical engineer and I see all too often people screwing stuff up.

[Q] How to modify memory capacity?

Hello guys,
Here is the script to get RAM capacity of a device. It's really different to other device specs that I read.
I have no idea how to hook to change it (memInfo.totalMem) .
PHP:
ActivityManager actManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
actManager.getMemoryInfo(memInfo);
long totalMemory = memInfo.totalMem;
The system file "/proc/meminfo" also holds RAM memory info, I tried to modify this file but didn't affect.
Is there anyway to solve this problem??
Have a nice day.
kidsphy said:
Hello guys,
Here is the script to get RAM capacity of a device. It's really different to other device specs that I read.
I have no idea how to hook to change it (memInfo.totalMem) .
PHP:
ActivityManager actManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
actManager.getMemoryInfo(memInfo);
long totalMemory = memInfo.totalMem;
The system file "/proc/meminfo" also holds RAM memory info, I tried to modify this file but didn't affect.
Is there anyway to solve this problem??
Have a nice day.
Click to expand...
Click to collapse
You can try:
Code:
ActivityManager.MemoryInfo memInfo = (ActivityManager.MemoryInfo) XposedHelpers.newInstance(ActivityManager.MemoryInfo.class);
XposedHelpers.setObjectField(memInfo, "totalMem", 141211211L);
OR:
Code:
Constructor<?> constructLayoutParams = XposedHelpers.findConstructorExact(android.app.ActivityManager.MemoryInfo.class, Parcel.class);
constructLayoutParams.setAccessible(true);
XposedBridge.hookMethod(constructLayoutParams, new XC_MethodHook(XCallback.PRIORITY_HIGHEST) {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (param.args[0] != null) {
param.args[0] = new CustomMemoryInfo();
}
}});
CustomMemoryInfo extends MemoryInfo class, you can override super method to change "totalMem" attribute
hahalulu said:
You can try:
Code:
ActivityManager.MemoryInfo memInfo = (ActivityManager.MemoryInfo) XposedHelpers.newInstance(ActivityManager.MemoryInfo.class);
XposedHelpers.setObjectField(memInfo, "totalMem", 141211211L);
OR:
Code:
Constructor<?> constructLayoutParams = XposedHelpers.findConstructorExact(android.app.ActivityManager.MemoryInfo.class, Parcel.class);
constructLayoutParams.setAccessible(true);
XposedBridge.hookMethod(constructLayoutParams, new XC_MethodHook(XCallback.PRIORITY_HIGHEST) {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (param.args[0] != null) {
param.args[0] = new CustomMemoryInfo();
}
}});
CustomMemoryInfo extends MemoryInfo class, you can override super method to change "totalMem" attribute
Click to expand...
Click to collapse
Thank for your reply, but it doesn't work. Have you ever tried running this piece or it's just your thinking?
Here's a commented example of doing this (at least for the method that you posted):
Java:
// Hook the method getMemoryInfo from the ActivityManager class
XposedHelpers.findAndHookMethod(ActivityManager.class, "getMemoryInfo", ActivityManager.MemoryInfo.class, new XC_MethodHook() {
// We use afterHooked here because you have to modify the values *after* the method already setup the object,
// as this method take the object passed as argument and parcel the data (it's always good to check the source)
// https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/ActivityManager.java#2358 > which calls
// https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/ActivityManagerNative.java#4918
[user=439709]@override[/user]
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
// Method contructor -> public void getMemoryInfo(MemoryInfo outInfo)
// As you can see, the getMemoryInfo take a MemoryInfo object as argument
// you just have to get the object from the arguments array, and then cast
// to MemoryInfo to set the desired field
((ActivityManager.MemoryInfo) param.args[0]).totalMem = 12345678L;
((ActivityManager.MemoryInfo) param.args[0]).availMem = 87654321L;
}
});
mauricio_C said:
Here's a commented example of doing this (at least for the method that you posted):
Click to expand...
Click to collapse
Thank you so much :good:

Categories

Resources