Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db7f6d18 authored by Chandru S's avatar Chandru S
Browse files

Move StatusBarService.disableForUser binder call to bg thread.

This happens on the main thread during the lockscreen -> bouncer transition
lockscreen -> bouncer transition is janky

Flag: com.android.systemui.bouncer_ui_revamp
Test: verified manually in trace that the binder call is not happening on the main thread
Bug: 404201117
Change-Id: I746da2a8d59fab63b2eccd1c5cec2659d381439e
parent e31637b6
Loading
Loading
Loading
Loading
+19 −14
Original line number Diff line number Diff line
@@ -3765,13 +3765,7 @@ public class KeyguardViewMediator implements CoreStartable,
                        Log.d(TAG, "Status bar manager is disabled for visible background users");
                    }
                } else {
                    try {
                        mStatusBarService.disableForUser(flags, mStatusBarDisableToken,
                                mContext.getPackageName(),
                                mSelectedUserInteractor.getSelectedUserId());
                    } catch (RemoteException e) {
                        Log.d(TAG, "Failed to force clear flags", e);
                    }
                    statusBarServiceDisableForUser(flags, "Failed to force clear flags");
                }
            }

@@ -3807,15 +3801,26 @@ public class KeyguardViewMediator implements CoreStartable,

                // Handled in StatusBarDisableFlagsInteractor.
                if (!KeyguardWmStateRefactor.isEnabled()) {
                    statusBarServiceDisableForUser(flags, "Failed to set disable flags: ");
                }
            }
        }
    }

    private void statusBarServiceDisableForUser(int flags, String loggingContext) {
        Runnable runnable = () -> {
            try {
                mStatusBarService.disableForUser(flags, mStatusBarDisableToken,
                        mContext.getPackageName(),
                        mSelectedUserInteractor.getSelectedUserId());
            } catch (RemoteException e) {
                        Log.d(TAG, "Failed to set disable flags: " + flags, e);
                    }
                }
                Log.d(TAG, loggingContext + " " + flags, e);
            }
        };
        if (com.android.systemui.Flags.bouncerUiRevamp()) {
            mUiBgExecutor.execute(runnable);
        } else {
            runnable.run();
        }
    }