[Android Themes] byrong:
I use the Android pattern lock on my Inc, but I've never really liked the layout. I find most of the information on the screen to be unnecessary, and I wanted to have a personalized message instead. Through trial, error, and some help from a friend, I've succeeded, so I wanted to share what I've learned. I've also put together two ZipThemer packs for anyone who is interested in my version of the mod, but isn't comfortable editing on their own.

Note: this was done on CM7, but should apply to almost any version of GB. ICS has the same layout file in the same location, but contains extra information. Since I am not currently running an ICS rom, I haven't bothered tinkering with it yet.

I started to write a how-to guide, but it was quickly turning into a "how to decompile an apk" guide, of which there are already a thousand. If you do not know how to decompile an apk, you will need to go learn that from another source. Once you are comfortable, you'll want to decompile /system/framework/framework-res.apk

In your project directory, open /framework-res.apk/res/layout/keyguard_screen_unlock_portrait.xml

Running CM7, mine looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient android:gravity="center_horizontal" android:orientation="vertical" android:id="@id/pattern" android:background="#70000000" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<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>
<TextView android:textAppearance="?textAppearanceSmall" android:id="@id/customMsg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="24.0dip" android:layout_marginTop="4.0dip" android:layout_marginRight="24.0dip" android:layout_below="@id/status2" />
<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" />
<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>

And here's a breakdown of which parts of the XML control which parts of the pattern lock screen:

I wanted to hide most parts of the layout and instead show a custom message. Here's all that I had to do. The below code window shows the same XML as before, but I've highlighted my changes in red

<?xml version="1.0" encoding="UTF-8"?>
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient android:gravity="center_horizontal" android:orientation="vertical" android:id="@id/pattern" [COLOR="Red"]android:background="#FF000000"[/COLOR] android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView [COLOR="Red"]android:visibility="gone"[/COLOR] 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" />
[COLOR="Red"]<TextView android:textAppearance="?textAppearanceMedium" android:ellipsize="none" android:gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6.0dip" android:layout_marginRight="8.0dip" android:text="If found, please contact me at XXXXXXXXXX@XXXXX.com" android:layout_toRightOf="@id/time" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" />[/COLOR]
<com.android.internal.widget.DigitalClock [COLOR="Red"]android:visibility="gone"[/COLOR] 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 [COLOR="Red"]android:visibility="gone"[/COLOR] 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>
<TextView android:textAppearance="?textAppearanceSmall" android:id="@id/customMsg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="24.0dip" android:layout_marginTop="4.0dip" android:layout_marginRight="24.0dip" android:layout_below="@id/status2" />
<View [COLOR="Red"]android:visibility="gone"[/COLOR] 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 [COLOR="Red"]android:visibility="gone"[/COLOR] 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" />
<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>

As you can see, all I did was hide most of the preexisting layout via attribute tags. I also changed the background to solid black, so even if I have a wallpaper set, it doesn't show on the pattern lock. Then, I just added in an extra line to show my desired string...

Recompile... flash... and voila!

No more clock, date, carrier id, divider, or status reminders; instead, a simple message. In the event that my phone falls into someone else's hands, it remains (relatively) secure but they can still get in touch with me.

Unfortunately, I don't have the time to make custom flashables for your rom. For those of you who aren't comfortable editing XML on your own, however, I've created two ZipThemer packs which should hopefully work on any GB rom.

I stuck with the concept of "Please contact me..." but since I couldn't hardcode a contact value for you, I used the CarrierID. In other words, if you successfully apply one of these, your pattern lock will say "If found, please contact me at [Your Carrier ID]"

Obviously that does you no good if you leave your CarrierID stock, but this was the best "middle ground" solution I could figure out so that I could release something more universal. Use a tool like CCName to change your CarrierID to an email address, alternate phone number, etc, and you'll be in business.

Instructions for install:

Make a nandroid backup. Given the fact that ZipThemer creates undo files, this shouldn't really be needed, but better safe than sorry!

Download the version that you want (no need to unzip)

Place the zip file under /sdcard/ZipThemer

Start ZipThemer, select the theme you just downloaded, and build it

Flash the update package that ZipThemer has created and all should be well!

If anything goes wrong, try flashing the undo package that ZipThemer created. If that still does not resolve the issue, restore your backup.

Version 1 has the standard background, which is semi-transparent and will allow your wallpaper to show through.

Version 2 has a solid black background, which will cover any wallpaper that you have.

As mentioned, both use your CarrierID as the contact info. If your email address is insanely long, it will wrap. If you use custom fonts, no guarantees as to how this will look.

Click either image for the relevant ZipThemer pack