summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Archisha Baranwal <archisha@google.com> 2024-12-03 10:19:56 +0000
committer Archisha Baranwal <archisha@google.com> 2025-03-16 23:16:25 -0700
commitf195cb43e1e4dd44c03c4ebdf059b8e8cc3b18f6 (patch)
treed59d946a77840acf1c6ca63dedbf636522957012
parent419ae9ccffb43274ff4abbea2eb3df27dc0408b9 (diff)
Modified Revert of "Adding ViewCaptureAwareWindowManager to WirelessCharging..."
Revert submission 28837398-wirelessChargeViewCapture Reason for revert: Reverting change due to the restructure of ViewCaptureAwareWindowManager ( go/wm-for-viewcapture ) Reverted changes: /q/submissionid:28837398-wirelessChargeViewCapture Flag: com.android.systemui.enable_view_capture_tracing Change-Id: I0ec5b3ef230b3b25e5ff047fa5c59e647bd53ced
-rw-r--r--packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java29
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java22
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java14
3 files changed, 34 insertions, 31 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java b/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java
index e5e9c4685264..4ca55400561e 100644
--- a/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java
+++ b/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java
@@ -28,10 +28,10 @@ import android.util.Slog;
import android.view.Gravity;
import android.view.WindowManager;
-import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
import com.android.systemui.surfaceeffects.ripple.RippleShader.RippleShape;
+import com.android.systemui.utils.windowmanager.WindowManagerProvider;
/**
* A WirelessChargingAnimation is a view containing view + animation for wireless charging.
@@ -60,11 +60,11 @@ public class WirelessChargingAnimation {
*/
private WirelessChargingAnimation(@NonNull Context context, @Nullable Looper looper,
int transmittingBatteryLevel, int batteryLevel, Callback callback, boolean isDozing,
- RippleShape rippleShape, UiEventLogger uiEventLogger,
- ViewCaptureAwareWindowManager viewCaptureAwareWindowManager) {
+ RippleShape rippleShape, UiEventLogger uiEventLogger, WindowManager windowManager,
+ WindowManagerProvider windowManagerProvider) {
mCurrentWirelessChargingView = new WirelessChargingView(context, looper,
transmittingBatteryLevel, batteryLevel, callback, isDozing,
- rippleShape, uiEventLogger, viewCaptureAwareWindowManager);
+ rippleShape, uiEventLogger, windowManager, windowManagerProvider);
}
/**
@@ -75,11 +75,11 @@ public class WirelessChargingAnimation {
public static WirelessChargingAnimation makeWirelessChargingAnimation(@NonNull Context context,
@Nullable Looper looper, int transmittingBatteryLevel, int batteryLevel,
Callback callback, boolean isDozing, RippleShape rippleShape,
- UiEventLogger uiEventLogger,
- ViewCaptureAwareWindowManager viewCaptureAwareWindowManager) {
+ UiEventLogger uiEventLogger, WindowManager windowManager,
+ WindowManagerProvider windowManagerProvider) {
return new WirelessChargingAnimation(context, looper, transmittingBatteryLevel,
- batteryLevel, callback, isDozing, rippleShape, uiEventLogger,
- viewCaptureAwareWindowManager);
+ batteryLevel, callback, isDozing, rippleShape, uiEventLogger, windowManager,
+ windowManagerProvider);
}
/**
@@ -88,10 +88,10 @@ public class WirelessChargingAnimation {
*/
public static WirelessChargingAnimation makeChargingAnimationWithNoBatteryLevel(
@NonNull Context context, RippleShape rippleShape, UiEventLogger uiEventLogger,
- ViewCaptureAwareWindowManager viewCaptureAwareWindowManager) {
+ WindowManager windowManager, WindowManagerProvider windowManagerProvider) {
return makeWirelessChargingAnimation(context, null,
UNKNOWN_BATTERY_LEVEL, UNKNOWN_BATTERY_LEVEL, null, false,
- rippleShape, uiEventLogger, viewCaptureAwareWindowManager);
+ rippleShape, uiEventLogger, windowManager, windowManagerProvider);
}
/**
@@ -123,19 +123,21 @@ public class WirelessChargingAnimation {
private int mGravity;
private WirelessChargingLayout mView;
private WirelessChargingLayout mNextView;
- private ViewCaptureAwareWindowManager mWM;
+ private WindowManager mWM;
private Callback mCallback;
+ private WindowManagerProvider mWindowManagerProvider;
public WirelessChargingView(Context context, @Nullable Looper looper,
int transmittingBatteryLevel, int batteryLevel, Callback callback,
boolean isDozing, RippleShape rippleShape, UiEventLogger uiEventLogger,
- ViewCaptureAwareWindowManager viewCaptureAwareWindowManager) {
+ WindowManager windowManager, WindowManagerProvider windowManagerProvider) {
mCallback = callback;
mNextView = new WirelessChargingLayout(context, transmittingBatteryLevel, batteryLevel,
isDozing, rippleShape);
mGravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER;
mUiEventLogger = uiEventLogger;
- mWM = viewCaptureAwareWindowManager;
+ mWM = windowManager;
+ mWindowManagerProvider = windowManagerProvider;
final WindowManager.LayoutParams params = mParams;
params.height = WindowManager.LayoutParams.MATCH_PARENT;
@@ -207,6 +209,7 @@ public class WirelessChargingAnimation {
if (context == null) {
context = mView.getContext();
}
+ mWM = mWindowManagerProvider.getWindowManager(context);
mParams.packageName = packageName;
mParams.hideTimeoutMilliseconds = DURATION;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index 9d9f01b571a7..07485e971e73 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -90,7 +90,6 @@ import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleRegistry;
-import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.colorextraction.ColorExtractor;
import com.android.internal.logging.MetricsLogger;
@@ -233,6 +232,7 @@ import com.android.systemui.util.WallpaperController;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.concurrency.MessageRouter;
import com.android.systemui.util.kotlin.JavaAdapter;
+import com.android.systemui.utils.windowmanager.WindowManagerProvider;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wallet.controller.QuickAccessWalletController;
import com.android.wm.shell.bubbles.Bubbles;
@@ -597,7 +597,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
private final EmergencyGestureIntentFactory mEmergencyGestureIntentFactory;
- private final ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager;
private final QuickAccessWalletController mWalletController;
/**
@@ -713,8 +712,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
BrightnessMirrorShowingRepository brightnessMirrorShowingRepository,
GlanceableHubContainerController glanceableHubContainerController,
EmergencyGestureIntentFactory emergencyGestureIntentFactory,
- ViewCaptureAwareWindowManager viewCaptureAwareWindowManager,
- QuickAccessWalletController walletController
+ QuickAccessWalletController walletController,
+ WindowManager windowManager,
+ WindowManagerProvider windowManagerProvider
) {
mContext = context;
mNotificationsController = notificationsController;
@@ -852,7 +852,8 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
mLightRevealScrim = lightRevealScrim;
- mViewCaptureAwareWindowManager = viewCaptureAwareWindowManager;
+ mWindowManager = windowManager;
+ mWindowManagerProvider = windowManagerProvider;
}
private void initBubbles(Bubbles bubbles) {
@@ -880,8 +881,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener);
- mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
-
mDisplay = mContext.getDisplay();
mDisplayId = mDisplay.getDisplayId();
updateDisplaySize();
@@ -1716,7 +1715,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
mNotificationShadeWindowController.setRequestTopUi(false, TAG);
}
}, /* isDozing= */ false, RippleShape.CIRCLE,
- sUiEventLogger, mViewCaptureAwareWindowManager).show(animationDelay);
+ sUiEventLogger, mWindowManager, mWindowManagerProvider).show(animationDelay);
}
@Override
@@ -2875,6 +2874,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
protected WindowManager mWindowManager;
protected IWindowManager mWindowManagerService;
private final IDreamManager mDreamManager;
+ private final WindowManagerProvider mWindowManagerProvider;
protected Display mDisplay;
private int mDisplayId;
@@ -2911,9 +2911,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
protected void toggleKeyboardShortcuts(int deviceId) {
if (shouldUseTabletKeyboardShortcuts()) {
- KeyboardShortcutListSearch.toggle(mContext, deviceId);
+ KeyboardShortcutListSearch.toggle(mContext, deviceId, mWindowManagerProvider);
} else {
- KeyboardShortcuts.toggle(mContext, deviceId);
+ KeyboardShortcuts.toggle(mContext, deviceId, mWindowManagerProvider);
}
}
@@ -2927,7 +2927,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
private boolean shouldUseTabletKeyboardShortcuts() {
return mFeatureFlags.isEnabled(SHORTCUT_LIST_SEARCH_LAYOUT)
- && Utilities.isLargeScreen(mContext);
+ && Utilities.isLargeScreen(mWindowManager, mContext.getResources());
}
private void clearNotificationEffects() {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index a7f3fdcb517e..0c5cbc299aee 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
@@ -93,7 +93,6 @@ import android.view.WindowMetrics;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
-import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.compose.animation.scene.ObservableTransitionState;
import com.android.internal.colorextraction.ColorExtractor;
import com.android.internal.logging.UiEventLogger;
@@ -214,6 +213,7 @@ import com.android.systemui.util.settings.FakeGlobalSettings;
import com.android.systemui.util.settings.FakeSettings;
import com.android.systemui.util.settings.SystemSettings;
import com.android.systemui.util.time.FakeSystemClock;
+import com.android.systemui.utils.windowmanager.WindowManagerProvider;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wallet.controller.QuickAccessWalletController;
import com.android.wm.shell.bubbles.Bubbles;
@@ -372,9 +372,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Mock private GlanceableHubContainerController mGlanceableHubContainerController;
@Mock private EmergencyGestureIntentFactory mEmergencyGestureIntentFactory;
@Mock private NotificationSettingsInteractor mNotificationSettingsInteractor;
- @Mock private ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager;
@Mock private StatusBarLongPressGestureDetector mStatusBarLongPressGestureDetector;
@Mock private QuickAccessWalletController mQuickAccessWalletController;
+ @Mock private WindowManager mWindowManager;
+ @Mock private WindowManagerProvider mWindowManagerProvider;
private ShadeController mShadeController;
private final FakeSystemClock mFakeSystemClock = new FakeSystemClock();
private final FakeGlobalSettings mFakeGlobalSettings = new FakeGlobalSettings();
@@ -642,8 +643,9 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
mBrightnessMirrorShowingRepository,
mGlanceableHubContainerController,
mEmergencyGestureIntentFactory,
- mViewCaptureAwareWindowManager,
- mQuickAccessWalletController
+ mQuickAccessWalletController,
+ mWindowManager,
+ mWindowManagerProvider
);
mScreenLifecycle.addObserver(mCentralSurfaces.mScreenObserver);
mCentralSurfaces.initShadeVisibilityListener();
@@ -1363,15 +1365,13 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
private void switchToScreenSize(int widthDp, int heightDp) {
WindowMetrics windowMetrics = Mockito.mock(WindowMetrics.class);
- WindowManager windowManager = Mockito.mock(WindowManager.class);
Configuration configuration = new Configuration();
configuration.densityDpi = DisplayMetrics.DENSITY_DEFAULT;
mContext.getOrCreateTestableResources().overrideConfiguration(configuration);
when(windowMetrics.getBounds()).thenReturn(new Rect(0, 0, widthDp, heightDp));
- when(windowManager.getCurrentWindowMetrics()).thenReturn(windowMetrics);
- mContext.addMockSystemService(WindowManager.class, windowManager);
+ when(mWindowManager.getCurrentWindowMetrics()).thenReturn(windowMetrics);
}
/**