summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java10
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java5
3 files changed, 27 insertions, 12 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java b/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java
index 3808ab742419..e5e9c4685264 100644
--- a/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java
+++ b/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingAnimation.java
@@ -28,6 +28,7 @@ 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;
@@ -59,10 +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) {
+ RippleShape rippleShape, UiEventLogger uiEventLogger,
+ ViewCaptureAwareWindowManager viewCaptureAwareWindowManager) {
mCurrentWirelessChargingView = new WirelessChargingView(context, looper,
transmittingBatteryLevel, batteryLevel, callback, isDozing,
- rippleShape, uiEventLogger);
+ rippleShape, uiEventLogger, viewCaptureAwareWindowManager);
}
/**
@@ -73,9 +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) {
+ UiEventLogger uiEventLogger,
+ ViewCaptureAwareWindowManager viewCaptureAwareWindowManager) {
return new WirelessChargingAnimation(context, looper, transmittingBatteryLevel,
- batteryLevel, callback, isDozing, rippleShape, uiEventLogger);
+ batteryLevel, callback, isDozing, rippleShape, uiEventLogger,
+ viewCaptureAwareWindowManager);
}
/**
@@ -83,10 +87,11 @@ public class WirelessChargingAnimation {
* battery level without charging number shown.
*/
public static WirelessChargingAnimation makeChargingAnimationWithNoBatteryLevel(
- @NonNull Context context, RippleShape rippleShape, UiEventLogger uiEventLogger) {
+ @NonNull Context context, RippleShape rippleShape, UiEventLogger uiEventLogger,
+ ViewCaptureAwareWindowManager viewCaptureAwareWindowManager) {
return makeWirelessChargingAnimation(context, null,
UNKNOWN_BATTERY_LEVEL, UNKNOWN_BATTERY_LEVEL, null, false,
- rippleShape, uiEventLogger);
+ rippleShape, uiEventLogger, viewCaptureAwareWindowManager);
}
/**
@@ -118,17 +123,19 @@ public class WirelessChargingAnimation {
private int mGravity;
private WirelessChargingLayout mView;
private WirelessChargingLayout mNextView;
- private WindowManager mWM;
+ private ViewCaptureAwareWindowManager mWM;
private Callback mCallback;
public WirelessChargingView(Context context, @Nullable Looper looper,
int transmittingBatteryLevel, int batteryLevel, Callback callback,
- boolean isDozing, RippleShape rippleShape, UiEventLogger uiEventLogger) {
+ boolean isDozing, RippleShape rippleShape, UiEventLogger uiEventLogger,
+ ViewCaptureAwareWindowManager viewCaptureAwareWindowManager) {
mCallback = callback;
mNextView = new WirelessChargingLayout(context, transmittingBatteryLevel, batteryLevel,
isDozing, rippleShape);
mGravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER;
mUiEventLogger = uiEventLogger;
+ mWM = viewCaptureAwareWindowManager;
final WindowManager.LayoutParams params = mParams;
params.height = WindowManager.LayoutParams.MATCH_PARENT;
@@ -200,7 +207,6 @@ public class WirelessChargingAnimation {
if (context == null) {
context = mView.getContext();
}
- mWM = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
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 94dd9bbefaa3..3dd265bb92da 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -91,6 +91,7 @@ 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;
@@ -596,6 +597,8 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
private final EmergencyGestureIntentFactory mEmergencyGestureIntentFactory;
+ private final ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager;
+
/**
* Public constructor for CentralSurfaces.
*
@@ -708,7 +711,8 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
ActivityStarter activityStarter,
BrightnessMirrorShowingInteractor brightnessMirrorShowingInteractor,
GlanceableHubContainerController glanceableHubContainerController,
- EmergencyGestureIntentFactory emergencyGestureIntentFactory
+ EmergencyGestureIntentFactory emergencyGestureIntentFactory,
+ ViewCaptureAwareWindowManager viewCaptureAwareWindowManager
) {
mContext = context;
mNotificationsController = notificationsController;
@@ -842,6 +846,8 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
mLightRevealScrimViewModelLazy = lightRevealScrimViewModelLazy;
mLightRevealScrim = lightRevealScrim;
+ mViewCaptureAwareWindowManager = viewCaptureAwareWindowManager;
+
if (PredictiveBackSysUiFlag.isEnabled()) {
mContext.getApplicationInfo().setEnableOnBackInvokedCallback(true);
}
@@ -1683,7 +1689,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
mNotificationShadeWindowController.setRequestTopUi(false, TAG);
}
}, /* isDozing= */ false, RippleShape.CIRCLE,
- sUiEventLogger).show(animationDelay);
+ sUiEventLogger, mViewCaptureAwareWindowManager).show(animationDelay);
}
@Override
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 e9c16c207ea8..c7c08a9d91e7 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
@@ -89,6 +89,7 @@ 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;
@@ -344,6 +345,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Mock private GlanceableHubContainerController mGlanceableHubContainerController;
@Mock private EmergencyGestureIntentFactory mEmergencyGestureIntentFactory;
@Mock private NotificationSettingsInteractor mNotificationSettingsInteractor;
+ @Mock private ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager;
private ShadeController mShadeController;
private final FakeSystemClock mFakeSystemClock = new FakeSystemClock();
private final FakeGlobalSettings mFakeGlobalSettings = new FakeGlobalSettings();
@@ -603,7 +605,8 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
mActivityStarter,
mBrightnessMirrorShowingInteractor,
mGlanceableHubContainerController,
- mEmergencyGestureIntentFactory
+ mEmergencyGestureIntentFactory,
+ mViewCaptureAwareWindowManager
);
mScreenLifecycle.addObserver(mCentralSurfaces.mScreenObserver);
mCentralSurfaces.initShadeVisibilityListener();