9
you could always filter in your methods to restrict the packages that are allowed. Throw a SecurityException if the package does not have permission
Collection<String> callingpackages = getCallingPackages();
if(!callingpackages.contains("yourpackagename"){
//Throw securityException.
}
And getCallingPackages
private Collection<String> getCallingPackages() {
int caller = Binder.getCallingUid();
if (caller == 0) {
return null;
}
return Lists.newArrayList(mContext.getPackageManager().getPackagesForUid(caller));
}