Skip to content

Commit

Permalink
StringBlock: Prevent SystemUI crash when inflating QS
Browse files Browse the repository at this point in the history
* Reported while switching between light/dark themes.

Log:

05-01 21:03:37.375  2512  2512 E AndroidRuntime: FATAL EXCEPTION: main
05-01 21:03:37.375  2512  2512 E AndroidRuntime: Process: com.android.systemui, PID: 2512
05-01 21:03:37.375  2512  2512 E AndroidRuntime: android.view.InflateException: Binary XML file line #28 in com.android.systemui:layout/qs_tile_label_vertical: Binary XML file line #28 in com.android.systemui:layout/qs_tile_label_vertical: Error inflating class <unknown>
05-01 21:03:37.375  2512  2512 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #28 in com.android.systemui:layout/qs_tile_label_vertical: Error inflating class <unknown>
05-01 21:03:37.375  2512  2512 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at java.lang.reflect.Constructor.newInstance0(Native Method)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.view.LayoutInflater.createView(LayoutInflater.java:747)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:902)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:857)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1019)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:980)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:570)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:462)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.tileimpl.QSTileViewImpl.createAndAddLabels(QSTileViewImpl.kt:397)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.tileimpl.QSTileViewImpl.<init>(QSTileViewImpl.kt:287)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.QSPanelControllerBase.addTile(QSPanelControllerBase.java:302)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.QSPanelControllerBase.setTiles(QSPanelControllerBase.java:280)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.QSPanelControllerBase.setTiles(QSPanelControllerBase.java:249)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.QSPanelControllerBase.onTuningChanged(QSPanelControllerBase.java:546)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.tuner.TunerServiceImpl.addTunable(TunerServiceImpl.java:348)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.tuner.TunerServiceImpl.addTunable(TunerServiceImpl.java:314)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.QSPanelControllerBase.onViewAttached(QSPanelControllerBase.java:223)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.QSPanelController.onViewAttached(QSPanelController.java:118)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.util.ViewController$1.onViewAttachedToWindow(ViewController.java:52)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.util.ViewController.init(ViewController.java:80)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.QSImpl.onComponentCreated(QSImpl.java:231)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.qs.QSFragmentLegacy.onViewCreated(QSFragmentLegacy.java:78)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1313)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1581)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1642)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3052)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:3009)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.app.FragmentController.dispatchStart(FragmentController.java:196)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.fragments.FragmentHostManager.createFragmentHost(FragmentHostManager.java:115)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.fragments.FragmentHostManager.reloadFragments(FragmentHostManager.java:235)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.fragments.FragmentHostManager.onConfigurationChanged(FragmentHostManager.java:185)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.fragments.FragmentService$FragmentHostState.handleSendConfigurationChange(FragmentService.java:143)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.fragments.FragmentService$FragmentHostState.lambda$sendConfigurationChange$0(FragmentService.java:135)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.fragments.FragmentService$FragmentHostState.$r8$lambda$ILnRBQ67muZvoLLBWD-A7ymjzuo(FragmentService.java:0)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.fragments.FragmentService$FragmentHostState$$ExternalSyntheticLambda0.run(R8$$SyntheticClass:0)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:959)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:100)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:232)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:317)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8498)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
05-01 21:03:37.375  2512  2512 E AndroidRuntime: Caused by: java.lang.ArrayIndexOutOfBoundsException: length=2; index=6
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.content.res.StringBlock.getSequence(StringBlock.java:109)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.content.res.ApkAssets.getStringFromPool(ApkAssets.java:358)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.content.res.AssetManager.getPooledStringForCookie(AssetManager.java:878)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:1402)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.content.res.TypedArray.getValueAt(TypedArray.java:1387)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.content.res.TypedArray.getFont(TypedArray.java:1044)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.widget.TextView.readTextAppearance(TextView.java:4319)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at android.widget.TextView.<init>(TextView.java:1225)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.util.SafeMarqueeTextView.<init>(SafeMarqueeTextView.kt:18)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.util.DelayableMarqueeTextView.<init>(DelayableMarqueeTextView.kt:28)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.util.DelayableMarqueeTextView.<init>(DelayableMarqueeTextView.kt:23)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        at com.android.systemui.util.DelayableMarqueeTextView.<init>(DelayableMarqueeTextView.kt:0)
05-01 21:03:37.375  2512  2512 E AndroidRuntime:        ... 44 more

Signed-off-by: Pranav Vashi <[email protected]>
Signed-off-by: Jis G Jacob <[email protected]>
  • Loading branch information
neobuddy89 authored and StudioKeys committed Aug 7, 2024
1 parent e3e8347 commit 2fde06b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/java/android/content/res/StringBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public CharSequence get(int idx) {
@Nullable
public CharSequence getSequence(int idx) {
synchronized (this) {
if (mStrings != null) {
if (mStrings != null && idx < mStrings.length) {
CharSequence res = mStrings[idx];
if (res != null) {
return res;
Expand Down

0 comments on commit 2fde06b

Please sign in to comment.