FORUMS
Remove All Ads from XDA

[GUIDE] Pattern Lock Tweaks - Wallpaper Brightness, Pattern Lock Dots, etc.

173 posts
Thanks Meter: 106
 
By claimui, Senior Member on 2nd November 2011, 09:13 PM
Post Reply Email Thread
This is a summary of a Galaxy S II thread, but it should be applicable to other Android phones with a pattern lock. Some of this info is elsewhere in bits and pieces, but enough of it is new to warrant a full post. Plus it is helpful to have it all in one place.

Pattern Lock Wallpaper Brightness

Normally the pattern lock wallpaper is not as bright as the original image-- there's a dim or dark filter over it. To change this, decompile framework-res.apk (use apktool or apk_manager), and edit res\layout\keyguard_screen_unlock_portrait.xml.

On line 4, change android:background="#70000000" to android:background="@color/transparent"

Compile framework-res.apk and put it back into system\framework. Reboot and you should see that the pattern lock wallpaper is the same brightness as the original image! You can also try changing the "#70000000" to another hex color code for different effects.

Alternative by LfcFan1977:
Quote:
Originally Posted by LfcFan1977

I am using a Htc Desire on dGB aosp rom but just to add to this thread. In the keyguard_screen_unlock_portrait.xml, I changed:
android:background="#70000000" to android:background="@drawable/patternlock_background"
Added an image called patternlock_background.png to the drawable-hdpi folder.

Pattern Lock Wallpaper Sizing
Quote:
Originally Posted by ICWiener_

Hi,
a few month ago I investigated the size of the background image to fit the pattern dots, and after a few experiments I saw that android was doing a bit of resizing, even if the image was exactly the screen size.

What worked for me, is to make an image smaller than 800 in height (763px to be precise) and 480 in width (regular width of 1 screen). But when done editing, I stretch its height back to 800. Then, when applying within gallery ("use as..."), it stretch it back to undeformed.

I made a template in photoshop, for those who are interested, also with my actual pattern background. Still can't post urls here, so...it's hosted at mediafire.com :

Code:
/?fo04gtvp82y1xw1 (the template)
/?82txu5qxdea6usb (the background)

Pattern Lock Dots

I found the pattern lock dots to be too large and dark, covering up most of the wallpaper. I wanted to make the dots smaller and more transparent so that I could see the wallpaper but still see where the dot locations are.

The images for the pattern lock dots are in the framework-res.apk, under res\drawable-hdpi. These are png images so if you just want to change the dots, you do not need to use apktool to decompile framework-res.apk. Just open framework-res.apk with 7zip and replace the images directly.

These are the images you need to edit:
btn_code_lock_default.png -- This is the white dot in the middle
indicator_code_lock_point_area_default.png -- This is the dark circular background of the dot

Here are some replacement png's you can try: http://forum.xda-developers.com/show...54&postcount=5
For this one, I reduced both the white middle dot and the outer ring by 50%. Then I increased the transparency of both and made the outer ring a lighter gray.

I am not a Photoshop wiz, so I recommend Paint.NET as a free image editor that is relatively simple to use and works well with transparency.

Some other pattern lock dot images you can change (thanks ICWiener_):
Quote:
Originally Posted by ICWiener_

The pngs that shows up when the pattern is the wrong one :
indicator_code_lock_point_area_red.png (the circle around)
indicator_code_lock_drag_direction_red_up.png (the arrow showing the direction)

And if you use "visible pattern" in the options, these are the green ones :
indicator_code_lock_point_area_green.png
indicator_code_lock_drag_direction_green_up.png
btn_code_lock_touched.png (the small dot in the center, touched version)

Pattern Lock Clock font

The clock font on the pattern lock screen is Clockopia.ttf located in /system/fonts. Replacing this file will replace the font. You can also use the Font Changer app, available on XDA or Market: http://forum.xda-developers.com/showthread.php?t=874658 (You'll find Clockopia in the "Advanced" tab of Font Changer.)

However, simply replacing Clockopia with a normal font results in placement issues. This thread on Rootzwiki gives a good description of the Clockopia alignment problem and how to fix it. Basically, use a font editor to replace the glyphs in the Clockopia.ttf with the glyphs from your favorite font.

As an example, here is a Roboto font replacement for Clockopia, where I replaced each of the Clockopia glyphs with the ones from Roboto. This font now aligns perfectly on the pattern lockscreen.

Pattern Lock Path Color [HELP NEEDED]

Big thanks to pendo for figuring out the pattern lock path color (the white semi-transparent line when you drag a pattern, if you have "Visible Pattern" enabled in Settings.) And also to LfcFan1977 for following up on this.

Quote:
Originally Posted by pendo

Decompile framework.jar and look in smali/com/android/internal/widget/LockPatternView.smali and look for a line like this

Code:
    iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;

    const/4 v3, -0x1
The "-0x1" is what you'd want to change. That's white. You should be able to just set any hex value you want.

Quote:
Originally Posted by LfcFan1977

I could only get black 0x0 or white -0x1 until I changed it to the following:

Code:
    .line 266
    iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;

    const/4 v3, 0x0

    invoke-virtual {v2, v3}, Landroid/graphics/Paint;->setColor(I)V

    .line 267
    iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;

    const/16 v3, 0x0

    invoke-virtual {v2, v3}, Landroid/graphics/Paint;->setAlpha(I)V
Which gave me full transparency.

Sample Pattern Lock Screen

Here is a nice example of a custom pattern lock screen by LfcFan1977.
Quote:
Originally Posted by LfcFan1977

It would be great to see some wallpapers that incorporate the pattern lock into their design. There could be some pretty cool ideas by mixing a pattern lock wallpaper with custom pattern dots and lines.
The Following 15 Users Say Thank You to claimui For This Useful Post: [ View ] Gift claimui Ad-Free
 
 
4th November 2011, 05:29 AM |#2  
OP Senior Member
Flag Taipei
Thanks Meter: 106
 
More
Editing the Text / Information on the Pattern Lock Screen

Thanks to byrong for putting together a detailed reference on editing the various text elements on the pattern lock screen: [MOD] Pattern Lock screen - remove/add information Check out his thread for a great graphic on what parts of the XML match up with the various text elements.

To edit the text, decompile framework-res.apk (use apktool or apk_manager), and edit res\layout\keyguard_screen_unlock_portrait.xml.

In my case, I wanted to just add an extra line to the pattern lock screen to give my contact info, in case I lost my phone and somebody wanted to return it to me. So I just added an extra LinearLayout text block underneath the pattern lock dots, with smaller font size for a cleaner look.

Here is my change highlighted in red:
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@id/patternlockscreenwallpaper_root" android:layout_width="fill_parent" android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient android:gravity="center_horizontal" android:orientation="vertical" android:background="@color/transparent" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
            <TextView android:textAppearance="?textAppearanceMedium" android:ellipsize="marquee" android:gravity="bottom|right|center" android:id="@id/carrier" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6.0dip" android:layout_marginRight="8.0dip" android:singleLine="true" android:layout_toRightOf="@id/time" android:layout_alignParentTop="true" android:layout_alignParentRight="true" />
            <com.android.internal.widget.DigitalClock android:id="@id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20.0dip" android:layout_marginTop="15.0dip" android:layout_alignParentLeft="true" android:layout_alignParentTop="true">
                <TextView android:textAppearance="?textAppearanceMedium" android:textSize="56.0sp" android:ellipsize="none" android:gravity="bottom" android:id="@id/timeDisplay" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="6.0dip" android:singleLine="true" android:shadowColor="#c0000000" android:shadowDx="0.0" android:shadowDy="0.0" android:shadowRadius="3.0" />
                <TextView android:textAppearance="?textAppearanceMedium" android:textSize="18.0sp" android:ellipsize="none" android:gravity="bottom" android:id="@id/am_pm" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginLeft="4.0dip" android:singleLine="true" android:shadowColor="#c0000000" android:shadowDx="0.0" android:shadowDy="0.0" android:shadowRadius="3.0" />
            </com.android.internal.widget.DigitalClock>
            <TextView android:textAppearance="?textAppearanceMedium" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="24.0dip" android:layout_below="@id/time" />
        </RelativeLayout>
        <View android:id="@id/divider" android:background="@drawable/divider_horizontal_dark" android:layout_width="fill_parent" android:layout_height="1.0dip" android:layout_marginTop="8.0dip" android:layout_marginBottom="8.0dip" />
        <LinearLayout android:gravity="left" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="12.0dip" android:layout_marginTop="0.0dip">
            <TextView android:textAppearance="?textAppearanceMedium" android:textSize="18.0sp" android:id="@id/status1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawablePadding="4.0dip" />
            <TextView android:textAppearance="?textAppearanceMedium" android:textSize="18.0sp" android:id="@id/statusSep" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5.0dip" android:layout_marginRight="5.0dip" />
            <TextView android:textAppearance="?textAppearanceMedium" android:textSize="18.0sp" android:id="@id/status2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawablePadding="4.0dip" android:layout_alignParentTop="true" />
        </LinearLayout>
        <com.android.internal.widget.LockPatternView android:id="@id/lockPattern" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_marginTop="2.0dip" android:layout_weight="1.0" android:aspect="@string/lock_pattern_view_aspect" />
        <LinearLayout android:gravity="center_horizontal" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="0.0dip" android:layout_marginTop="0.0dip">
            <TextView android:textAppearance="?textAppearanceMedium" android:textSize="14.0sp" android:text="If found, please contact me at xxxxx@xxxxx.com" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawablePadding="4.0dip" />
        </LinearLayout>
        <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
            <RelativeLayout android:id="@id/footerNormal" android:layout_width="fill_parent" android:layout_height="fill_parent">
                <Button android:id="@id/emergencyCallAlone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lockscreen_emergency_call" android:drawableLeft="@drawable/ic_emergency" android:drawablePadding="8.0dip" android:layout_centerInParent="true" style="@style/Widget.Button.Transparent" />
            </RelativeLayout>
            <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/footerForgotPattern" android:layout_width="fill_parent" android:layout_height="fill_parent">
                <Button android:id="@id/emergencyCallTogether" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_marginLeft="4.0dip" android:layout_marginTop="4.0dip" android:layout_marginRight="2.0dip" android:layout_marginBottom="4.0dip" android:text="@string/lockscreen_emergency_call" android:drawableLeft="@drawable/ic_emergency" android:drawablePadding="8.0dip" android:layout_weight="1.0" style="@style/Widget.Button.Transparent" />
                <Button android:id="@id/forgotPattern" android:visibility="invisible" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_marginLeft="2.0dip" android:layout_marginTop="4.0dip" android:layout_marginRight="4.0dip" android:layout_marginBottom="4.0dip" android:layout_weight="1.0" style="@style/Widget.Button.Transparent" />
            </LinearLayout>
        </FrameLayout>
    </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
</RelativeLayout>
Again, check out byrong's thread for more details and options.
The Following 2 Users Say Thank You to claimui For This Useful Post: [ View ] Gift claimui Ad-Free
4th November 2011, 05:31 AM |#3  
OP Senior Member
Flag Taipei
Thanks Meter: 106
 
More
[Reserved for future use.]
The Following User Says Thank You to claimui For This Useful Post: [ View ] Gift claimui Ad-Free
4th November 2011, 01:39 PM |#4  
LfcFan1977's Avatar
Senior Member
Thanks Meter: 165
 
More
Pattern Lock Path Color [HELP NEEDED]
Here are some files I hope will shed light on what controls the white semi-transparent line that appears when we draw/finger drag a pattern.
See screenshot in [OP].

In the keyguard_screen_unlock_portrait.xml on line 18 is the following code which I assume is linked to the process.
If that is part of the process then I am confused as to why the end of that line does not appear in keyguard_screen_unlock_landscape.xml.
Code:
<com.android.internal.widget.LockPatternView android:id="@id/lockPattern" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_marginTop="2.0dip" android:layout_weight="1.0" android:aspect="@string/lock_pattern_view_aspect" />
I have been looking at the source code LockPatternView here and a third of the way down there is reference to R.styleable.LockPatternView_aspect and all the images used for the lockpattern.
Amongst that is
Code:
mPathPaint.setColor(Color.WHITE);   // TODO this should be from the style
but by this time I am completely lost and plucking at straws.

Any help would be very much appreciated.

keyguard_screen_unlock_portrait.xml
keyguard_screen_unlock_landscape.xml
LockPatternView.smali
LinearLayoutWithDefaultTouchRecepient.smali
7th November 2011, 07:31 PM |#5  
Member
Thanks Meter: 29
 
More
Good info, thanks for posting this. Looking forward to the color answer. Someone has to have changed this before!
30th November 2011, 06:11 AM |#6  
akusokuzan's Avatar
Senior Member
Thanks Meter: 40
 
More
do you think there's any way we would be able to use the Samsung lock screen for the galaxy s2 (I like the messaging and music integration) but with a secondary lock with a pattern for example without a 3rd party app?
30th November 2011, 07:47 PM |#7  
LfcFan1977's Avatar
Senior Member
Thanks Meter: 165
 
More
Do you not just need to press Menu - Settings - Location & security - Set up screen lock - Pattern.
Sorry if I have completely misunderstood you.
1st December 2011, 09:18 PM |#8  
akusokuzan's Avatar
Senior Member
Thanks Meter: 40
 
More
no, I'm looking for a sort of "double lock" without the use of a third party app. I remember my HTC hero back then had this feature where you would unlock the phone then enter the password. I think even iphones have the same feature.

I only need it now because syncing email requires that I have the security lock on the device
4th January 2012, 04:02 AM |#9  
LfcFan1977's Avatar
Senior Member
Thanks Meter: 165
 
More
[Solved] Transparent drag/draw line
Big thanks to Pendo for pointing me right to the correct spot.

Quote:
Originally Posted by pendo

Decompile framework.jar and look in smali/com/android/internal/widget/LockPatternView.smali and look for a line like this

Code:
    iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;

    const/4 v3, -0x1
The "-0x1" is what you'd want to change. That's white. You should be able to just set any hex value you want.

Superb, thanks Pendo.
I could only get black 0x0 or white -0x1 until I changed it to the following:
Code:
    .line 266
    iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;

    const/4 v3, 0x0

    invoke-virtual {v2, v3}, Landroid/graphics/Paint;->setColor(I)V

    .line 267
    iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;

    const/16 v3, 0x0

    invoke-virtual {v2, v3}, Landroid/graphics/Paint;->setAlpha(I)V
Which gave me full transparency.

Need to have a play around with is some more because I could not get different colours to either show or even compile most times.

Again, that you very much for the help.
The Following User Says Thank You to LfcFan1977 For This Useful Post: [ View ] Gift LfcFan1977 Ad-Free
29th January 2012, 11:26 PM |#10  
Member
Thanks Meter: 29
 
More
Got the pattern lock color change to work in a theme for my droid X. Thanks for this!
14th February 2012, 01:42 PM |#11  
LfcFan1977's Avatar
Senior Member
Thanks Meter: 165
 
More
Helpful guide to changing the text displayed [MOD] Pattern Lock screen - remove/add information

New one
patternlock_background.png - 480x762

btn_code_lock_default.png - Transparent
btn_code_lock_touched.png - Fingerprint
indicator_code_lock_point_area_default.png - Transparent
indicator_code_lock_point_area_green.png - Transparent
indicator_code_lock_point_area_red.png - Transparent
indicator_code_lock_drag_direction_green_up.png - Semi transparent small white blurred dot
indicator_code_lock_drag_direction_red_up.png - Semi transparent small white blurred dot
ic_emergency.png - white
The drag/draw line described in post #9 is transparent.



Anybody know what the emergency call button is named?
On screen it is a semi transparent rectangle. To change its appearance I have added a red retangle to the patternlock_background.png but I would like to edit the actual button to match the other red parts of the screen.
Post Reply Subscribe to Thread

Tags
lockscreen, pattern lock, pattern lockscreen, pattern wallpaper

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes