android.content.pm.InstrumentationInfo Java Examples

The following examples show how to use android.content.pm.InstrumentationInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #2
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #3
Source File: ApplicationPackageManager.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #4
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #5
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #6
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #7
Source File: RunnerArgs.java    From android-test with Apache License 2.0 6 votes vote down vote up
/** 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;
}
 
Example #8
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #9
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #10
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #11
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #12
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #13
Source File: PluginPackageParser.java    From DroidPlugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #14
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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();
    }
}
 
Example #15
Source File: PackageParserApi21.java    From DroidPlugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example #16
Source File: PackageParserApi16.java    From DroidPlugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public InstrumentationInfo generateInstrumentationInfo(
        Object instrumentation, int flags) throws Exception {
    /*    public static final InstrumentationInfo generateInstrumentationInfo(
        Instrumentation i, int flags)*/
    return super.generateInstrumentationInfo(instrumentation, flags);
}
 
Example #17
Source File: LoadedPlugin.java    From VirtualAPK with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #18
Source File: AndroidTestOrchestrator.java    From android-test with Apache License 2.0 5 votes vote down vote up
/** 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.");
  }
}
 
Example #19
Source File: ApplicationPackageManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@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();
    }
}
 
Example #20
Source File: PackageParserApi15.java    From DroidPlugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public InstrumentationInfo generateInstrumentationInfo(
        Object instrumentation, int flags) throws Exception {
    /*     public static final InstrumentationInfo generateInstrumentationInfo(
        Instrumentation i, int flags) */
    return super.generateInstrumentationInfo(instrumentation, flags);
}
 
Example #21
Source File: DynamicApkParser.java    From Android-plugin-support with MIT License 5 votes vote down vote up
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;
}
 
Example #22
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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();
    }
}
 
Example #23
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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();
    }
}
 
Example #24
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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();
    }
}
 
Example #25
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example #26
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example #27
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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();
    }
}
 
Example #28
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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();
    }
}
 
Example #29
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example #30
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@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();
    }
}