Minor cleanup
- Remove unnecessary/unused methods in Bubbles interface (it can use the shell dump callback instead) - Remove some unused methods exposed in one handed interface Bug: 238217847 Test: Presubmit Change-Id: I63c90f71b66b72c5a33ffa8d2b382b0feba443f9
This commit is contained in:
@@ -821,7 +821,7 @@ public class Bubble implements BubbleViewProvider {
|
||||
/**
|
||||
* Description of current bubble state.
|
||||
*/
|
||||
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
|
||||
public void dump(@NonNull PrintWriter pw) {
|
||||
pw.print("key: "); pw.println(mKey);
|
||||
pw.print(" showInShade: "); pw.println(showInShade());
|
||||
pw.print(" showDot: "); pw.println(showDot());
|
||||
@@ -831,7 +831,7 @@ public class Bubble implements BubbleViewProvider {
|
||||
pw.print(" suppressNotif: "); pw.println(shouldSuppressNotification());
|
||||
pw.print(" autoExpand: "); pw.println(shouldAutoExpand());
|
||||
if (mExpandedView != null) {
|
||||
mExpandedView.dump(pw, args);
|
||||
mExpandedView.dump(pw);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ import android.service.notification.NotificationListenerService;
|
||||
import android.service.notification.NotificationListenerService.RankingMap;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -100,6 +99,7 @@ import com.android.wm.shell.onehanded.OneHandedController;
|
||||
import com.android.wm.shell.onehanded.OneHandedTransitionCallback;
|
||||
import com.android.wm.shell.pip.PinnedStackListenerForwarder;
|
||||
import com.android.wm.shell.sysui.ConfigurationChangeListener;
|
||||
import com.android.wm.shell.sysui.ShellCommandHandler;
|
||||
import com.android.wm.shell.sysui.ShellController;
|
||||
import com.android.wm.shell.sysui.ShellInit;
|
||||
|
||||
@@ -159,6 +159,7 @@ public class BubbleController implements ConfigurationChangeListener {
|
||||
private final TaskViewTransitions mTaskViewTransitions;
|
||||
private final SyncTransactionQueue mSyncQueue;
|
||||
private final ShellController mShellController;
|
||||
private final ShellCommandHandler mShellCommandHandler;
|
||||
|
||||
// Used to post to main UI thread
|
||||
private final ShellExecutor mMainExecutor;
|
||||
@@ -229,6 +230,7 @@ public class BubbleController implements ConfigurationChangeListener {
|
||||
|
||||
public BubbleController(Context context,
|
||||
ShellInit shellInit,
|
||||
ShellCommandHandler shellCommandHandler,
|
||||
ShellController shellController,
|
||||
BubbleData data,
|
||||
@Nullable BubbleStackView.SurfaceSynchronizer synchronizer,
|
||||
@@ -252,6 +254,7 @@ public class BubbleController implements ConfigurationChangeListener {
|
||||
TaskViewTransitions taskViewTransitions,
|
||||
SyncTransactionQueue syncQueue) {
|
||||
mContext = context;
|
||||
mShellCommandHandler = shellCommandHandler;
|
||||
mShellController = shellController;
|
||||
mLauncherApps = launcherApps;
|
||||
mBarService = statusBarService == null
|
||||
@@ -431,6 +434,7 @@ public class BubbleController implements ConfigurationChangeListener {
|
||||
mCurrentProfiles = userProfiles;
|
||||
|
||||
mShellController.addConfigurationChangeListener(this);
|
||||
mShellCommandHandler.addDumpCallback(this::dump, this);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -925,15 +929,6 @@ public class BubbleController implements ConfigurationChangeListener {
|
||||
return (isSummary && isSuppressedSummary) || isSuppressedBubble;
|
||||
}
|
||||
|
||||
private void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback) {
|
||||
if (mBubbleData.isSummarySuppressed(groupKey)) {
|
||||
mBubbleData.removeSuppressedSummary(groupKey);
|
||||
if (callback != null) {
|
||||
callback.accept(mBubbleData.getSummaryKey(groupKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Promote the provided bubble from the overflow view. */
|
||||
public void promoteBubbleFromOverflow(Bubble bubble) {
|
||||
mLogger.log(bubble, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_BACK_TO_STACK);
|
||||
@@ -1519,14 +1514,15 @@ public class BubbleController implements ConfigurationChangeListener {
|
||||
/**
|
||||
* Description of current bubble state.
|
||||
*/
|
||||
private void dump(PrintWriter pw, String[] args) {
|
||||
private void dump(PrintWriter pw, String prefix) {
|
||||
pw.println("BubbleController state:");
|
||||
mBubbleData.dump(pw, args);
|
||||
mBubbleData.dump(pw);
|
||||
pw.println();
|
||||
if (mStackView != null) {
|
||||
mStackView.dump(pw, args);
|
||||
mStackView.dump(pw);
|
||||
}
|
||||
pw.println();
|
||||
mImpl.mCachedState.dump(pw);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1710,28 +1706,12 @@ public class BubbleController implements ConfigurationChangeListener {
|
||||
return mCachedState.isBubbleExpanded(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackExpanded() {
|
||||
return mCachedState.isStackExpanded();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Bubble getBubbleWithShortcutId(String shortcutId) {
|
||||
return mCachedState.getBubbleWithShortcutId(shortcutId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback,
|
||||
Executor callbackExecutor) {
|
||||
mMainExecutor.execute(() -> {
|
||||
Consumer<String> cb = callback != null
|
||||
? (key) -> callbackExecutor.execute(() -> callback.accept(key))
|
||||
: null;
|
||||
BubbleController.this.removeSuppressedSummaryIfNecessary(groupKey, cb);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collapseStack() {
|
||||
mMainExecutor.execute(() -> {
|
||||
@@ -1760,13 +1740,6 @@ public class BubbleController implements ConfigurationChangeListener {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openBubbleOverflow() {
|
||||
mMainExecutor.execute(() -> {
|
||||
BubbleController.this.openBubbleOverflow();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleDismissalInterception(BubbleEntry entry,
|
||||
@Nullable List<BubbleEntry> children, IntConsumer removeCallback,
|
||||
@@ -1882,18 +1855,6 @@ public class BubbleController implements ConfigurationChangeListener {
|
||||
mMainExecutor.execute(
|
||||
() -> BubbleController.this.onNotificationPanelExpandedChanged(expanded));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
try {
|
||||
mMainExecutor.executeBlocking(() -> {
|
||||
BubbleController.this.dump(pw, args);
|
||||
mCachedState.dump(pw);
|
||||
});
|
||||
} catch (InterruptedException e) {
|
||||
Slog.e(TAG, "Failed to dump BubbleController in 2s");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1136,7 +1136,7 @@ public class BubbleData {
|
||||
/**
|
||||
* Description of current bubble data state.
|
||||
*/
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.print("selected: ");
|
||||
pw.println(mSelectedBubble != null
|
||||
? mSelectedBubble.getKey()
|
||||
@@ -1147,13 +1147,13 @@ public class BubbleData {
|
||||
pw.print("stack bubble count: ");
|
||||
pw.println(mBubbles.size());
|
||||
for (Bubble bubble : mBubbles) {
|
||||
bubble.dump(pw, args);
|
||||
bubble.dump(pw);
|
||||
}
|
||||
|
||||
pw.print("overflow bubble count: ");
|
||||
pw.println(mOverflowBubbles.size());
|
||||
for (Bubble bubble : mOverflowBubbles) {
|
||||
bubble.dump(pw, args);
|
||||
bubble.dump(pw);
|
||||
}
|
||||
|
||||
pw.print("summaryKeys: ");
|
||||
|
||||
@@ -1044,7 +1044,7 @@ public class BubbleExpandedView extends LinearLayout {
|
||||
/**
|
||||
* Description of current expanded view state.
|
||||
*/
|
||||
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
|
||||
public void dump(@NonNull PrintWriter pw) {
|
||||
pw.print("BubbleExpandedView");
|
||||
pw.print(" taskId: "); pw.println(mTaskId);
|
||||
pw.print(" stackView: "); pw.println(mStackView);
|
||||
|
||||
@@ -299,7 +299,7 @@ public class BubbleStackView extends FrameLayout
|
||||
private BubblesNavBarGestureTracker mBubblesNavBarGestureTracker;
|
||||
|
||||
/** Description of current animation controller state. */
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.println("Stack view state:");
|
||||
|
||||
String bubblesOnScreen = BubbleDebugConfig.formatBubblesString(
|
||||
@@ -313,8 +313,8 @@ public class BubbleStackView extends FrameLayout
|
||||
pw.print(" expandedContainerMatrix: ");
|
||||
pw.println(mExpandedViewContainer.getAnimationMatrix());
|
||||
|
||||
mStackAnimationController.dump(pw, args);
|
||||
mExpandedAnimationController.dump(pw, args);
|
||||
mStackAnimationController.dump(pw);
|
||||
mExpandedAnimationController.dump(pw);
|
||||
|
||||
if (mExpandedBubble != null) {
|
||||
pw.println("Expanded bubble state:");
|
||||
|
||||
@@ -35,7 +35,6 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.wm.shell.common.annotations.ExternalThread;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.HashMap;
|
||||
@@ -91,18 +90,6 @@ public interface Bubbles {
|
||||
*/
|
||||
boolean isBubbleExpanded(String key);
|
||||
|
||||
/** @return {@code true} if stack of bubbles is expanded or not. */
|
||||
boolean isStackExpanded();
|
||||
|
||||
/**
|
||||
* Removes a group key indicating that the summary for this group should no longer be
|
||||
* suppressed.
|
||||
*
|
||||
* @param callback If removed, this callback will be called with the summary key of the group
|
||||
*/
|
||||
void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback,
|
||||
Executor callbackExecutor);
|
||||
|
||||
/** Tell the stack of bubbles to collapse. */
|
||||
void collapseStack();
|
||||
|
||||
@@ -130,9 +117,6 @@ public interface Bubbles {
|
||||
/** Called for any taskbar changes. */
|
||||
void onTaskbarChanged(Bundle b);
|
||||
|
||||
/** Open the overflow view. */
|
||||
void openBubbleOverflow();
|
||||
|
||||
/**
|
||||
* We intercept notification entries (including group summaries) dismissed by the user when
|
||||
* there is an active bubble associated with it. We do this so that developers can still
|
||||
@@ -252,9 +236,6 @@ public interface Bubbles {
|
||||
*/
|
||||
void onUserRemoved(int removedUserId);
|
||||
|
||||
/** Description of current bubble state. */
|
||||
void dump(PrintWriter pw, String[] args);
|
||||
|
||||
/** Listener to find out about stack expansion / collapse events. */
|
||||
interface BubbleExpandListener {
|
||||
/**
|
||||
|
||||
@@ -468,7 +468,7 @@ public class ExpandedAnimationController
|
||||
}
|
||||
|
||||
/** Description of current animation controller state. */
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.println("ExpandedAnimationController state:");
|
||||
pw.print(" isActive: "); pw.println(isActiveController());
|
||||
pw.print(" animatingExpand: "); pw.println(mAnimatingExpand);
|
||||
|
||||
@@ -431,7 +431,7 @@ public class StackAnimationController extends
|
||||
}
|
||||
|
||||
/** Description of current animation controller state. */
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.println("StackAnimationController state:");
|
||||
pw.print(" isActive: "); pw.println(isActiveController());
|
||||
pw.print(" restingStackPos: ");
|
||||
|
||||
@@ -142,6 +142,7 @@ public abstract class WMShellModule {
|
||||
@Provides
|
||||
static BubbleController provideBubbleController(Context context,
|
||||
ShellInit shellInit,
|
||||
ShellCommandHandler shellCommandHandler,
|
||||
ShellController shellController,
|
||||
BubbleData data,
|
||||
FloatingContentCoordinator floatingContentCoordinator,
|
||||
@@ -162,7 +163,7 @@ public abstract class WMShellModule {
|
||||
@ShellBackgroundThread ShellExecutor bgExecutor,
|
||||
TaskViewTransitions taskViewTransitions,
|
||||
SyncTransactionQueue syncQueue) {
|
||||
return new BubbleController(context, shellInit, shellController, data,
|
||||
return new BubbleController(context, shellInit, shellCommandHandler, shellController, data,
|
||||
null /* synchronizer */, floatingContentCoordinator,
|
||||
new BubbleDataRepository(context, launcherApps, mainExecutor),
|
||||
statusBarService, windowManager, windowManagerShellWrapper, userManager,
|
||||
|
||||
@@ -36,16 +36,6 @@ public interface OneHanded {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return one handed settings enabled or not.
|
||||
*/
|
||||
boolean isOneHandedEnabled();
|
||||
|
||||
/**
|
||||
* Return swipe to notification settings enabled or not.
|
||||
*/
|
||||
boolean isSwipeToNotificationEnabled();
|
||||
|
||||
/**
|
||||
* Enters one handed mode.
|
||||
*/
|
||||
|
||||
@@ -77,8 +77,8 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
||||
|
||||
public static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
|
||||
|
||||
private volatile boolean mIsOneHandedEnabled;
|
||||
private volatile boolean mIsSwipeToNotificationEnabled;
|
||||
private boolean mIsOneHandedEnabled;
|
||||
private boolean mIsSwipeToNotificationEnabled;
|
||||
private boolean mIsShortcutEnabled;
|
||||
private boolean mTaskChangeToExit;
|
||||
private boolean mLockedDisabled;
|
||||
@@ -720,18 +720,6 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
||||
return mIOneHanded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOneHandedEnabled() {
|
||||
// This is volatile so return directly
|
||||
return mIsOneHandedEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSwipeToNotificationEnabled() {
|
||||
// This is volatile so return directly
|
||||
return mIsSwipeToNotificationEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startOneHanded() {
|
||||
mMainExecutor.execute(() -> {
|
||||
|
||||
@@ -238,7 +238,6 @@ public abstract class SystemUIModule {
|
||||
notifCollection,
|
||||
notifPipeline,
|
||||
sysUiState,
|
||||
dumpManager,
|
||||
sysuiMainExecutor));
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.statusbar.IStatusBarService;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.model.SysUiState;
|
||||
import com.android.systemui.shade.ShadeController;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
@@ -76,7 +74,6 @@ import com.android.wm.shell.bubbles.Bubble;
|
||||
import com.android.wm.shell.bubbles.BubbleEntry;
|
||||
import com.android.wm.shell.bubbles.Bubbles;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -91,7 +88,7 @@ import java.util.function.IntConsumer;
|
||||
* The SysUi side bubbles manager which communicate with other SysUi components.
|
||||
*/
|
||||
@SysUISingleton
|
||||
public class BubblesManager implements Dumpable {
|
||||
public class BubblesManager {
|
||||
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME ? "BubblesManager" : TAG_BUBBLES;
|
||||
|
||||
@@ -134,7 +131,6 @@ public class BubblesManager implements Dumpable {
|
||||
CommonNotifCollection notifCollection,
|
||||
NotifPipeline notifPipeline,
|
||||
SysUiState sysUiState,
|
||||
DumpManager dumpManager,
|
||||
Executor sysuiMainExecutor) {
|
||||
if (bubblesOptional.isPresent()) {
|
||||
return new BubblesManager(context,
|
||||
@@ -152,7 +148,6 @@ public class BubblesManager implements Dumpable {
|
||||
notifCollection,
|
||||
notifPipeline,
|
||||
sysUiState,
|
||||
dumpManager,
|
||||
sysuiMainExecutor);
|
||||
} else {
|
||||
return null;
|
||||
@@ -175,7 +170,6 @@ public class BubblesManager implements Dumpable {
|
||||
CommonNotifCollection notifCollection,
|
||||
NotifPipeline notifPipeline,
|
||||
SysUiState sysUiState,
|
||||
DumpManager dumpManager,
|
||||
Executor sysuiMainExecutor) {
|
||||
mContext = context;
|
||||
mBubbles = bubbles;
|
||||
@@ -197,8 +191,6 @@ public class BubblesManager implements Dumpable {
|
||||
|
||||
setupNotifPipeline();
|
||||
|
||||
dumpManager.registerDumpable(TAG, this);
|
||||
|
||||
keyguardStateController.addCallback(new KeyguardStateController.Callback() {
|
||||
@Override
|
||||
public void onKeyguardShowingChanged() {
|
||||
@@ -633,11 +625,6 @@ public class BubblesManager implements Dumpable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
|
||||
mBubbles.dump(pw, args);
|
||||
}
|
||||
|
||||
/** Checks whether bubbles are enabled for this user, handles negative userIds. */
|
||||
public static boolean areBubblesEnabled(@NonNull Context context, @NonNull UserHandle user) {
|
||||
if (user.getIdentifier() < 0) {
|
||||
|
||||
@@ -134,6 +134,7 @@ import com.android.wm.shell.common.SyncTransactionQueue;
|
||||
import com.android.wm.shell.common.TaskStackListenerImpl;
|
||||
import com.android.wm.shell.draganddrop.DragAndDropController;
|
||||
import com.android.wm.shell.onehanded.OneHandedController;
|
||||
import com.android.wm.shell.sysui.ShellCommandHandler;
|
||||
import com.android.wm.shell.sysui.ShellController;
|
||||
import com.android.wm.shell.sysui.ShellInit;
|
||||
|
||||
@@ -222,6 +223,8 @@ public class BubblesTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private ShellInit mShellInit;
|
||||
@Mock
|
||||
private ShellCommandHandler mShellCommandHandler;
|
||||
@Mock
|
||||
private ShellController mShellController;
|
||||
@Mock
|
||||
private Bubbles.BubbleExpandListener mBubbleExpandListener;
|
||||
@@ -344,6 +347,7 @@ public class BubblesTest extends SysuiTestCase {
|
||||
mBubbleController = new TestableBubbleController(
|
||||
mContext,
|
||||
mShellInit,
|
||||
mShellCommandHandler,
|
||||
mShellController,
|
||||
mBubbleData,
|
||||
mFloatingContentCoordinator,
|
||||
@@ -383,7 +387,6 @@ public class BubblesTest extends SysuiTestCase {
|
||||
mCommonNotifCollection,
|
||||
mNotifPipeline,
|
||||
mSysUiState,
|
||||
mDumpManager,
|
||||
syncExecutor);
|
||||
mBubblesManager.addNotifCallback(mNotifCallback);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.android.wm.shell.common.SyncTransactionQueue;
|
||||
import com.android.wm.shell.common.TaskStackListenerImpl;
|
||||
import com.android.wm.shell.draganddrop.DragAndDropController;
|
||||
import com.android.wm.shell.onehanded.OneHandedController;
|
||||
import com.android.wm.shell.sysui.ShellCommandHandler;
|
||||
import com.android.wm.shell.sysui.ShellController;
|
||||
import com.android.wm.shell.sysui.ShellInit;
|
||||
|
||||
@@ -51,6 +52,7 @@ public class TestableBubbleController extends BubbleController {
|
||||
// Let's assume surfaces can be synchronized immediately.
|
||||
TestableBubbleController(Context context,
|
||||
ShellInit shellInit,
|
||||
ShellCommandHandler shellCommandHandler,
|
||||
ShellController shellController,
|
||||
BubbleData data,
|
||||
FloatingContentCoordinator floatingContentCoordinator,
|
||||
@@ -71,12 +73,12 @@ public class TestableBubbleController extends BubbleController {
|
||||
Handler shellMainHandler,
|
||||
TaskViewTransitions taskViewTransitions,
|
||||
SyncTransactionQueue syncQueue) {
|
||||
super(context, shellInit, shellController, data, Runnable::run, floatingContentCoordinator,
|
||||
dataRepository, statusBarService, windowManager, windowManagerShellWrapper,
|
||||
userManager, launcherApps, bubbleLogger, taskStackListener, shellTaskOrganizer,
|
||||
positioner, displayController, oneHandedOptional, dragAndDropController,
|
||||
shellMainExecutor, shellMainHandler, new SyncExecutor(), taskViewTransitions,
|
||||
syncQueue);
|
||||
super(context, shellInit, shellCommandHandler, shellController, data, Runnable::run,
|
||||
floatingContentCoordinator, dataRepository, statusBarService, windowManager,
|
||||
windowManagerShellWrapper, userManager, launcherApps, bubbleLogger,
|
||||
taskStackListener, shellTaskOrganizer, positioner, displayController,
|
||||
oneHandedOptional, dragAndDropController, shellMainExecutor, shellMainHandler,
|
||||
new SyncExecutor(), taskViewTransitions, syncQueue);
|
||||
setInflateSynchronously(true);
|
||||
onInit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user