Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarModule.java +17 −0 Original line number Diff line number Diff line Loading @@ -16,11 +16,16 @@ package com.android.systemui.navigationbar; import static com.android.systemui.Flags.enableViewCaptureTracing; import static com.android.systemui.util.ConvenienceExtensionsKt.toKotlinLazy; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import com.android.app.viewcapture.ViewCapture; import com.android.app.viewcapture.ViewCaptureAwareWindowManager; import com.android.systemui.dagger.qualifiers.DisplayId; import com.android.systemui.navigationbar.NavigationBarComponent.NavigationBarScope; import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler; Loading @@ -28,6 +33,7 @@ import com.android.systemui.navigationbar.views.NavigationBarFrame; import com.android.systemui.navigationbar.views.NavigationBarView; import com.android.systemui.res.R; import dagger.Lazy; import dagger.Module; import dagger.Provides; Loading Loading @@ -73,4 +79,15 @@ public interface NavigationBarModule { static WindowManager provideWindowManager(@DisplayId Context context) { return context.getSystemService(WindowManager.class); } /** A ViewCaptureAwareWindowManager specific to the display's context. */ @Provides @NavigationBarScope @DisplayId static ViewCaptureAwareWindowManager provideViewCaptureAwareWindowManager( @DisplayId WindowManager windowManager, Lazy<ViewCapture> daggerLazyViewCapture) { return new ViewCaptureAwareWindowManager(windowManager, /* lazyViewCapture= */ toKotlinLazy(daggerLazyViewCapture), /* isViewCaptureEnabled= */ enableViewCaptureTracing()); } } packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java +8 −4 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ import android.view.inputmethod.InputMethodManager; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.app.viewcapture.ViewCaptureAwareWindowManager; import com.android.internal.accessibility.dialog.AccessibilityButtonChooserActivity; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEvent; Loading Loading @@ -196,6 +197,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private final Context mContext; private final Bundle mSavedState; private final WindowManager mWindowManager; private final ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager; private final AccessibilityManager mAccessibilityManager; private final DeviceProvisionedController mDeviceProvisionedController; private final StatusBarStateController mStatusBarStateController; Loading Loading @@ -556,6 +558,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements @Nullable Bundle savedState, @DisplayId Context context, @DisplayId WindowManager windowManager, @DisplayId ViewCaptureAwareWindowManager viewCaptureAwareWindowManager, Lazy<AssistManager> assistManagerLazy, AccessibilityManager accessibilityManager, DeviceProvisionedController deviceProvisionedController, Loading Loading @@ -601,6 +604,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mContext = context; mSavedState = savedState; mWindowManager = windowManager; mViewCaptureAwareWindowManager = viewCaptureAwareWindowManager; mAccessibilityManager = accessibilityManager; mDeviceProvisionedController = deviceProvisionedController; mStatusBarStateController = statusBarStateController; Loading Loading @@ -721,7 +725,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements if (DEBUG) Log.v(TAG, "addNavigationBar: about to add " + mView); mWindowManager.addView(mFrame, mViewCaptureAwareWindowManager.addView(mFrame, getBarLayoutParams(mContext.getResources().getConfiguration().windowConfiguration .getRotation())); mDisplayId = mContext.getDisplayId(); Loading Loading @@ -764,7 +768,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mCommandQueue.removeCallback(this); Trace.beginSection("NavigationBar#removeViewImmediate"); try { mWindowManager.removeViewImmediate(mView.getRootView()); mViewCaptureAwareWindowManager.removeViewImmediate(mView.getRootView()); } finally { Trace.endSection(); } Loading Loading @@ -866,7 +870,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements if (mOrientationHandle != null) { resetSecondaryHandle(); getBarTransitions().removeDarkIntensityListener(mOrientationHandleIntensityListener); mWindowManager.removeView(mOrientationHandle); mViewCaptureAwareWindowManager.removeView(mOrientationHandle); mOrientationHandle.getViewTreeObserver().removeOnGlobalLayoutListener( mOrientationHandleGlobalLayoutListener); } Loading Loading @@ -937,7 +941,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mOrientationParams.setTitle("SecondaryHomeHandle" + mContext.getDisplayId()); mOrientationParams.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION | WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT; mWindowManager.addView(mOrientationHandle, mOrientationParams); mViewCaptureAwareWindowManager.addView(mOrientationHandle, mOrientationParams); mOrientationHandle.setVisibility(View.GONE); logNavbarOrientation("initSecondaryHomeHandleForRotation"); Loading packages/SystemUI/tests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ import android.view.inputmethod.InputMethodManager; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import com.android.app.viewcapture.ViewCaptureAwareWindowManager; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEventLogger; import com.android.systemui.SysuiTestCase; Loading Loading @@ -214,6 +215,8 @@ public class NavigationBarTest extends SysuiTestCase { @Mock private WindowManager mWindowManager; @Mock private ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager; @Mock private TelecomManager mTelecomManager; @Mock private InputMethodManager mInputMethodManager; Loading Loading @@ -619,6 +622,7 @@ public class NavigationBarTest extends SysuiTestCase { null, context, mWindowManager, mViewCaptureAwareWindowManager, () -> mAssistManager, mock(AccessibilityManager.class), deviceProvisionedController, Loading Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarModule.java +17 −0 Original line number Diff line number Diff line Loading @@ -16,11 +16,16 @@ package com.android.systemui.navigationbar; import static com.android.systemui.Flags.enableViewCaptureTracing; import static com.android.systemui.util.ConvenienceExtensionsKt.toKotlinLazy; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import com.android.app.viewcapture.ViewCapture; import com.android.app.viewcapture.ViewCaptureAwareWindowManager; import com.android.systemui.dagger.qualifiers.DisplayId; import com.android.systemui.navigationbar.NavigationBarComponent.NavigationBarScope; import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler; Loading @@ -28,6 +33,7 @@ import com.android.systemui.navigationbar.views.NavigationBarFrame; import com.android.systemui.navigationbar.views.NavigationBarView; import com.android.systemui.res.R; import dagger.Lazy; import dagger.Module; import dagger.Provides; Loading Loading @@ -73,4 +79,15 @@ public interface NavigationBarModule { static WindowManager provideWindowManager(@DisplayId Context context) { return context.getSystemService(WindowManager.class); } /** A ViewCaptureAwareWindowManager specific to the display's context. */ @Provides @NavigationBarScope @DisplayId static ViewCaptureAwareWindowManager provideViewCaptureAwareWindowManager( @DisplayId WindowManager windowManager, Lazy<ViewCapture> daggerLazyViewCapture) { return new ViewCaptureAwareWindowManager(windowManager, /* lazyViewCapture= */ toKotlinLazy(daggerLazyViewCapture), /* isViewCaptureEnabled= */ enableViewCaptureTracing()); } }
packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java +8 −4 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ import android.view.inputmethod.InputMethodManager; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.app.viewcapture.ViewCaptureAwareWindowManager; import com.android.internal.accessibility.dialog.AccessibilityButtonChooserActivity; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEvent; Loading Loading @@ -196,6 +197,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private final Context mContext; private final Bundle mSavedState; private final WindowManager mWindowManager; private final ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager; private final AccessibilityManager mAccessibilityManager; private final DeviceProvisionedController mDeviceProvisionedController; private final StatusBarStateController mStatusBarStateController; Loading Loading @@ -556,6 +558,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements @Nullable Bundle savedState, @DisplayId Context context, @DisplayId WindowManager windowManager, @DisplayId ViewCaptureAwareWindowManager viewCaptureAwareWindowManager, Lazy<AssistManager> assistManagerLazy, AccessibilityManager accessibilityManager, DeviceProvisionedController deviceProvisionedController, Loading Loading @@ -601,6 +604,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mContext = context; mSavedState = savedState; mWindowManager = windowManager; mViewCaptureAwareWindowManager = viewCaptureAwareWindowManager; mAccessibilityManager = accessibilityManager; mDeviceProvisionedController = deviceProvisionedController; mStatusBarStateController = statusBarStateController; Loading Loading @@ -721,7 +725,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements if (DEBUG) Log.v(TAG, "addNavigationBar: about to add " + mView); mWindowManager.addView(mFrame, mViewCaptureAwareWindowManager.addView(mFrame, getBarLayoutParams(mContext.getResources().getConfiguration().windowConfiguration .getRotation())); mDisplayId = mContext.getDisplayId(); Loading Loading @@ -764,7 +768,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mCommandQueue.removeCallback(this); Trace.beginSection("NavigationBar#removeViewImmediate"); try { mWindowManager.removeViewImmediate(mView.getRootView()); mViewCaptureAwareWindowManager.removeViewImmediate(mView.getRootView()); } finally { Trace.endSection(); } Loading Loading @@ -866,7 +870,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements if (mOrientationHandle != null) { resetSecondaryHandle(); getBarTransitions().removeDarkIntensityListener(mOrientationHandleIntensityListener); mWindowManager.removeView(mOrientationHandle); mViewCaptureAwareWindowManager.removeView(mOrientationHandle); mOrientationHandle.getViewTreeObserver().removeOnGlobalLayoutListener( mOrientationHandleGlobalLayoutListener); } Loading Loading @@ -937,7 +941,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mOrientationParams.setTitle("SecondaryHomeHandle" + mContext.getDisplayId()); mOrientationParams.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION | WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT; mWindowManager.addView(mOrientationHandle, mOrientationParams); mViewCaptureAwareWindowManager.addView(mOrientationHandle, mOrientationParams); mOrientationHandle.setVisibility(View.GONE); logNavbarOrientation("initSecondaryHomeHandleForRotation"); Loading
packages/SystemUI/tests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ import android.view.inputmethod.InputMethodManager; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import com.android.app.viewcapture.ViewCaptureAwareWindowManager; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEventLogger; import com.android.systemui.SysuiTestCase; Loading Loading @@ -214,6 +215,8 @@ public class NavigationBarTest extends SysuiTestCase { @Mock private WindowManager mWindowManager; @Mock private ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager; @Mock private TelecomManager mTelecomManager; @Mock private InputMethodManager mInputMethodManager; Loading Loading @@ -619,6 +622,7 @@ public class NavigationBarTest extends SysuiTestCase { null, context, mWindowManager, mViewCaptureAwareWindowManager, () -> mAssistManager, mock(AccessibilityManager.class), deviceProvisionedController, Loading