Looks like this option is not available neither by Apex, nor by Tooling API, SOAP API or Metadata API. So the only option to achieve this is screen-scraping.
public static List<String> getObjectsHavingGrantAccessUsingHierarchies() { String u = URL.getSalesforceBaseUrl().toExternalForm() + '/p/own/OrgSharingDetail?setupid=SecuritySharing'; PageReference p = new PageReference(u); String x = p.getContent().toString().substringBetween('class="pbBody">','</div'); List<string> xx = x.split('</tr>'); Map<String, Boolean> entityLabelToCheckbox = new Map<String, Boolean>(); for (String xxx: xx) { String a = xxx.substringBetween('class=" dataCell ">', '</th>'); String b = xxx.substringBetween(' booleanColumn">', '</td>'); if (!String.isBlank(b)) { Boolean c = b.contains('/img/checkbox_checked.gif'); entityLabelToCheckbox.put(a, c); } } List<String> with = new List<String>(); List<String> without = new List<String>(); for (String label: entityLabelToCheckbox.keySet() ) { if (entityLabelToCheckbox.get(label)) { with.add(label); } else { without.add(label); } } System.debug(with); System.debug(without); return with; }
However, this might not pass Security Review, since this is fragile as any screen-scraping methods.
Also I posted idea to get a better option https://success.salesforce.com/ideaView?id=0873A0000015AhkQAE