Split getHashFactorInternal() from getHashFactor()
Move the core of getHashFactor() into a new method getHashFactorInternal(). Make updatePasswordHistory() call getHashFactorInternal() instead of getHashFactor(). This follows the best practice for service implementations by not re-entering the Binder interface as part of the implementation of a different method in the interface. Specifically, it avoids a redundant permission check that is needed only for incoming Binder calls. (updatePasswordHistory() is part of the implementation of ILockSettings#setLockCredential() and LockSettingsInternal#setLockCredentialWithToken(). ILockSettings#setLockCredential() already does its own permission check and clears the calling identity. LockSettingsInternal methods are callable only by system_server itself and are not expected to check permissions; indeed, the only caller of setLockCredentialWithToken() does its own permission check and clears the calling identity.) No functional change other than removing redundant work. Test: atest FrameworksServicesTests:com.android.server.locksettings Bug: 320392352 Bug: 416768837 Flag: EXEMPT refactor Change-Id: Iba3687cbe3db9cbbcb23f029111aa3208d4bd5a5
Loading
Please register or sign in to comment