use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowMotionEvent method nativeGetPointerProperties.
@Implementation(minSdk = LOLLIPOP)
@HiddenApi
protected static void nativeGetPointerProperties(long nativePtr, int pointerIndex, PointerProperties outPointerPropertiesObj) {
NativeInput.MotionEvent event = getNativeMotionEvent(nativePtr);
int pointerCount = event.getPointerCount();
validatePointerIndex(pointerIndex, pointerCount);
validatePointerProperties(outPointerPropertiesObj);
PointerProperties pointerProperties = event.getPointerProperties(pointerIndex);
// pointerPropertiesFromNative(env, pointerProperties, outPointerPropertiesObj);
outPointerPropertiesObj.copyFrom(pointerProperties);
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowTelecomManager method getCallCapablePhoneAccounts.
@Implementation(minSdk = M)
@HiddenApi
public List<PhoneAccountHandle> getCallCapablePhoneAccounts(boolean includeDisabledAccounts) {
List<PhoneAccountHandle> result = new ArrayList<>();
for (PhoneAccountHandle handle : accounts.keySet()) {
PhoneAccount phoneAccount = accounts.get(handle);
if (!phoneAccount.isEnabled() && !includeDisabledAccounts) {
continue;
}
result.add(handle);
}
return result;
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowTelecomManager method getPhoneAccountsForPackage.
@Implementation
@HiddenApi
public List<PhoneAccountHandle> getPhoneAccountsForPackage() {
Context context = ReflectionHelpers.getField(realObject, "mContext");
List<PhoneAccountHandle> results = new ArrayList<>();
for (PhoneAccountHandle handle : accounts.keySet()) {
if (handle.getComponentName().getPackageName().equals(context.getPackageName())) {
results.add(handle);
}
}
return results;
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowContextHubManager method createClient.
@Implementation(minSdk = VERSION_CODES.S)
@HiddenApi
protected Object createClient(Context context, ContextHubInfo hubInfo, PendingIntent pendingIntent, long nanoAppId) {
ContextHubClient client = Shadow.newInstance(ContextHubClient.class, new Class<?>[] { ContextHubInfo.class, Boolean.TYPE }, new Object[] { hubInfo, false });
contextHubClientWithPendingIntentList.add(client);
return client;
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowWifiManager method connect.
@HiddenApi
@Implementation(minSdk = KITKAT)
protected void connect(WifiConfiguration wifiConfiguration, WifiManager.ActionListener listener) {
WifiInfo wifiInfo = getConnectionInfo();
String ssid = isQuoted(wifiConfiguration.SSID) ? stripQuotes(wifiConfiguration.SSID) : wifiConfiguration.SSID;
ShadowWifiInfo shadowWifiInfo = Shadow.extract(wifiInfo);
shadowWifiInfo.setSSID(ssid);
shadowWifiInfo.setBSSID(wifiConfiguration.BSSID);
shadowWifiInfo.setNetworkId(wifiConfiguration.networkId);
setConnectionInfo(wifiInfo);
// Now that we're "connected" to wifi, update Dhcp and point it to localhost.
DhcpInfo dhcpInfo = new DhcpInfo();
dhcpInfo.gateway = LOCAL_HOST;
dhcpInfo.ipAddress = LOCAL_HOST;
setDhcpInfo(dhcpInfo);
// Now add the network to ConnectivityManager.
NetworkInfo networkInfo = ShadowNetworkInfo.newInstance(NetworkInfo.DetailedState.CONNECTED, ConnectivityManager.TYPE_WIFI, 0, /* subType */
true, /* isAvailable */
true);
ShadowConnectivityManager connectivityManager = Shadow.extract(RuntimeEnvironment.getApplication().getSystemService(Context.CONNECTIVITY_SERVICE));
connectivityManager.setActiveNetworkInfo(networkInfo);
if (listener != null) {
listener.onSuccess();
}
}
Aggregations