Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac09cbe1 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin Committed by Automerger Merge Worker
Browse files

Minimize API of KeyguardBottomAreaView am: 262f1f31 am: 323676b5

parents 65e92054 323676b5
Loading
Loading
Loading
Loading
+32 −51
Original line number Original line Diff line number Diff line
@@ -89,7 +89,6 @@ public class KeyguardBottomAreaView extends FrameLayout {


    private ActivityStarter mActivityStarter;
    private ActivityStarter mActivityStarter;
    private KeyguardStateController mKeyguardStateController;
    private KeyguardStateController mKeyguardStateController;
    private CentralSurfaces mCentralSurfaces;
    private FalsingManager mFalsingManager;
    private FalsingManager mFalsingManager;


    private boolean mDozing;
    private boolean mDozing;
@@ -139,9 +138,38 @@ public class KeyguardBottomAreaView extends FrameLayout {
        super(context, attrs, defStyleAttr, defStyleRes);
        super(context, attrs, defStyleAttr, defStyleRes);
    }
    }


    public void initFrom(KeyguardBottomAreaView oldBottomArea) {
    /** Initializes the {@link KeyguardBottomAreaView} with the given dependencies */
        setCentralSurfaces(oldBottomArea.mCentralSurfaces);
    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
        // if it exists, continue to use the original ambient indication container
        // instead of the newly inflated one
        // instead of the newly inflated one
        if (mAmbientIndicationArea != null) {
        if (mAmbientIndicationArea != null) {
@@ -268,10 +296,6 @@ public class KeyguardBottomAreaView extends FrameLayout {
        updateAffordanceColors();
        updateAffordanceColors();
    }
    }


    public void setCentralSurfaces(CentralSurfaces centralSurfaces) {
        mCentralSurfaces = centralSurfaces;
    }

    private void updateWalletVisibility() {
    private void updateWalletVisibility() {
        if (mDozing
        if (mDozing
                || mQuickAccessWalletController == null
                || mQuickAccessWalletController == null
@@ -332,7 +356,7 @@ public class KeyguardBottomAreaView extends FrameLayout {
        return false;
        return false;
    }
    }


    public void startFinishDozeAnimation() {
    private void startFinishDozeAnimation() {
        long delay = 0;
        long delay = 0;
        if (mWalletButton.getVisibility() == View.VISIBLE) {
        if (mWalletButton.getVisibility() == View.VISIBLE) {
            startFinishDozeAnimationElement(mWalletButton, delay);
            startFinishDozeAnimationElement(mWalletButton, delay);
@@ -415,38 +439,6 @@ public class KeyguardBottomAreaView extends FrameLayout {
        return insets;
        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() {
    private void updateQRCodeButtonVisibility() {
        if (mQuickAccessWalletController != null
        if (mQuickAccessWalletController != null
                && mQuickAccessWalletController.isWalletEnabled()) {
                && mQuickAccessWalletController.isWalletEnabled()) {
@@ -502,17 +494,6 @@ public class KeyguardBottomAreaView extends FrameLayout {
        mQRCodeScannerButton.setBackgroundTintList(bgColor);
        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) {
    private void onWalletClick(View v) {
        // More coming here; need to inform the user about how to proceed
        // More coming here; need to inform the user about how to proceed
        if (mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) {
        if (mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) {
+5 −6
Original line number Original line Diff line number Diff line
@@ -1110,7 +1110,6 @@ public class NotificationPanelViewController extends PanelViewController {
    private void setCentralSurfaces(CentralSurfaces centralSurfaces) {
    private void setCentralSurfaces(CentralSurfaces centralSurfaces) {
        // TODO: this can be injected.
        // TODO: this can be injected.
        mCentralSurfaces = centralSurfaces;
        mCentralSurfaces = centralSurfaces;
        mKeyguardBottomArea.setCentralSurfaces(mCentralSurfaces);
    }
    }


    public void updateResources() {
    public void updateResources() {
@@ -1283,11 +1282,11 @@ public class NotificationPanelViewController extends PanelViewController {
    }
    }


    private void initBottomArea() {
    private void initBottomArea() {
        mKeyguardBottomArea.setCentralSurfaces(mCentralSurfaces);
        mKeyguardBottomArea.init(
        mKeyguardBottomArea.setFalsingManager(mFalsingManager);
                mFalsingManager,
        mKeyguardBottomArea.initWallet(mQuickAccessWalletController);
                mQuickAccessWalletController,
        mKeyguardBottomArea.initControls(mControlsComponent);
                mControlsComponent,
        mKeyguardBottomArea.initQRCodeScanner(mQRCodeScannerController);
                mQRCodeScannerController);
    }
    }


    @VisibleForTesting
    @VisibleForTesting
+0 −1
Original line number Original line Diff line number Diff line
@@ -42,7 +42,6 @@ class KeyguardBottomAreaTest : SysuiTestCase() {


        mKeyguardBottomArea = LayoutInflater.from(mContext).inflate(
        mKeyguardBottomArea = LayoutInflater.from(mContext).inflate(
                R.layout.keyguard_bottom_area, null, false) as KeyguardBottomAreaView
                R.layout.keyguard_bottom_area, null, false) as KeyguardBottomAreaView
        mKeyguardBottomArea.setCentralSurfaces(mCentralSurfaces)
    }
    }


    @Test
    @Test