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

Commit 5d420781 authored by Fengjiang Li's avatar Fengjiang Li Committed by Android (Google) Code Review
Browse files

Merge "Gracefully handle exception when processing widget loads event while...

Merge "Gracefully handle exception when processing widget loads event while device is locked." into udc-dev
parents fedbe746 e82b3fa8
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -78,8 +78,16 @@ public class WidgetManagerHelper {
            return allWidgetsSteam(mContext).collect(Collectors.toList());
        }

        try {
            return mAppWidgetManager.getInstalledProvidersForPackage(
                    packageUser.mPackageName, packageUser.mUser);
        } catch (IllegalStateException e) {
            // b/277189566: Launcher will load the widget when it gets the user-unlock event.
            // If exception is thrown because of device is locked, it means a race condition occurs
            // that the user got locked again while launcher is processing the event. In this case
            // we should return empty list.
            return Collections.emptyList();
        }
    }

    /**