mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Gracefully handle exception when processing widget loads event while device is locked.
Bug: 277189566 Test: test starting launcher and editing widgets Change-Id: Id15da3f3471374b02f1e2bf2e0a45dc801957241
This commit is contained in:
@@ -78,8 +78,16 @@ public class WidgetManagerHelper {
|
||||
return allWidgetsSteam(mContext).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
return mAppWidgetManager.getInstalledProvidersForPackage(
|
||||
packageUser.mPackageName, packageUser.mUser);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user