summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/widget/CallLayout.java47
-rw-r--r--packages/SystemUI/src/com/android/systemui/flags/Flags.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/CallLayoutSetDataAsyncFactory.kt37
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewsFactoryContainer.kt4
4 files changed, 38 insertions, 54 deletions
diff --git a/core/java/com/android/internal/widget/CallLayout.java b/core/java/com/android/internal/widget/CallLayout.java
index 89f46599322e..c85257578492 100644
--- a/core/java/com/android/internal/widget/CallLayout.java
+++ b/core/java/com/android/internal/widget/CallLayout.java
@@ -31,6 +31,7 @@ import android.view.RemotableViewMethod;
import android.widget.FrameLayout;
import android.widget.RemoteViews;
import android.widget.TextView;
+import android.widget.flags.Flags;
import com.android.internal.R;
@@ -41,7 +42,17 @@ import com.android.internal.R;
public class CallLayout extends FrameLayout {
private final PeopleHelper mPeopleHelper = new PeopleHelper();
+ /**
+ * Layout Color is used for creating CallLayout person avatar.
+ * It will be set on the background thread during CallLayout's inflation
+ * when call_style_set_data_async is enabled.
+ */
private int mLayoutColor;
+ /**
+ * LargeIcon is used for creating CallLayout person avatar.
+ * It will be set on the background thread during CallLayout's inflation
+ * when call_style_set_data_async is enabled.
+ */
private Icon mLargeIcon;
private Person mUser;
@@ -49,7 +60,6 @@ public class CallLayout extends FrameLayout {
private CachingIconView mIcon;
private CachingIconView mConversationIconBadgeBg;
private TextView mConversationText;
- private boolean mSetDataAsyncEnabled = false;
public CallLayout(@NonNull Context context) {
super(context);
@@ -103,7 +113,19 @@ public class CallLayout extends FrameLayout {
return icon;
}
- @RemotableViewMethod
+ /**
+ * async version of {@link CallLayout#setLayoutColor}
+ */
+ public Runnable setLayoutColorAsync(int color) {
+ if (!Flags.callStyleSetDataAsync()) {
+ return () -> setLayoutColor(color);
+ }
+
+ mLayoutColor = color;
+ return () -> {};
+ }
+
+ @RemotableViewMethod(asyncImpl = "setLayoutColorAsync")
public void setLayoutColor(int color) {
mLayoutColor = color;
}
@@ -116,7 +138,19 @@ public class CallLayout extends FrameLayout {
mConversationIconBadgeBg.setImageTintList(ColorStateList.valueOf(color));
}
- @RemotableViewMethod
+ /**
+ * async version of {@link CallLayout#setLargeIcon}
+ */
+ public Runnable setLargeIconAsync(Icon largeIcon) {
+ if (!Flags.callStyleSetDataAsync()) {
+ return () -> setLargeIcon(largeIcon);
+ }
+
+ mLargeIcon = largeIcon;
+ return () -> {};
+ }
+
+ @RemotableViewMethod(asyncImpl = "setLargeIconAsync")
public void setLargeIcon(Icon largeIcon) {
mLargeIcon = largeIcon;
}
@@ -133,16 +167,11 @@ public class CallLayout extends FrameLayout {
mConversationIconView.setImageIcon(icon);
}
-
- public void setSetDataAsyncEnabled(boolean setDataAsyncEnabled) {
- mSetDataAsyncEnabled = setDataAsyncEnabled;
- }
-
/**
* Async implementation for setData
*/
public Runnable setDataAsync(Bundle extras) {
- if (!mSetDataAsyncEnabled) {
+ if (!Flags.callStyleSetDataAsync()) {
return () -> setData(extras);
}
diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
index aae73bc47616..33a69bf0d774 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
+++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
@@ -542,10 +542,6 @@ object Flags {
@JvmField
val ENABLE_NEW_PRIVACY_DIALOG = releasedFlag("enable_new_privacy_dialog")
- // TODO(b/302087895): Tracking Bug
- @JvmField val CALL_LAYOUT_ASYNC_SET_DATA =
- unreleasedFlag("call_layout_async_set_data", teamfood = true)
-
// TODO(b/302144438): Tracking Bug
@JvmField val DECOUPLE_REMOTE_INPUT_DELEGATE_AND_CALLBACK_UPDATE =
unreleasedFlag("decouple_remote_input_delegate_and_callback_update")
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/CallLayoutSetDataAsyncFactory.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/CallLayoutSetDataAsyncFactory.kt
deleted file mode 100644
index 4deebdb8de7d..000000000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/CallLayoutSetDataAsyncFactory.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2023 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.systemui.statusbar.notification.row
-
-import android.content.Context
-import android.util.AttributeSet
-import android.view.View
-import com.android.internal.widget.CallLayout
-import javax.inject.Inject
-
-class CallLayoutSetDataAsyncFactory @Inject constructor() : NotifRemoteViewsFactory {
- override fun instantiate(
- row: ExpandableNotificationRow,
- @NotificationRowContentBinder.InflationFlag layoutType: Int,
- parent: View?,
- name: String,
- context: Context,
- attrs: AttributeSet
- ): View? =
- if (name == CallLayout::class.java.name)
- CallLayout(context, attrs).apply { setSetDataAsyncEnabled(true) }
- else null
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewsFactoryContainer.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewsFactoryContainer.kt
index 195fe785b538..dab89c5235b0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewsFactoryContainer.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotifRemoteViewsFactoryContainer.kt
@@ -31,7 +31,6 @@ constructor(
featureFlags: FeatureFlags,
precomputedTextViewFactory: PrecomputedTextViewFactory,
bigPictureLayoutInflaterFactory: BigPictureLayoutInflaterFactory,
- callLayoutSetDataAsyncFactory: CallLayoutSetDataAsyncFactory,
optimizedLinearLayoutFactory: NotificationOptimizedLinearLayoutFactory
) : NotifRemoteViewsFactoryContainer {
override val factories: Set<NotifRemoteViewsFactory> = buildSet {
@@ -39,9 +38,6 @@ constructor(
if (featureFlags.isEnabled(Flags.BIGPICTURE_NOTIFICATION_LAZY_LOADING)) {
add(bigPictureLayoutInflaterFactory)
}
- if (featureFlags.isEnabled(Flags.CALL_LAYOUT_ASYNC_SET_DATA)) {
- add(callLayoutSetDataAsyncFactory)
- }
if (notifLinearlayoutOptimized()) {
add(optimizedLinearLayoutFactory)
}