diff options
author | Adnan Begovic <adnan@cyngn.com> | 2016-03-15 16:40:06 -0700 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2016-03-24 16:50:56 -0700 |
commit | 21a567428db79f97d2178a8dec7cf1825b7ecff6 (patch) | |
tree | 31108b2cb12675ddf48e99583b14b4bf70bfc419 /src | |
parent | cdf85adde1be30ce675e8c5442ec4c21a6cd2991 (diff) | |
download | vendor_cmsdk-21a567428db79f97d2178a8dec7cf1825b7ecff6.tar.gz vendor_cmsdk-21a567428db79f97d2178a8dec7cf1825b7ecff6.tar.bz2 vendor_cmsdk-21a567428db79f97d2178a8dec7cf1825b7ecff6.zip |
cmsdk: Mandate profile feature xml's for service implementation.
The feature xml plays two roles:
1) To allow sdk interface (constructor) to throw when system
service is unavailable. This allows for clearer platform
development debugging.
2) To allow for simpler disambiguation of what services to
instrument in a modular environment.
TICKET: CYNGNOS-2288
Change-Id: Id0adcc1eaa4a0512faf25f11057c45dc2ac733e0
Diffstat (limited to 'src')
-rw-r--r-- | src/java/cyanogenmod/app/CMContextConstants.java | 8 | ||||
-rw-r--r-- | src/java/cyanogenmod/app/ProfileManager.java | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/java/cyanogenmod/app/CMContextConstants.java b/src/java/cyanogenmod/app/CMContextConstants.java index 761ce09..622732d 100644 --- a/src/java/cyanogenmod/app/CMContextConstants.java +++ b/src/java/cyanogenmod/app/CMContextConstants.java @@ -133,5 +133,13 @@ public final class CMContextConstants { */ @SdkConstant(SdkConstant.SdkConstantType.FEATURE) public static final String STATUSBAR = "org.cyanogenmod.statusbar"; + + /** + * Feature for {@link PackageManager#getSystemAvailableFeatures} and + * {@link PackageManager#hasSystemFeature}: The device includes the cm profiles service + * utilized by the cmsdk. + */ + @SdkConstant(SdkConstant.SdkConstantType.FEATURE) + public static final String PROFILES = "org.cyanogenmod.profiles"; } } diff --git a/src/java/cyanogenmod/app/ProfileManager.java b/src/java/cyanogenmod/app/ProfileManager.java index 499f583..c2470cb 100644 --- a/src/java/cyanogenmod/app/ProfileManager.java +++ b/src/java/cyanogenmod/app/ProfileManager.java @@ -221,6 +221,13 @@ public class ProfileManager { mContext = context; } sService = getService(); + + if (context.getPackageManager().hasSystemFeature( + cyanogenmod.app.CMContextConstants.Features.PROFILES) && sService == null) { + throw new RuntimeException("Unable to get ProfileManagerService. The service either" + + " crashed, was not started, or the interface has been called to early in" + + " SystemServer init"); + } } /** |