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

Commit 33767b86 authored by Heemin Seog's avatar Heemin Seog Committed by Android (Google) Code Review
Browse files

Merge changes I0a54ddf3,I10fd4e2e

* changes:
  Remove references to nav bar views in StatusBar
  Setup on device testing for sys ui
parents 579fac68 8d6ec6a7
Loading
Loading
Loading
Loading
+58 −0
Original line number Diff line number Diff line
@@ -63,6 +63,64 @@ android_library {

}

android_library {
    name: "CarSystemUI-tests",
    manifest: "tests/AndroidManifest.xml",
    resource_dirs: [
        "tests/res",
        "res-keyguard",
        "res",
    ],
    srcs: [
        "tests/src/**/*.java",
        "src/**/*.java",
        "src/**/I*.aidl",
    ],
    static_libs: [
        "SystemUI-tests",
        "CarNotificationLib",
        "SystemUIPluginLib",
        "SystemUISharedLib",
        "SettingsLib",
        "android.car.userlib",
        "androidx.legacy_legacy-support-v4",
        "androidx.recyclerview_recyclerview",
        "androidx.preference_preference",
        "androidx.appcompat_appcompat",
        "androidx.mediarouter_mediarouter",
        "androidx.palette_palette",
        "androidx.legacy_legacy-preference-v14",
        "androidx.leanback_leanback",
        "androidx.slice_slice-core",
        "androidx.slice_slice-view",
        "androidx.slice_slice-builders",
        "androidx.arch.core_core-runtime",
        "androidx.lifecycle_lifecycle-extensions",
        "SystemUI-tags",
        "SystemUI-proto",
        "metrics-helper-lib",
        "androidx.test.rules", "hamcrest-library",
        "mockito-target-inline-minus-junit4",
        "testables",
        "truth-prebuilt",
        "dagger2-2.19",
        "//external/kotlinc:kotlin-annotations",
    ],
    libs: [
        "android.test.runner",
        "telephony-common",
        "android.test.base",
        "android.car",
    ],

    aaptflags: [
        "--extra-packages",
        "com.android.systemui",
    ],

    plugins: ["dagger2-compiler-2.19"],
}

android_app {
    name: "CarSystemUI",

+3 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;

@@ -291,7 +292,8 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks
        }

        boolean isKeyboardVisible = (vis & InputMethodService.IME_VISIBLE) != 0;
        mCarNavigationBarController.setBottomWindowVisibility(!isKeyboardVisible);
        mCarNavigationBarController.setBottomWindowVisibility(
                isKeyboardVisible ? View.GONE : View.VISIBLE);
    }

    private void updateNavBarForKeyguardContent() {
+73 −10
Original line number Diff line number Diff line
@@ -98,31 +98,30 @@ public class CarNavigationBarController {
    }

    /** Toggles the bottom nav bar visibility. */
    public boolean setBottomWindowVisibility(boolean isVisible) {
        return setWindowVisibility(getBottomWindow(), isVisible);
    public boolean setBottomWindowVisibility(@View.Visibility int visibility) {
        return setWindowVisibility(getBottomWindow(), visibility);
    }

    /** Toggles the left nav bar visibility. */
    public boolean setLeftWindowVisibility(boolean isVisible) {
        return setWindowVisibility(getLeftWindow(), isVisible);
    public boolean setLeftWindowVisibility(@View.Visibility int visibility) {
        return setWindowVisibility(getLeftWindow(), visibility);
    }

    /** Toggles the right nav bar visibility. */
    public boolean setRightWindowVisibility(boolean isVisible) {
        return setWindowVisibility(getRightWindow(), isVisible);
    public boolean setRightWindowVisibility(@View.Visibility int visibility) {
        return setWindowVisibility(getRightWindow(), visibility);
    }

    private boolean setWindowVisibility(ViewGroup window, boolean isVisible) {
    private boolean setWindowVisibility(ViewGroup window, @View.Visibility int visibility) {
        if (window == null) {
            return false;
        }

        int newVisibility = isVisible ? View.VISIBLE : View.GONE;
        if (window.getVisibility() == newVisibility) {
        if (window.getVisibility() == visibility) {
            return false;
        }

        window.setVisibility(newVisibility);
        window.setVisibility(visibility);
        return true;
    }

@@ -228,6 +227,63 @@ public class CarNavigationBarController {
        }
    }

    /**
     * Shows all of the keyguard specific buttons on the valid instances of
     * {@link CarNavigationBarView}.
     */
    public void showAllKeyguardButtons(boolean isSetUp) {
        checkAllBars(isSetUp);
        if (mTopView != null) {
            mTopView.showKeyguardButtons();
        }
        if (mBottomView != null) {
            mBottomView.showKeyguardButtons();
        }
        if (mLeftView != null) {
            mLeftView.showKeyguardButtons();
        }
        if (mRightView != null) {
            mRightView.showKeyguardButtons();
        }
    }

    /**
     * Hides all of the keyguard specific buttons on the valid instances of
     * {@link CarNavigationBarView}.
     */
    public void hideAllKeyguardButtons(boolean isSetUp) {
        checkAllBars(isSetUp);
        if (mTopView != null) {
            mTopView.hideKeyguardButtons();
        }
        if (mBottomView != null) {
            mBottomView.hideKeyguardButtons();
        }
        if (mLeftView != null) {
            mLeftView.hideKeyguardButtons();
        }
        if (mRightView != null) {
            mRightView.hideKeyguardButtons();
        }
    }

    /** Toggles whether the notifications icon has an unseen indicator or not. */
    public void toggleAllNotificationsUnseenIndicator(boolean isSetUp, boolean hasUnseen) {
        checkAllBars(isSetUp);
        if (mTopView != null) {
            mTopView.toggleNotificationUnseenIndicator(hasUnseen);
        }
        if (mBottomView != null) {
            mBottomView.toggleNotificationUnseenIndicator(hasUnseen);
        }
        if (mLeftView != null) {
            mLeftView.toggleNotificationUnseenIndicator(hasUnseen);
        }
        if (mRightView != null) {
            mRightView.toggleNotificationUnseenIndicator(hasUnseen);
        }
    }

    /** Interface for controlling the notifications shade. */
    public interface NotificationsShadeController {
        /** Toggles the visibility of the notifications shade. */
@@ -244,4 +300,11 @@ public class CarNavigationBarController {
            }
        }
    }

    private void checkAllBars(boolean isSetUp) {
        mTopView = getTopBar(isSetUp);
        mBottomView = getBottomBar(isSetUp);
        mLeftView = getLeftBar(isSetUp);
        mRightView = getRightBar(isSetUp);
    }
}
+15 −4
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.widget.LinearLayout;

import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.navigationbar.car.CarNavigationBarController.NotificationsShadeController;
import com.android.systemui.statusbar.phone.StatusBarIconController;

/**
@@ -35,7 +36,7 @@ import com.android.systemui.statusbar.phone.StatusBarIconController;
public class CarNavigationBarView extends LinearLayout {
    private View mNavButtons;
    private CarNavigationButton mNotificationsButton;
    private CarNavigationBarController.NotificationsShadeController mNotificationsShadeController;
    private NotificationsShadeController mNotificationsShadeController;
    private Context mContext;
    private View mLockScreenButtons;
    // used to wire in open/close gestures for notifications
@@ -81,13 +82,18 @@ public class CarNavigationBarView extends LinearLayout {
        return super.onInterceptTouchEvent(ev);
    }

    public void setNotificationsPanelController(
            CarNavigationBarController.NotificationsShadeController controller) {
    /** Sets the notifications panel controller. */
    public void setNotificationsPanelController(NotificationsShadeController controller) {
        mNotificationsShadeController = controller;
    }

    /** Gets the notifications panel controller. */
    public NotificationsShadeController getNotificationsPanelController() {
        return mNotificationsShadeController;
    }

    /**
     * Set a touch listener that will be called from onInterceptTouchEvent and onTouchEvent
     * Sets a touch listener that will be called from onInterceptTouchEvent and onTouchEvent
     *
     * @param statusBarWindowTouchListener The listener to call from touch and intercept touch
     */
@@ -95,6 +101,11 @@ public class CarNavigationBarView extends LinearLayout {
        mStatusBarWindowTouchListener = statusBarWindowTouchListener;
    }

    /** Gets the touch listener that will be called from onInterceptTouchEvent and onTouchEvent. */
    public OnTouchListener getStatusBarWindowTouchListener() {
        return mStatusBarWindowTouchListener;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (mStatusBarWindowTouchListener != null) {
+5 −0
Original line number Diff line number Diff line
@@ -150,6 +150,11 @@ public class CarNavigationButton extends com.android.keyguard.AlphaOptimizedImag
        updateImage();
    }

    /** Gets whether the icon is in an unseen state. */
    public boolean getUnseen() {
        return mHasUnseen;
    }

    private void updateImage() {
        if (mHasUnseen) {
            setImageResource(mSelected ? UNSEEN_SELECTED_ICON_RESOURCE_ID
Loading