Loading packages/SystemUI/src/com/android/systemui/util/leak/RotationUtils.java +12 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.view.Surface; import com.android.systemui.statusbar.core.StatusBarConnectedDisplays; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -138,7 +140,16 @@ public final class RotationUtils { default: throw new IllegalArgumentException("Unknown rotation: " + rot); } Configuration c = new Configuration(context.getResources().getConfiguration()); Configuration c; if (StatusBarConnectedDisplays.isEnabled()) { // Create an empty config to use as an override. This ensures the new context inherits // other configuration values from the base context and stays up to date. // we only want to override the orientation, and not anything else. c = new Configuration(); } else { // Legacy behavior: copy the full configuration, creating a static snapshot. c = new Configuration(context.getResources().getConfiguration()); } c.orientation = orientation; Context rotated = context.createConfigurationContext(c); return rotated.getResources(); Loading Loading
packages/SystemUI/src/com/android/systemui/util/leak/RotationUtils.java +12 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.view.Surface; import com.android.systemui.statusbar.core.StatusBarConnectedDisplays; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -138,7 +140,16 @@ public final class RotationUtils { default: throw new IllegalArgumentException("Unknown rotation: " + rot); } Configuration c = new Configuration(context.getResources().getConfiguration()); Configuration c; if (StatusBarConnectedDisplays.isEnabled()) { // Create an empty config to use as an override. This ensures the new context inherits // other configuration values from the base context and stays up to date. // we only want to override the orientation, and not anything else. c = new Configuration(); } else { // Legacy behavior: copy the full configuration, creating a static snapshot. c = new Configuration(context.getResources().getConfiguration()); } c.orientation = orientation; Context rotated = context.createConfigurationContext(c); return rotated.getResources(); Loading