zoukankan      html  css  js  c++  java
  • Enable screen lock and HOME key (eclair and older versions)(转)

    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 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/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 would work now.

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

  • 相关阅读:
    《增长黑客》阅读内容摘要(前三章)
    ios的安全机制
    R语言  RStudio快捷键总结
    R in action 笔记(第二部分)
    R in action 笔记(第一部分)
    R统计函数-开源
    R语言函数索引-11月
    mysql join的优化实例
    android异步消息处理机制
    android ListView与EditText共存错位
  • 原文地址:https://www.cnblogs.com/myitm/p/2545634.html
Copyright © 2011-2022 走看看