Minimize API of KeyguardBottomAreaView

As part of the effort to refactor KBAV to a more modern implementation,
this CL minimizes the public API surface of that class.

There are namely three changes:
1. Removal of setCentralSurfaces (this was no longer used inside KBAV)
2. Unification of the four "init" methods into one
3. Making startFinishDozeAnimation private (it was not called from
   outside the class)

Bug: b/235403546
Test: built using make and verified the bottom view is visible on the
lock screen. Does the bouncy animation, opens the home controls view
from that button, shows the song ID, etc.

Change-Id: I7393d357e82a139c3ad83b2f48b0f2dc9a02b93a
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 61113a0..a6fcde3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -89,7 +89,6 @@
 
     private ActivityStarter mActivityStarter;
     private KeyguardStateController mKeyguardStateController;
-    private CentralSurfaces mCentralSurfaces;
     private FalsingManager mFalsingManager;
 
     private boolean mDozing;
@@ -139,9 +138,38 @@
         super(context, attrs, defStyleAttr, defStyleRes);
     }
 
-    public void initFrom(KeyguardBottomAreaView oldBottomArea) {
-        setCentralSurfaces(oldBottomArea.mCentralSurfaces);
+    /** Initializes the {@link KeyguardBottomAreaView} with the given dependencies */
+    public void init(
+            FalsingManager falsingManager,
+            QuickAccessWalletController controller,
+            ControlsComponent controlsComponent,
+            QRCodeScannerController qrCodeScannerController) {
+        mFalsingManager = falsingManager;
+        mQuickAccessWalletController = controller;
+        mQuickAccessWalletController.setupWalletChangeObservers(
+                mCardRetriever, WALLET_PREFERENCE_CHANGE, DEFAULT_PAYMENT_APP_CHANGE);
+        mQuickAccessWalletController.updateWalletPreference();
+        mQuickAccessWalletController.queryWalletCards(mCardRetriever);
+        updateWalletVisibility();
 
+        mControlsComponent = controlsComponent;
+        mControlsComponent.getControlsListingController().ifPresent(
+                c -> c.addCallback(mListingCallback));
+
+        mQRCodeScannerController = qrCodeScannerController;
+        mQRCodeScannerController.registerQRCodeScannerChangeObservers(
+                QRCodeScannerController.DEFAULT_QR_CODE_SCANNER_CHANGE,
+                QRCodeScannerController.QR_CODE_SCANNER_PREFERENCE_CHANGE);
+        updateQRCodeButtonVisibility();
+
+        updateAffordanceColors();
+    }
+
+    /**
+     * Initializes this instance of {@link KeyguardBottomAreaView} based on the given instance of
+     * another {@link KeyguardBottomAreaView}
+     */
+    public void initFrom(KeyguardBottomAreaView oldBottomArea) {
         // if it exists, continue to use the original ambient indication container
         // instead of the newly inflated one
         if (mAmbientIndicationArea != null) {
@@ -268,10 +296,6 @@
         updateAffordanceColors();
     }
 
-    public void setCentralSurfaces(CentralSurfaces centralSurfaces) {
-        mCentralSurfaces = centralSurfaces;
-    }
-
     private void updateWalletVisibility() {
         if (mDozing
                 || mQuickAccessWalletController == null
@@ -332,7 +356,7 @@
         return false;
     }
 
-    public void startFinishDozeAnimation() {
+    private void startFinishDozeAnimation() {
         long delay = 0;
         if (mWalletButton.getVisibility() == View.VISIBLE) {
             startFinishDozeAnimationElement(mWalletButton, delay);
@@ -415,38 +439,6 @@
         return insets;
     }
 
-    /** Set the falsing manager */
-    public void setFalsingManager(FalsingManager falsingManager) {
-        mFalsingManager = falsingManager;
-    }
-
-    /**
-     * Initialize the wallet feature, only enabling if the feature is enabled within the platform.
-     */
-    public void initWallet(
-            QuickAccessWalletController controller) {
-        mQuickAccessWalletController = controller;
-        mQuickAccessWalletController.setupWalletChangeObservers(
-                mCardRetriever, WALLET_PREFERENCE_CHANGE, DEFAULT_PAYMENT_APP_CHANGE);
-        mQuickAccessWalletController.updateWalletPreference();
-        mQuickAccessWalletController.queryWalletCards(mCardRetriever);
-
-        updateWalletVisibility();
-        updateAffordanceColors();
-    }
-
-    /**
-     * Initialize the qr code scanner feature, controlled by QRCodeScannerController.
-     */
-    public void initQRCodeScanner(QRCodeScannerController qrCodeScannerController) {
-        mQRCodeScannerController = qrCodeScannerController;
-        mQRCodeScannerController.registerQRCodeScannerChangeObservers(
-                QRCodeScannerController.DEFAULT_QR_CODE_SCANNER_CHANGE,
-                QRCodeScannerController.QR_CODE_SCANNER_PREFERENCE_CHANGE);
-        updateQRCodeButtonVisibility();
-        updateAffordanceColors();
-    }
-
     private void updateQRCodeButtonVisibility() {
         if (mQuickAccessWalletController != null
                 && mQuickAccessWalletController.isWalletEnabled()) {
@@ -502,17 +494,6 @@
         mQRCodeScannerButton.setBackgroundTintList(bgColor);
     }
 
-    /**
-      * Initialize controls via the ControlsComponent
-      */
-    public void initControls(ControlsComponent controlsComponent) {
-        mControlsComponent = controlsComponent;
-        mControlsComponent.getControlsListingController().ifPresent(
-                c -> c.addCallback(mListingCallback));
-
-        updateAffordanceColors();
-    }
-
     private void onWalletClick(View v) {
         // More coming here; need to inform the user about how to proceed
         if (mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) {
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 648bb0c..abda44c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -1118,7 +1118,6 @@
     private void setCentralSurfaces(CentralSurfaces centralSurfaces) {
         // TODO: this can be injected.
         mCentralSurfaces = centralSurfaces;
-        mKeyguardBottomArea.setCentralSurfaces(mCentralSurfaces);
     }
 
     public void updateResources() {
@@ -1292,11 +1291,11 @@
     }
 
     private void initBottomArea() {
-        mKeyguardBottomArea.setCentralSurfaces(mCentralSurfaces);
-        mKeyguardBottomArea.setFalsingManager(mFalsingManager);
-        mKeyguardBottomArea.initWallet(mQuickAccessWalletController);
-        mKeyguardBottomArea.initControls(mControlsComponent);
-        mKeyguardBottomArea.initQRCodeScanner(mQRCodeScannerController);
+        mKeyguardBottomArea.init(
+                mFalsingManager,
+                mQuickAccessWalletController,
+                mControlsComponent,
+                mQRCodeScannerController);
     }
 
     @VisibleForTesting
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
index 4b557dc..3440fa5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
@@ -42,7 +42,6 @@
 
         mKeyguardBottomArea = LayoutInflater.from(mContext).inflate(
                 R.layout.keyguard_bottom_area, null, false) as KeyguardBottomAreaView
-        mKeyguardBottomArea.setCentralSurfaces(mCentralSurfaces)
     }
 
     @Test