From 763e39ad54cc231f10c71722c2024654320e123d Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Wed, 13 Apr 2016 18:14:10 -0700 Subject: [PATCH] livedisplay: Fix error checks when fetching config Change-Id: I8ba43f32b2c45f626401f3cbc0050bc0593748c8 --- sdk/src/java/cyanogenmod/hardware/LiveDisplayManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdk/src/java/cyanogenmod/hardware/LiveDisplayManager.java b/sdk/src/java/cyanogenmod/hardware/LiveDisplayManager.java index 0e4f7a1..e75c9d8 100644 --- a/sdk/src/java/cyanogenmod/hardware/LiveDisplayManager.java +++ b/sdk/src/java/cyanogenmod/hardware/LiveDisplayManager.java @@ -127,8 +127,8 @@ public class LiveDisplayManager { } sService = getService(); - if (context.getPackageManager().hasSystemFeature( - CMContextConstants.Features.LIVEDISPLAY) && !checkService()) { + if (!context.getPackageManager().hasSystemFeature( + CMContextConstants.Features.LIVEDISPLAY) || !checkService()) { throw new RuntimeException("Unable to get LiveDisplayService. The service either" + " crashed, was not started, or the interface has been called to early in" + " SystemServer init"); @@ -136,6 +136,9 @@ public class LiveDisplayManager { try { mConfig = sService.getConfig(); + if (mConfig == null) { + throw new RuntimeException("Unable to get LiveDisplay configuration!"); + } } catch (RemoteException e) { throw new RuntimeException("Unable to fetch LiveDisplay configuration!", e); }