Create clock customization section

Created a clock section which shows on the wallpaper picker home
page and leads to clock customization.

Bug: 241966062
Test: https://screenshot.googleplex.com/64DxwUBSbnfFfPf.png
Change-Id: I8a15652bdc580f37cb56efc88e485cb782fc89b7
diff --git a/Android.bp b/Android.bp
index 5b16e07..7bbbb10 100644
--- a/Android.bp
+++ b/Android.bp
@@ -24,22 +24,6 @@
     srcs: [
         "src/**/*.java",
         "src/**/*.kt",
-        // Min requirement for CustomizationInjector and StatsLogUserEventLogger to build without Clock and Theme feature.
-        "src/com/android/customization/model/clock/BaseClockManager.java",
-        "src/com/android/customization/model/clock/Clockface.java",
-        "src/com/android/customization/model/clock/ClockManager.java",
-        "src/com/android/customization/model/clock/ClockProvider.java",
-        "src/com/android/customization/model/theme/OverlayManagerCompat.java",
-        "src/com/android/customization/model/theme/ThemeBundleProvider.java",
-        "src/com/android/customization/model/theme/ThemeManager.java",
-        "src/com/android/customization/model/theme/ThemeBundle.java",
-        "src/com/android/customization/model/theme/custom/CustomTheme.java",
-    ],
-    exclude_srcs: [
-        "src/com/android/customization/model/clock/**/*.java",
-        "src/com/android/customization/model/theme/**/*.java",
-        "src/com/android/customization/picker/clock/**/*.java",
-        "src/com/android/customization/picker/theme/**/*.java",
     ],
 }
 
diff --git a/res/drawable/ic_clock_24px.xml b/res/drawable/ic_clock_24px.xml
new file mode 100644
index 0000000..b3f1fee
--- /dev/null
+++ b/res/drawable/ic_clock_24px.xml
@@ -0,0 +1,25 @@
+<!--
+     Copyright (C) 2022 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24"
+    android:tint="?attr/colorControlNormal">
+    <path
+        android:fillColor="@android:color/white"
+        android:pathData="M15.3,16.7 L16.7,15.3 13,11.6V7H11V12.4ZM12,22Q9.925,22 8.1,21.212Q6.275,20.425 4.925,19.075Q3.575,17.725 2.788,15.9Q2,14.075 2,12Q2,9.925 2.788,8.1Q3.575,6.275 4.925,4.925Q6.275,3.575 8.1,2.787Q9.925,2 12,2Q14.075,2 15.9,2.787Q17.725,3.575 19.075,4.925Q20.425,6.275 21.212,8.1Q22,9.925 22,12Q22,14.075 21.212,15.9Q20.425,17.725 19.075,19.075Q17.725,20.425 15.9,21.212Q14.075,22 12,22ZM12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12ZM12,20Q15.325,20 17.663,17.663Q20,15.325 20,12Q20,8.675 17.663,6.337Q15.325,4 12,4Q8.675,4 6.338,6.337Q4,8.675 4,12Q4,15.325 6.338,17.663Q8.675,20 12,20Z"/>
+</vector>
\ No newline at end of file
diff --git a/res/layout/clock_section_view.xml b/res/layout/clock_section_view.xml
new file mode 100644
index 0000000..d95e651
--- /dev/null
+++ b/res/layout/clock_section_view.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2022 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.
+-->
+<com.android.customization.picker.clock.ClockSectionView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="?selectableItemBackground"
+    android:clickable="true"
+    android:paddingVertical="@dimen/section_top_padding"
+    android:paddingHorizontal="@dimen/section_horizontal_padding"
+    android:orientation="horizontal">
+
+    <LinearLayout
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="vertical">
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/clock_title"
+            style="@style/SectionTitleTextStyle" />
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/clock_description"
+            style="@style/SectionSubtitleTextStyle"/>
+    </LinearLayout>
+
+    <ImageView
+        android:layout_width="@dimen/option_tile_width"
+        android:layout_height="@dimen/option_tile_width"
+        android:scaleType="center"
+        android:src="@drawable/ic_clock_24px"
+        android:background="@drawable/option_border_color"
+        android:contentDescription="@string/clock_picker_entry_content_description" />
+
+</com.android.customization.picker.clock.ClockSectionView>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1a15fd0..7aef401 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -24,7 +24,14 @@
 
     <!-- Title of a section of the customization picker where the user can select a Clock face.
         [CHAR LIMIT=15] -->
-    <string name="clock_title">Clock</string>
+    <string name="clock_title">Custom Clock</string>
+
+    <!-- Description of a section of the customization picker where the user can select a Clock
+        face. [CHAR LIMIT=15] -->
+    <string name="clock_description">Pick a custom clock</string>
+
+    <!-- The content description of clock entry. [CHAR LIMIT=NONE] -->
+    <string name="clock_picker_entry_content_description">Change a custom clock</string>
 
     <!-- Title of a section of the customization picker where the user can select a Grid size for
         the home screen. [CHAR LIMIT=15] -->
diff --git a/src/com/android/customization/model/clock/ClockSectionController.java b/src/com/android/customization/model/clock/ClockSectionController.java
new file mode 100644
index 0000000..cb8b9c8
--- /dev/null
+++ b/src/com/android/customization/model/clock/ClockSectionController.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2022 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.customization.model.clock;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+
+import androidx.annotation.Nullable;
+
+import com.android.customization.picker.clock.ClockSectionView;
+import com.android.wallpaper.R;
+import com.android.wallpaper.config.Flags;
+import com.android.wallpaper.model.CustomizationSectionController;
+
+/** A {@link CustomizationSectionController} for clock customization. */
+public class ClockSectionController implements CustomizationSectionController<ClockSectionView> {
+
+    private final CustomizationSectionNavigationController mNavigationController;
+
+    public ClockSectionController(CustomizationSectionNavigationController navigationController) {
+        mNavigationController = navigationController;
+    }
+
+    @Override
+    public boolean isAvailable(@Nullable Context context) {
+        return Flags.enableClockCustomization;
+    }
+
+    @Override
+    public ClockSectionView createView(Context context) {
+        return (ClockSectionView) LayoutInflater.from(context).inflate(R.layout.clock_section_view,
+                null);
+    }
+}
diff --git a/src/com/android/customization/picker/clock/ClockSectionView.kt b/src/com/android/customization/picker/clock/ClockSectionView.kt
new file mode 100644
index 0000000..c043209
--- /dev/null
+++ b/src/com/android/customization/picker/clock/ClockSectionView.kt
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2022 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.customization.picker.clock
+
+import android.content.Context
+import android.util.AttributeSet
+import com.android.wallpaper.picker.SectionView
+
+/** The [SectionView] for app clock.  */
+class ClockSectionView(context: Context?, attrs: AttributeSet?) : SectionView(context, attrs)
\ No newline at end of file
diff --git a/src_override/com/android/wallpaper/config/Flags.java b/src_override/com/android/wallpaper/config/Flags.java
index d35d88f..76549cb 100644
--- a/src_override/com/android/wallpaper/config/Flags.java
+++ b/src_override/com/android/wallpaper/config/Flags.java
@@ -16,4 +16,5 @@
 package com.android.wallpaper.config;
 
 public class Flags extends BaseFlags {
+    public static boolean enableClockCustomization = false;
 }