Search in sources :

Example 26 with HiddenApi

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);
}
Also used : WifiConfiguration(android.net.wifi.WifiConfiguration) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Example 27 with HiddenApi

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));
}
Also used : UsbPortStatus(android.hardware.usb.UsbPortStatus) Intent(android.content.Intent) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Example 28 with HiddenApi

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);
}
Also used : BrightnessConfiguration(android.hardware.display.BrightnessConfiguration) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Example 29 with HiddenApi

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;
}
Also used : ArrayList(java.util.ArrayList) NanoAppState(android.hardware.location.NanoAppState) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) ContextHubTransaction(android.hardware.location.ContextHubTransaction) NanoAppInstanceInfo(android.hardware.location.NanoAppInstanceInfo) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Example 30 with HiddenApi

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;
}
Also used : FileTypedResource(org.robolectric.res.FileTypedResource) TypedResource(org.robolectric.res.TypedResource) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Aggregations

HiddenApi (org.robolectric.annotation.HiddenApi)61 Implementation (org.robolectric.annotation.Implementation)61 CppAssetManager (org.robolectric.res.android.CppAssetManager)18 Ref (org.robolectric.res.android.Ref)9 ResTable (org.robolectric.res.android.ResTable)9 FileTypedResource (org.robolectric.res.FileTypedResource)8 Asset (org.robolectric.res.android.Asset)8 TypedResource (org.robolectric.res.TypedResource)6 Res_value (org.robolectric.res.android.ResourceTypes.Res_value)6 FileNotFoundException (java.io.FileNotFoundException)5 ArrayList (java.util.ArrayList)5 ResTableTheme (org.robolectric.res.android.ResTableTheme)5 SuppressLint (android.annotation.SuppressLint)4 ResName (org.robolectric.res.ResName)4 ResTable.bag_entry (org.robolectric.res.android.ResTable.bag_entry)4 ResTable_config (org.robolectric.res.android.ResTable_config)4 IOException (java.io.IOException)3 AttributedOpEntry (android.app.AppOpsManager.AttributedOpEntry)2 OpEntry (android.app.AppOpsManager.OpEntry)2 PackageOps (android.app.AppOpsManager.PackageOps)2