Java Code Examples for dalvik.system.VMRuntime#getInstructionSet()

The following examples show how to use dalvik.system.VMRuntime#getInstructionSet() . 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
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = info.secondaryNativeLibraryDir;
            return modified;
        }
    }
    return info;
}
 
Example 2
Source File: ApplicationPackageManager.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = info.secondaryNativeLibraryDir;
            return modified;
        }
    }
    return info;
}
 
Example 3
Source File: LoadedApk.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private static ApplicationInfo adjustNativeLibraryPaths(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            final ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = modified.secondaryNativeLibraryDir;
            modified.primaryCpuAbi = modified.secondaryCpuAbi;
            return modified;
        }
    }

    return info;
}
 
Example 4
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = info.secondaryNativeLibraryDir;
            return modified;
        }
    }
    return info;
}
 
Example 5
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = info.secondaryNativeLibraryDir;
            return modified;
        }
    }
    return info;
}
 
Example 6
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = info.secondaryNativeLibraryDir;
            return modified;
        }
    }
    return info;
}
 
Example 7
Source File: LoadedApk.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static ApplicationInfo adjustNativeLibraryPaths(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            final ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = modified.secondaryNativeLibraryDir;
            modified.primaryCpuAbi = modified.secondaryCpuAbi;
            return modified;
        }
    }

    return info;
}
 
Example 8
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static void maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();
        final String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            info.nativeLibraryDir = info.secondaryNativeLibraryDir;
        }
    }
}
 
Example 9
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = info.secondaryNativeLibraryDir;
            return modified;
        }
    }
    return info;
}
 
Example 10
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = info.secondaryNativeLibraryDir;
            return modified;
        }
    }
    return info;
}
 
Example 11
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static void maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            info.nativeLibraryDir = info.secondaryNativeLibraryDir;
        }
    }
}
 
Example 12
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) {
    // If we're dealing with a multi-arch application that has both
    // 32 and 64 bit shared libraries, we might need to choose the secondary
    // depending on what the current runtime's instruction set is.
    if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) {
        final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet();

        // Get the instruction set that the libraries of secondary Abi is supported.
        // In presence of a native bridge this might be different than the one secondary Abi used.
        String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi);
        final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa);
        secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa;

        // If the runtimeIsa is the same as the primary isa, then we do nothing.
        // Everything will be set up correctly because info.nativeLibraryDir will
        // correspond to the right ISA.
        if (runtimeIsa.equals(secondaryIsa)) {
            ApplicationInfo modified = new ApplicationInfo(info);
            modified.nativeLibraryDir = info.secondaryNativeLibraryDir;
            return modified;
        }
    }
    return info;
}
 
Example 13
Source File: InstructionSets.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public static String[] getAppDexInstructionSets(ApplicationInfo info) {
    if (info.primaryCpuAbi != null) {
        if (info.secondaryCpuAbi != null) {
            return new String[] {
                    VMRuntime.getInstructionSet(info.primaryCpuAbi),
                    VMRuntime.getInstructionSet(info.secondaryCpuAbi) };
        } else {
            return new String[] {
                    VMRuntime.getInstructionSet(info.primaryCpuAbi) };
        }
    }

    return new String[] { getPreferredInstructionSet() };
}
 
Example 14
Source File: InstructionSets.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public static String[] getAppDexInstructionSets(PackageSetting ps) {
    if (ps.primaryCpuAbiString != null) {
        if (ps.secondaryCpuAbiString != null) {
            return new String[] {
                    VMRuntime.getInstructionSet(ps.primaryCpuAbiString),
                    VMRuntime.getInstructionSet(ps.secondaryCpuAbiString) };
        } else {
            return new String[] {
                    VMRuntime.getInstructionSet(ps.primaryCpuAbiString) };
        }
    }

    return new String[] { getPreferredInstructionSet() };
}
 
Example 15
Source File: InstructionSets.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Returns deduplicated list of supported instructions for dex code.
 */
public static String[] getAllDexCodeInstructionSets() {
    String[] supportedInstructionSets = new String[Build.SUPPORTED_ABIS.length];
    for (int i = 0; i < supportedInstructionSets.length; i++) {
        String abi = Build.SUPPORTED_ABIS[i];
        supportedInstructionSets[i] = VMRuntime.getInstructionSet(abi);
    }
    return getDexCodeInstructionSets(supportedInstructionSets);
}
 
Example 16
Source File: InstructionSets.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public static List<String> getAllInstructionSets() {
    final String[] allAbis = Build.SUPPORTED_ABIS;
    final List<String> allInstructionSets = new ArrayList<String>(allAbis.length);

    for (String abi : allAbis) {
        final String instructionSet = VMRuntime.getInstructionSet(abi);
        if (!allInstructionSets.contains(instructionSet)) {
            allInstructionSets.add(instructionSet);
        }
    }

    return allInstructionSets;
}
 
Example 17
Source File: InstructionSets.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public static String getPrimaryInstructionSet(ApplicationInfo info) {
    if (info.primaryCpuAbi == null) {
        return getPreferredInstructionSet();
    }

    return VMRuntime.getInstructionSet(info.primaryCpuAbi);
}