From 8eb451597d5f795c11e96663232ec58a2b1fc60f Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Thu, 3 Mar 2016 16:21:24 -0800 Subject: [PATCH] Redraw the UI when a print page preview is updated When switching between two printers with different margins but with the same paper size we were missing updates of the print preview. This change triggers these updates. The issue was the we reuse the a bitmap when a page is rewritten. This causes View.setBackground(drawable) to do nothing as the old background is the same as the new one. This function only checks the background drawable object reference, not the content. Hence we need to add a call that notifies the listeners to the changes on the content of the drawable. Bug: 26961677 Change-Id: Id8b9be59c9ca7220f40ac59168f78bfdcccb2761 --- .../com/android/printspooler/model/PageContentRepository.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java b/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java index ac97ad04e96bd..f8b134300908b 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java +++ b/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java @@ -862,6 +862,9 @@ public final class PageContentRepository { // Take a note that the content is rendered. renderedPage.state = RenderedPage.STATE_RENDERED; + // Invalidate all caches of the old state of the bitmap + mRenderedPage.content.invalidateSelf(); + // Announce success if needed. if (mCallback != null) { mCallback.onPageContentAvailable(renderedPage.content);