Logspam: Properly handle optional app widgets service
If a service is not present and an exeception is thrown in the SystemServiceRegistry, we log a message and proceed with the null service. Optional feature services, like app widgets, are expected to be missing if not supported. Properly handle the lookup, so no exception that pollutes the logs is emitted for what is normal operation. Test: No exception logged with the app widgets feature disabled Upstream from Meta Change-Id: I1cae4f9188ec47b55d68d7c8208f0da1c6c263b4
This commit is contained in:
@@ -1020,9 +1020,10 @@ public final class SystemServiceRegistry {
|
||||
registerService(Context.APPWIDGET_SERVICE, AppWidgetManager.class,
|
||||
new CachedServiceFetcher<AppWidgetManager>() {
|
||||
@Override
|
||||
public AppWidgetManager createService(ContextImpl ctx) throws ServiceNotFoundException {
|
||||
IBinder b = ServiceManager.getServiceOrThrow(Context.APPWIDGET_SERVICE);
|
||||
return new AppWidgetManager(ctx, IAppWidgetService.Stub.asInterface(b));
|
||||
public AppWidgetManager createService(ContextImpl ctx) {
|
||||
IBinder b = ServiceManager.getService(Context.APPWIDGET_SERVICE);
|
||||
return b == null ? null : new AppWidgetManager(ctx,
|
||||
IAppWidgetService.Stub.asInterface(b));
|
||||
}});
|
||||
|
||||
registerService(Context.MIDI_SERVICE, MidiManager.class,
|
||||
|
||||
Reference in New Issue
Block a user