Search in sources :

Example 56 with HiddenApi

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);
}
Also used : PointerProperties(android.view.MotionEvent.PointerProperties) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Example 57 with HiddenApi

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;
}
Also used : PhoneAccount(android.telecom.PhoneAccount) PhoneAccountHandle(android.telecom.PhoneAccountHandle) ArrayList(java.util.ArrayList) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Example 58 with HiddenApi

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;
}
Also used : Context(android.content.Context) PhoneAccountHandle(android.telecom.PhoneAccountHandle) ArrayList(java.util.ArrayList) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Example 59 with HiddenApi

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

Example 60 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(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();
    }
}
Also used : NetworkInfo(android.net.NetworkInfo) DhcpInfo(android.net.DhcpInfo) WifiInfo(android.net.wifi.WifiInfo) 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