aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2016-03-25 12:43:22 -0700
committerAdnan Begovic <adnan@cyngn.com>2016-03-25 14:16:35 -0700
commitb271dcf279d0818c01c080827141a1ac311250c2 (patch)
treea88aa74f2277294e6b3104ab99d395931d04f119 /src/java
parent279ce42664be4a958e01dd41fecefbe36eaa5074 (diff)
downloadvendor_cmsdk-b271dcf279d0818c01c080827141a1ac311250c2.zip
vendor_cmsdk-b271dcf279d0818c01c080827141a1ac311250c2.tar.gz
vendor_cmsdk-b271dcf279d0818c01c080827141a1ac311250c2.tar.bz2
cmsdk: Mandate partner 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. Change-Id: Ic980225df9c115e97f7147cf043cf92bbb225f01 TICKET: CYNGNOS-2293
Diffstat (limited to 'src/java')
-rw-r--r--src/java/cyanogenmod/app/CMContextConstants.java8
-rw-r--r--src/java/cyanogenmod/app/PartnerInterface.java6
2 files changed, 14 insertions, 0 deletions
diff --git a/src/java/cyanogenmod/app/CMContextConstants.java b/src/java/cyanogenmod/app/CMContextConstants.java
index e34f211..e90d8ed 100644
--- a/src/java/cyanogenmod/app/CMContextConstants.java
+++ b/src/java/cyanogenmod/app/CMContextConstants.java
@@ -173,5 +173,13 @@ public final class CMContextConstants {
*/
@SdkConstant(SdkConstant.SdkConstantType.FEATURE)
public static final String PERFORMANCE = "org.cyanogenmod.performance";
+
+ /**
+ * Feature for {@link PackageManager#getSystemAvailableFeatures} and
+ * {@link PackageManager#hasSystemFeature}: The device includes the cm partner service
+ * utilized by the cmsdk.
+ */
+ @SdkConstant(SdkConstant.SdkConstantType.FEATURE)
+ public static final String PARTNER = "org.cyanogenmod.partner";
}
}
diff --git a/src/java/cyanogenmod/app/PartnerInterface.java b/src/java/cyanogenmod/app/PartnerInterface.java
index b06effd..a7661ff 100644
--- a/src/java/cyanogenmod/app/PartnerInterface.java
+++ b/src/java/cyanogenmod/app/PartnerInterface.java
@@ -83,6 +83,12 @@ public class PartnerInterface {
mContext = context;
}
sService = getService();
+ if (context.getPackageManager().hasSystemFeature(
+ CMContextConstants.Features.PARTNER) && sService == null) {
+ throw new RuntimeException("Unable to get PartnerInterfaceService. The service" +
+ " either crashed, was not started, or the interface has been called to early" +
+ " in SystemServer init");
+ }
}
/**