Fixed SystemServiceRegistry to return a null AppPredictionManager when the service is not defined.
Test: manual verification Test: atest CtsAssistTestCases Fixes: 139416391 Change-Id: Ieb2ae3f39bd42dc077ed3db1c6acdf429a39d519
This commit is contained in:
@@ -1162,7 +1162,8 @@ final class SystemServiceRegistry {
|
|||||||
@Override
|
@Override
|
||||||
public AppPredictionManager createService(ContextImpl ctx)
|
public AppPredictionManager createService(ContextImpl ctx)
|
||||||
throws ServiceNotFoundException {
|
throws ServiceNotFoundException {
|
||||||
return new AppPredictionManager(ctx);
|
IBinder b = ServiceManager.getService(Context.APP_PREDICTION_SERVICE);
|
||||||
|
return b == null ? null : new AppPredictionManager(ctx);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4106,6 +4106,9 @@ public abstract class Context {
|
|||||||
/**
|
/**
|
||||||
* Official published name of the app prediction service.
|
* 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
|
* @hide
|
||||||
* @see #getSystemService(String)
|
* @see #getSystemService(String)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user