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.

  • 相关阅读:
    SqlServer 查看数据库中所有存储过程
    SqlServer 查看数据库中所有视图
    SqlServer 查询表的详细信息
    SqlServer 遍历修改字段长度
    net core 操作Redis
    Tuning SharePoint Workflow Engine
    Open With Explorer
    Download language packs for SharePoint 2013
    Change Maximum Size For SharePoint List Template when Saving
    Six ways to store settings in SharePoint
  • 原文地址:https://www.cnblogs.com/myitm/p/2545634.html
Copyright © 2011-2022 走看看