Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cac1246e authored by Willie Koomson's avatar Willie Koomson
Browse files

Catch all exceptions for preview serialization

Updates catch block to catch all exceptions, not only IOException.

Bug: 395951771
Test: atest "CtsAppWidgetTestCases:AppWidgetTest#testSetGeneratedPreview_invalidPreview"
Flag: EXEMPT bugfix
Change-Id: I8fd1c767a0465cb4c845cbef95ccfa1f57a52b03
parent aaa454ed
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -5232,7 +5232,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
                }
                }
            }
            }
            return singleCategoryKeyedEntries;
            return singleCategoryKeyedEntries;
        } catch (IOException e) {
        } catch (Exception e) {
            Slog.e(TAG, "Failed to load generated previews for " + provider, e);
            Slog.e(TAG, "Failed to load generated previews for " + provider, e);
            return new SparseArray<>();
            return new SparseArray<>();
        }
        }
@@ -5261,7 +5261,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            try {
            try {
                provider.info.generatedPreviewCategories = readGeneratedPreviewCategoriesFromProto(
                provider.info.generatedPreviewCategories = readGeneratedPreviewCategoriesFromProto(
                        input);
                        input);
            } catch (IOException e) {
            } catch (Exception e) {
                Slog.e(TAG, "Failed to read generated previews from file for " + provider, e);
                Slog.e(TAG, "Failed to read generated previews from file for " + provider, e);
                previewsFile.delete();
                previewsFile.delete();
                provider.info.generatedPreviewCategories = 0;
                provider.info.generatedPreviewCategories = 0;
@@ -5314,7 +5314,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
                    scheduleNotifyGroupHostsForProvidersChangedLocked(provider.getUserId());
                    scheduleNotifyGroupHostsForProvidersChangedLocked(provider.getUserId());
                }
                }
            }
            }
        } catch (IOException e) {
        } catch (Exception e) {
            if (file != null && stream != null) {
            if (file != null && stream != null) {
                file.failWrite(stream);
                file.failWrite(stream);
            }
            }