diff options
| author | 2018-12-05 17:56:51 +0000 | |
|---|---|---|
| committer | 2018-12-05 17:56:51 +0000 | |
| commit | a1ff6f509f6a33cbfa726c8591c701a7aed318d6 (patch) | |
| tree | c1a5d64aa8af141120ba3adef0c78b7a3ad56520 | |
| parent | 1ddb6e815c305ec5f49d0eed4bfea971285a903f (diff) | |
| parent | d7c9855ef745badf047ffe5a172291aa3332280d (diff) | |
Merge "Make CommandQueue implement CallbackController"
18 files changed, 30 insertions, 28 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java index a90a7d231dc1..ba89fe662a65 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java @@ -140,7 +140,7 @@ public class BiometricDialogImpl extends SystemUI implements CommandQueue.Callba createDialogs(); if (!mDialogs.isEmpty()) { - getComponent(CommandQueue.class).addCallbacks(this); + getComponent(CommandQueue.class).addCallback(this); mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); } } diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java index aa085626b6c2..e8ef454bd466 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java @@ -45,7 +45,7 @@ public class GlobalActionsComponent extends SystemUI implements Callbacks, Globa .withCallback(this::onExtensionCallback) .build(); mPlugin = mExtension.get(); - SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this); } private void onExtensionCallback(GlobalActions newPlugin) { diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java index 039499858603..dc11b4c63d83 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java @@ -55,12 +55,12 @@ public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks mContext = context; mKeyguardMonitor = Dependency.get(KeyguardMonitor.class); mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class); - SysUiServiceProvider.getComponent(context, CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(context, CommandQueue.class).addCallback(this); } @Override public void destroy() { - SysUiServiceProvider.getComponent(mContext, CommandQueue.class).removeCallbacks(this); + SysUiServiceProvider.getComponent(mContext, CommandQueue.class).removeCallback(this); if (mGlobalActions != null) { mGlobalActions.destroy(); mGlobalActions = null; diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipUI.java b/packages/SystemUI/src/com/android/systemui/pip/PipUI.java index 7792e177b601..37c8163702cf 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/PipUI.java +++ b/packages/SystemUI/src/com/android/systemui/pip/PipUI.java @@ -58,7 +58,7 @@ public class PipUI extends SystemUI implements CommandQueue.Callbacks { : com.android.systemui.pip.phone.PipManager.getInstance(); mPipManager.initialize(mContext); - getComponent(CommandQueue.class).addCallbacks(this); + getComponent(CommandQueue.class).addCallback(this); putComponent(PipUI.class, this); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index 953eb70cac5d..2acbea45a235 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -108,12 +108,12 @@ public class QSFragment extends Fragment implements QS, CommandQueue.Callbacks { mQSPanel.getTileLayout().restoreInstanceState(savedInstanceState); } } - SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallback(this); } @Override public void onDestroyView() { - SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).removeCallbacks(this); + SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).removeCallback(this); super.onDestroyView(); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index 0702d74506fd..f13b565bd532 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -37,7 +37,7 @@ public class Recents extends SystemUI implements CommandQueue.Callbacks { @Override public void start() { - getComponent(CommandQueue.class).addCallbacks(this); + getComponent(CommandQueue.class).addCallback(this); putComponent(Recents.class, this); mImpl = createRecentsImplementationFromConfig(); mImpl.onStart(mContext, this); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index b55027436b91..95019ee2aeea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -35,6 +35,8 @@ import com.android.internal.os.SomeArgs; import com.android.internal.statusbar.IStatusBar; import com.android.internal.statusbar.StatusBarIcon; import com.android.systemui.SystemUI; +import com.android.systemui.statusbar.CommandQueue.Callbacks; +import com.android.systemui.statusbar.policy.CallbackController; import java.util.ArrayList; @@ -45,7 +47,7 @@ import java.util.ArrayList; * coalescing these calls so they don't stack up. For the calls * are coalesced, note that they are all idempotent. */ -public class CommandQueue extends IStatusBar.Stub { +public class CommandQueue extends IStatusBar.Stub implements CallbackController<Callbacks> { private static final int INDEX_MASK = 0xffff; private static final int MSG_SHIFT = 16; private static final int MSG_MASK = 0xffff << MSG_SHIFT; @@ -183,12 +185,12 @@ public class CommandQueue extends IStatusBar.Stub { && !ONLY_CORE_APPS; } - public void addCallbacks(Callbacks callbacks) { + public void addCallback(Callbacks callbacks) { mCallbacks.add(callbacks); callbacks.disable(mDisable1, mDisable2, false /* animate */); } - public void removeCallbacks(Callbacks callbacks) { + public void removeCallback(Callbacks callbacks) { mCallbacks.remove(callbacks); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java index 8418cba4c7b6..24570aec9db4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java @@ -120,14 +120,14 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue @Override public void onResume() { super.onResume(); - mCommandQueue.addCallbacks(this); + mCommandQueue.addCallback(this); mStatusBarStateController.addCallback(this); } @Override public void onPause() { super.onPause(); - mCommandQueue.removeCallbacks(this); + mCommandQueue.removeCallback(this); mStatusBarStateController.removeCallback(this); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java index 1c6d2924bb93..57cc7d6c1ecb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java @@ -73,14 +73,14 @@ public class LightBarTransitionsController implements Dumpable, Callbacks, mKeyguardMonitor = Dependency.get(KeyguardMonitor.class); mStatusBarStateController = Dependency.get(StatusBarStateController.class); SysUiServiceProvider.getComponent(context, CommandQueue.class) - .addCallbacks(this); + .addCallback(this); mStatusBarStateController.addCallback(this); mDozeAmount = mStatusBarStateController.getDozeAmount(); } public void destroy(Context context) { SysUiServiceProvider.getComponent(context, CommandQueue.class) - .removeCallbacks(this); + .removeCallback(this); mStatusBarStateController.removeCallback(this); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java index 8657003891be..d2bfd123f113 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java @@ -199,7 +199,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks { public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mCommandQueue = SysUiServiceProvider.getComponent(getContext(), CommandQueue.class); - mCommandQueue.addCallbacks(this); + mCommandQueue.addCallback(this); mStatusBar = SysUiServiceProvider.getComponent(getContext(), StatusBar.class); mRecents = SysUiServiceProvider.getComponent(getContext(), Recents.class); mDivider = SysUiServiceProvider.getComponent(getContext(), Divider.class); @@ -225,7 +225,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks { @Override public void onDestroy() { super.onDestroy(); - mCommandQueue.removeCallbacks(this); + mCommandQueue.removeCallback(this); Dependency.get(AccessibilityManagerWrapper.class).removeCallback( mAccessibilityListener); mContentResolver.unregisterContentObserver(mMagnificationObserver); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index c84f3db8acb0..ee1eb42a07f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -268,7 +268,7 @@ public class PhoneStatusBarPolicy implements Callback, Callbacks, mLocationController.addCallback(this); mPrivacyItemController.setListening(true); - SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this); ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskListener); // Clear out all old notifications on startup (only present in the case where sysui dies) @@ -296,7 +296,7 @@ public class PhoneStatusBarPolicy implements Callback, Callbacks, mKeyguardMonitor.removeCallback(this); mLocationController.removeCallback(this); mPrivacyItemController.setListening(false); - SysUiServiceProvider.getComponent(mContext, CommandQueue.class).removeCallbacks(this); + SysUiServiceProvider.getComponent(mContext, CommandQueue.class).removeCallback(this); mContext.unregisterReceiver(mIntentReceiver); NotificationManager noMan = mContext.getSystemService(NotificationManager.class); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 58b9de4ebe27..f7aaf427f118 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -663,7 +663,7 @@ public class StatusBar extends SystemUI implements DemoMode, // Connect in to the status bar manager service mCommandQueue = getComponent(CommandQueue.class); - mCommandQueue.addCallbacks(this); + mCommandQueue.addCallback(this); int[] switches = new int[9]; ArrayList<IBinder> binders = new ArrayList<>(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java index 7c17c018443e..4f25349ef7d2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java @@ -76,7 +76,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu loadDimens(); SysUiServiceProvider.getComponent(context, CommandQueue.class) - .addCallbacks(this); + .addCallback(this); Dependency.get(TunerService.class).addTunable(this, ICON_BLACKLIST); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java index 3f1e826eb67b..e3f6bd8f21f1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java @@ -73,7 +73,7 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks { mStatusBarStateController.addCallback(mStateListener); mKeyguardManager = context.getSystemService(KeyguardManager.class); mCommandQueue = getComponent(context, CommandQueue.class); - mCommandQueue.addCallbacks(this); + mCommandQueue.addCallback(this); } private void setStatusBarState(int state) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java index c2af95e66fe9..aafdcd50b8e8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java @@ -187,7 +187,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C null, Dependency.get(Dependency.TIME_TICK_HANDLER)); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS, StatusBarIconController.ICON_BLACKLIST); - SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallback(this); if (mShowDark) { Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this); } @@ -215,7 +215,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C mAttached = false; Dependency.get(TunerService.class).removeTunable(this); SysUiServiceProvider.getComponent(getContext(), CommandQueue.class) - .removeCallbacks(this); + .removeCallback(this); if (mShowDark) { Dependency.get(DarkIconDispatcher.class).removeDarkReceiver(this); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java index cd379c5f551f..4a69cd783a6c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java @@ -42,7 +42,7 @@ public class TvStatusBar extends SystemUI implements Callbacks { public void start() { putComponent(TvStatusBar.class, this); CommandQueue commandQueue = getComponent(CommandQueue.class); - commandQueue.addCallbacks(this); + commandQueue.addCallback(this); int[] switches = new int[9]; ArrayList<IBinder> binders = new ArrayList<>(); ArrayList<String> iconSlots = new ArrayList<>(); diff --git a/packages/SystemUI/src/com/android/systemui/util/Utils.java b/packages/SystemUI/src/com/android/systemui/util/Utils.java index 6812410c851c..490cdd5ce9bd 100644 --- a/packages/SystemUI/src/com/android/systemui/util/Utils.java +++ b/packages/SystemUI/src/com/android/systemui/util/Utils.java @@ -57,13 +57,13 @@ public class Utils { public void onViewAttachedToWindow(View v) { mView = v; SysUiServiceProvider.getComponent(v.getContext(), CommandQueue.class) - .addCallbacks(this); + .addCallback(this); } @Override public void onViewDetachedFromWindow(View v) { SysUiServiceProvider.getComponent(mView.getContext(), CommandQueue.class) - .removeCallbacks(this); + .removeCallback(this); mView = null; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java index a4fe52d46f56..a04e57bb4990 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java @@ -44,7 +44,7 @@ public class CommandQueueTest extends SysuiTestCase { public void setup() { mCommandQueue = new CommandQueue(); mCallbacks = mock(Callbacks.class); - mCommandQueue.addCallbacks(mCallbacks); + mCommandQueue.addCallback(mCallbacks); verify(mCallbacks).disable(eq(0), eq(0), eq(false)); } |