Set up a folder for Chassis lib, with some stub content.
Bug: 139319073
Test: Manual on device
Change-Id: I7b353862474f3149787a6071f8c8ef1539f7844b
diff --git a/car-chassis-lib/Android.mk b/car-chassis-lib/Android.mk
new file mode 100644
index 0000000..5ae4041
--- /dev/null
+++ b/car-chassis-lib/Android.mk
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_MODULE := car-chassis-lib
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_PRIVILEGED_MODULE := true
+
+LOCAL_PROGUARD_ENABLED := disabled
+
+LOCAL_USE_AAPT2 := true
+
+LOCAL_JAVA_LIBRARIES += android.car
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_STATIC_ANDROID_LIBRARIES += \
+ androidx.annotation_annotation \
+ androidx-constraintlayout_constraintlayout \
+ androidx.recyclerview_recyclerview
+
+LOCAL_STATIC_JAVA_LIBRARIES += \
+ androidx-constraintlayout_constraintlayout-solver
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+ifeq (,$(ONE_SHOT_MAKEFILE))
+ include $(call all-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/car-chassis-lib/AndroidManifest.xml b/car-chassis-lib/AndroidManifest.xml
new file mode 100644
index 0000000..79fafdd
--- /dev/null
+++ b/car-chassis-lib/AndroidManifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.car.chassis">
+
+</manifest>
diff --git a/car-chassis-lib/README.md b/car-chassis-lib/README.md
new file mode 100644
index 0000000..31bd2f1
--- /dev/null
+++ b/car-chassis-lib/README.md
@@ -0,0 +1,28 @@
+# Android Automotive 'Chassis' library
+Components and resources designed to increase Automotive UI consistency between
+GAS (Google Automotive Services) apps, system-apps and OEM developed apps.
+
+See: go/aae-chassis
+
+## Content
+
+Components and resources designed to be configured by means of RRO (Runtime
+Resource Overlays) by OEMs.
+
+## Updating
+
+This library is developed in Gerrit and copied as source to Google3 using
+Copybara (go/copybara).
+
+Source: /packages/apps/Car/libs/car-chassis-lib
+Target: //google3/third_party/java/android_libs/android_car_chassis_lib
+
+Here is the process for updating this library:
+
+1. Develop, test and create CL in Gerrit with the desired changes
+2. On Google3, run update.sh and test your changes
+3. Iterate until your changes look okay on both places.
+4. Back on Gerrit, submit your CL
+5. Back on Google3, run update.sh again and submit
+
+TODO: Automate this process using CaaS
\ No newline at end of file
diff --git a/car-chassis-lib/res/values/attrs.xml b/car-chassis-lib/res/values/attrs.xml
new file mode 100644
index 0000000..b946e88
--- /dev/null
+++ b/car-chassis-lib/res/values/attrs.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <!-- Attributes for the ClickThroughToolbar. -->
+ <declare-styleable name="ClickThroughToolbar">
+ <!-- Whether or not clicks on this toolbar will pass through to an underlying view. This
+ value is false by default. -->
+ <attr name="clickThrough" format="boolean"/>
+ </declare-styleable>
+</resources>
diff --git a/car-chassis-lib/src/com/android/car/chassis/ClickThroughToolbar.java b/car-chassis-lib/src/com/android/car/chassis/ClickThroughToolbar.java
new file mode 100644
index 0000000..e0c1120
--- /dev/null
+++ b/car-chassis-lib/src/com/android/car/chassis/ClickThroughToolbar.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.car.chassis;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.widget.Toolbar;
+
+/**
+ * A toolbar that optionally supports allowing clicks on it to pass through to any underlying views.
+ *
+ * <p>By default, the {@link Toolbar} eats all touches on it. This view will override
+ * {@link #onTouchEvent(MotionEvent)} and return {@code false} if configured to allow pass through.
+ */
+public class ClickThroughToolbar extends Toolbar {
+ private boolean mAllowClickPassThrough;
+
+ public ClickThroughToolbar(Context context) {
+ super(context);
+ }
+
+ public ClickThroughToolbar(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ initAttributes(context, attrs, 0 /* defStyleAttrs */);
+ }
+
+ public ClickThroughToolbar(Context context, AttributeSet attrs, int defStyleAttrs) {
+ super(context, attrs, defStyleAttrs);
+ initAttributes(context, attrs, defStyleAttrs);
+ }
+
+ private void initAttributes(Context context, AttributeSet attrs, int defStyleAttrs) {
+ TypedArray a = context.obtainStyledAttributes(
+ attrs, R.styleable.ClickThroughToolbar, defStyleAttrs, 0 /* defStyleRes */);
+
+ mAllowClickPassThrough = a.getBoolean(R.styleable.ClickThroughToolbar_clickThrough, false);
+
+ a.recycle();
+ }
+
+ /**
+ * Whether or not clicks on this toolbar will pass through to any views that are underneath
+ * it. By default, this value is {@code false}.
+ *
+ * @param allowPassThrough {@code true} if clicks will pass through to an underlying view;
+ * {@code false} otherwise.
+ */
+ public void setClickPassThrough(boolean allowPassThrough) {
+ mAllowClickPassThrough = allowPassThrough;
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ if (mAllowClickPassThrough) {
+ return false;
+ }
+
+ return super.onTouchEvent(ev);
+ }
+}