类android.content.pm.InstrumentationInfo源码实例Demo

下面列出了怎么用android.content.pm.InstrumentationInfo的API类实例代码及写法,或者点击链接到github查看源代码。

@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(className.toString());
}
 
@Override
public InstrumentationInfo getInstrumentationInfo(
    ComponentName className, int flags)
        throws NameNotFoundException {
    try {
        InstrumentationInfo ii = mPM.getInstrumentationInfo(
            className, flags);
        if (ii != null) {
            return ii;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    throw new NameNotFoundException(className.toString());
}
 
源代码12 项目: android-test   文件: RunnerArgs.java
/** Populate the arg data from the instrumentation:metadata attribute in Manifest. */
public Builder fromManifest(Instrumentation instr) {
  PackageManager pm = instr.getContext().getPackageManager();
  try {
    InstrumentationInfo instrInfo =
        pm.getInstrumentationInfo(instr.getComponentName(), PackageManager.GET_META_DATA);
    Bundle b = instrInfo.metaData;
    if (b == null) {
      // metadata not present - skip
      return this;
    }
    // parse the metadata using same key names
    return fromBundle(instr, b);
  } catch (PackageManager.NameNotFoundException e) {
    // should never happen
    Log.wtf(LOG_TAG, String.format("Could not find component %s", instr.getComponentName()));
  }
  return this;
}
 
@Override
@SuppressWarnings("unchecked")
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        ParceledListSlice<InstrumentationInfo> parceledList =
                mPM.queryInstrumentation(targetPackage, flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
@Override
@SuppressWarnings("unchecked")
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        ParceledListSlice<InstrumentationInfo> parceledList =
                mPM.queryInstrumentation(targetPackage, flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
@Override
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        return mPM.queryInstrumentation(targetPackage, flags);
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }
}
 
@Override
@SuppressWarnings("unchecked")
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        ParceledListSlice<InstrumentationInfo> parceledList =
                mPM.queryInstrumentation(targetPackage, flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
@Override
@SuppressWarnings("unchecked")
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        ParceledListSlice<InstrumentationInfo> parceledList =
                mPM.queryInstrumentation(targetPackage, flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
@Override
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        return mPM.queryInstrumentation(targetPackage, flags);
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }
}
 
@Override
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        return mPM.queryInstrumentation(targetPackage, flags);
    } catch (RemoteException e) {
        throw new RuntimeException("Package manager has died", e);
    }
}
 
@Override
@SuppressWarnings("unchecked")
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        ParceledListSlice<InstrumentationInfo> parceledList =
                mPM.queryInstrumentation(targetPackage, flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
@Override
@SuppressWarnings("unchecked")
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        ParceledListSlice<InstrumentationInfo> parceledList =
                mPM.queryInstrumentation(targetPackage, flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
@Override
@SuppressWarnings("unchecked")
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        ParceledListSlice<InstrumentationInfo> parceledList =
                mPM.queryInstrumentation(targetPackage, flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
@Override
@SuppressWarnings("unchecked")
public List<InstrumentationInfo> queryInstrumentation(
    String targetPackage, int flags) {
    try {
        ParceledListSlice<InstrumentationInfo> parceledList =
                mPM.queryInstrumentation(targetPackage, flags);
        if (parceledList == null) {
            return Collections.emptyList();
        }
        return parceledList.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
源代码24 项目: VirtualAPK   文件: LoadedPlugin.java
@Override
public InstrumentationInfo getInstrumentationInfo(ComponentName component, int flags) throws NameNotFoundException {
    LoadedPlugin plugin = mPluginManager.getLoadedPlugin(component);
    if (null != plugin) {
        return plugin.mInstrumentationInfos.get(component);
    }

    return this.mHostPackageManager.getInstrumentationInfo(component, flags);
}
 
源代码25 项目: Android-plugin-support   文件: DynamicApkParser.java
public static final InstrumentationInfo generateInstrumentationInfo(
        Instrumentation i, int flags) {
    if (i == null) return null;
    if ((flags&PackageManager.GET_META_DATA) == 0) {
        return i.info;
    }
    InstrumentationInfo ii = new InstrumentationInfo(i.info);
    ii.metaData = i.metaData;
    return ii;
}
 
源代码26 项目: DroidPlugin   文件: PackageParserApi15.java
@Override
public InstrumentationInfo generateInstrumentationInfo(
        Object instrumentation, int flags) throws Exception {
    /*     public static final InstrumentationInfo generateInstrumentationInfo(
        Instrumentation i, int flags) */
    return super.generateInstrumentationInfo(instrumentation, flags);
}
 
源代码27 项目: DroidPlugin   文件: PackageParserApi16.java
@Override
public InstrumentationInfo generateInstrumentationInfo(
        Object instrumentation, int flags) throws Exception {
    /*    public static final InstrumentationInfo generateInstrumentationInfo(
        Instrumentation i, int flags)*/
    return super.generateInstrumentationInfo(instrumentation, flags);
}
 
源代码28 项目: DroidPlugin   文件: PluginPackageParser.java
public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags) throws Exception {
    Object data;
    synchronized (mInstrumentationObjCache) {
        data = mInstrumentationObjCache.get(className);
    }
    if (data != null) {
        return mParser.generateInstrumentationInfo(data, flags);
    }
    return null;
}
 
源代码29 项目: DroidPlugin   文件: PackageParserApi21.java
@Override
public InstrumentationInfo generateInstrumentationInfo(
        Object instrumentation, int flags) throws Exception {
    /*  public static final InstrumentationInfo generateInstrumentationInfo(
        Instrumentation i, int flags)*/
    Method method = MethodUtils.getAccessibleMethod(sPackageParserClass, "generateInstrumentationInfo", sInstrumentationClass, int.class);
    return (InstrumentationInfo) method.invoke(null, instrumentation, flags);
}
 
源代码30 项目: android-test   文件: AndroidTestOrchestrator.java
/** Returns the package of the app under test. */
private String getTargetPackage(Bundle arguments) {
  String instrPackage = getTargetInstrPackage(arguments);
  String instrumentation = getTargetInstrumentation(arguments).split("/", -1)[1];
  PackageManager packageManager = getContext().getPackageManager();
  try {
    InstrumentationInfo instrInfo =
        packageManager.getInstrumentationInfo(
            new ComponentName(instrPackage, instrumentation), 0 /* no flags */);
    return instrInfo.targetPackage;
  } catch (NameNotFoundException e) {
    throw new IllegalStateException(
        "Package [" + instrPackage + "] cannot be found on the system.");
  }
}
 
 类所在包
 同包方法