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
This commit is contained in:
Peter Kalauskas
2021-01-13 12:07:17 -08:00
parent db42b61db0
commit 34a747a191
2 changed files with 9 additions and 13 deletions

View File

@@ -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);

View File

@@ -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,