From 37508bc4820a9d8d668fc2636d36145635c310e6 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Tue, 7 Jul 2020 17:05:28 -0700 Subject: AOSP/Calendar - Added a null pointer check for widgetManager based on https://b.corp.google.com/issues/158480522#comment3 (line#540). I wasn't able to duplicate the problem as there are no reproducible instructions. BUG: 158480522 Test: manual - Ran the following tests on Pixel phone. Tested the calendar UI. $ make -j 40 $ make CalendarTests -j $ ls -l out/target/product/bonito/product/app/Calendar/Calendar.apk out/target/product/bonito/testcases/CalendarTests/arm64/CalendarTests.apk -rw-r----- 1 rtenneti primarygroup 2478692 Jul 7 16:03 out/target/product/bonito/product/app/Calendar/Calendar.apk -rw-r----- 1 rtenneti primarygroup 78231 Jul 7 16:28 out/target/product/bonito/testcases/CalendarTests/arm64/CalendarTests.apk $ adb install -r -d -t out/target/product/bonito/product/app/Calendar/Calendar.apk $ adb install -r -d -t out/target/product/bonito/testcases/CalendarTests/arm64/CalendarTests.apk $ adb shell am instrument -w com.android.calendar.tests com.android.calendar.FormatDateRangeTest:. com.android.calendar.UtilsTests:.................. com.android.calendar.WeekNumberTest:. com.android.calendar.widget.CalendarAppWidgetServiceTest:.. Test results for InstrumentationTestRunner=...................... Time: 0.123 OK (22 tests) Change-Id: I65931f9b4c8dc6c4644e491125965c2aeaeca702 --- src/com/android/calendar/widget/CalendarAppWidgetService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/calendar/widget/CalendarAppWidgetService.java b/src/com/android/calendar/widget/CalendarAppWidgetService.java index 6329463b..ec702c7c 100644 --- a/src/com/android/calendar/widget/CalendarAppWidgetService.java +++ b/src/com/android/calendar/widget/CalendarAppWidgetService.java @@ -542,6 +542,9 @@ public class CalendarAppWidgetService extends RemoteViewsService { } AppWidgetManager widgetManager = AppWidgetManager.getInstance(mContext); + if (widgetManager == null) { + return; + } if (mAppWidgetId == -1) { int[] ids = widgetManager.getAppWidgetIds(CalendarAppWidgetProvider .getComponentName(mContext)); -- cgit v1.2.3