t2k269 / PerAppHacking

Allow apply some hacking to applications by Xposed Framework
48 stars 16 forks source link

Disable date #5

Open francwalter opened 10 years ago

francwalter commented 10 years ago

Is it possible to disable the request of the system date for an individual app? Or giving a fixed date?

E.g. if a calender app tries to get the system date and time, the PerAppHacking module gives always the 1.1.2001, but only for this calendar app.

Is this theoretically possible for this module?

Dzakus commented 10 years ago

Why? What is this sense?

francwalter commented 10 years ago

I have problems with my phone on a battery change (I often have to do this), the date is then initially 1.1.2000. Some Apps complain then about unvalid date and I have to check each time manually the bloody date. It is a bigger problem, when I have no internet access, because then the date is not automatically set (only after a while anyway).

So is this possible or not?

Dzakus commented 10 years ago

I think, the better it will be better when I set different date for start, ex. last known.

francwalter commented 10 years ago

So it is possible?

Dzakus commented 10 years ago

Per App date - I don't know. Probably yes Set another date on boot if is invalid - possible https://github.com/android/platform_frameworks_base/blob/master/services/java/com/android/server/SystemServer.java end of File

I am writing a mobile phone, so I can not make deep analysis. I can only refer to (brain) memory.

Dzakus commented 10 years ago

Per App date - I don't know. Probably yes Set another date on boot if is invalid - possible https://github.com/android/platform_frameworks_base/blob/master/services/java/com/android/server/SystemServer.java end of File

I am writing a mobile phone, so I can not make deep analysis. I can only refer to (brain) memory.

Dzakus commented 10 years ago

Per App date - I don't know. Probably yes Set another date on boot if is invalid - possible https://github.com/android/platform_frameworks_base/blob/master/services/java/com/android/server/SystemServer.java end of File

I am writing a mobile phone, so I can not make deep analysis. I can only refer to (brain) memory.

francwalter commented 10 years ago

I am writing a mobile phone...

What? You are writing a mobile phone?? What do you mean? The base-band?

Dzakus commented 10 years ago

Writing on mobile phone because i come back to home by train. Sorry.

francwalter commented 10 years ago

Ah, OK :) Sorry for misunderstanding this.

t2k269 commented 10 years ago

As Dzakus mentioned, I can save the time when the first request of getting time (base_time). Then return (current_time - base_time + fake_time) in subsequence calls.

Can it fulfill your request?

francwalter commented 10 years ago

I think and hope so, I would try it. Thank!

francwalter commented 10 years ago

Could this be per app?

t2k269 commented 10 years ago

Yes, it is per app. I have implemented and only hooked System.currentTimeMillis. But it seems doesn't work on Calendar app. What app will you try to fake?

t2k269 commented 10 years ago

For Calendar app, it uses android.text.format.Time.setToNow to obtain the current time. I also hooked setToNow method to force it to set to the fake time. Please wait for my update.

francwalter commented 10 years ago

OK, I wait and will test. Thank you manyly already :) How do you see, which time-function an app uses? For WhatsApp, your hack already works, for other apps not (e.g. andclip).