summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2017-06-08 14:38:31 +0000
committer android-build-merger <android-build-merger@google.com> 2017-06-08 14:38:31 +0000
commit30a40030bd7802c12d0eeba257e3b45004b62d04 (patch)
tree58eb02f46fc12387875853f36edf1fe23761fa6b
parentf7f60df6aa85c93fad92df8e2d4b265d77b3fff6 (diff)
parent8dbeb33bd8d7b988f61034097730a7dc00187109 (diff)
Merge "Fixed a bug where the navigation notification would flicker" into oc-dev am: b18f65a168 am: 1c28e96bf0
am: 8dbeb33bd8 Change-Id: I9db049f7c203434551d757886c35bdf5cfbac866
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java18
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInflater.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMessagingTemplateViewWrapper.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationCustomViewWrapperTest.java11
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationViewWrapperTest.java5
12 files changed, 58 insertions, 39 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 15f3908f735b..75704b1612d7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -49,11 +49,11 @@ import com.android.systemui.statusbar.policy.RemoteInputView;
*/
public class NotificationContentView extends FrameLayout {
- private static final int VISIBLE_TYPE_CONTRACTED = 0;
- private static final int VISIBLE_TYPE_EXPANDED = 1;
- private static final int VISIBLE_TYPE_HEADSUP = 2;
+ public static final int VISIBLE_TYPE_CONTRACTED = 0;
+ public static final int VISIBLE_TYPE_EXPANDED = 1;
+ public static final int VISIBLE_TYPE_HEADSUP = 2;
private static final int VISIBLE_TYPE_SINGLELINE = 3;
- private static final int VISIBLE_TYPE_AMBIENT = 4;
+ public static final int VISIBLE_TYPE_AMBIENT = 4;
private static final int VISIBLE_TYPE_AMBIENT_SINGLELINE = 5;
public static final int UNDEFINED = -1;
@@ -928,7 +928,7 @@ public class NotificationContentView extends FrameLayout {
}
}
- private NotificationViewWrapper getVisibleWrapper(int visibleType) {
+ public NotificationViewWrapper getVisibleWrapper(int visibleType) {
switch (visibleType) {
case VISIBLE_TYPE_EXPANDED:
return mExpandedWrapper;
@@ -1085,16 +1085,16 @@ public class NotificationContentView extends FrameLayout {
mBeforeN = entry.targetSdk < Build.VERSION_CODES.N;
updateAllSingleLineViews();
if (mContractedChild != null) {
- mContractedWrapper.notifyContentUpdated(entry.row);
+ mContractedWrapper.onContentUpdated(entry.row);
}
if (mExpandedChild != null) {
- mExpandedWrapper.notifyContentUpdated(entry.row);
+ mExpandedWrapper.onContentUpdated(entry.row);
}
if (mHeadsUpChild != null) {
- mHeadsUpWrapper.notifyContentUpdated(entry.row);
+ mHeadsUpWrapper.onContentUpdated(entry.row);
}
if (mAmbientChild != null) {
- mAmbientWrapper.notifyContentUpdated(entry.row);
+ mAmbientWrapper.onContentUpdated(entry.row);
}
applyRemoteInput(entry);
updateLegacy();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java
index 7a34b6e3d2e4..cf12e94dfc5c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java
@@ -36,8 +36,8 @@ public class NotificationBigPictureTemplateViewWrapper extends NotificationTempl
}
@Override
- public void notifyContentUpdated(ExpandableNotificationRow row) {
- super.notifyContentUpdated(row);
+ public void onContentUpdated(ExpandableNotificationRow row) {
+ super.onContentUpdated(row);
updateImageTag(row.getStatusBarNotification());
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java
index 9476eed8f3f2..20a3d8f06e50 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java
@@ -41,11 +41,11 @@ public class NotificationBigTextTemplateViewWrapper extends NotificationTemplate
}
@Override
- public void notifyContentUpdated(ExpandableNotificationRow row) {
+ public void onContentUpdated(ExpandableNotificationRow row) {
// Reinspect the notification. Before the super call, because the super call also updates
// the transformation types and we need to have our values set by then.
resolveViews(row.getStatusBarNotification());
- super.notifyContentUpdated(row);
+ super.onContentUpdated(row);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
index faab157a73c0..fcc982ea3fb0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
@@ -133,8 +133,8 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
}
@Override
- public void notifyContentUpdated(ExpandableNotificationRow row) {
- super.notifyContentUpdated(row);
+ public void onContentUpdated(ExpandableNotificationRow row) {
+ super.onContentUpdated(row);
mIsLowPriority = row.isLowPriority();
mTransformLowPriorityTitle = !row.isChildInGroup() && !row.isSummaryWithChildren();
ArraySet<View> previousViews = mTransformationHelper.getAllTransformingViews();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInflater.java
index 4b08f2b5901d..7eaa290c9d23 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInflater.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInflater.java
@@ -36,7 +36,6 @@ import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.util.Assert;
import java.util.HashMap;
-import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
@@ -207,7 +206,8 @@ public class NotificationInflater {
};
applyRemoteView(result, reInflateFlags, flag, row, redactAmbient,
isNewView, remoteViewClickHandler, callback, entry, privateLayout,
- privateLayout.getContractedChild(),
+ privateLayout.getContractedChild(), privateLayout.getVisibleWrapper(
+ NotificationContentView.VISIBLE_TYPE_CONTRACTED),
runningInflations, applyCallback);
}
@@ -229,7 +229,9 @@ public class NotificationInflater {
};
applyRemoteView(result, reInflateFlags, flag, row,
redactAmbient, isNewView, remoteViewClickHandler, callback, entry,
- privateLayout, privateLayout.getExpandedChild(), runningInflations,
+ privateLayout, privateLayout.getExpandedChild(),
+ privateLayout.getVisibleWrapper(
+ NotificationContentView.VISIBLE_TYPE_EXPANDED), runningInflations,
applyCallback);
}
}
@@ -252,7 +254,9 @@ public class NotificationInflater {
};
applyRemoteView(result, reInflateFlags, flag, row,
redactAmbient, isNewView, remoteViewClickHandler, callback, entry,
- privateLayout, privateLayout.getHeadsUpChild(), runningInflations,
+ privateLayout, privateLayout.getHeadsUpChild(),
+ privateLayout.getVisibleWrapper(
+ NotificationContentView.VISIBLE_TYPE_HEADSUP), runningInflations,
applyCallback);
}
}
@@ -274,8 +278,9 @@ public class NotificationInflater {
};
applyRemoteView(result, reInflateFlags, flag, row,
redactAmbient, isNewView, remoteViewClickHandler, callback, entry,
- publicLayout, publicLayout.getContractedChild(), runningInflations,
- applyCallback);
+ publicLayout, publicLayout.getContractedChild(),
+ publicLayout.getVisibleWrapper(NotificationContentView.VISIBLE_TYPE_CONTRACTED),
+ runningInflations, applyCallback);
}
flag = FLAG_REINFLATE_AMBIENT_VIEW;
@@ -296,7 +301,8 @@ public class NotificationInflater {
};
applyRemoteView(result, reInflateFlags, flag, row,
redactAmbient, isNewView, remoteViewClickHandler, callback, entry,
- newParent, newParent.getAmbientChild(), runningInflations,
+ newParent, newParent.getAmbientChild(), newParent.getVisibleWrapper(
+ NotificationContentView.VISIBLE_TYPE_AMBIENT), runningInflations,
applyCallback);
}
@@ -316,6 +322,7 @@ public class NotificationInflater {
RemoteViews.OnClickHandler remoteViewClickHandler,
@Nullable final InflationCallback callback, NotificationData.Entry entry,
NotificationContentView parentLayout, View existingView,
+ NotificationViewWrapper existingWrapper,
final HashMap<Integer, CancellationSignal> runningInflations,
ApplyCallback applyCallback) {
RemoteViews.OnViewAppliedListener listener
@@ -326,6 +333,8 @@ public class NotificationInflater {
if (isNewView) {
v.setIsRootNamespace(true);
applyCallback.setResultView(v);
+ } else if (existingWrapper != null) {
+ existingWrapper.onReinflated();
}
runningInflations.remove(inflationId);
finishIfDone(result, reInflateFlags, runningInflations, callback, row,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java
index 7fbee7d66615..eb211a10737b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java
@@ -39,11 +39,11 @@ public class NotificationMediaTemplateViewWrapper extends NotificationTemplateVi
}
@Override
- public void notifyContentUpdated(ExpandableNotificationRow row) {
+ public void onContentUpdated(ExpandableNotificationRow row) {
// Reinspect the notification. Before the super call, because the super call also updates
// the transformation types and we need to have our values set by then.
resolveViews();
- super.notifyContentUpdated(row);
+ super.onContentUpdated(row);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMessagingTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMessagingTemplateViewWrapper.java
index 9631556e4267..f6ee1cac9c3d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMessagingTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMessagingTemplateViewWrapper.java
@@ -70,11 +70,11 @@ public class NotificationMessagingTemplateViewWrapper extends NotificationTempla
}
@Override
- public void notifyContentUpdated(ExpandableNotificationRow row) {
+ public void onContentUpdated(ExpandableNotificationRow row) {
// Reinspect the notification. Before the super call, because the super call also updates
// the transformation types and we need to have our values set by then.
resolveViews();
- super.notifyContentUpdated(row);
+ super.onContentUpdated(row);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
index f5f92c81df54..bb979ebd1288 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
@@ -159,11 +159,11 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
}
@Override
- public void notifyContentUpdated(ExpandableNotificationRow row) {
+ public void onContentUpdated(ExpandableNotificationRow row) {
// Reinspect the notification. Before the super call, because the super call also updates
// the transformation types and we need to have our values set by then.
resolveTemplateViews(row.getStatusBarNotification());
- super.notifyContentUpdated(row);
+ super.onContentUpdated(row);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java
index 07f50449fd68..5200d6962ed5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java
@@ -66,6 +66,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
mView = view;
mRow = row;
mDozer = createDozer(ctx);
+ onReinflated();
}
protected NotificationDozeHelper createDozer(Context ctx) {
@@ -92,12 +93,15 @@ public abstract class NotificationViewWrapper implements TransformableView {
* Notifies this wrapper that the content of the view might have changed.
* @param row the row this wrapper is attached to
*/
- public void notifyContentUpdated(ExpandableNotificationRow row) {
+ public void onContentUpdated(ExpandableNotificationRow row) {
mDarkInitialized = false;
- Drawable background = mView.getBackground();
+ }
+
+ public void onReinflated() {
if (shouldClearBackgroundOnReapply()) {
mBackgroundColor = 0;
}
+ Drawable background = mView.getBackground();
if (background instanceof ColorDrawable) {
mBackgroundColor = ((ColorDrawable) background).getColor();
mView.setBackground(null);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
index 2d7d17b8958a..fe53104ff9c2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
@@ -313,7 +313,7 @@ public class NotificationChildrenContainer extends ViewGroup {
} else {
header.reapply(getContext(), mNotificationHeader);
}
- mNotificationHeaderWrapper.notifyContentUpdated(mContainingNotification);
+ mNotificationHeaderWrapper.onContentUpdated(mContainingNotification);
recreateLowPriorityHeader(builder);
recreateAmbientHeader(builder);
updateHeaderVisibility(false /* animate */);
@@ -332,14 +332,14 @@ public class NotificationChildrenContainer extends ViewGroup {
mNotificationHeaderAmbient = (ViewGroup) header.apply(getContext(), this);
mNotificationHeaderWrapperAmbient = NotificationViewWrapper.wrap(getContext(),
mNotificationHeaderAmbient, mContainingNotification);
- mNotificationHeaderWrapperAmbient.notifyContentUpdated(mContainingNotification);
+ mNotificationHeaderWrapperAmbient.onContentUpdated(mContainingNotification);
addView(mNotificationHeaderAmbient, 0);
invalidate();
} else {
header.reapply(getContext(), mNotificationHeaderAmbient);
}
resetHeaderVisibilityIfNeeded(mNotificationHeaderAmbient, calculateDesiredHeader());
- mNotificationHeaderWrapperAmbient.notifyContentUpdated(mContainingNotification);
+ mNotificationHeaderWrapperAmbient.onContentUpdated(mContainingNotification);
}
/**
@@ -370,7 +370,7 @@ public class NotificationChildrenContainer extends ViewGroup {
} else {
header.reapply(getContext(), mNotificationHeaderLowPriority);
}
- mNotificationHeaderWrapperLowPriority.notifyContentUpdated(mContainingNotification);
+ mNotificationHeaderWrapperLowPriority.onContentUpdated(mContainingNotification);
resetHeaderVisibilityIfNeeded(mNotificationHeaderLowPriority, calculateDesiredHeader());
} else {
removeView(mNotificationHeaderLowPriority);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationCustomViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationCustomViewWrapperTest.java
index 6cc836c4aa23..d18e63bcc151 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationCustomViewWrapperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationCustomViewWrapperTest.java
@@ -54,11 +54,14 @@ public class NotificationCustomViewWrapperTest extends SysuiTestCase {
RemoteViews views = new RemoteViews(mContext.getPackageName(), R.layout.custom_view_dark);
View v = views.apply(mContext, null);
NotificationViewWrapper wrap = NotificationCustomViewWrapper.wrap(mContext, v, mRow);
- wrap.notifyContentUpdated(mRow);
- Assert.assertTrue(wrap.getCustomBackgroundColor() != 0);
+ wrap.onContentUpdated(mRow);
+ Assert.assertTrue("No background set, when applying custom background view",
+ wrap.getCustomBackgroundColor() != 0);
views.reapply(mContext, v);
- wrap.notifyContentUpdated(mRow);
- Assert.assertTrue(wrap.getCustomBackgroundColor() != 0);
+ wrap.onReinflated();
+ wrap.onContentUpdated(mRow);
+ Assert.assertTrue("Reapplying a custom remote view lost it's background!",
+ wrap.getCustomBackgroundColor() != 0);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationViewWrapperTest.java
index ebeb24c881a2..9da28a097b2a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationViewWrapperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationViewWrapperTest.java
@@ -24,6 +24,7 @@ import android.view.View;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.ExpandableNotificationRow;
+import com.android.systemui.statusbar.NotificationTestHelper;
import org.junit.Before;
import org.junit.Test;
@@ -35,7 +36,9 @@ public class NotificationViewWrapperTest extends SysuiTestCase {
@Test
public void constructor_doesntUseViewContext() throws Exception {
- new TestableNotificationViewWrapper(mContext, null /* view */, null /* row */);
+ new TestableNotificationViewWrapper(mContext,
+ new View(mContext),
+ new NotificationTestHelper(getContext()).createRow());
}
static class TestableNotificationViewWrapper extends NotificationViewWrapper {