From a12ac6d6b376d5151d86a9d66c887a60fb604995 Mon Sep 17 00:00:00 2001 From: Wenyi Wang Date: Thu, 11 Feb 2016 18:21:06 -0800 Subject: Don't use file ID of the removed photo Doc https://goto.google.com/removedphoto Bug 25978539 Change-Id: I77abbc11766a570eb657a3b02ef910b3fa300f45 --- src/com/android/contacts/editor/EditorUiUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/contacts/editor/EditorUiUtils.java b/src/com/android/contacts/editor/EditorUiUtils.java index a513be582..b87d4f4ab 100644 --- a/src/com/android/contacts/editor/EditorUiUtils.java +++ b/src/com/android/contacts/editor/EditorUiUtils.java @@ -240,7 +240,9 @@ public class EditorUiUtils { /** Returns the {@link Photo#PHOTO_FILE_ID} from the given ValuesDelta. */ public static Long getPhotoFileId(ValuesDelta valuesDelta) { if (valuesDelta == null) return null; - if (valuesDelta.getAfter() == null || valuesDelta.getAfter().get(Photo.PHOTO) == null) { + // 1. There's no "after", we want to obtain the value of Photo.PHOTO_FILE_ID from "before". + // 2. There's a "after", we want to obtain the value of Photo.PHOTO_FILE_ID from "after". + if (valuesDelta.getAfter().size() == 0 || valuesDelta.getAfter().get(Photo.PHOTO) != null) { return valuesDelta.getAsLong(Photo.PHOTO_FILE_ID); } return null; -- cgit v1.2.3