Skip to content

Commit 6307cce

Browse files
authored
Merge December 2025 QPR2 Patches (android-16.0.0_r4) (#91)
* SettingsLib: bump to `android-16.0.0_r4` tag * SettingsLib: bump `minSdk` version to 23 https://android.googlesource.com/platform/frameworks/base/+/40ba4786d08b0618fe77ce7435116dbd41f2fb12 ("Update SettingsLib/DataStore min_sdk_version to 23.") * CollapsingToolbarBaseActivity: add APIs for action button https://android.googlesource.com/platform/frameworks/base/+/7e207744232a1a9f22ba6edafe26d0e575290090 ("Added button in CollapsingToolbar") * CollapsingToolbarBaseActivity: add APIs for trailing buttons (primary/secondary/action) https://android.googlesource.com/platform/frameworks/base/+/5deb69739d62f225dd8ba15f0987250d107a1145 ("[Expressive design] Add trailing buttons to CollapsingToolbar") * CollapsingToolbarBaseActivity: add API to toggle Toolbar trailing buttons Now we have a trailing buttons view holding the action, primary & secondary buttons not just the action button, so refactoring is needed. * CollapsingToolbarBaseActivity: collapse toolbar when hosting multiple fragments https://android.googlesource.com/platform/frameworks/base/+/e0bf8cb02e2bbab0dea2ec1d1153b1b8818b6677 ("Collapse toolbar when hosting multiple fragments") * SettingsLib/CollapsingToolbarBaseActivity: fix compilation issues * ScrollableToolbarItemLayout is a Kotlin class. --- /home/runner/work/7SIM/7SIM/SettingsLib/fwb/packages/SettingsLib/CollapsingToolbarBaseActivity/src/com/android/settingslib/collapsingtoolbar/CollapsingToolbarBaseActivity.java:34: error: cannot find symbol import com.android.settingslib.collapsingtoolbar.widget.ScrollableToolbarItemLayout; ^ symbol: class ScrollableToolbarItemLayout location: package com.android.settingslib.collapsingtoolbar.widget * Bump `Room` to `v2.8.0-alpha01` (`android-16.0.0_r4` tag) * Bump `Material3` to `v1.14.0-alpha02` (`android-16.0.0_r4` tag) * Bump AndroidX deps to `android-16.0.0_r4` tag * CollapsingToolbarBaseActivity: fix compilations errors /home/runner/work/7SIM/7SIM/src/com/github/iusmac/sevensim/ui/components/CollapsingToolbarBaseActivity.java:87: error: cannot find symbol .map((v) -> (View) v.getParent()); ^ symbol: method getParent() location: variable v of type Object * SimPinFeederTest: increase task timeout in CI environment to 5 seconds GitHub Actions runners are very slow sometimes, which timeouts our tests, probably due to JVM waiting for resources from the OS such as processor. We already faced a similar issue in 1b353b0 and 6946b97, so increasing timeout a bit should resolve the issue. To maintain speed when testing locally, we still want to timeout after 3 seconds. org.awaitility.core.ConditionTimeoutException: Condition with Lambda expression in com.github.iusmac.sevensim.telephony.SimPinFeederTest was not fulfilled within 3 seconds. at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167) at org.awaitility.core.CallableCondition.await(CallableCondition.java:78) at org.awaitility.core.CallableCondition.await(CallableCondition.java:26) at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1160) at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1129) at com.github.iusmac.sevensim.telephony.SimPinFeederTest.assertTaskInState(SimPinFeederTest.java:879) at com.github.iusmac.sevensim.telephony.SimPinFeederTest.test_ShouldUnlockWhenAttemptsRemainingIsAtLeastThree_SinceS(SimPinFeederTest.java:274) --- Another symptom that GitHub Actions runners are very slow, is that we even got a NPE in the SimPinFeeder thread that runs in parallel, because the main/test thread already terminated (due to a fixed timeout), and recycled objects that aren't reachable anymore. Exception in thread "Thread-71" java.lang.NullPointerException: Cannot invoke "android.telephony.TelephonyManager.getSimState()" because "this.mTelephonyManager" is null at com.github.iusmac.sevensim.telephony.SimPinFeeder$SimCard.toString(SimPinFeeder.java:325) at java.base/java.util.Formatter$FormatSpecifier.printString(Formatter.java:3158) at java.base/java.util.Formatter$FormatSpecifier.print(Formatter.java:3036) at java.base/java.util.Formatter.format(Formatter.java:2791) at java.base/java.util.Formatter.format(Formatter.java:2728) at java.base/java.lang.String.format(String.java:4431) at com.github.iusmac.sevensim.Logger.format(Logger.java:112) at com.github.iusmac.sevensim.Logger.v(Logger.java:56) at com.github.iusmac.sevensim.telephony.SimPinFeeder.run(SimPinFeeder.java:99) * SimPinFeederTest: fix compilation errors /home/runner/work/7SIM/7SIM/tests/test/java/com/github/iusmac/sevensim/telephony/SimPinFeederTest.java:120: error: element value must be a constant expression @test(timeout = TASK_WAIT_TIMEOUT_MILLIS) * Revert "fix(ui/PrimarySwitchPreference): address extra divider empty space [Expressive Design] (#79)" This reverts commit 60c5164. * fix(ui/PrimarySwitchPreference): address extra divider empty space [Expressive Design] In the expressive theme introduced in Android 16 (Baklava), the switch preference used in the SIM list activity contains additional space at the beginning of the parent layout causing the title (e.g., SIM name) and summary (e.g., next upcoming schedule) text views that precede it to wrap earlier. * Update golden screenshots for Roborazzi tests
1 parent a3b7bcb commit 6307cce

423 files changed

Lines changed: 148 additions & 63 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SettingsLib/ButtonPreference/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
namespace 'com.android.settingslib.widget.preference.button'
1010

1111
defaultConfig {
12-
minSdk 21
12+
minSdk 23
1313
versionCode 1
1414
versionName "1.0"
1515
}

SettingsLib/CollapsingToolbarBaseActivity/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id 'com.android.library'
3+
id 'org.jetbrains.kotlin.android'
34
}
45

56
def SettingsLibCollapsingToolbarBaseActivity = '../fwb/packages/SettingsLib/CollapsingToolbarBaseActivity'

SettingsLib/LayoutPreference/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
namespace 'com.android.settingslib.widget.preference.layout'
99

1010
defaultConfig {
11-
minSdk 21
11+
minSdk 23
1212
versionCode 1
1313
versionName "1.0"
1414
}

SettingsLib/SettingsTheme/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
namespace 'com.android.settingslib.widget.theme'
1010

1111
defaultConfig {
12-
minSdk 21
12+
minSdk 23
1313
versionCode 1
1414
versionName "1.0"
1515
}

SettingsLib/SettingsThemeFlags/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ android {
66
namespace 'com.android.settingslib.widget.theme.flags'
77

88
defaultConfig {
9-
minSdk 21
9+
minSdk 23
1010
}
1111

1212
sourceSets {

SettingsLib/TwoTargetPreference/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
namespace 'com.android.settingslib.widget.preference.twotarget'
99

1010
defaultConfig {
11-
minSdk 21
11+
minSdk 23
1212
versionCode 1
1313
versionName "1.0"
1414
}

SettingsLib/fetch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ declare -r SHORT_OPTS=u:,t:
88
declare -r LONG_OPTS=set-repo-url:,set-repo-tag:,get-repo-url,get-repo-tag,apply-patches-only
99
declare -r FWB_DIR='fwb'
1010
declare REPO_URL='https://android.googlesource.com/platform/frameworks/base.git'
11-
declare REPO_TAG='android-16.0.0_r1'
11+
declare REPO_TAG='android-16.0.0_r4'
1212
declare -a LIBS=(
1313
'BannerMessagePreference'
1414
'ButtonPreference'

gradle/libs.versions.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# https://mvnrepository.com/artifact/androidx.room/room-runtime
77
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/room/room-compiler/
88
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/room/room-runtime/
9-
room = "2.7.0-beta01"
9+
room = "2.8.0-alpha01"
1010
# https://mvnrepository.com/artifact/com.google.dagger/hilt-android
1111
# https://mvnrepository.com/artifact/com.google.dagger/hilt-compiler
1212
# https://android.googlesource.com/platform/external/dagger2
@@ -33,10 +33,10 @@ kover = "0.9.1"
3333
[libraries]
3434
# https://mvnrepository.com/artifact/androidx.activity/activity
3535
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/activity/activity/
36-
activity = { module = "androidx.activity:activity", version = "1.11.0-alpha01" }
36+
activity = { module = "androidx.activity:activity", version = "1.12.0-alpha08" }
3737
# https://mvnrepository.com/artifact/androidx.annotation/annotation
3838
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/annotation/annotation-jvm/
39-
annotation = { module = "androidx.annotation:annotation", version = "1.9.0-rc01" }
39+
annotation = { module = "androidx.annotation:annotation", version = "1.9.1" } # TODO: AOSP sources use 1.11.0-alpha01; upgrade when available in Maven Central
4040
# https://mvnrepository.com/artifact/androidx.appcompat/appcompat
4141
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/appcompat/appcompat/
4242
appcompat = { module = "androidx.appcompat:appcompat", version = "1.7.1" } # TODO: AOSP sources use 1.8.0-alpha01; upgrade when available in Maven Central }
@@ -46,16 +46,16 @@ arch-core-testing = { module = "androidx.arch.core:core-testing", version = "2.2
4646
awaitility = { module = "org.awaitility:awaitility", version = "4.3.0" }
4747
# https://mvnrepository.com/artifact/androidx.biometric/biometric
4848
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/biometric/biometric/
49-
biometric = { module = "androidx.biometric:biometric", version = "1.4.0-alpha02" }
49+
biometric = { module = "androidx.biometric:biometric", version = "1.4.0-alpha04" }
5050
# https://mvnrepository.com/artifact/androidx.collection/collection
5151
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/collection/collection-jvm/
52-
collection = { module = "androidx.collection:collection", version = "1.5.0-beta03" }
52+
collection = { module = "androidx.collection:collection", version = "1.5.0" }
5353
# https://mvnrepository.com/artifact/androidx.coordinatorlayout/coordinatorlayout
5454
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/coordinatorlayout/coordinatorlayout/
5555
coordinatorlayout = { module = "androidx.coordinatorlayout:coordinatorlayout", version = "1.3.0-alpha02" }
5656
# https://mvnrepository.com/artifact/androidx.core/core
5757
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/core/core/
58-
core = { module = "androidx.core:core", version = "1.16.0-beta01" }
58+
core = { module = "androidx.core:core", version = "1.17.0" } # TODO: AOSP sources use 1.19.0-alpha01; upgrade when available in Maven Central }
5959
# https://mvnrepository.com/artifact/com.google.errorprone/error_prone_core
6060
errorprone = { module = "com.google.errorprone:error_prone_core", version = "2.42.0" }
6161
# https://mvnrepository.com/artifact/androidx.test.espresso/espresso-core
@@ -70,10 +70,10 @@ hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hil
7070
junit = { module = "junit:junit", version = "4.13.2" }
7171
# https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-livedata
7272
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/lifecycle/lifecycle-livedata/
73-
livedata = { module = "androidx.lifecycle:lifecycle-livedata", version = "2.9.0-alpha12" }
73+
livedata = { module = "androidx.lifecycle:lifecycle-livedata", version = "2.10.0-alpha04" }
7474
# https://mvnrepository.com/artifact/com.google.android.material/material
7575
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/extras/material-design-x/com/google/android/material/material/
76-
material = { module = "com.google.android.material:material", version = "1.13.0-alpha08" }
76+
material = { module = "com.google.android.material:material", version = "1.14.0-alpha02" }
7777
# https://mvnrepository.com/artifact/org.mockito/mockito-core
7878
mockito = { module = "org.mockito:mockito-core", version = "5.20.0" }
7979
# https://mvnrepository.com/artifact/androidx.preference/preference
@@ -101,7 +101,7 @@ test-rules = { module = "androidx.test:rules", version = "1.7.0" }
101101
test-runner = { module = "androidx.test:runner", version = "1.7.0" }
102102
# https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-viewmodel
103103
# https://android.googlesource.com/platform/prebuilts/sdk/+/refs/heads/main/current/androidx/m2repository/androidx/lifecycle/lifecycle-viewmodel-android/
104-
viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version = "2.9.0-alpha12" }
104+
viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version = "2.10.0-alpha04" }
105105

106106
[plugins]
107107
android-application = { id = "com.android.application", version.ref = "agp" }

res/values-v36/themes_expressive.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,16 @@
77

88
<item name="scheduleCardCollapsedBackgroundColor">@color/settingslib_materialColorSurfaceBright</item>
99
<item name="scheduleCardExpandedBackgroundColor">@color/settingslib_materialColorSurfaceDim</item>
10+
11+
<item name="expressiveTwoTargetPreferenceTheme">@style/ExpressiveTwoTargetPreferenceTheme.Custom</item>
12+
</style>
13+
14+
<style name="ExpressiveTwoTargetPreferenceTheme.Custom" parent="ExpressiveTwoTargetPreferenceTheme">
15+
<item name="expressiveTwoTargetDividerStyle">@style/ExpressiveTwoTargetDividerStyle.Custom</item>
16+
</style>
17+
18+
<style name="ExpressiveTwoTargetDividerStyle.Custom" parent="ExpressiveTwoTargetDividerStyle">
19+
<!-- Remove unnecessary padding at the start of the divider in the expressive theme. -->
20+
<item name="android:paddingStart">0dip</item>
1021
</style>
1122
</resources>

src/com/github/iusmac/sevensim/ui/components/CollapsingToolbarBaseActivity.java

Lines changed: 95 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.iusmac.sevensim.ui.components;
22

3+
import android.annotation.DrawableRes;
34
import android.app.ActionBar;
45
import android.os.Bundle;
56
import android.view.MenuItem;
@@ -37,7 +38,7 @@ public abstract class CollapsingToolbarBaseActivity extends FragmentActivity {
3738
private CollapsingToolbarDelegate mToolbardelegate;
3839
private ToolbarDecorator mToolbarDecorator;
3940
private ViewModel mViewModel;
40-
private Optional<View> mActionButton = Optional.empty();
41+
private Optional<View> mTrailingButtons = Optional.empty();
4142

4243
@Override
4344
protected void onCreate(final @Nullable Bundle savedInstanceState) {
@@ -46,6 +47,8 @@ protected void onCreate(final @Nullable Bundle savedInstanceState) {
4647
EdgeToEdgeUtils.enable(this);
4748
super.onCreate(savedInstanceState);
4849

50+
getToolbarDelegate().registerToolbarCollapseBehavior(this);
51+
4952
final boolean isExpressiveTheme = SettingsThemeHelper.isExpressiveTheme(this);
5053
if (isExpressiveTheme) {
5154
setTheme(R.style.Theme_SubSettingsBase_Expressive_Custom);
@@ -78,10 +81,14 @@ protected void onCreate(final @Nullable Bundle savedInstanceState) {
7881
getAppBarLayout().setExpanded(true);
7982
}
8083
if (isExpressiveTheme) {
81-
mActionButton = Optional.ofNullable(getToolbarDelegate().getToolbar().findViewById(
82-
com.android.settingslib.collapsingtoolbar.R.id.action_button));
83-
// Hide the action button by default when expressive theme is enabled.
84-
setActionButtonEnabled(false);
84+
mTrailingButtons = Optional.<View>ofNullable(getToolbarDelegate().getToolbar()
85+
// Use action button view to find the trailing buttons parent
86+
.findViewById(com.android.settingslib.collapsingtoolbar.R.id.action_button))
87+
.map((v) -> (View) v.getParent());
88+
// Hide the trailing buttons view by default when expressive theme is enabled to
89+
// avoid the blank space at the end of the Toolbar added in XML, which we can't
90+
// edit. This will allow for the Toolbar's title & subtitle to fully expand
91+
setTrailingButtonsEnabled(false);
8592
}
8693
// Our use case requires the CollapsingToolbar to be permanently lifted above the
8794
// scrollable content (safe to disable; less animations, better performance)
@@ -129,6 +136,52 @@ public void setSubtitle(final @StringRes int subtitleId) {
129136
setSubtitle(getText(subtitleId));
130137
}
131138

139+
/**
140+
* Show/Hide the primary button on the Toolbar.
141+
* @param enabled true to show the button, otherwise it's hidden.
142+
*/
143+
public void setPrimaryButtonEnabled(final boolean enabled) {
144+
getToolbarDelegate().setPrimaryButtonEnabled(enabled);
145+
}
146+
147+
/** Set the icon to the primary button */
148+
public void setPrimaryButtonIcon(final @DrawableRes int drawableRes) {
149+
getToolbarDelegate().setPrimaryButtonIcon(this, drawableRes);
150+
}
151+
152+
/** Set the OnClick listener to the primary button. */
153+
public void setPrimaryButtonOnClickListener(final @Nullable View.OnClickListener listener) {
154+
getToolbarDelegate().setPrimaryButtonOnClickListener(listener);
155+
}
156+
157+
/** Set the content description to the primary button */
158+
public void setPrimaryButtonContentDescription(final @Nullable CharSequence contentDescription) {
159+
getToolbarDelegate().setPrimaryButtonContentDescription(contentDescription);
160+
}
161+
162+
/**
163+
* Show/Hide the secondary button on the Toolbar.
164+
* @param enabled true to show the button, otherwise it's hidden.
165+
*/
166+
public void setSecondaryButtonEnabled(final boolean enabled) {
167+
getToolbarDelegate().setSecondaryButtonEnabled(enabled);
168+
}
169+
170+
/** Set the icon to the secondary button */
171+
public void setSecondaryButtonIcon(final @DrawableRes int drawableRes) {
172+
getToolbarDelegate().setSecondaryButtonIcon(this, drawableRes);
173+
}
174+
175+
/** Set the OnClick listener to the secondary button */
176+
public void setSecondaryButtonOnClickListener(final @Nullable View.OnClickListener listener) {
177+
getToolbarDelegate().setSecondaryButtonOnClickListener(listener);
178+
}
179+
180+
/** Set the content description to the secondary button */
181+
public void setSecondaryButtonContentDescription(final @Nullable CharSequence contentDescription) {
182+
getToolbarDelegate().setSecondaryButtonContentDescription(contentDescription);
183+
}
184+
132185
/**
133186
* Show/Hide the action button on the Toolbar.
134187
*
@@ -137,13 +190,46 @@ public void setSubtitle(final @StringRes int subtitleId) {
137190
* @param enabled {@code true} to show the button, otherwise it's hidden.
138191
*/
139192
public void setActionButtonEnabled(final boolean enabled) {
140-
mActionButton.ifPresent((v) ->
141-
// Note that, the action button is wrapped by a parent view that has padding and we
142-
// can't edit the layout in XML, so we want to hide it too to avoid empty spaces
143-
((View) v.getParent()).setVisibility(enabled ? View.VISIBLE : View.GONE));
144193
getToolbarDelegate().setActionButtonEnabled(enabled);
145194
}
146195

196+
/**
197+
* Enable/Disable the action button on the Toolbar (being clickable or not).
198+
* @param clickable true to enable the button, otherwise it's disabled.
199+
*/
200+
public void setActionButtonClickable(final boolean clickable) {
201+
getToolbarDelegate().setActionButtonClickable(clickable);
202+
}
203+
204+
/** Set the icon to the action button */
205+
public void setActionButtonIcon(final @DrawableRes int drawableRes) {
206+
getToolbarDelegate().setActionButtonIcon(this, drawableRes);
207+
}
208+
209+
/** Set the text to the action button */
210+
public void setActionButtonText(final @Nullable CharSequence text) {
211+
getToolbarDelegate().setActionButtonText(text);
212+
}
213+
214+
/** Set the OnClick listener to the action button */
215+
public void setActionButtonListener(final @Nullable View.OnClickListener listener) {
216+
getToolbarDelegate().setActionButtonOnClickListener(listener);
217+
}
218+
219+
/** Set the content description to the action button */
220+
public void setActionButtonContentDescription(final @Nullable CharSequence contentDescription) {
221+
getToolbarDelegate().setActionButtonContentDescription(contentDescription);
222+
}
223+
224+
/**
225+
* Show/Hide the Toolbar's trailing buttons (action/primary/secondary) view.
226+
*
227+
* @param enabled {@code true} to show the trailing buttons view, otherwise it's hidden.
228+
*/
229+
public void setTrailingButtonsEnabled(final boolean enabled) {
230+
mTrailingButtons.ifPresent((v) -> v.setVisibility(enabled ? View.VISIBLE : View.GONE));
231+
}
232+
147233
@Override
148234
public boolean onNavigateUp() {
149235
if (!super.onNavigateUp()) {

0 commit comments

Comments
 (0)