diff options
-rw-r--r-- | sdk/src/java/lineageos/hardware/LiveDisplayManager.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sdk/src/java/lineageos/hardware/LiveDisplayManager.java b/sdk/src/java/lineageos/hardware/LiveDisplayManager.java index 17e142ef..c6be27cc 100644 --- a/sdk/src/java/lineageos/hardware/LiveDisplayManager.java +++ b/sdk/src/java/lineageos/hardware/LiveDisplayManager.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2016 The CyanogenMod Project - * 2018 The LineageOS Project + * 2018-2019 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -139,7 +139,7 @@ public class LiveDisplayManager { private static final String TAG = "LiveDisplay"; private final Context mContext; - private final LiveDisplayConfig mConfig; + private LiveDisplayConfig mConfig; private static LiveDisplayManager sInstance; private static ILiveDisplayService sService; @@ -162,15 +162,6 @@ public class LiveDisplayManager { " crashed, was not started, or the interface has been called to early in" + " SystemServer init"); } - - try { - mConfig = sService.getConfig(); - if (mConfig == null) { - Log.w(TAG, "Unable to get LiveDisplay configuration!"); - } - } catch (RemoteException e) { - throw new RuntimeException("Unable to fetch LiveDisplay configuration!", e); - } } /** @@ -215,7 +206,14 @@ public class LiveDisplayManager { * @return the configuration */ public LiveDisplayConfig getConfig() { - return mConfig; + try { + if (mConfig == null) { + mConfig = checkService() ? sService.getConfig() : null; + } + return mConfig; + } catch (RemoteException e) { + return null; + } } /** |