diff options
| author | Felipe Leme <felipeal@google.com> | 2019-08-15 02:09:58 -0700 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2019-08-15 02:09:58 -0700 |
| commit | fcee9fb574ecd4d98aa95a5971f117d4575ba167 (patch) | |
| tree | c5a7c59b40a7632c677408008f248eb0619bebf4 /core/java | |
| parent | 7c39b1a8230a82c5369bd93ff7b08dfe782ded68 (diff) | |
| parent | 87c5855e17c51c4dafafb020f3d310c19dd54481 (diff) | |
Fixed SystemServiceRegistry to return a null AppPredictionManager when the service is not defined.
am: 87c5855e17
Change-Id: I207ddf77599d9a12609c7b297a58c8ce1b6eab17
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/SystemServiceRegistry.java | 3 | ||||
| -rw-r--r-- | core/java/android/content/Context.java | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index cfe2cf09ae19..d29cf80bd74e 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -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); } }); diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 73bc908632b2..0bac6835496b 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -4109,6 +4109,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) */ |
