Fixed SystemServiceRegistry to return a null AppPredictionManager when the service is not defined.

am: 87c5855e17

Change-Id: Ibf1e8dce145906729c13c5df7942c5055b86e3e6
This commit is contained in:
Felipe Leme
2019-08-19 16:32:43 -07:00
committed by android-build-merger
2 changed files with 5 additions and 1 deletions

View File

@@ -1162,7 +1162,8 @@ final class SystemServiceRegistry {
@Override
public AppPredictionManager createService(ContextImpl ctx)
throws ServiceNotFoundException {
return new AppPredictionManager(ctx);
IBinder b = ServiceManager.getService(Context.APP_PREDICTION_SERVICE);
return b == null ? null : new AppPredictionManager(ctx);
}
});

View File

@@ -4106,6 +4106,9 @@ public abstract class Context {
/**
* Official published name of the app prediction service.
*
* <p><b>NOTE: </b> this service is optional; callers of
* {@code Context.getSystemServiceName(APP_PREDICTION_SERVICE)} should check for {@code null}.
*
* @hide
* @see #getSystemService(String)
*/