Enable screen lock and HOME key (eclair and older versions)(转)
2012-06-11 22:28
417 查看
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.
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.
相关文章推荐
- Home/Search key doesn't work, and Power key cann't lock screen 关于home首页 搜索按键失灵,电源键不能锁屏问题
- enable home screen lock
- 动态访问控制列表:lock-and-key
- older versions of the JRE and JDK
- Disable and enable Foreign Key and Check Constraints
- 12.1.2: How to Modify and Enable The Configurable Home Page Delivered Via 12.1.2 (Doc ID 1061482.1)
- 配置lock-and-key(动态访问列表) 推荐
- Introducing home screen widgets and the AppWidget framework (翻译)
- Vbscript SendKeys and Get NumLock ,CapsLock, ScrollLock Key Status
- Lock and Key (Dynamic ACLs)
- Vbscript SendKeys and Get NumLock ,CapsLock, ScrollLock Key Status
- tslib: Selected device is not a touchscreen (must support ABS and KEY event types)解决方法
- Lock and Key Access-List
- create shortcut in gnome3 and some settings-- lockscreen & arp_attack
- How to install and manage different versions of Python in Linux
- 查询最近oracle更改的数据 VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE
- Direct Path Insert - APPEND HINT and TM Enqueue LOCK Behaviour
- Bluetooth in Android 4.2 and 4.3(三):Enable Bluetooth
- Essential Security Tools: OpenSSL and Keytool
- Lock screen when logged in gnome env as root