From 34a747a191a5a58c1d39cb49112ce501c8c2572b Mon Sep 17 00:00:00 2001 From: Peter Kalauskas Date: Wed, 13 Jan 2021 12:07:17 -0800 Subject: [PATCH] Remove InjectionInflationController from NPV NotificationPanelViewController can use LayoutInflator directly. The views it was applied to were not using dagger injection. Also, replace static usages of LayoutInflator.from() with injected LayoutInflator instance. Test: atest SystemUITests Change-Id: I206b7d388c61aa1821b7c52c2ef1497c0b533fa9 --- .../phone/NotificationPanelViewController.java | 16 ++++++---------- .../phone/NotificationPanelViewTest.java | 6 +++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index ba08e76e6f66a..3519ce1257cc0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -129,7 +129,6 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardUserSwitcher; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; -import com.android.systemui.util.InjectionInflationController; import com.android.wm.shell.animation.FlingAnimationUtils; import java.io.FileDescriptor; @@ -266,8 +265,7 @@ public class NotificationPanelViewController extends PanelViewController { && mAuthController.getUdfpsRegion() != null && mAuthController.isUdfpsEnrolled( KeyguardUpdateMonitor.getCurrentUser())) { - LayoutInflater.from(mView.getContext()) - .inflate(R.layout.disabled_udfps_view, mView); + mLayoutInflater.inflate(R.layout.disabled_udfps_view, mView); mDisabledUdfpsController = new DisabledUdfpsController( mView.findViewById(R.id.disabled_udfps_view), mStatusBarStateController, @@ -279,7 +277,7 @@ public class NotificationPanelViewController extends PanelViewController { } }; - private final InjectionInflationController mInjectionInflationController; + private final LayoutInflater mLayoutInflater; private final PowerManager mPowerManager; private final AccessibilityManager mAccessibilityManager; private final NotificationWakeUpCoordinator mWakeUpCoordinator; @@ -523,7 +521,7 @@ public class NotificationPanelViewController extends PanelViewController { @Inject public NotificationPanelViewController(NotificationPanelView view, @Main Resources resources, - InjectionInflationController injectionInflationController, + LayoutInflater layoutInflater, NotificationWakeUpCoordinator coordinator, PulseExpansionHandler pulseExpansionHandler, DynamicPrivacyController dynamicPrivacyController, KeyguardBypassController bypassController, FalsingManager falsingManager, @@ -568,7 +566,7 @@ public class NotificationPanelViewController extends PanelViewController { mKeyguardStatusViewComponentFactory = keyguardStatusViewComponentFactory; mQSDetailDisplayer = qsDetailDisplayer; mView.setWillNotDraw(!DEBUG); - mInjectionInflationController = injectionInflationController; + mLayoutInflater = layoutInflater; mFalsingManager = falsingManager; mFalsingCollector = falsingCollector; mPowerManager = powerManager; @@ -774,8 +772,7 @@ public class NotificationPanelViewController extends PanelViewController { KeyguardStatusView keyguardStatusView = mView.findViewById(R.id.keyguard_status_view); int index = mView.indexOfChild(keyguardStatusView); mView.removeView(keyguardStatusView); - keyguardStatusView = (KeyguardStatusView) mInjectionInflationController.injectable( - LayoutInflater.from(mView.getContext())).inflate( + keyguardStatusView = (KeyguardStatusView) mLayoutInflater.inflate( R.layout.keyguard_status_view, mView, false); mView.addView(keyguardStatusView, index); @@ -786,8 +783,7 @@ public class NotificationPanelViewController extends PanelViewController { index = mView.indexOfChild(mKeyguardBottomArea); mView.removeView(mKeyguardBottomArea); KeyguardBottomAreaView oldBottomArea = mKeyguardBottomArea; - mKeyguardBottomArea = (KeyguardBottomAreaView) mInjectionInflationController.injectable( - LayoutInflater.from(mView.getContext())).inflate( + mKeyguardBottomArea = (KeyguardBottomAreaView) mLayoutInflater.inflate( R.layout.keyguard_bottom_area, mView, false); mKeyguardBottomArea.initFrom(oldBottomArea); mView.addView(mKeyguardBottomArea, index); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index d452861c31c0e..aa7143e6c5496 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -40,6 +40,7 @@ import android.os.PowerManager; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.util.DisplayMetrics; +import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -84,7 +85,6 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; -import com.android.systemui.util.InjectionInflationController; import com.android.wm.shell.animation.FlingAnimationUtils; import org.junit.Before; @@ -139,7 +139,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Mock private NotificationPanelView mView; @Mock - private InjectionInflationController mInjectionInflationController; + private LayoutInflater mLayoutInflater; @Mock private DynamicPrivacyController mDynamicPrivacyController; @Mock @@ -264,7 +264,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { .thenReturn(mKeyguardStatusViewController); mNotificationPanelViewController = new NotificationPanelViewController(mView, mResources, - mInjectionInflationController, + mLayoutInflater, coordinator, expansionHandler, mDynamicPrivacyController, mKeyguardBypassController, new FalsingManagerFake(), new FalsingCollectorFake(), mShadeController, mNotificationLockscreenUserManager, mNotificationEntryManager,