use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowWifiManager method connect.
@HiddenApi
@Implementation(minSdk = KITKAT)
protected void connect(int networkId, WifiManager.ActionListener listener) {
WifiConfiguration wifiConfiguration = new WifiConfiguration();
wifiConfiguration.networkId = networkId;
wifiConfiguration.SSID = "";
wifiConfiguration.BSSID = "";
connect(wifiConfiguration, listener);
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowUsbManager method setPortRoles.
@Implementation(minSdk = M)
@HiddenApi
protected void setPortRoles(/* UsbPort */
Object port, /* int */
Object powerRole, /* int */
Object dataRole) {
UsbPortStatus status = usbPortStatuses.get(port);
usbPortStatuses.put((UsbPort) port, (UsbPortStatus) createUsbPortStatus(status.getCurrentMode(), (int) powerRole, (int) dataRole, status.getSupportedRoleCombinations()));
RuntimeEnvironment.getApplication().sendBroadcast(new Intent(UsbManager.ACTION_USB_PORT_CHANGED));
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowDisplayManagerGlobal method setBrightnessConfigurationForUser.
@Implementation(minSdk = P)
@HiddenApi
protected void setBrightnessConfigurationForUser(Object configObject, int userId, String packageName) {
BrightnessConfiguration config = (BrightnessConfiguration) configObject;
brightnessConfiguration.put(userId, config);
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowContextHubManager method queryNanoApps.
@Implementation(minSdk = VERSION_CODES.P)
@HiddenApi
protected Object queryNanoApps(ContextHubInfo hubInfo) {
@SuppressWarnings("unchecked") ContextHubTransaction<List<NanoAppState>> transaction = ReflectionHelpers.callConstructor(ContextHubTransaction.class, ClassParameter.from(int.class, ContextHubTransaction.TYPE_QUERY_NANOAPPS));
Collection<Integer> uids = contextHubToNanoappUid.get(hubInfo);
List<NanoAppState> nanoAppStates = new ArrayList<>();
for (Integer uid : uids) {
NanoAppInstanceInfo info = nanoAppUidToInfo.get(uid);
if (info != null) {
nanoAppStates.add(new NanoAppState(info.getAppId(), info.getAppVersion(), true));
}
}
@SuppressWarnings("unchecked") ContextHubTransaction.Response<List<NanoAppState>> response = ReflectionHelpers.newInstance(ContextHubTransaction.Response.class);
ReflectorContextHubTransactionResponse reflectedResponse = reflector(ReflectorContextHubTransactionResponse.class, response);
reflectedResponse.setResult(ContextHubTransaction.RESULT_SUCCESS);
reflectedResponse.setContents(nanoAppStates);
reflector(ReflectorContextHubTransaction.class, transaction).setResponse(response);
return transaction;
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowAssetManager method getArrayIntResource.
@HiddenApi
@Implementation
public int[] getArrayIntResource(int resId) {
TypedResource value = getAndResolve(resId, RuntimeEnvironment.getQualifiers(), true);
if (value == null)
return null;
TypedResource[] items = getConverter(value).getItems(value);
int[] ints = new int[items.length];
for (int i = 0; i < items.length; i++) {
TypedResource typedResource = resolve(items[i], RuntimeEnvironment.getQualifiers(), resId);
ints[i] = getConverter(typedResource).asInt(typedResource);
}
return ints;
}
Aggregations