From e0f0bde0bc2c59fd57adf5e84e5c843eb706a402 Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Mon, 17 Jun 2024 19:21:39 +0000 Subject: Adding check to validate assets before appending shared library Bug: b/344805124 Test: Verified all affected tests passed Flag: android.content.res.register_resource_paths (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a5dbbb092fbe6c912c3cce1143d72f3a14aa451b) Merged-In: Idae846c9f799887635f85bec5e0cb912b5eaa1b1 Change-Id: Idae846c9f799887635f85bec5e0cb912b5eaa1b1 --- core/java/android/app/ResourcesManager.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java index b51462e6b363..1050e1d4b30f 100644 --- a/core/java/android/app/ResourcesManager.java +++ b/core/java/android/app/ResourcesManager.java @@ -1834,10 +1834,15 @@ public class ResourcesManager { if (r.getImpl() != null) { final ResourcesImpl oldImpl = r.getImpl(); // ResourcesImpl constructor will help to append shared library asset paths. - final ResourcesImpl newImpl = new ResourcesImpl(oldImpl.getAssets(), - oldImpl.getMetrics(), oldImpl.getConfiguration(), - oldImpl.getDisplayAdjustments()); - r.setImpl(newImpl); + if (oldImpl.getAssets().isUpToDate()) { + final ResourcesImpl newImpl = new ResourcesImpl(oldImpl.getAssets(), + oldImpl.getMetrics(), oldImpl.getConfiguration(), + oldImpl.getDisplayAdjustments()); + r.setImpl(newImpl); + } else { + Slog.w(TAG, "Skip appending shared library asset paths for the " + + "Resource as its assets are not up to date."); + } } } } -- cgit v1.2.3-59-g8ed1b From 2e51f187712a4191d86755cf2eb9c2aa8429ccf1 Mon Sep 17 00:00:00 2001 From: Nicolo' Mazzucato Date: Fri, 21 Jun 2024 10:58:59 +0000 Subject: Fix concurrentModificationException of DevicePostureController listeners Some listener ended up registering or unregistering other listeners while posture updates were sent. I coulnd't repro it, but we had a few reports from the field. I suspect there is a chain of calls that leads to the destruction of some objects (onDestroy) and triggers the postureController.removeListener, but only rarely. Fix: 345390663 Test: DevicePostureControllerImplTest Flag: NONE safe fix for rare and not reproducible exception (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a25fc68d3892efdaece3314e0ad92b976a1d16ec) Merged-In: I00b5813267e917c65ca269324a9f17783069fd82 Change-Id: I00b5813267e917c65ca269324a9f17783069fd82 --- .../systemui/statusbar/policy/DevicePostureControllerImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DevicePostureControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DevicePostureControllerImpl.java index de0eb493c83d..528ef491f40c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DevicePostureControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DevicePostureControllerImpl.java @@ -31,8 +31,8 @@ import com.android.systemui.util.Assert; import kotlin.Unit; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Executor; import javax.inject.Inject; @@ -42,7 +42,13 @@ import javax.inject.Inject; public class DevicePostureControllerImpl implements DevicePostureController { /** From androidx.window.common.COMMON_STATE_USE_BASE_STATE */ private static final int COMMON_STATE_USE_BASE_STATE = 1000; - private final List mListeners = new ArrayList<>(); + /** + * Despite this is always used only from the main thread, it might be that some listener + * unregisters itself while we're sending the update, ending up modifying this while we're + * iterating it. + * Keeping a threadsafe list of listeners helps preventing ConcurrentModificationExceptions. + */ + private final List mListeners = new CopyOnWriteArrayList<>(); private final List mSupportedStates; private DeviceState mCurrentDeviceState; private int mCurrentDevicePosture = DEVICE_POSTURE_UNKNOWN; -- cgit v1.2.3-59-g8ed1b From 886516009fe48d4e2f043c668b82d1c037cf1172 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 23 Jul 2024 08:53:27 +0000 Subject: Fixed Bluetooth dialog active device color Bug: 337067143 Flag: EXEMPT bugfix Test: manual (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:df1a57396c9d87f23cd5cbfaa188500f7e6b2fd3) Merged-In: I756c3f90ea13f5264174ef94149f9d78764d5833 Change-Id: I756c3f90ea13f5264174ef94149f9d78764d5833 --- .../color/disconnected_network_primary_color.xml | 20 +++++++++++ .../res/layout/internet_connectivity_dialog.xml | 3 +- packages/SystemUI/res/values/styles.xml | 23 +++++++++++-- .../qsdialog/BluetoothTileDialogDelegate.kt | 39 ++++++++++++++++++---- .../systemui/bluetooth/qsdialog/DeviceItem.kt | 1 + .../bluetooth/qsdialog/DeviceItemFactory.kt | 21 ++++++++---- .../qs/tiles/dialog/InternetDialogDelegate.java | 4 +++ 7 files changed, 94 insertions(+), 17 deletions(-) create mode 100644 packages/SystemUI/res/color/disconnected_network_primary_color.xml diff --git a/packages/SystemUI/res/color/disconnected_network_primary_color.xml b/packages/SystemUI/res/color/disconnected_network_primary_color.xml new file mode 100644 index 000000000000..536bf78b7b60 --- /dev/null +++ b/packages/SystemUI/res/color/disconnected_network_primary_color.xml @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/layout/internet_connectivity_dialog.xml b/packages/SystemUI/res/layout/internet_connectivity_dialog.xml index 22d156da7580..0029180932ee 100644 --- a/packages/SystemUI/res/layout/internet_connectivity_dialog.xml +++ b/packages/SystemUI/res/layout/internet_connectivity_dialog.xml @@ -170,8 +170,7 @@ android:layout_height="28dp" android:layout_marginStart="7dp" android:layout_marginEnd="16dp" - android:layout_gravity="center_vertical" - android:background="?android:attr/textColorSecondary"/> + android:layout_gravity="center_vertical"/> ?androidprv:attr/materialColorOnSurfaceVariant - - + + + + + +