当前位置: 首页 > news >正文

Android13重置锁屏(1)

跟踪系统设置密码过程,查找到/packages/apps/Settings/src/com/android/settings/password/ChooseLockPassword.java

的代码:

 @Overrideprotected Pair<Boolean, Intent> saveAndVerifyInBackground() {boolean success;try {success = mUtils.setLockCredential(mChosenPassword, mCurrentCredential, mUserId);} catch (RuntimeException e) {Log.e(TAG, "Failed to set lockscreen credential", e);success = false;}if (success) {unifyProfileCredentialIfRequested();}
..............................
}

mUtils是LockPatternUtils new出来的对象,查找LockPatternUtils对应的方法:

/frameworks/base/core/java/com/android/internal/widget/LockPatternUtils.java

    /*** Save a new lockscreen credential.** <p> This method will fail (returning {@code false}) if the previously saved credential* provided is incorrect, or if the lockscreen verification is still being throttled.** @param newCredential The new credential to save* @param savedCredential The current credential* @param userHandle the user whose lockscreen credential is to be changed** @return whether this method saved the new password successfully or not. This flow will fail* and return false if the given credential is wrong.* @throws RuntimeException if password change encountered an unrecoverable error.* @throws UnsupportedOperationException secure lockscreen is not supported on this device.* @throws IllegalArgumentException if new credential is too short.*/public boolean setLockCredential(@NonNull LockscreenCredential newCredential,@NonNull LockscreenCredential savedCredential, int userHandle) {if (!hasSecureLockScreen() && newCredential.getType() != CREDENTIAL_TYPE_NONE) {throw new UnsupportedOperationException("This operation requires the lock screen feature.");}newCredential.checkLength();try {if (!getLockSettings().setLockCredential(newCredential, savedCredential, userHandle)) {return false;}} catch (RemoteException e) {throw new RuntimeException("Unable to save lock password", e);}return true;}

注释说明:

LockscreenCredential newCredential 新的锁屏凭证

LockscreenCredential savedCredential 当前锁屏凭证

如果更改锁屏凭证,需要当前锁屏凭证验证,但要求是不知道当前锁屏凭证的情况下,设置新的锁屏凭证,继续跟踪代码

getLockSettings().setLockCredential(newCredential, savedCredential, userHandle)

getLockSettings()代码:

public ILockSettings getLockSettings() {if (mLockSettingsService == null) {ILockSettings service = ILockSettings.Stub.asInterface(ServiceManager.getService("lock_settings"));mLockSettingsService = service;}return mLockSettingsService;}

方法里面实际调用了LockSettingsService服务的setLockCredential方法,继续跟踪LockSettingsService。

/frameworks/base/services/core/java/com/android/server/locksettings/LockSettingsService.java

   @Overridepublic boolean setLockCredential(LockscreenCredential credential,LockscreenCredential savedCredential, int userId) {...........................................final long identity = Binder.clearCallingIdentity();try {..............................................synchronized (mSeparateChallengeLock) {if (!setLockCredentialInternal(credential, savedCredential,userId, /* isLockTiedToParent= */ false)) {scheduleGc();return false;}setSeparateProfileChallengeEnabledLocked(userId, true, /* unused */ null);notifyPasswordChanged(credential, userId);}if (isCredentialSharableWithParent(userId)) {// Make sure the profile doesn't get locked straight after setting work challenge.setDeviceUnlockedForUser(userId);}notifySeparateProfileChallengeChanged(userId);onPostPasswordChanged(credential, userId);scheduleGc();         return true;} finally {Binder.restoreCallingIdentity(identity);}}

setLockCredential又调用了setLockCredentialInternal方法。

。。。。。

经过一层层跟踪,查找到/frameworks/base/services/core/java/com/android/server/locksettings/LockSettingsStorage.java

锁屏凭证存在/data/system/locksettings.db,而且是经过加密,直接读取原始明文需要反向破解,直接清除locksettings.db又担心引起系统异常,还是得用别的办法,继续回到setLockCredential。

http://www.xdnf.cn/news/1167715.html

相关文章:

  • 碰一碰发视频源码搭建:支持OEM
  • 现在希望用git将本地文件crawler目录下的文件更新到远程仓库指定crawler目录下,命名相同的文件本地文件将其覆盖
  • 【Tomcat】Tomcat线程池深度调优手册(终极版)
  • 用USBi仿真器的SPI模式和IIC模式来调试DSP应该怎么做?
  • Vue项目中的AJAX请求与跨域问题解析
  • Linux CentOS 虚拟机升级内核至4.x以上版本
  • 异构融合 4A:重构高性能计算与复杂场景分析的安全与效率边界
  • Go 的第一类对象与闭包
  • Vercel AI SDK 3.0 学习入门指南
  • 厚铜板载流革命与精密压合工艺——高可靠性PCB批量制造的新锚点
  • 容器化部署 Tomcat + MySQL 实战指南:从入门到进阶
  • 分布式高可用ELK平台搭建及使用保姆级教程指南
  • 智能制造——解读52页汽车设计制造一体化整车产品生命周期PLM解决方案【附全文阅读】
  • linux用户态各定时器抖动测试
  • 操作符练习
  • 【Linux内核模块】模块声明与描述
  • nginx使用手册
  • 在easyui中如何自定义表格里面的内容
  • MCU中的总线桥是什么?
  • 分布在内侧内嗅皮层(MEC)的边界细胞对NLP中的深层语义分析的积极影响和启示
  • 深入浅出理解 TCP 与 UDP:网络传输协议的核心差异与应用
  • JMeter groovy 编译成.jar 文件
  • oracle里面concat函数用法,oracle wm_concat函数用法-
  • python学习-读取csv大文件
  • Apache Ignite实现无死锁特性
  • PHP与Web页面交互:从基础表单到AJAX实战
  • k8s:利用helm离线部署consul v1.21.2
  • 【菜狗学聚类】时间序列聚类主要方法—20250722
  • web3.0怎么入局
  • PePeOnTron上线 Binance Alpha:中文社区正走出自己的Web3之路