Hi
This is the solution to fix the StartingAlertService Wakelock
To reproduce the problem (or the fix) modify calendar settings to notify events in status bar, create a an event and add a reminder inmediatly, so a notificantion is triggered and you can see it in status bar, open BetterBatteryStats and you can check in partial wakelocks if you have the StartingAlertService Wakelock. You will see that the wakelock is always working, you only need to refresh data and the wakelock time is increased, the wakelock is not released until you close to notification.
The problem is in TouchWizCalendar.apk not releasing the wakelock properly in class ServiceHandler inside class AlertService
The actual code is:
Code:
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
processMessage(msg);
AlertService.this.stopSelf();
}
}
If you check the new android sources you can see the next code:
Code:
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
processMessage(msg);
// NOTE: We MUST not call stopSelf() directly, since we need to
// make sure the wake lock acquired by AlertReceiver is released.
AlertReceiver.finishStartingService(AlertService.this, msg.arg1);
}
}
So the next change will fix the problem. You have to decompile TouchWizCalendar.apk locate com/android/calendar/AlertService$ServiceHandler.smali and search & replace next code.
Search (the last method):
Code:
# virtual methods
.method public handleMessage(Landroid/os/Message;)V
.registers 3
.parameter "msg"
.prologue
.line 594
iget-object v0, p0, Lcom/android/calendar/AlertService$ServiceHandler;->this$0:Lcom/android/calendar/AlertService;
invoke-virtual {v0, p1}, Lcom/android/calendar/AlertService;->processMessage(Landroid/os/Message;)V
.line 598
iget-object v0, p0, Lcom/android/calendar/AlertService$ServiceHandler;->this$0:Lcom/android/calendar/AlertService;
invoke-virtual {v0}, Lcom/android/calendar/AlertService;->stopSelf()V
.line 601
return-void
.end method
Replace by:
Code:
# virtual methods
.method public handleMessage(Landroid/os/Message;)V
.registers 4
.parameter "msg"
.prologue
iget-object v0, p0, Lcom/android/calendar/AlertService$ServiceHandler;->this$0:Lcom/android/calendar/AlertService;
invoke-virtual {v0, p1}, Lcom/android/calendar/AlertService;->processMessage(Landroid/os/Message;)V
iget-object v0, p0, Lcom/android/calendar/AlertService$ServiceHandler;->this$0:Lcom/android/calendar/AlertService;
iget v1, p1, Landroid/os/Message;->arg1:I
invoke-static {v0, v1}, Lcom/android/calendar/AlertReceiver;->finishStartingService(Landroid/app/Service;I)V
return-void
.end method
Now recompile TouchWizCalendar.apk and replace it.
I've attached a cwm zip file to create a backup (TouchWizCalendar.apk.bak), replace the apk, and clear battery stats to reset wakelocks counters (reset battery stats doesn't affect to SGS2 battery, the battery chip doesn't need that info). The apk is based on kk5 rom.
If you don't want to use the cwm file you can extract TouchWizCalendar.apk from the zip and use root explorer (or similar) to replace the file, don't forget to make a backup of your original apk.
Edit:
If you get:
Code:
# virtual methods
.method public handleMessage(Landroid/os/Message;)V
.locals 1
.parameter "msg"
...
...
...
when decompile then replace with
Code:
# virtual methods
.method public handleMessage(Landroid/os/Message;)V
.locals 2
.parameter "msg"
...
...
...
Edit2:
If you use odexed rom delete or rename the odex file (maybe com.android.calendar.odex or TouchWizCalendar.odex, I'm not sure) to be sure classes.dex is used from deodexed apk
Edit3:
I've updated the zip to be sure odex file is not used in odexed roms
hi
it will work on xwkk5 stock rom odexed?
Hi,
this works fine on CheckRom v4, StartingAlertService now 0,3%.
with friendly greet
starbase64
pissyhun said:
hi
it will work on xwkk5 stock rom odexed?
Click to expand...
Click to collapse
I think so, but I'm not sure. To be sure that you can revert the changes make a backup (or rename) of the apk(TouchWizCalendar.apk.bak) and the odex calendar files, then delete the odex (I think the odex will be com.android.calendar.odex) and install the zip.
You can always to reodex (http://forum.xda-developers.com/showthread.php?t=1208320)
hi
thx for the answer but i am not a developer or an expert in android commands. i read the post u link but gave me headache)))
i will save the file and use it with a deodexed rom.
pissyhun said:
hi
thx for the answer but i am not a developer or an expert in android commands. i read the post u link but gave me headache)))
i will save the file and use it with a deodexed rom.
Click to expand...
Click to collapse
Wise decision
Great. Will implement this in my Note ROM
Love your fix
Yesterday I've installed your fix, and my wake locks for startingalertservice are gone. For your information I'm running a rooted version of the standard i9100XWKK2. Thanks again for your work, my battery time increased quit a bit.
hugoxboss said:
Yesterday I've installed your fix, and my wake locks for startingalertservice are gone. For your information I'm running a rooted version of the standard i9100XWKK2. Thanks again for your work, my battery time increased quit a bit.
Click to expand...
Click to collapse
Glad to hear it
just to make sure, if my wakelocks are in seconds in betterbatterystats, i'm good right?
ATN24 said:
just to make sure, if my wakelocks are in seconds in betterbatterystats, i'm good right?
Click to expand...
Click to collapse
that's right
Thanks for the instructions!
However, my calendar apk file has a bit of a difference in the code.
For example, it starts with:
# virtual methods
.method public handleMessage(Landroid/os/MessageV
.locals 1
.parameter "msg"
Can I use the same instructions?
Excellent job,thanks very much for by apk
Does anyone know if this APK will work for UCKK6?
Thanks a bunch rodries, this is awesome. Instead of ".registers 3", my AlertService$ServiceHandler.smali had ".locals 1". So, I went ahead and changed that to ".registers 4" as well.
Just revised KK5 TouchWizCalendar.apk, working well.
itaykoren said:
Thanks for the instructions!
However, my calendar apk file has a bit of a difference in the code.
For example, it starts with:
# virtual methods
.method public handleMessage(Landroid/os/MessageV
.locals 1
.parameter "msg"
Can I use the same instructions?
Click to expand...
Click to collapse
I think it's safe use same instructions. I'm using last smali and kk5 apk.
Hello rodies,
i am sorry but i can`t get it to work with my GingerMod v0.7 Rom.
http://forum.xda-developers.com/showthread.php?t=1220283
Neither the cwm-file nor the copy direct option works.
I have the Wakelock also. I am not a programmer. So things like compile decompile are chinese to me.
Is it somehowe possible that you can contact the Developer of GingerMod that he can apply this patch for his Rom.
Many thanks in advanced.
Would this issue be fixed if I just deleted the apk entirely?
crossover37 said:
Would this issue be fixed if I just deleted the apk entirely?
Click to expand...
Click to collapse
Lol, did you think this through... are you serious? You do realize it's required to use your calendar, not to mention it might cause your phone to crash continuously given all the other items that call on the calendar.
TheMatrix2000 said:
Hello rodies,
i am sorry but i can`t get it to work with my GingerMod v0.7 Rom.
http://forum.xda-developers.com/showthread.php?t=1220283
Neither the cwm-file nor the copy direct option works.
I have the Wakelock also. I am not a programmer. So things like compile decompile are chinese to me.
Is it somehowe possible that you can contact the Developer of GingerMod that he can apply this patch for his Rom.
Many thanks in advanced.
Click to expand...
Click to collapse
Upload your original TouchWizCalendar.apk, I'll create a cwm file for you
Related
I'm starting this thread as a result of trying to port Paranoid Android 2.51 from the saga. Long story short, turns out previous known ways to fix keyboard problems in ICS ports no longer work for Jelly Bean.
Please PM me and post useful info in this thread.... I absolutely do not want this to turn into a "how do I do this" thread.... This is for exchanging knowledges and discussion.
Progress so far: Thanks to strapped365, who has successfully ported PA 2.xx WITH working keyboard for the myTouch 4G Slide, We now know how to enable the soft keyboard. strapped365's instructions were off the top of his head, so here I have written a revised version with detailed instructions.
If you want to help out but are a n00b at editing .apk files, please follow this simple guide for de/ recompiling with APKTool.
SOFT KEYBOARD FIX
Using apktool, decompile framework-res.apk, then open res/values/bools.XML . Look for
Code:
<bool name="config_forceDisableHardwareKeyboard">[COLOR="Red"]false[/COLOR]</bool>
Change it to
Code:
<bool name="config_forceDisableHardwareKeyboard">[COLOR="Red"]true[/COLOR]</bool>
Before I go any further, I'm not convinced this is the best way to fix the problem because this boolean suggests we are saying that we should force the hardware keyboard to not be used just to get the soft keyboard up instead, although at least the hardware keyboard is still recognised. We need to look more into android.policy.jar stuff.
Anyway, now go into res/values/integers.XML and find
Code:
<integer name="config_lidOpenRotation">[COLOR="red"]-1[/COLOR]</integer>
Change it to
Code:
<integer name="config_lidOpenRotation">[COLOR="red"]90[/COLOR]</integer>
Still in integers.XML, look for
Code:
<integer name="config_lidNavigationAccessibility">[COLOR="red"]0[/COLOR]</integer>
and change it to
Code:
<integer name="config_lidNavigationAccessibility">[COLOR="Red"]1[/COLOR]</integer>
DO NOT change
Code:
<integer name="config_lidKeyboardAccessibility">[COLOR="red"]0[/COLOR]</integer>
When I did, I got bootloops.
Click to expand...
Click to collapse
PHYSICAL KEYBOARD BUTTON BACKLIGHT
I've tried lms24's fix for ICS (scroll down to the bottom of the post) but unfortunately this does not work, which I'm slightly surprised at being as other framework tweaks (for soft keyboard) work, and comparing JB's values for this stuff to ICS's does not show much difference.
Click to expand...
Click to collapse
PHYSICAL KEYBOARD OPEN / LID OPEN STATE (SCREEN ROTATION UPON OPENING KEYBOARD)
I've had a look in android.policy.jar and in PhoneWindowManager.smali there is an interesting method, it is in the original Jelly Belly ROM (which is what, if you're porting, you should be using because the other JB ROMs are test builds) but is not in the PA ROM I'm porting (nor will it be in any other non-Vision ROM, I guess). Take a look. Simply putting the method into the ported ROM's PhineWindowManager.smali file doesn't work, there must be something deeper at work here.
Code:
.method private applyLidSwitchState()V
.registers 4
.prologue
.line 5042
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mPowerManager:Landroid/os/LocalPowerManager;
invoke-direct {p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isBuiltInKeyboardVisible()Z
move-result v1
invoke-interface {v0, v1}, Landroid/os/LocalPowerManager;->setKeyboardVisibility(Z)V
.line 5044
iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLidState:I
if-nez v0, :cond_1a
iget-boolean v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLidControlsSleep:Z
if-eqz v0, :cond_1a
.line 5045
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mPowerManager:Landroid/os/LocalPowerManager;
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v1
invoke-interface {v0, v1, v2}, Landroid/os/LocalPowerManager;->goToSleep(J)V
.line 5047
:cond_1a
return-void
.end method
Click to expand...
Click to collapse
TO FINISH OFF
Here's how strapped365 told me to finish it off (I used Ubuntu's built in archive manager to do this, it should work fine, if you're not using 7zip just extract the right files from the original, delete the respective files in the new one and pack the old stuff):
Once the apk is compiled open the newly compiled apk with 7zip on one window and then open the original untouched apk in another 7zip window and drag the META_inf and manifest XML from the original apk into the new apk ( the new apk NEEDS these ) once that's done your good to go. Just note that this still leaves an onscreen keyboard in landscape when then keyboard is open, but its better than what your dealing with.
Click to expand...
Click to collapse
Obviously make sure the new file is renamed to to framework-res.apk.
THANKS TO...
ajhavery
lms24
strapped365
For helping me out with all this... so far this is not spawned in any way from my own knowledge (although I have been doing my own investigating) but has been from help and advice from the above.
Click to expand...
Click to collapse
RESERVED
RESERVED
AW: [INFO][REF][MON 18 FEB '13] Jelly Bean Porting thread | Vision Keyboard Fixes
Good job man! This will be appreciated by many g2 devs, when it comes to in porting. Thanks for sharing.
Sent from my HTC One X using xda app-developers app
On my victory running 4.1.2 it had a schedule message option on the menu. Does anyone know how to get it on the s3. I opened feature.xml and changed false to true but it still doesn't show up.
derekb123 said:
On my victory running 4.1.2 it had a schedule message option on the menu. Does anyone know how to get it on the s3. I opened feature.xml and changed false to true but it still doesn't show up.
Click to expand...
Click to collapse
Decompile SecMms.apk
Goto
smali/com/android/mms/MmsConfig.smali
Click to expand...
Click to collapse
FIND:
Code:
.method public static getEnableScheduledMessage()Z
.locals 1
.prologue
.line 878
const/4 v0, 0x0
return v0
.end method
CHANGE TO::
Code:
.method public static getEnableScheduledMessage()Z
.locals 1
.prologue
.line 878
[COLOR="Blue"]const/4 v0, 0x1[/COLOR]
return v0
.end method
Recompile, done
Thanks I'll try that. Do you know why the feature was removed?
I dont know why not even on the S2 was it enabled by default
When I decompile with apk manager it says can't find framework resources for package of id: 2. You must install proper framework files.
This guide was written based on the Sprint Samsung Galaxy S3 ND8 KitKat stock ROM but with the proper modifications may work for other KitKat ROMs. Please don't ask me to modify this to work with ROM xyz or to compile this for you into a ROM. I won't do it.
Background Info
This guide is based on work orignally written by havocgb here. His code was written for the Sony Xperia Mini and had to be somewhat modified for use on our phones so make sure to drop a thank you over in that thread.
Requirements
apktool 2.0 beta 9 and the knowledge of how to use it. There are various guides on how to use apktool on XDA. Find one and read it. Make sure to read the information on the apktool site as well since some of the options in 2.0 may be different from the guides you find.
A text editor that supports Unix-style text files. I recommend Notepad++.
Files
You'll be working with SystemUI.apk
SystemUI.apk
Decompile SystemUI.apk using apktool.
Open smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali in your preferred text editor.
Find # instance fields and add .field private mTouchRight:Z on a new line somewhere before # direct methods.
Find # virtual methods and add the following methods ABOVE it:
Code:
.method private interceptOneFingerStatusBarRightTap(Landroid/view/MotionEvent;)V
.locals 4
.param p1, "event" # Landroid/view/MotionEvent;
.prologue
iget-boolean v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedVisible:Z
if-nez v1, :cond_1
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mDisplay:Landroid/view/Display;
invoke-virtual {v0}, Landroid/view/Display;->getRotation()I
move-result v1
const v0, 0x1
if-eq v0, v1, :cond_2
const v0, 0x3
if-eq v0, v1, :cond_2
const/high16 v1, 0x44070000
:goto_0
invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F
move-result v0
cmpl-float v0, v0, v1
if-ltz v0, :cond_0
const/4 v1, 0x1
iput-boolean v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTouchRight:Z
goto :goto_1
:cond_0
const/4 v1, 0x0
iput-boolean v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTouchRight:Z
:cond_1
:goto_1
return-void
:cond_2
const/high16 v1, 0x44480000
goto :goto_0
.end method
.method private oneFingerStatusBarRightTapFlipToQuickPanel()V
.locals 1
.prologue
iget-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTouchRight:Z
if-eqz v0, :cond_0
invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->flipToSettings()V
:goto_0
return-void
:cond_0
invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->flipToNotifications()V
goto :goto_0
.end method
Take note that the line const/high16 v1, 0x44070000 is a floating-point hexadecimal value that controls the starting point of the quick pulldown zone in pixels when in portrait orientation (in this case, the start point is set at approximately 540 pixels from the left side of the status bar) while the line const/high16 v1, 0x44480000 controls the start point of the pulldown zone when in landscape orientation (this value is approximately 800 pixels from the left side of the status bar). For larger screens or to change the size of the drag zone, you'll want to re-calculate these using a floating-point to hexadecimal conversion.
Locate the portion of code that looks like the following:
Code:
.method public flipToNotifications()V
.locals 10
.prologue
const/high16 v9, 0x3f800000
const/4 v8, 0x0
const-wide/16 v6, 0xc8
const/4 v5, 0x1
const/4 v4, 0x0
On a new line under const/4 v4, 0x0, add iput-boolean v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTouchRight:Z
Locate the portion of code that looks like the following:
Code:
.method public flipToSettings()V
.locals 11
.prologue
const-wide/16 v9, 0x15e
const/4 v8, 0x4
const/4 v7, 0x1
const/4 v6, 0x0
const/4 v5, 0x0
On a new line under const/4 v5, 0x0, add iput-boolean v7, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTouchRight:Z
Locate the section of code that looks like the following:
Code:
.method public interceptTouchEvent(Landroid/view/MotionEvent;)Z
.locals 5
.param p1, "event" # Landroid/view/MotionEvent;
.prologue
const/4 v1, 0x0
const/4 v2, 0x1
.line 2973
iget v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindowState:I
if-nez v3, :cond_1
.line 2974
invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I
On a newline above ABOVE the line invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I, add invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->interceptOneFingerStatusBarRightTap(Landroid/view/MotionEventV
Locate the method .method public updateExpandedViewPos(I)V and locate the line return-void inside of the method. On a new line above return-void, add invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->oneFingerStatusBarRightTapFlipToQuickPanel()V.
Save the file and recompile SystemUI using apktool. Don't forget to re-sign the APK (either use an APK signer if you have a ROM that has 3rd-party system app signatures enabled or copy the AndroidManifest.xml file and META-INF folder from the original to the new APK).
Install to your phone using your preferred method. You should already know this but I'll say it anyway, THIS CANNOT BE INSTALLED LIKE NORMAL SIDE-LOADED APKs. I prefer to reboot to recovery and use ADB to push the file to the system, but you can use whatever method is easiest for you (ie. Aroma file manager, flashable zip, etc.).
Thanks for this. I plan on adding this to Tribute in the near future.
I need help please. I'm having error " [5048,15] no viable alternative at input 'p1' " whenever I compile SystemUI.apk. I'm trying to apply this mod on my N8000. Thanks in advance!
filchi756 said:
I need help please. I'm having error " [5048,15] no viable alternative at input 'p1' " whenever I compile SystemUI.apk. I'm trying to apply this mod on my N8000. Thanks in advance!
Click to expand...
Click to collapse
Try using apktool 2.
Thank you for releasing this guide. Looking forward to adding this to my rom.
talkingmonkeys said:
Try using apktool 2.
Thank you for releasing this guide. Looking forward to adding this to my rom.
Click to expand...
Click to collapse
Ok thanks for the suggestion. I will try that.
Need help please .I manage to solve my problem about compiling but when I install it I'm having systemUI stop(foreclose) message. If you have time if possible please help me check my Phonestatusbar.smali ,in what part did I do wrong I've attach my PhoneStatusBar.smali below. Hope you can help me.Thanks in advance.
filchi756 said:
Need help please .I manage to solve my problem about compiling but when I install it I'm having systemUI stop(foreclose) message. If you have time if possible please help me check my Phonestatusbar.smali ,in what part did I do wrong I've attach my PhoneStatusBar.smali below. Hope you can help me.Thanks in advance.
Click to expand...
Click to collapse
Would need to see a logcat. If you don't know how to pull one and post it here, however, I'd say you're not ready to start implementing mods.
moonknightus said:
Would need to see a logcat. If you don't know how to pull one and post it here, however, I'd say you're not ready to start implementing mods.
Click to expand...
Click to collapse
Ok I will post a logcat when I have access to pc. Yeah I think I'm not ready yet for this kind of mods.But I have some little experience in implementing mods in Jellybean before though(by following others guide too), but having a hardtime with kitkat at the moment. By the way any chance you can share me your phonestatusbar.smali or even the SystemUI.apk with you mod included so I can compare it with mine? I think it not necessary to download the whole rom if I just need one apk and beside I don't have S3. And I have a crappy internet connection. Hope you understand.Thanks!
filchi756 said:
Ok I will post a logcat when I have access to pc. Yeah I think I'm not ready yet for this kind of mods.I have some experience in implementing mods in Jellybean before though(by following others guide too), but having a hardtime with kitkatat the moment. By the way any chance you can share me your phonestatusbar.smali or even the SystemUI.apk with you mod included so I can compare it with mine? I think it not necessary to download the whole rom if I just need one apk and beside I don't have S3. And I have a crappy internet connection. Hope you understand.Thanks!
Click to expand...
Click to collapse
Nope. My ROM has multiple mods so the smali and apk will not help you. Not to mention, my phone is a Galaxy S3.
moonknightus said:
Nope. My ROM has multiple mods so the smali and apk will not help you. Not to mention, my phone is a Galaxy S3.
Click to expand...
Click to collapse
Ok thanks.I'll wait for someone's else help, who implemented this mod of your's and with clear instruction I'm capable of understanding(like the guide of havocgb, it has before and after).Your mod is just new that's means just few people implemented it yet in their rom at the moment.When time come's there will surely be someone out there who will write a clear guide which we amateur's will understand. Thanks again for this guide anyway. Cheers mate!
P.S. I think even we have different gadget as long as they are the same brand(like Samsung) .I think there are a lot of similarities on their content. I successfully made mods for my tablet using guides from Note 2014 and Note pro before by the way .
filchi756 said:
Ok thanks.I'll wait for someone's else help, who implemented this mod of your's and with clear instruction I'm capable of understanding.Your mod is just new that's means just few people implemented it yet in their rom at the moment.When time come's there will surely be someone out there who will write a clear guide which we amateur's will understand. Thanks again for this guide anyway. Cheers mate!
P.S. I think even we have different gadget as long as they are the same brand(like Samsung) .I think there are a lot of similarities on their content. I successfully made mods for my tablet using guides from Note 2014 and Note pro before by the way .
Click to expand...
Click to collapse
There's nothing new about this mod. Was originally written for an Xperia phone by havocgb in March 2013. This is clearly stated in the op. If you are incapable of following instructions, modifying the code to fit your device, and debugging your own code, that is not my fault. FYI, others have already successfully implemented this mod. At least one was on a note device.
moonknightus said:
There's nothing new about this mod. Was originally written for an Xperia phone by havocgb in March 2013. This is clearly stated in the op. If you are incapable of following instructions, modifying the code to fit your device, and debugging your own code, that is not my fault. FYI, others have already successfully implemented this mod. At least one was on a note device.
Click to expand...
Click to collapse
Ok. I'll look for that who implemented it on note(If I get lucky).I'm just looking for a quick solution for this cause I really want to implement this to my gadgets. Thankfully you did not suggest "google is your friend" thing to find solution for your problem.I can't access google, its block in my location(China).Thanks again for the guide.Anyway Cool! peace mate!
filchi756 said:
Ok. I'll look for that who implemented it on note(If I get lucky).I'm just looking for a quick solution for this cause I really want to implement this to my gadgets. Thankfully you did not suggest "google is your friend" thing to find solution for your problem.I can't access google, its block in my location(China).Thanks again for the guide.Anyway Cool! peace mate!
Click to expand...
Click to collapse
There's always Baidu. If I run across the PM, I'll shoot the guy's name over to you. I may have deleted it
moonknightus said:
There's always Baidu. If I run across the PM, I'll shoot the guy's name over to you. I may have deleted it
Click to expand...
Click to collapse
Ok thanks mate .That will be great:good:! If I use baidu in China the results are only from China and in chinese(I don't understand Chinese). I tried it before in Hongkong the results are international and in English.Hope you understand what I meant mate.
P.S. I'm trying your other mod here: http://forum.xda-developers.com/gal...t/mod-enable-heads-notifications-nd8-t2873109 .Lets see if I can implement it successfully:fingers-crossed:.
bro. screenshots show the work of this tutorial..
Sorry for my bad english
please upload the screenshot
Updated the SuperUser mode .. Click here
Firstly thanks to sagitt67 from 4PDA ( he did it )
I grabbed it and tested and working
Hope this should help all others
Requirements :-
* core-libart.jar
* services.jar
* Apktool/tickle my android
and patience
1. Decompile core-libart.jar
2. open core-libart/smali/java/security/Signature.smali
look for this method
Code:
.method public final verify([B)Z
in that method find this line
Code:
invoke-virtual {p0, p1}, Ljava/security/Signature;->engineVerify([B)Z
[COLOR="Red"]move-result v0[/COLOR]
Replace the red code with this
Code:
const/4 v0, 0x1
now find this method
Code:
.method public final verify([BII)Z
in that method find this line
Code:
invoke-virtual {p0, p1, p2, p3}, Ljava/security/Signature;->engineVerify([BII)Z
[COLOR="red"]move-result v0[/COLOR]
replace the red line with this
Code:
const/4 v0, 0x1
save and close
3. Now open this core-libart/smali/java/security/MessageDigest.smali
find this method
Code:
.method public static isEqual([B[B)Z
.registers 7
[COLOR="red"]const/4 v2, 0x0 [/COLOR]
Change the red line to this
Code:
const/4 v2, 0x1
save and close
Compile it and Replace
and Continued in next post
Continued
Now decompile services.jar
1. open services/smali/com/android/server/accounts/AccountManagerService.smali
Find this method
Code:
.method private isAccountPresentForCaller(Ljava/lang/String;Ljava/lang/String;)Z
look for this lines
Code:
iget-object v4, v0, Landroid/accounts/Account;->name:Ljava/lang/String;
invoke-virtual {v4, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
[COLOR="Red"] move-result v4
if-eqz v4, :cond_2c[/COLOR]
cond_2c may vary with your code
in that 2 lines do the changes like this
Code:
[COLOR="red"]move-result v4 [/COLOR] to const/4 v4, 0x0
if-[COLOR="red"]eqz[/COLOR] v4, :cond_2c to if-[COLOR="Red"]nez[/COLOR] v4, :cond_2c
save and Close
3. Now open this services/smali/com/android/server/pm/PackageManagerService$InstallParams.smali
look for this method
Code:
.method private installLocationPolicy(Landroid/content/pm/PackageInfoLite;)I
find these lines
Code:
iget v8, p0, Lcom/android/server/pm/PackageManagerService$InstallParams;->installFlags:I
:try_end_22
.catchall {:try_start_10 .. :try_end_22} :catchall_5f
[COLOR="red"]and[/COLOR]-int/lit16 v8, v8, 0x80
Change the red to this
Code:
[COLOR="red"]or[/COLOR]-int/lit16 v8, v8, 0x80
save and Close
4. Now open this services/smali/com/android/server/pm/PackageManagerService.smali
in that look for this method
Code:
.method private checkUpgradeKeySetLP(Lcom/android/server/pm/PackageSetting;Landroid/content/pm/PackageParser$Package;)Z
in that look for these lines
Code:
iget-object v4, p2, Landroid/content/pm/PackageParser$Package;->mSigningKeys:Landroid/util/ArraySet;
invoke-virtual {v4, v3}, Landroid/util/ArraySet;->containsAll(Ljava/util/Collection;)Z
[COLOR="red"]move-result v4
if-eqz v4, :cond_20[/COLOR]
cond_20 may be different with your code
Change re lines to these
Code:
[COLOR="red"]move-result v4[/COLOR] to this const/4 v4, 0x0
if-[COLOR="red"]eqz[/COLOR] v4, :cond_20 to this if-[COLOR="red"]nez[/COLOR] v4, :cond_20
Now look for this method
Code:
.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
and replace with this
Code:
.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
.locals 11
const/4 v7, 0x0
return v7
.end method
and look for this method
Code:
.method private packageIsBrowser(Ljava/lang/String;I)Z
in that find these lines
Code:
iget-object v4, v4, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;
invoke-virtual {p1, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
[COLOR="red"]move-result v4
if-eqz v4, :cond_22[/COLOR]
cond_22 may be different with your code
Change re lines to these
Code:
[COLOR="red"]move-result v4[/COLOR] to this const/4 v4, 0x0
if-[COLOR="red"]eqz[/COLOR] v4, :cond_22 to this if-[COLOR="red"]nez[/COLOR] v4, :cond_22
Now save all and compile
replace both and Reboot
Tada
SuperUserMod Done....
#YourWish for this
Additional for Unlocked Bootloaders click here (complete mod)
Have Fun guys
Dont forget to mention me If you use my work
Thanks alot Buddy, really useful, I've been looking for this on some old thread.
Sent from my E6683 using Tapatalk
@venkat kamesh bro thanks for your tut
i do this but get error in service.jar
after edit , i want to recompile it but get this error:
Code:
Recompiling "services.jar" With Original Signature,
in work area "_WorkArea1", using "apktool_2.2.1.jar"
With Tickle My Android 14.2.0.0.
(tinyurl.com\ticklemyandroid)
----------------
I: Using Apktool 2.2.1
I: Smaling smali folder into classes.dex...
..\_WorkArea1\_working\services.jar\smali\com\android\server\pm\PackageManagerService.smali[7670,4] missing EOF at '.locals'
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/server/pm/PackageManagerService.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:77)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:61)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:38)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:405)
at brut.androlib.Androlib.buildSources(Androlib.java:336)
at brut.androlib.Androlib.build(Androlib.java:292)
at brut.androlib.Androlib.build(Androlib.java:264)
at brut.apktool.Main.cmdBuild(Main.java:227)
at brut.apktool.Main.main(Main.java:84)
----------------
Recompile Not Successful!
how can i solve that?
Hamidreza2010 said:
@venkat kamesh bro thanks for your tut
i do this but get error in service.jar
after edit , i want to recompile it but get this error:
Code:
Recompiling "services.jar" With Original Signature,
in work area "_WorkArea1", using "apktool_2.2.1.jar"
With Tickle My Android 14.2.0.0.
(tinyurl.com\ticklemyandroid)
----------------
I: Using Apktool 2.2.1
I: Smaling smali folder into classes.dex...
..\_WorkArea1\_working\services.jar\smali\com\android\server\pm\PackageManagerService.smali[7670,4] missing EOF at '.locals'
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/server/pm/PackageManagerService.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:77)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:61)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:38)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:405)
at brut.androlib.Androlib.buildSources(Androlib.java:336)
at brut.androlib.Androlib.build(Androlib.java:292)
at brut.androlib.Androlib.build(Androlib.java:264)
at brut.apktool.Main.cmdBuild(Main.java:227)
at brut.apktool.Main.main(Main.java:84)
----------------
Recompile Not Successful!
how can i solve that?
Click to expand...
Click to collapse
bro seems you deleted '.locals'
please recheck it
nothing more
Goodluck bro
what´s the diferencce with the davidMKD´s tutorial disable signature verification http://forum.xda-developers.com/showthread.php?t=2458144
I ve been using this method since kit kat and its working fine, and you only modified slightly services.jar nothing else. cheers
juanpirulo said:
what´s the diferencce with the davidMKD´s tutorial disable signature verification http://forum.xda-developers.com/showthread.php?t=2458144
I ve been using this method since kit kat and its working fine, and you only modified slightly services.jar nothing else. cheers
Click to expand...
Click to collapse
haha well said bro
but structure of signature verification is not same since 4.4 to till date
there are lot of modification in structure and security level of api developed in their best
seems you just seen the services.jar changes hmm
had you looked to core-libart.jar ?
and you just see lines bro ?
why don't you look the code back to java ( i meant from smali to java ) so you can know the changes what i did
read the java imports
https://github.com/frohoff/jdk8u-dev-jdk/tree/master/src/share/classes/java/security
read it get it
i had those changes too
the old guide is just allowing to install temporary ( if you already had old install and data is present)
but not a complete SuperUserMod
just for you to prove ( try only with marshmallow and this guide is from marshmallow )
for example add new settings.apk with new signatures replace it
clear data from recovery and check if your settings are there or not
Before commenting of comparison please go through the google, and try to read what changes are done ( analyze them in java )
then come to thread and give a comment
we are not ready to post something which is already persist/Working
Do tests and get back to here bro
Good luck bro
First, this is not superuser mod, this is three android patches from LuckyPatcher.apk
First two makes your phone very vulnerable, because you makes signature verification always true and disable .apk signature verification. (core-libart.jar)
Superusermod is just
Code:
comparesignatures
const/4 v7, 0x0
bla bla
All other just give you access for downgrade your installed apk (services.jar)
I think you must add this info (about core-libart.jar) to first post. Thanks.
Did it.all good!
Thanks bro!
@venkat kamesh bro is this need to do after these steps?
http://forum.xda-developers.com/showpost.php?p=68965462&postcount=1264
i mean we should to do it or steps of this page is enough ? ( i have unlocked bootloader )
venkat kamesh said:
haha well said bro
but structure of signature verification is not same since 4.4 to till date
there are lot of modification in structure and security level of api developed in their best
seems you just seen the services.jar changes hmm
had you looked to core-libart.jar ?
and you just see lines bro ?
why don't you look the code back to java ( i meant from smali to java ) so you can know the changes what i did
read the java imports
https://github.com/frohoff/jdk8u-dev-jdk/tree/master/src/share/classes/java/security
read it get it
i had those changes too
the old guide is just allowing to install temporary ( if you already had old install and data is present)
but not a complete SuperUserMod
just for you to prove ( try only with marshmallow and this guide is from marshmallow )
for example add new settings.apk with new signatures replace it
clear data from recovery and check if your settings are there or not
Before commenting of comparison please go through the google, and try to read what changes are done ( analyze them in java )
then come to thread and give a comment
we are not ready to post something which is already persist/Working
Do tests and get back to here bro
Good luck bro
Click to expand...
Click to collapse
sorry bro when i said "you just modified slightly the services.jar" I didnt meant yourself i meant in the david tutorial no your tutorial. i just wanted your explanation about yours because i didnt know the difference. Now its ok
juanpirulo said:
sorry bro when i said "you just modified slightly the services.jar" I didnt meant yourself i meant in the david tutorial no your tutorial. i just wanted your explanation about yours because i didnt know the difference. Now its ok
Click to expand...
Click to collapse
haha no worries bro
happy to explain
Good luck bro
Hamidreza2010 said:
@venkat kamesh bro is this need to do after these steps?
http://forum.xda-developers.com/showpost.php?p=68965462&postcount=1264
i mean we should to do it or steps of this page is enough ? ( i have unlocked bootloader )
i need to do both of them?
Click to expand...
Click to collapse
@venkat kamesh would you please clear me here?
thanks bro
As always venkat kamesh! Great guide bro!
venkat kamesh said:
haha no worries bro
happy to explain
Good luck bro
Click to expand...
Click to collapse
i dont know why Xperia M4 Services.jar and other file not have Smali Folder
Hello! Does this work on stock marshmallow .291 for sony devices? Also, does this work on locked bootloaders? Great tutorial BTW!
Can I do this if my services.jar is from another systemUI. I have a z3c and I flashed Xperia X sysui and it replaced my stock systemUi and services.jar
thank you bro
but after edit
any app not installed.
russel5 said:
First, this is not superuser mod, this is three android patches from LuckyPatcher.apk
First two makes your phone very vulnerable, because you makes signature verification always true and disable .apk signature verification. (core-libart.jar)
Superusermod is just
Code:
comparesignatures
const/4 v7, 0x0
bla bla
All other just give you access for downgrade your installed apk (services.jar)
I think you must add this info (about core-libart.jar) to first post. Thanks.
Click to expand...
Click to collapse
@russel5,
I am not familiar with how to decompile services.jar, and I am not sure I understand what this is. Do you know of any more basic of a guide on services.jar, deodexing and what it achieves?
Thanks a lot in advance,
MW
I have been served this guide to enable superuser mod in my xperia x
music widget particles requires superuser mod but my xperia x has it
Hello guys
i just found a simple way to disable Signature verification on Nougat / Marshmallow
Tested on Sony and LG .. should also work on AOSP, and based roms
Firstly thanks to My best buddy/ brother (moon guy) @kingdj haha
Requirements:-
- Deodexed Rom
- Services.jar
- core-oj.jar
- Latest Apktools ( i suggest Tickle my android tool by @Ticklefish )
Lets start Start
1. Decompile services.jar (Nougat/MM versions)
2. Open services.jar\smali\com\android\server\pm\PackageManagerService.smali
Method 1 :- (not working for few devices)
look for this method
Code:
method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
in that method find these line
Code:
:goto_0
return v3
:cond_0
const/4 v3, -0x1
goto :goto_0
and replace them with this
Code:
:goto_0
const/4 v3, 0x0
:cond_0
const/4 v3, 0x0
return v3
Now look for this code
Code:
invoke-static {v0, v6}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
[COLOR="red"]move-result v6[/COLOR]
if-eqz v6, :cond_7
Add these changes to that code ( Just red code give an edit )
Code:
invoke-static {v0, v6}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
[COLOR="red"]const/4 v6, 0x0[/COLOR]
if-eqz v6, :cond_7
Here its Done...!
save and Close
Method 2 :- (will work on any device / easy)
look for this method
Code:
method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
Replace the complete method with this
Code:
.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
.locals 13
const/4 v0, 0x0
return v0
.end method
and find his method
Code:
.method private compareSignaturesCompat(Lcom/android/server/pm/PackageSignatures;Landroid/content/pm/PackageParser$Package;)I
replace the complete method with this
Code:
.method private compareSignaturesCompat(Lcom/android/server/pm/PackageSignatures;Landroid/content/pm/PackageParser$Package;)I
.locals 13
const/4 v0, 0x0
return v0
.end method
and find his method
Code:
.method private compareSignaturesRecover(Lcom/android/server/pm/PackageSignatures;Landroid/content/pm/PackageParser$Package;)I
replace the complete method with this
Code:
.method private compareSignaturesRecover(Lcom/android/server/pm/PackageSignatures;Landroid/content/pm/PackageParser$Package;)I
.locals 13
const/4 v0, 0x0
return v0
.end method
3. Decompile core-oj.jar ( Red line should be replaced and blue should be matched
open core-oj/smali/java/security/Signature.smali
find this method
Code:
.method public final verify([B)Z
in that method find this lines
Code:
invoke-virtual {p0, p1}, Ljava/security/Signature;->engineVerify([B)Z
[COLOR="Red"]move-result v[COLOR="blue"]0[/COLOR][/COLOR]
Change Red line to this
Code:
[COLOR="red"]const/4 v[COLOR="blue"]0[/COLOR], 0x1[/COLOR]
Code:
.method public final verify([BII)Z
in that method find this lines
Code:
invoke-virtual {p0, p1, p2, p3}, Ljava/security/Signature;->engineVerify([BII)Z
[COLOR="Red"]move-result v[COLOR="blue"]0[/COLOR][/COLOR]
Change Red line to this
Code:
[COLOR="red"]const/4 v[COLOR="blue"]0[/COLOR], 0x1[/COLOR]
save and close
Now open core-oj/smali/java/security/MessageDigest.smali
Find this method and lines
Code:
.method public static isEqual([B[B)Z
.registers 7
.param p0, "digesta" # [B
.param p1, "digestb" # [B
.prologue
[COLOR="red"]const/4 v[COLOR="blue"]2[/COLOR], 0x0[/COLOR]
array-length v3, p0
array-length v4, p1
if-eq v3, v4, :cond_6
In that change red line to this
Code:
const/4 v[COLOR="Blue"]2[/COLOR], 0x1
Now For Sony devices There is other thing to disable signature Verification...! ( if persists else ignore )
open services.jar/smali/com/android/server/AppOpsService.smali
in that look for this lines
Code:
invoke-direct {p0, p4, p3}, Lcom/android/server/AppOpsService;->isSystemOrPrivApp(Ljava/lang/String;I)Z
move-result v2
if-eqz v2, :cond_1
Delete all those 3 lines and save .... tada
So now super user mode is ready .. you can now do more
Dont forget to mention me if you used my tuts and if i helped you ,....
Regards
VK
Does the process work on Pure Vanilla Marshmallow 6.0.1 . The device i m using is Karbonn Sparkle V Sprout4.
What should i do for the rom making Deodexed?????
meprakash_pyc said:
What should i do for the rom making Deodexed?????
Click to expand...
Click to collapse
I deodexed my 6.0 with tickel my android..u can try it also..
hi @venkat kamesh
1. when i decompile services.jar with TMA or BatchApkTool by BurSoft,
i can't find these lines:
Code:
invoke-direct {p0, p4, p3}, Lcom/android/server/AppOpsService;->isSystemOrPrivApp(Ljava/lang/String;I)Z
move-result v2
if-eqz v2, :cond_1
2. when i decompile services.jar with batchapktool,
packagemanagerservice.smali looks different to yours.
is tma important to decompile???
Old method for KK works on Marshmallow too
Source: My Nexus 5 running Sony Apps.
Just use
@rajdeep312, I'm sorry to say that even mentioning that app is in violation of the XDA Rules. This is because it's considered a warez app.
I'd recommend that you delete the name of it or an XDA Admin could penalize you and/or close the thread.
Just advising you to help prevent this from happening my friend.
Peace and Love!
Peace and Love!
~Ringo Starr~
Sent on my Communicator [SCH-I535] from the Bridge of the U.S.S. Enterprise...
********************************************
**IF I WAS HELPFUL IN ANY WAY THEN**
**PLZ THANK ME WITH A THUMBS UP!**
********************************************
Dnt know weda there is new security in 378 fw... I did dis and flashed unlock camera buh front camera fc.... And also i tried to use font selector buh didnt work.
There is 3 AppOpsService.smali in Sony services.jar im using it in .376 nougat firmware
here check this: http://imgur.com/a/VxLbO
I'd like to do this by editing source code rather than editing smali code, I can find and edit PackageManagerService's methods but couldn't find later methods. Can you explain where do they exist in source code?
nicesoni_ash said:
I'd like to do this by editing source code rather than editing smali code, I can find and edit PackageManagerService's methods but couldn't find later methods. Can you explain where do they exist in source code?
Click to expand...
Click to collapse
Use tha first method den continue with core-oj.jar.....
whalesplaho said:
Use tha first method den continue with core-oj.jar.....
Click to expand...
Click to collapse
What!! How's this answer my post asking for those specific methods?
Besides I don't just wish to disable it completely but if possible making a switch for the same.
Sent from my "1+2" powered by Official RR 7.x.x
Compiled by myself
nicesoni_ash said:
What!! How's this answer my post asking for those specific methods?
Besides I don't just wish to disable it completely but if possible making a switch for the same.
Sent from my "1+2" powered by Official RR 7.x.x
Compiled by myself
Click to expand...
Click to collapse
Yhu said yhu couldnt find tha later methods dats why i said use tha first method in OP continue from core-oj.jar which is also present dere. Sorry for answering and i dnt know if its possible to make a switch!
whalesplaho said:
Yhu said yhu couldnt find tha later methods dats why i said use tha first method in OP continue from core-oj.jar which is also present dere. Sorry for answering and i dnt know if its possible to make a switch!
Click to expand...
Click to collapse
It's ok, I guess you didn't understand my question. I am not editing smali files but making changes in source itself thus I need to know exact file names to find these methods. I couldn't find files from core-oj.jar in source and that's what I asked.
nicesoni_ash said:
It's ok, I guess you didn't understand my question. I am not editing smali files but making changes in source itself thus I need to know exact file names to find these methods. I couldn't find files from core-oj.jar in source and that's what I asked.
Click to expand...
Click to collapse
Gotten now... I dnt know bout tha source code, sorry!
But with PackageManagerService alone, it should work. Work for some.!
whalesplaho said:
Gotten now... I dnt know bout tha source code, sorry!
But with PackageManagerService alone, it should work. Work for some.!
Click to expand...
Click to collapse
Yeah, packagemanagerservice should do the work as all main three methods are in there. I just need to make a switch now.
Sent from my "1+2" powered by Official RR 7.x.x
Compiled by myself
nicesoni_ash said:
Yeah, packagemanagerservice should do the work as all main three methods are in there. I just need to make a switch now.
Sent from my "1+2" powered by Official RR 7.x.x
Compiled by myself
Click to expand...
Click to collapse
Okay buddy... Goodluck and how will tha switch work!?
whalesplaho said:
Okay buddy... Goodluck and how will tha switch work!?
Click to expand...
Click to collapse
Theoretically if it's a yes to disable verification, then instead of running any code the method will simply return true for signature matches but if it's a no, I am letting it follow it's normal process. Building now.
nicesoni_ash said:
Theoretically if it's a yes to disable verification, then instead of running any code the method will simply return true for signature matches but if it's a no, I am letting it follow it's normal process. Building now.
Click to expand...
Click to collapse
Okay.....
Nice one buddy!!!
Thanks for the way. Is there any simple way to do this. As coding is not my thing.