Enable screen lock and Home Key (eclair and older versions)

Source: Internet
Author: User

From: http://rootfs.wordpress.com/2010/07/23/android-enable-home-screen-lock-and-home-key/

 

The lock pattern does not take effect after setting. And the home key does not work.

1. Frameworks/base/policies/phone/COM/Android/Internal/policy/impl/keyguardviewmediator. java.

In private void dokeyguard () routine:

Final Boolean provisioned = mupdatemonitor. isdeviceprovisioned ();

...

If (! Lockedormissing &&! Provisioned ){
If (Debug) log. D (TAG, "dokeyguard: Not showing because device isn' t provisioned"
+ "And the SIM is not locked or missing ");
Return;
}

2. Frameworks/base/policies/phone/COM/Android/Internal/policy/impl/keyguardupdatemonitor. java.

Public Boolean isdeviceprovisioned (){
Return mdeviceprovisioned;
}

In public keyguardupdatemonitor (context) routine:

Mdeviceprovisioned = settings. Secure. getint (
Mcontext. getcontentresolver (), settings. Secure. device_provisioned, 0 )! = 0;

3. Frameworks/base/CORE/Java/Android/provider/settings. Java

Public static final string device_provisioned = secure. device_provisioned;

The default value for device_provisioned is 0, need set it to 1.

Fix 1: (modify the database)

$ ADB Shell

$ CD Data/data/COM. Android. providers. Settings/databases

$ Sqlite3 settings. DB

SQLite>. Tables

SQLite> select * from secure;

SQLite> insert into secure (name, value) values ('device _ provisioned', 1 );

SQLite>. Exit

$

Reboot the phone, lock screen shows up. Note that this modification also enables the home and some other key functions.

Fix 2: (need to rebuild the image)

1. Modify packages/apps/launcher/src/COM/Android/launcher. Java as follows:

1): Add "Import Android. provider. settings;" to the header.

2): Add below line to somewhere of the oncreate () routine:

Settings. Secure. putint (getcontentresolver (), settings. Secure. device_provisioned, 1 );

2. Add write permission in packages/apps/launcher/androidmenifest. xml:

<! -<Uses-Permission Android: Name = "android. Permission. write_settings"/> already exist->
<Uses-Permission Android: Name = "android. Permission. write_secure_settings"/>

Rebuild the image. The lock pattern and Home key function wocould work now.

 

Note: Since Android 2.2 (froyo), a default provision package has been added to the system image. So the issue has gone.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.