From 8213c706b71f16442316a9a02375e66835af5e5f Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Wed, 26 May 2021 16:14:54 -0400 Subject: [PATCH] Copy configuration when getting resources for a rotation Avoids changing the orientation field on the current configuration. Fixes: 189338162 Test: manual; kill sysui in portrait mode and make sure the context returns `portrat` instead of `landscape` Change-Id: I971daa9d332fb399b7801805af467fbf775cdb55 --- .../src/com/android/systemui/util/leak/RotationUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/RotationUtils.java b/packages/SystemUI/src/com/android/systemui/util/leak/RotationUtils.java index b9b7730c67f3b..0b2f004537d69 100644 --- a/packages/SystemUI/src/com/android/systemui/util/leak/RotationUtils.java +++ b/packages/SystemUI/src/com/android/systemui/util/leak/RotationUtils.java @@ -116,7 +116,7 @@ public class RotationUtils { default: throw new IllegalArgumentException("Unknown rotation: " + rot); } - Configuration c = context.getResources().getConfiguration(); + Configuration c = new Configuration(context.getResources().getConfiguration()); c.orientation = orientation; Context rotated = context.createConfigurationContext(c); return rotated.getResources();