Further defer loading widgets until it is absolutely needed.
Current implementation parses the provider info from all manifests in every app the first time getInstalledProvidersForProfile is called, which causes unnecessary delay on the call-site if only a single package was requested. This CL ensures widgets loading are deferred further down the line, until it is absolutely needed to be parsed. Bug: 202356231 Test: manual Change-Id: I793bd818781ae956cd5bc590a315c669d01e7ca6
This commit is contained in:
parent
286fd132d6
commit
9c2cb7e257
@ -1617,14 +1617,17 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
||||
final int providerCount = mProviders.size();
|
||||
for (int i = 0; i < providerCount; i++) {
|
||||
Provider provider = mProviders.get(i);
|
||||
AppWidgetProviderInfo info = provider.getInfoLocked(mContext);
|
||||
final String providerPackageName = provider.id.componentName.getPackageName();
|
||||
|
||||
// Ignore an invalid provider, one not matching the filter,
|
||||
// or one that isn't in the given package, if any.
|
||||
boolean inPackage = packageName == null
|
||||
|| providerPackageName.equals(packageName);
|
||||
if (provider.zombie || (info.widgetCategory & categoryFilter) == 0 || !inPackage) {
|
||||
// Ignore an invalid provider or one that isn't in the given package, if any.
|
||||
boolean inPackage = packageName == null || providerPackageName.equals(packageName);
|
||||
if (provider.zombie || !inPackage) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore the ones not matching the filter.
|
||||
AppWidgetProviderInfo info = provider.getInfoLocked(mContext);
|
||||
if ((info.widgetCategory & categoryFilter) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user