Skip to content

Commit

Permalink
SystemUI: Prevent another OOB when creating tile views
Browse files Browse the repository at this point in the history
* not sure about this but the issue usually happens when triggering dark mode via qs tile

05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.qs.tileimpl.QSTileViewImpl.<init>(QSTileViewImpl.kt:420)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.qs.tileimpl.QSFactoryImpl.createTileView(QSFactoryImpl.java:6)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.qs.QSPanelControllerBase.setTiles(QSPanelControllerBase.java:27)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.qs.QSPanelControllerBase.setTiles(QSPanelControllerBase.java:2)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.qs.QSPanelControllerBase.onViewAttached(QSPanelControllerBase.java:91)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.qs.QSPanelController.onViewAttached(QSPanelController.java:0)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.util.ViewController$1.onViewAttachedToWindow(ViewController.java:2)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.util.ViewController.init(ViewController.java:21)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.qs.QSFragment.onViewCreated(QSFragment.java:20)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1313)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1581)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1642)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3052)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:3009)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.app.FragmentController.dispatchStart(FragmentController.java:196)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.fragments.FragmentHostManager.createFragmentHost(FragmentHostManager.java:48)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.systemui.fragments.FragmentHostManager.reloadFragments(FragmentHostManager.java:37)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.keyguard.CarrierTextManager$$ExternalSyntheticLambda0.run(R8$$SyntheticClass:282)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:942)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:99)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:201)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:288)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7946)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
05-02 00:53:13.918  2099  2099 E AndroidRuntime: Caused by: java.lang.IndexOutOfBoundsException

test: consecutive toggling of qs dark theme tile (40+), observe for sysui crash, so far none yet.

Change-Id: I4a46e03a4aefc13d870c87b227445a6333165eda
Signed-off-by: minaripenguin <[email protected]>
Signed-off-by: DennySPb <[email protected]>
  • Loading branch information
minaripenguin authored and DennySPB committed May 12, 2023
1 parent 6bbd26c commit 4c2444f
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ protected void onViewDetached() {

mMediaHost.removeVisibilityChangeListener(mMediaHostVisibilityListener);

for (TileRecord record : mRecords) {
record.tile.removeCallbacks();
if (areThereTiles()) {
for (TileRecord record : mRecords) {
record.tile.removeCallbacks();
}
mRecords.clear();
}
mRecords.clear();
mDumpManager.unregisterDumpable(mView.getDumpableTag());
}

Expand Down Expand Up @@ -263,6 +265,7 @@ public void setTiles(Collection<QSTile> tiles, boolean collapsedView) {

/** */
public void refreshAllTiles() {
if (!areThereTiles()) return;
for (QSPanelControllerBase.TileRecord r : mRecords) {
if (!r.tile.isListening()) {
// Only refresh tiles that were not already in the listening state. Tiles that are
Expand Down

0 comments on commit 4c2444f

Please sign in to comment.