Status Update
Comments
ki...@google.com <ki...@google.com>
jp...@gmail.com <jp...@gmail.com> #2
The issue is reproducible with core-ktx 1.2.0 and 1.3.0-rc01.
al...@google.com <al...@google.com> #3
The Typeface.weight is not a weight of the underlying font file. It is a display style. On older APIs, the display style is adjusted if the Typeface is created from single font. However, after moving to CustomFallbackBuilder, that adjustment is removed since it can crate Typeface from multiple style font files.
Looks like it is good to set display style by ResourcesCompat.getFont for backward compatibility.
al...@google.com <al...@google.com> #4
Hi Nona,
Can you please schedule a release after you merge the fix?
al...@google.com <al...@google.com> #5
Branch: androidx-master-dev
commit 3d6aa2e9b3243dcc4de1f54bd8d40339bd69cb05
Author: Seigo Nonaka <nona@google.com>
Date: Wed May 27 17:38:05 2020
Adjust the Typeface display style with the style of given font
This behavir is implicitly done by Typeface.Builder and
Typeface.createXXX function but not to be done by
Typeface.CustomFallbackBuilder since it is designed to be working
with multiple font files which has different style.
Looks like the style argument is ignored on older API implementation.
Bug: 156853883
Bug: 152023266
Test: ResourcesCompatTest#testGetFont_adjustDisplayStyle passes on 29
Test: ./gradlew core:core:connectedAndroidTest on API 29, 28, 23
Change-Id: I3a377c339a7aed50973cf11df86ddf0069f4ec25
A core/core/src/androidTest/assets/fonts/thin_italic.ttf
A core/core/src/androidTest/assets/fonts/thin_italic.ttx
M core/core/src/androidTest/java/androidx/core/content/res/ResourcesCompatTest.java
A core/core/src/androidTest/res/font/thin_italic.ttf
M core/core/src/main/java/androidx/core/graphics/TypefaceCompatApi29Impl.java
al...@google.com <al...@google.com> #7
Any way I can tell what version this will land in?
al...@google.com <al...@google.com> #9
Great—works as expected, thanks!
al...@google.com <al...@google.com> #10
Note that mToken
is used to avoid holding a reference to the Activity
.
al...@google.com <al...@google.com> #11
Test doesn't work because launchActivity
actually returns the second activity if recreate()
is successful!
val firstActivity = activityTestRule.launchActivity(null)
// Wait for the old activity to be destroyed.
PollingCheck.waitFor(5000) {
firstActivity.isDestroyed
}
al...@google.com <al...@google.com> #12
Tried to fix the test, but the second activity never reaches RESUMED
. I think this means we've addressed the issue with API 21 and 22 such that they behave like API 23.
It looks like the activity runs all the way through to RESUMED
but then receives a call to onPaused
and -- according to the lifecycle manager -- remains in the STARTED
state. Forever.
al...@google.com <al...@google.com> #13
API <= 23 doesn't support calling recreate() outside of the STARTED
state, so we'll try posting on the Handler
to delay the work until we reach the right state. Since we can't observe the state directly, though, we're going to have to post it to the Handler
all the time.
ap...@google.com <ap...@google.com> #14
Branch: androidx-master-dev
commit 42808e39fb69f457e1d3d07237425c3df9416c26
Author: Alan Viverette <alanv@google.com>
Date: Wed Jul 29 16:05:48 2020
Ensure that ActivityCompat.recreate() works from onResume on SDK <= 23
Adds tests for onResume, onStart, and onStop that verify behavior across
all API levels.
Relnote: "Allow ActivityCompat.recreate() to be safely called from any
lifecycle state on any API level."
Bug: 160122826
Test: ActivityCompatRecreateFromLifecycleStatesTest
Change-Id: I62dde2d9041eb5b7ba2344380841aa03848d42e0
M core/core/src/androidTest/AndroidManifest.xml
A core/core/src/androidTest/java/androidx/core/app/ActivityCompatRecreateFromResumeTestCase.kt
A core/core/src/androidTest/java/androidx/core/app/ActivityCompatRecreateLifecycleTestActivity.kt
M core/core/src/main/java/androidx/core/app/ActivityCompat.java
M core/core/src/main/java/androidx/core/app/ActivityRecreator.java
ap...@google.com <ap...@google.com> #15
Branch: snap-temp-L43700000691908123
commit d99565ea445577278517dc13a6783b68f8fec238
Author: Alan Viverette <alanv@google.com>
Date: Wed Jul 29 16:05:48 2020
Ensure that ActivityCompat.recreate() works from onResume on SDK <= 23
Adds tests for onResume, onStart, and onStop that verify behavior across
all API levels.
Relnote: "Allow ActivityCompat.recreate() to be safely called from any
lifecycle state on any API level."
Bug: 160122826
Test: ActivityCompatRecreateFromLifecycleStatesTest
Change-Id: I62dde2d9041eb5b7ba2344380841aa03848d42e0
(cherry picked from commit 5dcfcd6b3593e8237ecb306053979433e75f9515)
M core/core/src/androidTest/AndroidManifest.xml
A core/core/src/androidTest/java/androidx/core/app/ActivityCompatRecreateFromResumeTestCase.kt
A core/core/src/androidTest/java/androidx/core/app/ActivityCompatRecreateLifecycleTestActivity.kt
M core/core/src/main/java/androidx/core/app/ActivityCompat.java
M core/core/src/main/java/androidx/core/app/ActivityRecreator.java
ap...@google.com <ap...@google.com> #16
Branch: snap-temp-L39700000691908325
commit facb88fa7f503056bbbd9284cdd58c22073f354a
Author: Alan Viverette <alanv@google.com>
Date: Wed Jul 29 16:05:48 2020
Ensure that ActivityCompat.recreate() works from onResume on SDK <= 23
Adds tests for onResume, onStart, and onStop that verify behavior across
all API levels.
Relnote: "Allow ActivityCompat.recreate() to be safely called from any
lifecycle state on any API level."
Bug: 160122826
Test: ActivityCompatRecreateFromLifecycleStatesTest
Change-Id: I62dde2d9041eb5b7ba2344380841aa03848d42e0
(cherry picked from commit 5dcfcd6b3593e8237ecb306053979433e75f9515)
M core/core/src/androidTest/AndroidManifest.xml
A core/core/src/androidTest/java/androidx/core/app/ActivityCompatRecreateFromResumeTestCase.kt
A core/core/src/androidTest/java/androidx/core/app/ActivityCompatRecreateLifecycleTestActivity.kt
M core/core/src/main/java/androidx/core/app/ActivityCompat.java
M core/core/src/main/java/androidx/core/app/ActivityRecreator.java
ap...@google.com <ap...@google.com> #17
Branch: snap-temp-L39600000691945594
commit 09508097fd54b56c93298563e880862ba8d8944d
Author: Alan Viverette <alanv@google.com>
Date: Wed Jul 29 16:05:48 2020
Ensure that ActivityCompat.recreate() works from onResume on SDK <= 23
Adds tests for onResume, onStart, and onStop that verify behavior across
all API levels.
Relnote: "Allow ActivityCompat.recreate() to be safely called from any
lifecycle state on any API level."
Bug: 160122826
Test: ActivityCompatRecreateFromLifecycleStatesTest
Change-Id: I62dde2d9041eb5b7ba2344380841aa03848d42e0
(cherry picked from commit 5dcfcd6b3593e8237ecb306053979433e75f9515)
M core/core/src/androidTest/AndroidManifest.xml
A core/core/src/androidTest/java/androidx/core/app/ActivityCompatRecreateFromResumeTestCase.kt
A core/core/src/androidTest/java/androidx/core/app/ActivityCompatRecreateLifecycleTestActivity.kt
M core/core/src/main/java/androidx/core/app/ActivityCompat.java
M core/core/src/main/java/androidx/core/app/ActivityRecreator.java
an...@google.com <an...@google.com> #18
The following changes were cherrypicked through
Release Track:
Changes: aosp/1426928
Description
On API 21, when
ActivityCompat.recreate()
is called fromActivity.onStart()
orActivity.onResume()
, the newly created activity becomes stuck on a black screen. However, callingActivity.recreate()
directly doesn't cause any issues.I've created a very simple sample project to reproduce the issue:https://github.com/jpmcosta/AndroidTestProject/tree/43793368a74f97fff17818ebb5455594910b3002
The first time you open the app it will try to recreate the activity using
ActivityCompat.recreate()
and it will show a black screen. You should go back and reopen the app.The second time you open the app (if the app's process is not killed) it will try to recreate the activity using
Activity.recreate()
directly and it will succeed in doing so.Component used: AppCompat
Version used: 1.3.0-alpha01
Devices/Android versions reproduced on: Emulator API 21