Merge "Use full path for LOCAL_INSTRUMENT_SOURCE_DIRS" into ub-launcher3-master
diff --git a/Android.mk b/Android.mk
index 81a2976..a098ee2 100644
--- a/Android.mk
+++ b/Android.mk
@@ -26,7 +26,7 @@
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_ANDROID_LIBRARIES := WallpaperPicker2CommonDepsLib
-LOCAL_STATIC_JAVA_LIBRARIES := styleprotosnano
+LOCAL_STATIC_JAVA_LIBRARIES := styleprotosnano SystemUI-statsd
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SDK_VERSION := system_current
diff --git a/res/layout/fragment_clock_scalable_picker.xml b/res/layout/fragment_clock_scalable_picker.xml
new file mode 100644
index 0000000..41ee0f3
--- /dev/null
+++ b/res/layout/fragment_clock_scalable_picker.xml
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 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.
+-->
+<androidx.coordinatorlayout.widget.CoordinatorLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="?android:colorPrimary"
+ android:orientation="vertical">
+
+ <include layout="@layout/section_header" />
+
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_behavior="@string/scalable_container_behavior">
+
+ <com.android.customization.widget.PreviewPager
+ android:id="@+id/clock_preview_pager"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/preview_pager_background" />
+ </FrameLayout>
+
+ <FrameLayout
+ android:id="@+id/scalable_content_container"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/content_container_maximum_height"
+ app:behavior_peekHeight="@dimen/content_container_minimum_height"
+ app:layout_behavior="@string/bottom_sheet_behavior">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/content_section"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/options_container"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/options_container_height"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="10dp"
+ app:layout_constraintBottom_toTopOf="@id/placeholder"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="1.0" />
+
+ <Space
+ android:id="@+id/placeholder"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/min_taptarget_height"
+ app:layout_constraintBottom_toTopOf="@id/apply_button"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHeight_min="@dimen/min_taptarget_height"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/options_container"
+ app:layout_constraintVertical_bias="1.0" />
+
+ <Button
+ android:id="@+id/apply_button"
+ style="@style/ActionPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="end"
+ android:layout_marginVertical="10dp"
+ android:layout_marginEnd="10dp"
+ android:layout_weight="1"
+ android:text="@string/apply_theme_btn"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ </FrameLayout>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <androidx.core.widget.ContentLoadingProgressBar
+ android:id="@+id/loading_indicator"
+ style="@android:style/Widget.DeviceDefault.ProgressBar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal|top"
+ android:layout_marginTop="200dp"
+ android:indeterminate="true" />
+
+ <FrameLayout
+ android:id="@+id/error_section"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone">
+
+ <TextView
+ android:id="@+id/error_message"
+ style="@style/TitleTextAppearance"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:text="@string/something_went_wrong" />
+ </FrameLayout>
+ </FrameLayout>
+</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/res/layout/fragment_grid_scalable_picker.xml b/res/layout/fragment_grid_scalable_picker.xml
new file mode 100644
index 0000000..14cd503
--- /dev/null
+++ b/res/layout/fragment_grid_scalable_picker.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 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.
+-->
+<androidx.coordinatorlayout.widget.CoordinatorLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="?android:colorPrimary"
+ android:orientation="vertical">
+
+ <include layout="@layout/section_header" />
+
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_behavior="@string/scalable_container_behavior">
+
+ <com.android.customization.widget.PreviewPager
+ android:id="@+id/grid_preview_pager"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/preview_pager_background"
+ app:card_style="screen_aspect_ratio" />
+ </FrameLayout>
+
+ <FrameLayout
+ android:id="@+id/scalable_content_container"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/content_container_maximum_height"
+ app:behavior_peekHeight="@dimen/content_container_minimum_height"
+ app:layout_behavior="@string/bottom_sheet_behavior">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/content_section"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/options_container"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/options_container_height"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="10dp"
+ app:layout_constraintBottom_toTopOf="@id/placeholder"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="1.0" />
+
+ <Space
+ android:id="@+id/placeholder"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/min_taptarget_height"
+ app:layout_constraintBottom_toTopOf="@id/apply_button"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/options_container"
+ app:layout_constraintVertical_bias="1.0" />
+
+ <Button
+ android:id="@+id/apply_button"
+ style="@style/ActionPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="end"
+ android:layout_marginVertical="10dp"
+ android:layout_marginEnd="10dp"
+ android:layout_weight="1"
+ android:text="@string/apply_theme_btn"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ </FrameLayout>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <androidx.core.widget.ContentLoadingProgressBar
+ android:id="@+id/loading_indicator"
+ style="@android:style/Widget.DeviceDefault.ProgressBar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal|top"
+ android:layout_marginTop="200dp"
+ android:indeterminate="true" />
+
+ <FrameLayout
+ android:id="@+id/error_section"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone">
+
+ <TextView
+ android:id="@+id/error_message"
+ style="@style/TitleTextAppearance"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:text="@string/something_went_wrong" />
+ </FrameLayout>
+ </FrameLayout>
+</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/res/layout/fragment_theme_scalable_picker.xml b/res/layout/fragment_theme_scalable_picker.xml
new file mode 100644
index 0000000..fd5b5b6
--- /dev/null
+++ b/res/layout/fragment_theme_scalable_picker.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 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.
+-->
+<androidx.coordinatorlayout.widget.CoordinatorLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="?android:colorPrimary"
+ android:orientation="vertical">
+
+ <include layout="@layout/section_header" />
+
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_behavior="@string/scalable_container_behavior">
+
+ <com.android.customization.widget.PreviewPager
+ android:id="@+id/theme_preview_pager"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/preview_pager_background" />
+ </FrameLayout>
+
+ <FrameLayout
+ android:id="@+id/scalable_content_container"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/content_container_maximum_height"
+ app:behavior_peekHeight="@dimen/content_container_minimum_height"
+ app:layout_behavior="@string/bottom_sheet_behavior">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/content_section"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/options_container"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/options_container_height"
+ android:layout_gravity="bottom|center_horizontal"
+ android:layout_marginTop="10dp"
+ android:layout_weight="1"
+ app:layout_constraintBottom_toTopOf="@id/use_my_wallpaper"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="1.0" />
+
+ <CheckBox
+ android:id="@+id/use_my_wallpaper"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/min_taptarget_height"
+ android:layout_marginStart="10dp"
+ android:ellipsize="end"
+ android:gravity="start|center_vertical"
+ android:paddingLeft="4dp"
+ android:text="@string/keep_my_wallpaper"
+ app:layout_constraintBottom_toTopOf="@id/apply_button"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHeight_min="@dimen/min_taptarget_height"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/options_container"
+ app:layout_constraintVertical_bias="1.0" />
+
+ <Button
+ android:id="@+id/apply_button"
+ style="@style/ActionPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="end"
+ android:layout_marginEnd="10dp"
+ android:layout_marginBottom="10dp"
+ android:text="@string/apply_theme_btn"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ </FrameLayout>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <androidx.core.widget.ContentLoadingProgressBar
+ android:id="@+id/loading_indicator"
+ style="@android:style/Widget.DeviceDefault.ProgressBar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal|top"
+ android:layout_marginTop="200dp"
+ android:indeterminate="true" />
+
+ <FrameLayout
+ android:id="@+id/error_section"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone">
+
+ <TextView
+ android:id="@+id/error_message"
+ style="@style/TitleTextAppearance"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:text="@string/something_went_wrong" />
+ </FrameLayout>
+ </FrameLayout>
+</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/src/com/android/customization/module/StatsLogUserEventLogger.java b/src/com/android/customization/module/StatsLogUserEventLogger.java
index a13d420..bcdcaf0 100644
--- a/src/com/android/customization/module/StatsLogUserEventLogger.java
+++ b/src/com/android/customization/module/StatsLogUserEventLogger.java
@@ -18,6 +18,7 @@
import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_COLOR;
import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_FONT;
import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_SHAPE;
+import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UI_CHANGED;
import android.stats.style.nano.StyleEnums;
@@ -26,6 +27,7 @@
import com.android.customization.model.clock.Clockface;
import com.android.customization.model.grid.GridOption;
import com.android.customization.model.theme.ThemeBundle;
+import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.wallpaper.module.NoOpUserEventLogger;
import java.util.Map;
@@ -39,33 +41,32 @@
public class StatsLogUserEventLogger extends NoOpUserEventLogger implements ThemesUserEventLogger {
private static final String TAG = "StatsLogUserEventLogger";
- private static final int CODE = 179;
@Override
public void logResumed(boolean provisioned, boolean wallpaper) {
- WallpaperStatsLog.write(CODE, StyleEnums.ONRESUME, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.ONRESUME, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
@Override
public void logStopped() {
- WallpaperStatsLog.write(CODE, StyleEnums.ONSTOP, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.ONSTOP, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
@Override
public void logActionClicked(String collectionId, int actionLabelResId) {
- WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_EXPLORE, 0, 0, 0, 0, 0,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_EXPLORE, 0, 0, 0, 0, 0,
collectionId.hashCode(), 0, 0, 0);
}
@Override
public void logIndividualWallpaperSelected(String collectionId) {
- WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_SELECT, 0, 0, 0, 0, 0, 0,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_SELECT, 0, 0, 0, 0, 0, 0,
collectionId.hashCode(), 0, 0);
}
@Override
public void logCategorySelected(String collectionId) {
- WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_OPEN_CATEGORY,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_OPEN_CATEGORY,
0, 0, 0, 0, 0,
collectionId.hashCode(),
0, 0, 0);
@@ -73,7 +74,7 @@
@Override
public void logWallpaperSet(String collectionId, @Nullable String wallpaperId) {
- WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_APPLIED,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_APPLIED,
0, 0, 0, 0, 0,
collectionId.hashCode(),
wallpaperId != null ? wallpaperId.hashCode() : 0,
@@ -88,7 +89,7 @@
@Override
public void logThemeSelected(ThemeBundle theme, boolean isCustomTheme) {
- WallpaperStatsLog.write(CODE, StyleEnums.PICKER_SELECT,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT,
Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR)),
Objects.hashCode(getThemePackage(theme,OVERLAY_CATEGORY_FONT)),
Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE)),
@@ -97,7 +98,7 @@
@Override
public void logThemeApplied(ThemeBundle theme, boolean isCustomTheme) {
- WallpaperStatsLog.write(CODE, StyleEnums.PICKER_APPLIED,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED,
Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR)),
Objects.hashCode(getThemePackage(theme,OVERLAY_CATEGORY_FONT)),
Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE)),
@@ -106,7 +107,7 @@
@Override
public void logClockSelected(Clockface clock) {
- WallpaperStatsLog.write(CODE, StyleEnums.PICKER_SELECT,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT,
0, 0, 0,
Objects.hashCode(clock.getId()),
0, 0, 0, 0, 0);
@@ -114,7 +115,7 @@
@Override
public void logClockApplied(Clockface clock) {
- WallpaperStatsLog.write(CODE, StyleEnums.PICKER_APPLIED,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED,
0, 0, 0,
Objects.hashCode(clock.getId()),
0, 0, 0, 0, 0);
@@ -122,7 +123,7 @@
@Override
public void logGridSelected(GridOption grid) {
- WallpaperStatsLog.write(CODE, StyleEnums.PICKER_SELECT,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT,
0, 0, 0, 0,
grid.cols,
0, 0, 0, 0);
@@ -130,7 +131,7 @@
@Override
public void logGridApplied(GridOption grid) {
- WallpaperStatsLog.write(CODE, StyleEnums.PICKER_APPLIED,
+ SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED,
0, 0, 0, 0,
grid.cols,
0, 0, 0, 0);
diff --git a/src/com/android/customization/module/WallpaperStatsLog.java b/src/com/android/customization/module/WallpaperStatsLog.java
deleted file mode 100644
index 9f5761f..0000000
--- a/src/com/android/customization/module/WallpaperStatsLog.java
+++ /dev/null
@@ -1,147 +0,0 @@
-// This file is autogenerated
-
-package com.android.customization.module;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import android.util.StatsLog;
-import android.os.SystemClock;
-
-import java.util.ArrayList;
-
-
-/**
- * Utility class for logging statistics events.
- */
-public class WallpaperStatsLog {
- private static final int LOGGER_ENTRY_MAX_PAYLOAD = 4068;
- private static final int MAX_EVENT_PAYLOAD = LOGGER_ENTRY_MAX_PAYLOAD - 4;
- private static final byte INT_TYPE = 0;
- private static final byte LONG_TYPE = 1;
- private static final byte STRING_TYPE = 2;
- private static final byte LIST_TYPE = 3;
- private static final byte FLOAT_TYPE = 4;
- private static final int INT_TYPE_SIZE = 5;
- private static final int FLOAT_TYPE_SIZE = 5;
- private static final int LONG_TYPE_SIZE = 9;
- private static final int STRING_TYPE_OVERHEAD = 5;
- private static final int LIST_TYPE_OVERHEAD = 2;
- // Constants for atom codes.
-
- /**
- * StyleUIChanged style_ui_changed<br>
- * Usage: StatsLog.write(StatsLog.STYLE_UI_CHANGED, int action, int color_package_hash, int font_package_hash, int shape_package_hash, int clock_package_hash, int launcher_grid, int wallpaper_category_hash, int wallpaper_id_hash, int color_preference, int location_preference);<br>
- */
- public static final int STYLE_UI_CHANGED = 179;
-
- // Constants for enum values.
-
- // Values for StyleUIChanged.action
- public static final int STYLE_UICHANGED__ACTION__DEFAULT_ACTION = 0;
- public static final int STYLE_UICHANGED__ACTION__ONRESUME = 1;
- public static final int STYLE_UICHANGED__ACTION__ONSTOP = 2;
- public static final int STYLE_UICHANGED__ACTION__PICKER_SELECT = 3;
- public static final int STYLE_UICHANGED__ACTION__PICKER_APPLIED = 4;
- public static final int STYLE_UICHANGED__ACTION__WALLPAPER_OPEN_CATEGORY = 5;
- public static final int STYLE_UICHANGED__ACTION__WALLPAPER_SELECT = 6;
- public static final int STYLE_UICHANGED__ACTION__WALLPAPER_APPLIED = 7;
- public static final int STYLE_UICHANGED__ACTION__WALLPAPER_EXPLORE = 8;
- public static final int STYLE_UICHANGED__ACTION__WALLPAPER_DOWNLOAD = 9;
- public static final int STYLE_UICHANGED__ACTION__WALLPAPER_REMOVE = 10;
- public static final int STYLE_UICHANGED__ACTION__LIVE_WALLPAPER_DOWNLOAD_SUCCESS = 11;
- public static final int STYLE_UICHANGED__ACTION__LIVE_WALLPAPER_DOWNLOAD_FAILED = 12;
- public static final int STYLE_UICHANGED__ACTION__LIVE_WALLPAPER_DOWNLOAD_CANCELLED = 13;
- public static final int STYLE_UICHANGED__ACTION__LIVE_WALLPAPER_DELETE_SUCCESS = 14;
- public static final int STYLE_UICHANGED__ACTION__LIVE_WALLPAPER_DELETE_FAILED = 15;
- public static final int STYLE_UICHANGED__ACTION__LIVE_WALLPAPER_APPLIED = 16;
-
- // Values for StyleUIChanged.location_preference
- public static final int STYLE_UICHANGED__LOCATION_PREFERENCE__LOCATION_PREFERENCE_UNSPECIFIED = 0;
- public static final int STYLE_UICHANGED__LOCATION_PREFERENCE__LOCATION_UNAVAILABLE = 1;
- public static final int STYLE_UICHANGED__LOCATION_PREFERENCE__LOCATION_CURRENT = 2;
- public static final int STYLE_UICHANGED__LOCATION_PREFERENCE__LOCATION_MANUAL = 3;
-
- // Write methods
- public static void write(int code, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10) {
- // Initial overhead of the list, timestamp, and atom tag.
- int needed = LIST_TYPE_OVERHEAD + LONG_TYPE_SIZE + INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- needed += INT_TYPE_SIZE;
- if (needed > MAX_EVENT_PAYLOAD) {
- return;
- }
- byte[] buff = new byte[needed];
- int pos = 0;
- buff[pos] = LIST_TYPE;
- buff[pos + 1] = 12;
- pos += LIST_TYPE_OVERHEAD;
- long elapsedRealtime = SystemClock.elapsedRealtimeNanos();
- buff[pos] = LONG_TYPE;
- copyLong(buff, pos + 1, elapsedRealtime);
- pos += LONG_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, code);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg1);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg2);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg3);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg4);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg5);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg6);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg7);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg8);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg9);
- pos += INT_TYPE_SIZE;
- buff[pos] = INT_TYPE;
- copyInt(buff, pos + 1, arg10);
- pos += INT_TYPE_SIZE;
- StatsLog.writeRaw(buff, pos);
- }
-
- // Helper methods for copying primitives
- private static void copyInt(byte[] buff, int pos, int val) {
- buff[pos] = (byte) (val);
- buff[pos + 1] = (byte) (val >> 8);
- buff[pos + 2] = (byte) (val >> 16);
- buff[pos + 3] = (byte) (val >> 24);
- return;
- }
-
- private static void copyLong(byte[] buff, int pos, long val) {
- buff[pos] = (byte) (val);
- buff[pos + 1] = (byte) (val >> 8);
- buff[pos + 2] = (byte) (val >> 16);
- buff[pos + 3] = (byte) (val >> 24);
- buff[pos + 4] = (byte) (val >> 32);
- buff[pos + 5] = (byte) (val >> 40);
- buff[pos + 6] = (byte) (val >> 48);
- buff[pos + 7] = (byte) (val >> 56);
- return;
- }
-
-}
diff --git a/src/com/android/customization/picker/clock/ClockFragment.java b/src/com/android/customization/picker/clock/ClockFragment.java
index 14dbc16..5191a9e 100644
--- a/src/com/android/customization/picker/clock/ClockFragment.java
+++ b/src/com/android/customization/picker/clock/ClockFragment.java
@@ -15,6 +15,8 @@
*/
package com.android.customization.picker.clock;
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
@@ -88,8 +90,20 @@
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
- View view = inflater.inflate(
- R.layout.fragment_clock_picker, container, /* attachToRoot */ false);
+ View view;
+ if (ADD_SCALABLE_HEADER) {
+ // TODO(b/147780560): Once the temporary flag (ADD_SCALABLE_HEADER) is removed,
+ // we should have a layout with the same name for portrait and landscape.
+ int orientation = getResources().getConfiguration().orientation;
+ view = inflater.inflate(
+ orientation == ORIENTATION_LANDSCAPE
+ ? R.layout.fragment_clock_picker
+ : R.layout.fragment_clock_scalable_picker,
+ container, /* attachToRoot */ false);
+ } else {
+ view = inflater.inflate(
+ R.layout.fragment_clock_picker, container, /* attachToRoot */ false);
+ }
setUpToolbar(view);
mContent = view.findViewById(R.id.content_section);
mPreviewPager = view.findViewById(R.id.clock_preview_pager);
diff --git a/src/com/android/customization/picker/grid/GridFragment.java b/src/com/android/customization/picker/grid/GridFragment.java
index 3c395a1..57720fe 100644
--- a/src/com/android/customization/picker/grid/GridFragment.java
+++ b/src/com/android/customization/picker/grid/GridFragment.java
@@ -15,6 +15,8 @@
*/
package com.android.customization.picker.grid;
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
@@ -106,8 +108,20 @@
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
- View view = inflater.inflate(
- R.layout.fragment_grid_picker, container, /* attachToRoot */ false);
+ View view;
+ if (ADD_SCALABLE_HEADER) {
+ // TODO(b/147780560): Once the temporary flag (ADD_SCALABLE_HEADER) is removed,
+ // we should have a layout with the same name for portrait and landscape.
+ int orientation = getResources().getConfiguration().orientation;
+ view = inflater.inflate(
+ orientation == ORIENTATION_LANDSCAPE
+ ? R.layout.fragment_grid_picker
+ : R.layout.fragment_grid_scalable_picker,
+ container, /* attachToRoot */ false);
+ } else {
+ view = inflater.inflate(
+ R.layout.fragment_grid_picker, container, /* attachToRoot */ false);
+ }
setUpToolbar(view);
mContent = view.findViewById(R.id.content_section);
mPreviewPager = view.findViewById(R.id.grid_preview_pager);
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index 641d3e1..b7a39b3 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -15,6 +15,8 @@
*/
package com.android.customization.picker.theme;
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+
import android.app.Activity;
import android.app.WallpaperColors;
import android.content.Context;
@@ -117,8 +119,20 @@
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
- View view = inflater.inflate(
- R.layout.fragment_theme_picker, container, /* attachToRoot */ false);
+ View view;
+ if (ADD_SCALABLE_HEADER) {
+ // TODO(b/147780560): Once the temporary flag (ADD_SCALABLE_HEADER) is removed,
+ // we should have a layout with the same name for portrait and landscape.
+ int orientation = getResources().getConfiguration().orientation;
+ view = inflater.inflate(
+ orientation == ORIENTATION_LANDSCAPE
+ ? R.layout.fragment_theme_picker
+ : R.layout.fragment_theme_scalable_picker,
+ container, /* attachToRoot */ false);
+ } else {
+ view = inflater.inflate(
+ R.layout.fragment_theme_picker, container, /* attachToRoot */ false);
+ }
setUpToolbar(view);
mContent = view.findViewById(R.id.content_section);