Merge "Release the content views when we mark a notification UNINFLATED." into tm-qpr-dev am: aef0c2179a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18356050 Change-Id: I3816b5a23a616b2ecfd87b5fa83500ec36805256 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -79,6 +79,11 @@ public class NotifInflaterImpl implements NotifInflater {
|
|||||||
entry.abortTask();
|
entry.abortTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void releaseViews(@NonNull NotificationEntry entry) {
|
||||||
|
requireBinder().releaseViews(entry);
|
||||||
|
}
|
||||||
|
|
||||||
private NotificationContentInflater.InflationCallback wrapInflationCallback(
|
private NotificationContentInflater.InflationCallback wrapInflationCallback(
|
||||||
InflationCallback callback) {
|
InflationCallback callback) {
|
||||||
return new NotificationContentInflater.InflationCallback() {
|
return new NotificationContentInflater.InflationCallback() {
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ public class PreparationCoordinator implements Coordinator {
|
|||||||
|
|
||||||
private void freeNotifViews(NotificationEntry entry) {
|
private void freeNotifViews(NotificationEntry entry) {
|
||||||
mViewBarn.removeViewForEntry(entry);
|
mViewBarn.removeViewForEntry(entry);
|
||||||
|
mNotifInflater.releaseViews(entry);
|
||||||
// TODO: clear the entry's row here, or even better, stop setting the row on the entry!
|
// TODO: clear the entry's row here, or even better, stop setting the row on the entry!
|
||||||
mInflationStates.put(entry, STATE_UNINFLATED);
|
mInflationStates.put(entry, STATE_UNINFLATED);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ interface NotifInflater {
|
|||||||
*/
|
*/
|
||||||
fun abortInflation(entry: NotificationEntry)
|
fun abortInflation(entry: NotificationEntry)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to let the system remove the content views from the notification row.
|
||||||
|
*/
|
||||||
|
fun releaseViews(entry: NotificationEntry)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback once all the views are inflated and bound for a given NotificationEntry.
|
* Callback once all the views are inflated and bound for a given NotificationEntry.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,4 +50,9 @@ public interface NotificationRowBinder {
|
|||||||
NotificationUiAdjustment oldAdjustment,
|
NotificationUiAdjustment oldAdjustment,
|
||||||
NotificationUiAdjustment newAdjustment,
|
NotificationUiAdjustment newAdjustment,
|
||||||
NotificationRowContentBinder.InflationCallback callback);
|
NotificationRowContentBinder.InflationCallback callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a notification is no longer likely to be displayed and can have its views freed.
|
||||||
|
*/
|
||||||
|
void releaseViews(NotificationEntry entry);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.notification.collection.inflation;
|
package com.android.systemui.statusbar.notification.collection.inflation;
|
||||||
|
|
||||||
|
import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_CONTRACTED;
|
||||||
|
import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_EXPANDED;
|
||||||
import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_PUBLIC;
|
import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_PUBLIC;
|
||||||
|
|
||||||
import static java.util.Objects.requireNonNull;
|
import static java.util.Objects.requireNonNull;
|
||||||
@@ -161,6 +163,18 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void releaseViews(NotificationEntry entry) {
|
||||||
|
if (!entry.rowExists()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final RowContentBindParams params = mRowContentBindStage.getStageParams(entry);
|
||||||
|
params.markContentViewsFreeable(FLAG_CONTENT_VIEW_CONTRACTED);
|
||||||
|
params.markContentViewsFreeable(FLAG_CONTENT_VIEW_EXPANDED);
|
||||||
|
params.markContentViewsFreeable(FLAG_CONTENT_VIEW_PUBLIC);
|
||||||
|
mRowContentBindStage.requestRebind(entry, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind row to various controllers and managers. This is only called when the row is first
|
* Bind row to various controllers and managers. This is only called when the row is first
|
||||||
* created.
|
* created.
|
||||||
@@ -249,6 +263,8 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RowContentBindParams params = mRowContentBindStage.getStageParams(entry);
|
RowContentBindParams params = mRowContentBindStage.getStageParams(entry);
|
||||||
|
params.requireContentViews(FLAG_CONTENT_VIEW_CONTRACTED);
|
||||||
|
params.requireContentViews(FLAG_CONTENT_VIEW_EXPANDED);
|
||||||
params.setUseIncreasedCollapsedHeight(useIncreasedCollapsedHeight);
|
params.setUseIncreasedCollapsedHeight(useIncreasedCollapsedHeight);
|
||||||
params.setUseLowPriority(isLowPriority);
|
params.setUseLowPriority(isLowPriority);
|
||||||
|
|
||||||
|
|||||||
@@ -449,6 +449,7 @@ public class PreparationCoordinatorTest extends SysuiTestCase {
|
|||||||
mInflateCallbacks.put(entry, callback);
|
mInflateCallbacks.put(entry, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rebindViews(@NonNull NotificationEntry entry, @NonNull Params params,
|
public void rebindViews(@NonNull NotificationEntry entry, @NonNull Params params,
|
||||||
@NonNull InflationCallback callback) {
|
@NonNull InflationCallback callback) {
|
||||||
@@ -465,6 +466,10 @@ public class PreparationCoordinatorTest extends SysuiTestCase {
|
|||||||
public void invokeInflateCallbackForEntry(NotificationEntry entry) {
|
public void invokeInflateCallbackForEntry(NotificationEntry entry) {
|
||||||
getInflateCallback(entry).onInflationFinished(entry, entry.getRowController());
|
getInflateCallback(entry).onInflationFinished(entry, entry.getRowController());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void releaseViews(@NonNull NotificationEntry entry) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireAddEvents(List<? extends ListEntry> entries) {
|
private void fireAddEvents(List<? extends ListEntry> entries) {
|
||||||
|
|||||||
Reference in New Issue
Block a user