frida-java-bridge icon indicating copy to clipboard operation
frida-java-bridge copied to clipboard

How to call super.onCreate()

Open siebeneicher opened this issue 6 years ago • 3 comments

Hi, I have this decompiled Java snippet

public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    [....SOME_UNWATED_CODE....]
    startActivity(a());
    finish();
}

and would like to replay it without executing the [....SOME_UNWATED_CODE....] block. Thats what I tried:

Java.perform(function () {
	Bhi.onCreate.overload("android.os.Bundle").implementation = function (bundle) {
		this.super.onCreate(bundle);
		this.startActivity(this.a());
		this.finish();
	}
});

It breaks with error, this.super is undefined. Any ideas how to make this working? Kind regards, Markus

siebeneicher avatar Jan 17 '19 08:01 siebeneicher

Hi,I am from China,I can resolve it. You should do it like this: Java.perform(function () { Bhi.onCreate.overload("android.os.Bundle").implementation = function (bundle) { this.onCreate(bundle);//remove super,then it works! this.startActivity(this.a()); this.finish(); } });

Xrosen avatar Jan 22 '19 06:01 Xrosen

Hi,I am from China,I can resolve it. You should do it like this: Java.perform(function () { Bhi.onCreate.overload("android.os.Bundle").implementation = function (bundle) { this.onCreate(bundle);//remove super,then it works! this.startActivity(this.a()); this.finish(); } });

This is not a fundamental solution,I think what the publisher wants is how to call the method of the parent class

tcc0lin avatar Apr 15 '21 07:04 tcc0lin

this.super doesn't exist because you should use this.$super instead. I'm not sure if it's documented somewhere

yotamN avatar Jun 15 '21 19:06 yotamN