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

Commit 63e68601 authored by Priyank Singh's avatar Priyank Singh
Browse files

Disable pull down Notification UI if the device is not provisioned

Bug: 126738112
Test: Manual
Change-Id: I37664a9d52c554d9049dd9051f5cb3b04460ad52
(cherry picked from commit b690790f039bbfbaf40edd94d11bc25f5aa297f5)
parent dece92b2
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SystemUI;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.car.CarStatusBar;
import com.android.systemui.statusbar.policy.ConfigurationController;

/**
@@ -90,6 +91,7 @@ public class NotificationsUI extends SystemUI
    private FlingAnimationUtils mFlingAnimationUtils;
    private static int sSettleOpenPercentage;
    private static int sSettleClosePercentage;
    private CarStatusBar mCarStatusBar;

    /**
     * Inits the window that hosts the notifications and establishes the connections
@@ -230,6 +232,10 @@ public class NotificationsUI extends SystemUI
        inflateNotificationContent();
    }

    public void setStatusBar(CarStatusBar carStatusBar) {
        mCarStatusBar = carStatusBar;
    }

    public View.OnTouchListener getDragDownListener() {
        return mOnTouchListener;
    }
@@ -328,6 +334,9 @@ public class NotificationsUI extends SystemUI
        @Override
        public boolean onScroll(MotionEvent event1, MotionEvent event2, float distanceX,
                float distanceY) {
            if (mCarStatusBar == null || !mCarStatusBar.getIsUserSetup()) {
                return true;
            }
            boolean isDown = event1.getY() - event2.getY() < 0;
            // CarStatusBar and NavigationBar are identical so avoid the touch if it
            // starts from NavigationBar to open.
@@ -442,6 +451,9 @@ public class NotificationsUI extends SystemUI
     * Sets the notifications to visible
     */
    public void openCarNotifications(float velocityY) {
        if (mCarStatusBar == null || !mCarStatusBar.getIsUserSetup()) {
            return;
        }
        mCarNotificationWindow.setVisibility(View.VISIBLE);

        ValueAnimator animator = ValueAnimator.ofFloat(mContent.getTranslationY(), 0);
+6 −0
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ public class CarStatusBar extends StatusBar implements
        topBar.setStatusBar(this);
        CarNavigationBarView qsTopBar = mStatusBarWindow.findViewById(R.id.qs_car_top_bar);
        qsTopBar.setStatusBar(this);
        getComponent(NotificationsUI.class).setStatusBar(this);
    }

    @Override
@@ -614,6 +615,11 @@ public class CarStatusBar extends StatusBar implements
        return mContext.getDrawable(com.android.internal.R.drawable.default_wallpaper);
    }

    /** Returns true if the current user makes it through the setup wizard, false otherwise. */
    public boolean getIsUserSetup(){
        return mUserSetup;
    }

    public void toggleCarNotifications() {
        getComponent(NotificationsUI.class).toggleShowingCarNotifications();
    }