[MOD][GUIDE][JB 4.1.2][MULTI-THREAD/NATIVE] Lockscreen Blur Effect/MULTITHREAD

Search This thread

BOOTMGR

Senior Member
Aug 3, 2010
728
3,395
anoobdevsdiary.blogspot.in

Lockscreen Blur Effect

EDIT : Updated guide with Native function. Now it is ~60% faster

I wanna share this mod with you which i made for my HarshJelly ROM. Before starting guide let's see what it does. Actually idea came from GravityBox Module.

What it does : It'll simply blur the background activity which you left before locking device (something like iOS 7's notification bar). Here are some caps to make it more clear.

El8XY4n.png
VzqNEWK.png
Nqblokb.png
zq9LbIf.png


Yeah this mod is compatible with all Lockscreens (AOSP, Sammy's circle lockscreen, pattern etc). I tested this mod on my SGSA running stock TW 4.1.2. Since all TW roms are almost same, it should work on all TW 4.1.2 ROMs.

Before starting tutorial, let me clear one thing that i won't respond to posts without full log. If you found any difficulty, feel free to ask me but please keep in mind above sentence.

What is required?
  • android.policy.jar
  • Apktool
  • Notepad++

So, let's begin...

  • Decompile android.policy.jar
  • Navigate to : com\android\internal\policy\impl\sec
  • Download attached file, extract it and put WallpaperWidget$1.smali to above folder.
  • In the same folder, open WallpaperWidget.smali
  • before #instance field add following code
    Code:
    # static fields
    .field static mutex_acquired:Z
  • Search for .field private mEnhancedWallpaper:Lcom/android/internal/policy/impl/sec/EnhancedWallpaperWidget; and add this below it
    Code:
    .field private mHandler:Landroid/os/Handler;
  • Search for iput-boolean v2, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mIsLiveWallpaper:Z and add this below
    Code:
    new-instance v0, Landroid/os/Handler;
    
        invoke-direct {v0}, Landroid/os/Handler;-><init>()V
    
        iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mHandler:Landroid/os/Handler;
  • after # direct methods add following code
    Code:
    .method static constructor <clinit>()V
        .locals 1
    
        const-string v0, "harsh"
    
        invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
    
        const/4 v0, 0x1
    
        sput-boolean v0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mutex_acquired:Z
    
        return-void
    .end method
  • Now search for .method public constructor <init>(Landroid/content/Context;Landroid/content/res/Configuration;)V and replace whole method with following :
    Code:
    .method public constructor <init>(Landroid/content/Context;Landroid/content/res/Configuration;)V
        .locals 5
    
        const/4 v4, 0x0
    
        const/4 v3, -0x1
    
        const/4 v2, 0x1
    
        invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V
    
        const-string v0, "WallpaperWidget"
    
        iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->TAG:Ljava/lang/String;
    
        iput-boolean v2, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mIsLiveWallpaper:Z
    
        new-instance v0, Landroid/os/Handler;
    
        invoke-direct {v0}, Landroid/os/Handler;-><init>()V
    
        iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mHandler:Landroid/os/Handler;
    
        const/4 v0, 0x0
    
        iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
    
        const-string v0, "/data/data/com.sec.android.gallery3d/lockscreen_wallpaper.jpg"
    
        iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->PORTRAIT_WALLPAPER_IMAGE_PATH:Ljava/lang/String;
    
        iput-object p1, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mContext:Landroid/content/Context;
    
        invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
    
        move-result-object v0
    
        const-string v1, "lockscreen_wallpaper"
    
        invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
    
        move-result v0
    
        if-ne v0, v2, :cond_0
    
        iput-boolean v4, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mIsLiveWallpaper:Z
    
        :cond_0
        iget-boolean v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mIsLiveWallpaper:Z
    
        if-eqz v0, :cond_1
    
        :goto_0
        return-void
    
        :cond_1
        new-instance v0, Landroid/widget/ImageView;
    
        invoke-direct {v0, p1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V
    
        iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
    
        iget-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
    
        sget-object v1, Landroid/widget/ImageView$ScaleType;->CENTER_CROP:Landroid/widget/ImageView$ScaleType;
    
        invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setScaleType(Landroid/widget/ImageView$ScaleType;)V
    
        iget-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
    
        invoke-virtual {p0, v0, v3, v3}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->addView(Landroid/view/View;II)V
    	
        invoke-direct {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->BlurImage()V
    
        goto :goto_0
    .end method
    
    .method private BlurImage()V
        .locals 2
    
        new-instance v0, Ljava/lang/Thread;
    
        new-instance v1, Lcom/android/internal/policy/impl/sec/WallpaperWidget$1;
    
        invoke-direct {v1, p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget$1;-><init>(Lcom/android/internal/policy/impl/sec/WallpaperWidget;)V
    
        invoke-direct {v0, v1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V
    
        invoke-virtual {v0}, Ljava/lang/Thread;->start()V
    
        return-void
    .end method
    
    .method static synthetic access$0(Lcom/android/internal/policy/impl/sec/WallpaperWidget;Landroid/graphics/Bitmap;Landroid/graphics/Bitmap;I)V
        .locals 0
    
        invoke-direct {p0, p1, p2, p3}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->blurImage(Landroid/graphics/Bitmap;Landroid/graphics/Bitmap;I)V
    
        return-void
    .end method
    
    .method static synthetic access$1(Lcom/android/internal/policy/impl/sec/WallpaperWidget;)Landroid/os/Handler;
        .locals 1
    
        iget-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mHandler:Landroid/os/Handler;
    
        return-object v0
    .end method
    
    .method private native blurImage(Landroid/graphics/Bitmap;Landroid/graphics/Bitmap;I)V
    .end method
  • Now search for # virtual methods and add this code after it
    Code:
    .method public updateWallpaper()V
        .locals 3
    
        const-string v1, "/data/data/com.sec.android.gallery3d/lockscreen_wallpaper.jpg"
    
        iput-object v1, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mWallpaperPath:Ljava/lang/String;
    
        new-instance v0, Landroid/graphics/drawable/BitmapDrawable;
    
        invoke-virtual {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->getResources()Landroid/content/res/Resources;
    
        move-result-object v1
    
        iget-object v2, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mWallpaperPath:Ljava/lang/String;
    
        invoke-direct {v0, v1, v2}, Landroid/graphics/drawable/BitmapDrawable;-><init>(Landroid/content/res/Resources;Ljava/lang/String;)V
    
        iget-object v1, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
    
        invoke-virtual {v1, v0}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
    
        return-void
    .end method
  • Follow xperiacle's guide for TRANSPARENT STATUSBAR on lockscreen http://xdaforums.com/showthread.php?t=2384892 (this is required, don't worry, it won't make it transparent)
  • From the extracted files, push libharsh.so to /system/lib/libharsh.so and chmod it to 644 (rw-r--r--)
  • Make sure that /data/data/com.sec.android.gallery3d/lockscreen_wallpaper.png & /data/data/com.sec.android.gallery3d/lockscreen_wallpaper.jpg file exists before you reboot your device. If it doesn't then put any valid png file there with name lockscreen_wallpaper.png/lockscreen_wallpaper.jpg and chmod it to 777
  • We're done :highfive: compile it and push it to device :good:
  • To add toggle for it, read here

What we're doing here?
Basically we are taking screenshot when device is getting locked and then we apply blur effect and sets it as wallpaper.
I know there are many way's to do it but i've preferred hacking WallpaperWidget's constructor. You can go for another way if you want.
Another thing to tell is that it depend on you device that how much time it'll require to do this process. On my device it nearly take 2 seconds (it depends on background). Multithreading can also be used. Read second post for more info and other tweaks., By default we're using Multi threading :p

 

Attachments

  • files.zip
    10.4 KB · Views: 1,178
Last edited:

BOOTMGR

Senior Member
Aug 3, 2010
728
3,395
anoobdevsdiary.blogspot.in
Tips, Tricks & FAQs

Bugs & Remedies :
  • If multithreading is not enabled & device is woke up suddenly after locking then sometimes device stays unlocked for a moment --> Enabled multithreading or don't wake up device soon after locking it
    [*] When mutithreading is enabled & device is suddenly woke up (soon after locking), it shows older image --> Disable mutithreading or don't wake up device soon after locking it
All bug are solved..:p


As this tutorial is written for 4.1.2 (API 16), we don't have native image processing support (which came in API 17).This is the reason why it takes long time to blur image. As told above, i' trying to implement native method for blurring image anybody interested in it can help me.


Tweaks :
  • Blur Radius : (Value in Hex)
    Code:
    .local v4, out:Landroid/graphics/Bitmap;
        const/16 v5, [COLOR="Red"]0x19[/COLOR]
    (lower radius --> better performance)
  • JPEG Quility: (Value in Hex)
    Code:
    .local v1, bytes:Ljava/io/ByteArrayOutputStream;
        sget-object v5, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat;
    
        const/16 v6, [COLOR="red"]0x64[/COLOR]
    Lower Quality --> better performance, weird colors

Changelog:
  • 26th May 2014 --> Solved bug with delay while locking, Uses Multi Threading by default
  • xth February 2014 --> Native function Implementation (x > 6 :p)
  • 6th February 2014 --> Initial Release
 
Last edited:

BOOTMGR

Senior Member
Aug 3, 2010
728
3,395
anoobdevsdiary.blogspot.in
Updated thread with new implementation. Now we are using Native function to blur image which is ~60% faster than previous implementation. Follow tutorial again if you've already done so.




when i use this, can i still use normal wallpapers if i want? or does that need a toggle or something like that?

+1

@BOOTMGR, Please make a short tutorial (if possible) for setting up a Toggle to switch it on or off from the Settings app :good:

Adding toggle in secsetting is easy but only reason behind not providing it is that some people would have enabled AOSP lockscreen in that case method will be slightly different. But you can follow this tutorial to add toggle for it using build.prop



How to add Toggle :

  • Follow main tutorial
  • Inside WallpaperWidget.smali, search for invoke-direct {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->BlurImage()V and add following code above it
    Code:
    const-string v0, "ro.harsh.blurlockscreen"
    
        invoke-static {v0, v2}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z
    
        move-result v0
    
        if-eqz v0, :cond_2
  • Search below for .end method (2 - 3 lines down) and add this below it
    Code:
    :cond_2
        invoke-direct {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->setLockScreenWallpaper()V
    
        goto :goto_0
  • That's all. Compile it.
Now you can toggle its state by adding ro.harsh.blurlockscreen=true or ro.harsh.blurlockscreen=false
You can also type in terminal setprop ro.harsh.blurlockscreen true/false to toggle state on the fly.
 

rajeev994

Member
Jul 6, 2013
39
13
Delhi
I'm Sorry But i'm Naive I cannot Follow this tutorial Can you Make a Flashable zip Plz Plz Plz Plz Plzzzzzzzzzzzzzzzzzzzzz
 

Geddd

Senior Member
Nov 5, 2013
239
24
Upgrading Android OS...
Opening apllications...


I'm getting this again and again after I reboot my device, I think the files aren't compatible with my 4.1.2 TW deodexed.. :(
but this mod looks so cool, I want this :)
 

JovieBrett

Senior Member
Dec 17, 2012
821
308
Manila
Seems interesting, great work! :) btw is this tut possible for CM11 roms? I would like to try compiling this on our CM11 builds :)
 

BOOTMGR

Senior Member
Aug 3, 2010
728
3,395
anoobdevsdiary.blogspot.in
Upgrading Android OS...
Opening apllications...


I'm getting this again and again after I reboot my device, I think the files aren't compatible with my 4.1.2 TW deodexed.. :(
but this mod looks so cool, I want this :)

It should be. Check again that & make sure you did everything properly. Did you pushed libharsh.so to /system/lib and changed its permission?


Seems interesting, great work! :) btw is this tut possible for CM11 roms? I would like to try compiling this on our CM11 builds :)

You can do it easily by Xposed. Gravitybox doesnot suppot this on 4.1.2 because of unavailable API

Is there anyway to make this into an xposed module?

Making this available through xposed is very easy. I make module later when i'll be free.
 

Geddd

Senior Member
Nov 5, 2013
239
24

It should be. Check again that & make sure you did everything properly. Did you pushed libharsh.so to /system/lib and changed its permission?



Yes bro, I did follow the steps carefully and push the lib file (rw-r-r). I tried to do it again now it boot up but my homescreen is just blinking with black screen. If you have enough time can you please check my work? :(


here's my output classout folder and my untouched android policy..
if you're just not busy bro, I can wait. Thank you.
 

Attachments

  • android.policy.zip
    371.9 KB · Views: 18
  • classout.zip
    990.3 KB · Views: 12

BOOTMGR

Senior Member
Aug 3, 2010
728
3,395
anoobdevsdiary.blogspot.in

It should be. Check again that & make sure you did everything properly. Did you pushed libharsh.so to /system/lib and changed its permission?



Yes bro, I did follow the steps carefully and push the lib file (rw-r-r). I tried to do it again now it boot up but my homescreen is just blinking with black screen. If you have enough time can you please check my work? :(


here's my output classout folder and my untouched android policy..
if you're just not busy bro, I can wait. Thank you.

Compile attached sources (don't forget to add META-INF folder). There were some additional things in your constructor. Please if it doesn't work then provide me full log.
 

Attachments

  • classout.zip
    995 KB · Views: 35
  • Like
Reactions: Geddd

Top Liked Posts

  • There are no posts matching your filters.
  • 30

    Lockscreen Blur Effect

    EDIT : Updated guide with Native function. Now it is ~60% faster

    I wanna share this mod with you which i made for my HarshJelly ROM. Before starting guide let's see what it does. Actually idea came from GravityBox Module.

    What it does : It'll simply blur the background activity which you left before locking device (something like iOS 7's notification bar). Here are some caps to make it more clear.

    El8XY4n.png
    VzqNEWK.png
    Nqblokb.png
    zq9LbIf.png


    Yeah this mod is compatible with all Lockscreens (AOSP, Sammy's circle lockscreen, pattern etc). I tested this mod on my SGSA running stock TW 4.1.2. Since all TW roms are almost same, it should work on all TW 4.1.2 ROMs.

    Before starting tutorial, let me clear one thing that i won't respond to posts without full log. If you found any difficulty, feel free to ask me but please keep in mind above sentence.

    What is required?
    • android.policy.jar
    • Apktool
    • Notepad++

    So, let's begin...

    • Decompile android.policy.jar
    • Navigate to : com\android\internal\policy\impl\sec
    • Download attached file, extract it and put WallpaperWidget$1.smali to above folder.
    • In the same folder, open WallpaperWidget.smali
    • before #instance field add following code
      Code:
      # static fields
      .field static mutex_acquired:Z
    • Search for .field private mEnhancedWallpaper:Lcom/android/internal/policy/impl/sec/EnhancedWallpaperWidget; and add this below it
      Code:
      .field private mHandler:Landroid/os/Handler;
    • Search for iput-boolean v2, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mIsLiveWallpaper:Z and add this below
      Code:
      new-instance v0, Landroid/os/Handler;
      
          invoke-direct {v0}, Landroid/os/Handler;-><init>()V
      
          iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mHandler:Landroid/os/Handler;
    • after # direct methods add following code
      Code:
      .method static constructor <clinit>()V
          .locals 1
      
          const-string v0, "harsh"
      
          invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
      
          const/4 v0, 0x1
      
          sput-boolean v0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mutex_acquired:Z
      
          return-void
      .end method
    • Now search for .method public constructor <init>(Landroid/content/Context;Landroid/content/res/Configuration;)V and replace whole method with following :
      Code:
      .method public constructor <init>(Landroid/content/Context;Landroid/content/res/Configuration;)V
          .locals 5
      
          const/4 v4, 0x0
      
          const/4 v3, -0x1
      
          const/4 v2, 0x1
      
          invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V
      
          const-string v0, "WallpaperWidget"
      
          iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->TAG:Ljava/lang/String;
      
          iput-boolean v2, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mIsLiveWallpaper:Z
      
          new-instance v0, Landroid/os/Handler;
      
          invoke-direct {v0}, Landroid/os/Handler;-><init>()V
      
          iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mHandler:Landroid/os/Handler;
      
          const/4 v0, 0x0
      
          iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
      
          const-string v0, "/data/data/com.sec.android.gallery3d/lockscreen_wallpaper.jpg"
      
          iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->PORTRAIT_WALLPAPER_IMAGE_PATH:Ljava/lang/String;
      
          iput-object p1, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mContext:Landroid/content/Context;
      
          invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
      
          move-result-object v0
      
          const-string v1, "lockscreen_wallpaper"
      
          invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
      
          move-result v0
      
          if-ne v0, v2, :cond_0
      
          iput-boolean v4, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mIsLiveWallpaper:Z
      
          :cond_0
          iget-boolean v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mIsLiveWallpaper:Z
      
          if-eqz v0, :cond_1
      
          :goto_0
          return-void
      
          :cond_1
          new-instance v0, Landroid/widget/ImageView;
      
          invoke-direct {v0, p1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V
      
          iput-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
      
          iget-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
      
          sget-object v1, Landroid/widget/ImageView$ScaleType;->CENTER_CROP:Landroid/widget/ImageView$ScaleType;
      
          invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setScaleType(Landroid/widget/ImageView$ScaleType;)V
      
          iget-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
      
          invoke-virtual {p0, v0, v3, v3}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->addView(Landroid/view/View;II)V
      	
          invoke-direct {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->BlurImage()V
      
          goto :goto_0
      .end method
      
      .method private BlurImage()V
          .locals 2
      
          new-instance v0, Ljava/lang/Thread;
      
          new-instance v1, Lcom/android/internal/policy/impl/sec/WallpaperWidget$1;
      
          invoke-direct {v1, p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget$1;-><init>(Lcom/android/internal/policy/impl/sec/WallpaperWidget;)V
      
          invoke-direct {v0, v1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V
      
          invoke-virtual {v0}, Ljava/lang/Thread;->start()V
      
          return-void
      .end method
      
      .method static synthetic access$0(Lcom/android/internal/policy/impl/sec/WallpaperWidget;Landroid/graphics/Bitmap;Landroid/graphics/Bitmap;I)V
          .locals 0
      
          invoke-direct {p0, p1, p2, p3}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->blurImage(Landroid/graphics/Bitmap;Landroid/graphics/Bitmap;I)V
      
          return-void
      .end method
      
      .method static synthetic access$1(Lcom/android/internal/policy/impl/sec/WallpaperWidget;)Landroid/os/Handler;
          .locals 1
      
          iget-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mHandler:Landroid/os/Handler;
      
          return-object v0
      .end method
      
      .method private native blurImage(Landroid/graphics/Bitmap;Landroid/graphics/Bitmap;I)V
      .end method
    • Now search for # virtual methods and add this code after it
      Code:
      .method public updateWallpaper()V
          .locals 3
      
          const-string v1, "/data/data/com.sec.android.gallery3d/lockscreen_wallpaper.jpg"
      
          iput-object v1, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mWallpaperPath:Ljava/lang/String;
      
          new-instance v0, Landroid/graphics/drawable/BitmapDrawable;
      
          invoke-virtual {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->getResources()Landroid/content/res/Resources;
      
          move-result-object v1
      
          iget-object v2, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mWallpaperPath:Ljava/lang/String;
      
          invoke-direct {v0, v1, v2}, Landroid/graphics/drawable/BitmapDrawable;-><init>(Landroid/content/res/Resources;Ljava/lang/String;)V
      
          iget-object v1, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mLockScreenWallpaperImage:Landroid/widget/ImageView;
      
          invoke-virtual {v1, v0}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
      
          return-void
      .end method
    • Follow xperiacle's guide for TRANSPARENT STATUSBAR on lockscreen http://xdaforums.com/showthread.php?t=2384892 (this is required, don't worry, it won't make it transparent)
    • From the extracted files, push libharsh.so to /system/lib/libharsh.so and chmod it to 644 (rw-r--r--)
    • Make sure that /data/data/com.sec.android.gallery3d/lockscreen_wallpaper.png & /data/data/com.sec.android.gallery3d/lockscreen_wallpaper.jpg file exists before you reboot your device. If it doesn't then put any valid png file there with name lockscreen_wallpaper.png/lockscreen_wallpaper.jpg and chmod it to 777
    • We're done :highfive: compile it and push it to device :good:
    • To add toggle for it, read here

    What we're doing here?
    Basically we are taking screenshot when device is getting locked and then we apply blur effect and sets it as wallpaper.
    I know there are many way's to do it but i've preferred hacking WallpaperWidget's constructor. You can go for another way if you want.
    Another thing to tell is that it depend on you device that how much time it'll require to do this process. On my device it nearly take 2 seconds (it depends on background). Multithreading can also be used. Read second post for more info and other tweaks., By default we're using Multi threading :p

    13
    Tips, Tricks & FAQs

    Bugs & Remedies :
    • If multithreading is not enabled & device is woke up suddenly after locking then sometimes device stays unlocked for a moment --> Enabled multithreading or don't wake up device soon after locking it
      [*] When mutithreading is enabled & device is suddenly woke up (soon after locking), it shows older image --> Disable mutithreading or don't wake up device soon after locking it
    All bug are solved..:p


    As this tutorial is written for 4.1.2 (API 16), we don't have native image processing support (which came in API 17).This is the reason why it takes long time to blur image. As told above, i' trying to implement native method for blurring image anybody interested in it can help me.


    Tweaks :
    • Blur Radius : (Value in Hex)
      Code:
      .local v4, out:Landroid/graphics/Bitmap;
          const/16 v5, [COLOR="Red"]0x19[/COLOR]
      (lower radius --> better performance)
    • JPEG Quility: (Value in Hex)
      Code:
      .local v1, bytes:Ljava/io/ByteArrayOutputStream;
          sget-object v5, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat;
      
          const/16 v6, [COLOR="red"]0x64[/COLOR]
      Lower Quality --> better performance, weird colors

    Changelog:
    • 26th May 2014 --> Solved bug with delay while locking, Uses Multi Threading by default
    • xth February 2014 --> Native function Implementation (x > 6 :p)
    • 6th February 2014 --> Initial Release
    7
    Updated thread with new implementation. Now we are using Native function to blur image which is ~60% faster than previous implementation. Follow tutorial again if you've already done so.




    when i use this, can i still use normal wallpapers if i want? or does that need a toggle or something like that?

    +1

    @BOOTMGR, Please make a short tutorial (if possible) for setting up a Toggle to switch it on or off from the Settings app :good:

    Adding toggle in secsetting is easy but only reason behind not providing it is that some people would have enabled AOSP lockscreen in that case method will be slightly different. But you can follow this tutorial to add toggle for it using build.prop



    How to add Toggle :

    • Follow main tutorial
    • Inside WallpaperWidget.smali, search for invoke-direct {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->BlurImage()V and add following code above it
      Code:
      const-string v0, "ro.harsh.blurlockscreen"
      
          invoke-static {v0, v2}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z
      
          move-result v0
      
          if-eqz v0, :cond_2
    • Search below for .end method (2 - 3 lines down) and add this below it
      Code:
      :cond_2
          invoke-direct {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->setLockScreenWallpaper()V
      
          goto :goto_0
    • That's all. Compile it.
    Now you can toggle its state by adding ro.harsh.blurlockscreen=true or ro.harsh.blurlockscreen=false
    You can also type in terminal setprop ro.harsh.blurlockscreen true/false to toggle state on the fly.
    3
    Thanks @BOOTMGR for this effect, I have try to insert a smali to activate this effect with checkbox on the "fly" and it was a success :)
    I would like to share the code that I inserted with you.
    First search this line in WallpaperWidget:
    Code:
    invoke-direct {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->BlurImage()V
    Under this line insert this code:
    Code:
    iget-object v0, p0, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->mContext:Landroid/content/Context;
    
        invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
    
        move-result-object v0
    
        const-string v1, "blur_checkbox"
    
        invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
    
        move-result v0
    
        if-ne v0, v2, :cond_2
    	
        .line 63
        invoke-virtual {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->updateWallpaper()V
    
        goto :goto_0
    	
    	:cond_2
        invoke-direct {p0}, Lcom/android/internal/policy/impl/sec/WallpaperWidget;->setLockScreenWallpaper()V
    
        goto :goto_0
    .end method
    I hope I have been of help :)
    3
    Upgrading Android OS...
    Opening apllications...


    I'm getting this again and again after I reboot my device, I think the files aren't compatible with my 4.1.2 TW deodexed.. :(
    but this mod looks so cool, I want this :)

    It should be. Check again that & make sure you did everything properly. Did you pushed libharsh.so to /system/lib and changed its permission?


    Seems interesting, great work! :) btw is this tut possible for CM11 roms? I would like to try compiling this on our CM11 builds :)

    You can do it easily by Xposed. Gravitybox doesnot suppot this on 4.1.2 because of unavailable API

    Is there anyway to make this into an xposed module?

    Making this available through xposed is very easy. I make module later when i'll be free.