From 2eff9c20bd5eda56fd193d5e40c03b4bdb31245b Mon Sep 17 00:00:00 2001 From: linyuh Date: Thu, 4 Jan 2018 14:11:33 -0800 Subject: Fix the crash when deleting call details if CallDetailsActivity is launched from the new call log. Bug: 70218437 Test: Manual PiperOrigin-RevId: 180843892 Change-Id: Id4c582457bae90327f41b1c6431eff1385bdfd35 --- .../android/dialer/calldetails/CallDetailsCursorLoader.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'java/com/android/dialer/calldetails') diff --git a/java/com/android/dialer/calldetails/CallDetailsCursorLoader.java b/java/com/android/dialer/calldetails/CallDetailsCursorLoader.java index 838525372..15c64c927 100644 --- a/java/com/android/dialer/calldetails/CallDetailsCursorLoader.java +++ b/java/com/android/dialer/calldetails/CallDetailsCursorLoader.java @@ -64,6 +64,19 @@ public final class CallDetailsCursorLoader extends CursorLoader { AnnotatedCallLog.TIMESTAMP + " DESC"); } + @Override + public void onContentChanged() { + // Do nothing here. + // This is to prevent the loader to reload data when Loader.ForceLoadContentObserver detects a + // change. + // Without this, the app will crash when the user deletes call details as the deletion triggers + // the data loading but no data can be fetched and we want to ensure the data set is not empty + // when building CallDetailsEntries proto (see toCallDetailsEntries(Cursor)). + // + // CallDetailsActivity doesn't respond to underlying data changes when launched from the old + // call log and we decided to keep it that way when launched from the new call log. + } + /** * Build a string of the form "COLUMN_NAME IN (?, ?, ..., ?)", where COLUMN_NAME is the name of * the ID column in {@link AnnotatedCallLog}. -- cgit v1.2.3