好的,我已经解决了这个问题,现在我想与您分享我的解决方案。
起初,正如我所说的,我有 android 资源,所以我对 android 资源进行了一些更改,以访问 PIN 和 Pattern 对话框。他们在这里:
在~\AndroidSources\pakages\apps\Settings\AndroidManifest.xml我更改了以下代码行
<activity android:name="ConfirmLockPattern"
android:exported="true"> // This line was added by me.
</activity>
<activity android:name="ConfirmLockPassword"
android:exported="true" // This line was added by me.
android:them="@android:style/Them.NoTitleBar">
</activity>
<activity android:name="ChooseLockPattern"
android:exported="true" // This line was added by me.
android:label="@string/lockpattern_change_lock_pattern_label">
</activity>
这种修改允许我从我自己的应用程序中调用“ ConfirmLockPattern ”、“ ConfirmLockPassword ”和“ ChooseLockPattern ”活动。在我编译 android 源代码并在我的模拟器上启动 system.img 之后。
在我的应用程序中,我编写了以下函数来调用“ ConfirmLockPattern ”或“ ChooseLockPattern ”活动:
/**
* Show PIN/Password confirmation dialog.
*/
void ShowConfirmLockPINActivity() {
CustomLog.i(TAG, "Show Confirm Lock PIN Activity");
Intent intent = new Intent(Intent.ACTION_RUN);
intent.setComponent(new ComponentName("com.android.settings",
"com.android.settings.ConfirmLockPassword"));
startActivityForResult(intent, mRequestCode);
} /* ShowConfirmLockPINActivity() */
/**
* Show set PIN/Password dialog.
*/
void ShowSetLockPINActivity() {
CustomLog.i(TAG, "Show Set Lock PIN Activity");
Intent intent = new Intent(Intent.ACTION_RUN);
intent.setComponent(new ComponentName("com.android.settings",
"com.android.settings.ChooseLockPassword"));
startActivityForResult(intent, mRequestCode);
} /* ShowSetLockPINActivity() */
/**
* Show Pattern Confirmation dialog.
*/
void ShowSetLockPatternActivity() {
CustomLog.i(TAG, "Show Set Lock Pattern Activity");
Intent intent = new Intent(Intent.ACTION_RUN);
intent.setComponent(new ComponentName("com.android.settings",
"com.android.settings.ConfirmLockPattern"));
startActivityForResult(intent, mRequestCode);
} /* ShowSetLockPatternActivity() */