diff options
| author | 2019-06-16 00:55:14 +0000 | |
|---|---|---|
| committer | 2019-06-16 00:55:14 +0000 | |
| commit | fba0626e3ba3fa810a0b64f1a2d0b467a05bbcec (patch) | |
| tree | 8760dfd4a132422f6912a5ed17b6a5ef0b6524b8 | |
| parent | 4898d82773327ef401cac25b87de6c6cc2db37cd (diff) | |
| parent | dc0eca6cd201004f378694b672139332227ef4a7 (diff) | |
Merge "Remove dependency on OverviewProxyService from StatusBarWindowController" into qt-r1-dev
3 files changed, 70 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 88a8b31dc361..b4299fd760fd 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -27,6 +27,9 @@ import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_INP import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SUPPORTS_WINDOW_CORNERS; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_WINDOW_CORNER_RADIUS; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED; import android.annotation.FloatRange; import android.app.ActivityTaskManager; @@ -67,6 +70,7 @@ import com.android.systemui.statusbar.phone.NavigationBarFragment; import com.android.systemui.statusbar.phone.NavigationBarView; import com.android.systemui.statusbar.phone.NavigationModeController; import com.android.systemui.statusbar.phone.StatusBar; +import com.android.systemui.statusbar.phone.StatusBarWindowCallback; import com.android.systemui.statusbar.phone.StatusBarWindowController; import com.android.systemui.statusbar.policy.CallbackController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; @@ -90,7 +94,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE"; public static final String TAG_OPS = "OverviewProxyService"; - public static final boolean DEBUG_OVERVIEW_PROXY = false; private static final long BACKOFF_MILLIS = 1000; private static final long DEFERRED_CALLBACK_MILLIS = 5000; @@ -442,6 +445,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } }; + private final StatusBarWindowCallback mStatusBarWindowCallback = this::onStatusBarStateChanged; + // This is the death handler for the binder from the launcher service private final IBinder.DeathRecipient mOverviewServiceDeathRcpt = this::cleanupAfterDeath; @@ -481,6 +486,9 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis PatternMatcher.PATTERN_LITERAL); filter.addAction(Intent.ACTION_PACKAGE_CHANGED); mContext.registerReceiver(mLauncherStateChangedReceiver, filter); + + // Listen for status bar state changes + statusBarWinController.registerCallback(mStatusBarWindowCallback); } public void notifyBackAction(boolean completed, int downX, int downY, boolean isButton, @@ -531,7 +539,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis navBarView.updateSystemUiStateFlags(); } if (mStatusBarWinController != null) { - mStatusBarWinController.updateSystemUiStateFlags(); + mStatusBarWinController.notifyStateChangedCallbacks(); } notifySystemUiStateFlags(mSysUiStateFlags); } @@ -546,6 +554,16 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } } + private void onStatusBarStateChanged(boolean keyguardShowing, boolean keyguardOccluded, + boolean bouncerShowing) { + int displayId = mContext.getDisplayId(); + setSystemUiStateFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING, + keyguardShowing && !keyguardOccluded, displayId); + setSystemUiStateFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED, + keyguardShowing && keyguardOccluded, displayId); + setSystemUiStateFlag(SYSUI_STATE_BOUNCER_SHOWING, bouncerShowing, displayId); + } + /** * Sets the navbar region which can receive touch inputs */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowCallback.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowCallback.java new file mode 100644 index 000000000000..f33ff2732cda --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowCallback.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.systemui.statusbar.phone; + +public interface StatusBarWindowCallback { + void onStateChanged(boolean keyguardShowing, boolean keyguardOccluded, boolean bouncerShowing); +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java index a4f495aafda2..e68c18817989 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java @@ -18,9 +18,6 @@ package com.android.systemui.statusbar.phone; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED; import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENABLE_REMOTE_INPUT; import android.app.ActivityManager; @@ -47,17 +44,19 @@ import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; -import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.statusbar.RemoteInputController.Callback; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; +import com.google.android.collect.Lists; import java.io.FileDescriptor; import java.io.PrintWriter; +import java.lang.ref.WeakReference; import java.lang.reflect.Field; +import java.util.ArrayList; import javax.inject.Inject; import javax.inject.Singleton; @@ -84,6 +83,8 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat private final State mCurrentState = new State(); private OtherwisedCollapsedListener mListener; private ForcePluginOpenListener mForcePluginOpenListener; + private final ArrayList<WeakReference<StatusBarWindowCallback>> + mCallbacks = Lists.newArrayList(); private final SysuiColorExtractor mColorExtractor = Dependency.get(SysuiColorExtractor.class); @@ -109,6 +110,19 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat Dependency.get(ConfigurationController.class).addCallback(this); } + /** + * Register to receive notifications about status bar window state changes. + */ + public void registerCallback(StatusBarWindowCallback callback) { + // Prevent adding duplicate callbacks + for (int i = 0; i < mCallbacks.size(); i++) { + if (mCallbacks.get(i).get() == callback) { + return; + } + } + mCallbacks.add(new WeakReference<StatusBarWindowCallback>(callback)); + } + private boolean shouldEnableKeyguardScreenRotation() { Resources res = mContext.getResources(); return SystemProperties.getBoolean("lockscreen.rot_override", false) @@ -319,18 +333,18 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat } mHasTopUi = mHasTopUiChanged; } - updateSystemUiStateFlags(); - } - - public void updateSystemUiStateFlags() { - int displayId = mContext.getDisplayId(); - OverviewProxyService overviewProxyService = Dependency.get(OverviewProxyService.class); - overviewProxyService.setSystemUiStateFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING, - mCurrentState.keyguardShowing && !mCurrentState.keyguardOccluded, displayId); - overviewProxyService.setSystemUiStateFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED, - mCurrentState.keyguardShowing && mCurrentState.keyguardOccluded, displayId); - overviewProxyService.setSystemUiStateFlag(SYSUI_STATE_BOUNCER_SHOWING, - mCurrentState.bouncerShowing, displayId); + notifyStateChangedCallbacks(); + } + + public void notifyStateChangedCallbacks() { + for (int i = 0; i < mCallbacks.size(); i++) { + StatusBarWindowCallback cb = mCallbacks.get(i).get(); + if (cb != null) { + cb.onStateChanged(mCurrentState.keyguardShowing, + mCurrentState.keyguardOccluded, + mCurrentState.bouncerShowing); + } + } } private void applyForceStatusBarVisibleFlag(State state) { |