aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/src
diff options
context:
space:
mode:
authordianlujitao <dianlujitao@lineageos.org>2019-08-07 14:51:40 +0800
committerMichael Bestas <mkbestas@lineageos.org>2019-08-20 17:17:28 +0200
commit62885acacaf46c8455b5516e2b0e7d70d67b13da (patch)
tree276f215901ac4ee87f17af61374f14805aa71476 /sdk/src
parent36a87acd92285d42a3ab024e8f829062f93b495b (diff)
downloadlineage-sdk-62885acacaf46c8455b5516e2b0e7d70d67b13da.tar.gz
lineage-sdk-62885acacaf46c8455b5516e2b0e7d70d67b13da.tar.bz2
lineage-sdk-62885acacaf46c8455b5516e2b0e7d70d67b13da.zip
LiveDisplayManager: Perform null check in getConfig()
* LiveDisplayConfig isn't instanced until boot completed, thus if LiveDisplayManager is instanced earlier, null is always returned. Change-Id: I003886ffced86a5a82dec25a4cc7b542da0f2331
Diffstat (limited to 'sdk/src')
-rw-r--r--sdk/src/java/lineageos/hardware/LiveDisplayManager.java22
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;
+ }
}
/**