[MOD][HOW-TO] Even more toggles! Lockscreen + Screen Timeout [4.3 | 4.4 coming ASAP]

Search This thread

android.zealot.fervor

Senior Member
Nov 8, 2013
1,382
1,672
★◢↿MUSCAT↾◣★
33ndopd.gif


Cnexus my sir ,you are SEXY in real words. Thanks a TON for all of your amazing guides.
I love all of your work and you are deserved to be loved.

I hope you will come up with some more amazing guides like (how to port Note 3 water color effect,s5 particle effect etc)
THANKS ONCE AGAIN. LOVE YA
 

Crussader

Senior Member
Jun 15, 2007
1,606
3,675
Hey,

First of all, thanks for this wonderful toggles.... I have implemented them without issues for the i9300 but I'm noticing this...

If I set, for example, a screen timeout of 1 minute... after a reboot the timeout remains but the toggle icon goes back to the first one ( 15 sec ). Does this only happen to me?
 

MrDroidz

Member
Feb 4, 2013
47
4
@CNexus first of all thank you for your great work!
How about the "screen-off" or screenlock I am not sure how you call it but the toggle when you click it locks the screen or it goes black/closed, can you have a guide for that or just the smali and other files needed to add please :) thank you.
 

josephpatrick

Senior Member
Jan 24, 2012
1,213
237
Bangalore
4.4.4

hi, does this work for android 4.4.4? systemui loads up fine when the ScreenTimeout entry is not present in csc...the moment it is added, systemui starts crashing
is it mandatory to perform the secsettings.changes or is it only for the long click function to work?
 

Attachments

  • logcat.jpg
    logcat.jpg
    129 KB · Views: 28
Last edited:

roirraW "edor" ehT

Senior Moderator
Staff member
hi, does this work for android 4.4.4? systemui loads up fine when the ScreenTimeout entry is not present in csc...the moment it is added, systemui starts crashing
is it mandatory to perform the secsettings.changes or is it only for the long click function to work?

I haven't had this device in a year and a half, but I'm assuming the 4.4.4 you're referencing is AOSP / CM 11, correct ?

I think this mod is for Samsung stock-based ROMs only.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 21
    Hey guys! Today I'll be showing you how to add the Lockscreen and Screen Timeout toggles to your quick toggles.

    8eXKdtI.jpg


    Enable zip can be found HERE. WILL ONLY WORK IF YOU HAVE ALREADY DONE THE MOD BELOW, AND WILL ONLY MAKE THE TOGGLES VISIBLE.

    Items you will need
    1. SystemUI.apk from the rom you are modding
    2. SecSettings.apk from the rom you are modding
    3. Notepad++ or another text editor of your choice (NOT regular Notepad, it messes up the encoding)
    4. apktool 1.5.2

    Overview of mod
    • Step 1: Modding SystemUI.apk and android.policy.jar (jar is for lockscreen toggle
    • Step 2: Modding SecSettings.apk

    Now before we get started, download the attachment with the files you will need for this mod (attached to this post...make sure you grab the right version for the system you are modifying)




    Now lets get started!


    [size=+1]Step 1: Modding SystemUI.apk and android.policy.jar[/size]
    1. Decompile SystemUI.apk and navigate to com/android/systemui/statusbar/policy/quicksetting in your file browser
    2. Copy and paste the smali files from inside the zip you downloaded (toggle_files.zip/SystemUI/) into this folder
    3. Navigate to SystemUI/res/drawable-xhdpi (or SystemUI/res/drawable-xxhdpi depending on your device)
    4. Copy and paste the four pngs from the SystemUI folder of the attachment into the decompiled drawable folder you opened above
    5. Now navigate to SystemUI/res/values and add the following to the end of your strings.xml file
      PHP:
      Screen Timeout
      Lockscreen
    6. Now decompile android.policy.jar and open com/android/internal/policy/impl/keyguard/KeyguardViewMediator.smali and find the following method
      PHP:
      .method private doKeyguardLocked(Landroid/os/Bundle;)V
    7. Find the first instance of
      PHP:
      Landroid/os/Handler;->sendMessageDelayed(Landroid/os/Message;J)Z
      in this method and add the following code immediately after it (if there is a :cond_numberHere line, add the following code immediately AFTER that line )
      PHP:
          iget-object v10, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardViewMediator;->mContext:Landroid/content/Context;
      
          invoke-virtual {v10}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
      
          move-result-object v1
      
          const-string v10, "disable_lock"
      
          const/4 v11, 0x0
      
          invoke-static {v1, v10, v11}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
      
          move-result v10
      
          if-eqz v10, :cond_continue
      
          const-string v10, "KeyguardViewMediator"
      
          const-string v11, "doKeyguard: not showing because moar_disable_lock is set to 1"
      
          invoke-static {v10, v11}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
      
          invoke-virtual {p0}, Lcom/android/internal/policy/impl/keyguard/KeyguardViewMediator;->wakeUpIfNeeded()V
          
          return-void
      
          :cond_continue
    8. After the last step, your doKeyguardLocked method should look something like below (note how the additional code is inserted AFTER the sendMessage line and AFTER the :cond_XX line that follows it)
      PHP:
          iget v11, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardViewMediator;->WAKE_UP_TIMEOUT_DURATION:I
      
          int-to-long v11, v11
      
          invoke-virtual {v10, v5, v11, v12}, Landroid/os/Handler;->sendMessageDelayed(Landroid/os/Message;J)Z
      
          :cond_0
      
          iget-object v10, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardViewMediator;->mContext:Landroid/content/Context;
      
          invoke-virtual {v10}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
      
          move-result-object v1
      
          const-string v10, "disable_lock"
      
          const/4 v11, 0x0
      
          invoke-static {v1, v10, v11}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
      
          move-result v10
      
          if-eqz v10, :cond_continue
      
          const-string v10, "KeyguardViewMediator"
      
          const-string v11, "doKeyguard: not showing because moar_disable_lock is set to 1"
      
          invoke-static {v10, v11}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
      
          invoke-virtual {p0}, Lcom/android/internal/policy/impl/keyguard/KeyguardViewMediator;->wakeUpIfNeeded()V
          
          return-void
      
          :cond_continue[/HIDE]
      [*]That's it for SystemUI and android.policy.jar. Now recompile both and move on to step 2. At this point, the toggles will show up in the full toggles view (when you add ";LockScreen;ScreenTimeout" to the CscFeature (and clean flash)... or to the notification_panel_active_app_list in /data/data/com.android.providers.settings/settings.db, or flash the enable zip linked at the BEGINNING of this post) in the status bar, but Settings will FC if you try to go into edit mode/rearrange toggles mode

    14
    [SIZE=+1]Step 2: Modding SecSettings.apk[/SIZE]
    1. Decompile SecSettings and navigate to com/android/settings
    2. Open NotificationPanelMenu.smali and search for the method ".method private makeConvertPanelName"
    3. Add the following code to the end of the method before the
      Code:
      return-void
      PHP:
      iget-object v0, p0, Lcom/android/settings/NotificationPanelMenu;->mConvertPanelItemstring:Ljava/util/HashMap;
      const-string v1, "LockScreen"
      const-string v2, "notification_panel_lockscreen"
      invoke-virtual {v0, v1, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      
      iget-object v0, p0, Lcom/android/settings/NotificationPanelMenu;->mConvertPanelItemstring:Ljava/util/HashMap;
      const-string v1, "notification_panel_lockscreen"
      const-string v2, "LockScreen"
      invoke-virtual {v0, v1, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      
      iget-object v0, p0, Lcom/android/settings/NotificationPanelMenu;->mConvertPanelItemstring:Ljava/util/HashMap;
      const-string v1, "ScreenTimeout"
      const-string v2, "notification_panel_timeout"
      invoke-virtual {v0, v1, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      
      iget-object v0, p0, Lcom/android/settings/NotificationPanelMenu;->mConvertPanelItemstring:Ljava/util/HashMap;
      const-string v1, "notification_panel_timeout"
      const-string v2, "ScreenTimeout"
      invoke-virtual {v0, v1, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    4. Now save the file and close it and navigate to SecSettings/res/values/strings.xml
    5. Add the following line to your strings.xml
      PHP:
      <string name="notification_panel_lockscreen">Lockscreen</string>
      <string name="notification_panel_timeout">Screen Timeout</string>
    6. Save and close strings.xml and navigate to SecSettings/res/drawable-xhdpi or drawable-xxhdpi depending on your device
    7. Extract the PNGs from the toggles.zip/SecSettings and copy it into the drawable folder from above
    8. Finally, recompile SecSettings with your modifications


    Now for the final step, take your modified SecSettings.apk, SystemUI.apk, and android.policy.jar and add them to the /system/app folder of your rom and you are good to go!

    Congratulations, you just added the Lockscreen and Screen Timeout toggles to your rom. Enjoy :D:D

    Note: Devs are free to use this mod in their rom. Just make sure you give credits where they are due :)
    If you have any issues, I'd be more than happy to help :good:


    Thanks to:
    Google for the Android OS
    3
    Nerds.

    Thebe@r'$ G@L@XY- eliminate white backgrounds and any form of ics/holo blue.
    3
    Sweet! :thumbup:

    I had these toggles done for MOAR, but for an older version so that's why I didn't link you :eek:
    No problem. I see you're on a Guide kick, keep them coming.
    I haven't done any mods in a while so I was getting a little cross-eyed by the time I got to doing this one. The MOAR update is nearly finished now though. Just toying with a couple more toggles.
    2
    Last time I promise...but the toggle files are updated again :silly:

    LockScreenQuickSettingButton.smali was the only one that was changed this time

    Enable zip also added to OP (flash after you push the modded files to get the toggles to show in SystemUI)