Assigned
Status Update
Comments
jh...@gmail.com <jh...@gmail.com> #2
I face with the same problem. I have different pageMargin in landscape and portrait and when viewpager is scrolled for the more than first position, after rotating device it is shifted.
I beleive the problem is inside onSizeChanged that is called after onConfigurationChanged, it has following code:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
w always not equals oldw when changing orientation, so recomputeScrollPosition is called, but whit the same values for margin and oldMargin.
This should be fixed.
I beleive the problem is inside onSizeChanged that is called after onConfigurationChanged, it has following code:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
w always not equals oldw when changing orientation, so recomputeScrollPosition is called, but whit the same values for margin and oldMargin.
This should be fixed.
[Deleted User] <[Deleted User]> #3
[Comment deleted]
ja...@google.com <ja...@google.com> #4
I found the same problem in suport library v4, wrong align happens only when ViewPager has a page margin > 0.
xe...@google.com <xe...@google.com>
p....@gmail.com <p....@gmail.com> #5
[Comment deleted]
dr...@google.com <dr...@google.com>
ny...@google.com <ny...@google.com> #6
The issue is still reproducible in support library v4 (rev. 18).
I managed to fix the issue by importing the source code of ViewPager in my project and modifying from onSizeChanged method the following line:
From:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
To:
if (w != oldw) {
recomputeScrollPosition(w, oldw, 0, 0);
}
I managed to fix the issue by importing the source code of ViewPager in my project and modifying from onSizeChanged method the following line:
From:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
To:
if (w != oldw) {
recomputeScrollPosition(w, oldw, 0, 0);
}
dr...@google.com <dr...@google.com>
fi...@gmail.com <fi...@gmail.com> #7
I use this little wrapper as a work around for the bug:
ublic class FixedViewPager extends ViewPager {
public FixedViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FixedViewPager(Context context) {
super(context);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w-this.getPageMargin(), h, oldw-this.getPageMargin(), oldh);
}
}
ublic class FixedViewPager extends ViewPager {
public FixedViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FixedViewPager(Context context) {
super(context);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w-this.getPageMargin(), h, oldw-this.getPageMargin(), oldh);
}
}
fi...@gmail.com <fi...@gmail.com> #8
Thanks for posting the workaround. Works great. Can't believe this issue still exists after almost 2 years since it's been reported.
Description
This only happens after removing a fingerprint from the fingerprint safety section in settings (Pixel Imprint).
I would expect the device to just encrypt or decrypt after showing the biometric prompt. The key should still be valid due to a fingerprint being removed, not added and the fingerprint vault still containing valid fingerprints.
This is security related.
Device:
Pixel 4a
Android 12
Buildnumber:
SQ1A.211205.008
Steps to reproduce:
Generate secret key with key alias and following KeygenParameterSpec:
KeyGenParameterSpec.Builder("keyAlias", KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT)
.setBlockModes(KeyProperties.BLOCK_MODE_CBC)
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
.setUserAuthenticationRequired(true)
.setInvalidatedByBiometricEnrollment(true)
.build()
Generate Cipher for biometric prompt in either Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE mode.
Send Cipher to biometric prompt.
Receiver Encryption Cipher from biometric prompt.
call: cipher.doFinal(data)
Success - The data can be encrypted/decrypted
Go to system settings and remove a single or several fingerprints.
Try to encrypt / decrypt again:
Get the above produced secret key from the keystore: keyStore.getKey("keyAlias", null)
Generate Cipher for biometric prompt in either Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE mode.
Send Cipher to biometric prompt.
Receiver Encryption Cipher from biometric prompt.
call: cipher.doFinal(data)
cipher.doFinal throws the following exception:
throwable={javax.crypto.IllegalBlockSizeException}
cipher = {Cipher@23559}
data = {byte[48]@23560} [-84, 126, -68, -10, 28, 55, 17, 56, -12, -5, -101, -80, -117, 122, 22, -27, -42, 12, 93, -65, 48, 124, -86, -86, 93, -107, -21, 13, 4, -79, 125, -102, -119, 71, 85, -96, 71, -83, 73, -30, -50, 34, -30, -11, 112, 2, -96, 31]
throwable = {IllegalBlockSizeException@23561} "javax.crypto.IllegalBlockSizeException"
backtrace = {Object[23]@23623}
cause = {KeyStoreException@23562} "android.security.KeyStoreException: Key user not authenticated"
mErrorCode = -26
backtrace = {Object[29]@23630}
cause = {KeyStoreException@23562} "android.security.KeyStoreException: Key user not authenticated"
detailMessage = "Key user not authenticated"
stackTrace = {StackTraceElement[28]@23633}
suppressedExceptions = {Collections$EmptyList@23625} size = 0
shadow$_klass_ = {Class@11074} "class android.security.KeyStoreException"
shadow$_monitor_ = 0
detailMessage = null
stackTrace = {StackTraceElement[22]@23627}
suppressedExceptions = {Collections$EmptyList@23625} size = 0
shadow$_klass_ = {Class@14711} "class javax.crypto.IllegalBlockSizeException"
shadow$_monitor_ = 0
childThrowable = {KeyStoreException@23562} "android.security.KeyStoreException: Key user not authenticated"
The secret key configuration can be found here in the SecretKeyHelper:
The biometric cipher helper where the exception occurs can be found here in the BiometricCipherHelper:
The block where the exception occurs:
BiometricCipherHelper.encrypt and BiometricCipherHelper.decrypt
Can be reproduced in any example app, eg. this material for this raywenderlich guide:
In order for the exception to be thrown setUserAuthenticationRequired(true) has to be set on the KeygenParameterSpec.