Example #1
0
 public NetworkInterface getFirstWifiOrEthernetInterface() {
   try {
     for (InterfaceInfo ii : getNetworkInformation()) {
       if (ii.isWifi() || ii.isEthernet()) {
         return ii.getNetworkInterface();
       }
     }
   } catch (NetInfoException e) {
     Log.w(TAG, "cannot find a wifi/ethernet interface");
   }
   return null;
 }
  @Override
  public InterfaceInfo[] getInterfaces() {
    List<InterfaceInfo> result = new ArrayList<>();
    for (String iface : classDef.getInterfaces()) {
      InterfaceInfo ii = new InterfaceInfo();
      ii.interfaceStr = DexlibAdapter.getClassStringFromDex(iface);
      result.add(ii);
    }

    InterfaceInfo[] array = new InterfaceInfo[result.size()];
    return result.toArray(array);
  }
Example #3
0
  /** Read and process any {@link Implements} annotations on the mixin */
  private void readImplementations(ClassNode classNode) {
    this.interfaces.addAll(classNode.interfaces);

    AnnotationNode implementsAnnotation =
        ASMHelper.getInvisibleAnnotation(classNode, Implements.class);
    if (implementsAnnotation == null) {
      return;
    }

    List<AnnotationNode> interfaces = ASMHelper.getAnnotationValue(implementsAnnotation);
    if (interfaces == null) {
      return;
    }

    for (AnnotationNode interfaceNode : interfaces) {
      InterfaceInfo interfaceInfo = InterfaceInfo.fromAnnotation(this, interfaceNode);
      this.softImplements.add(interfaceInfo);
      this.interfaces.add(interfaceInfo.getInternalName());
      this.classInfo.addInterface(interfaceInfo.getInternalName());
    }
  }