Java Code Examples for android.os.Build#IS_ENG

The following examples show how to use android.os.Build#IS_ENG . 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: ArtManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isRuntimeProfilingEnabled(@ProfileType int profileType, String callingPackage) {
    int callingUid = Binder.getCallingUid();
    if (callingUid != Process.SHELL_UID && !checkAndroidPermissions(callingUid, callingPackage)) {
        return false;
    }

    switch (profileType) {
        case ArtManager.PROFILE_APPS :
            return SystemProperties.getBoolean("dalvik.vm.usejitprofiles", false);
        case ArtManager.PROFILE_BOOT_IMAGE:
            return (Build.IS_USERDEBUG || Build.IS_ENG) &&
                    SystemProperties.getBoolean("dalvik.vm.usejitprofiles", false) &&
                    SystemProperties.getBoolean("dalvik.vm.profilebootimage", false);
        default:
            throw new IllegalArgumentException("Invalid profile type:" + profileType);
    }
}
 
Example 2
Source File: RescueParty.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private static boolean isDisabled() {
    // Check if we're explicitly enabled for testing
    if (SystemProperties.getBoolean(PROP_ENABLE_RESCUE, false)) {
        return false;
    }

    // We're disabled on all engineering devices
    if (Build.IS_ENG) {
        Slog.v(TAG, "Disabled because of eng build");
        return true;
    }

    // We're disabled on userdebug devices connected over USB, since that's
    // a decent signal that someone is actively trying to debug the device,
    // or that it's in a lab environment.
    if (Build.IS_USERDEBUG && isUsbActive()) {
        Slog.v(TAG, "Disabled because of active USB connection");
        return true;
    }

    // One last-ditch check
    if (SystemProperties.getBoolean(PROP_DISABLE_RESCUE, false)) {
        Slog.v(TAG, "Disabled because of manual property");
        return true;
    }

    return false;
}
 
Example 3
Source File: NetworkIdentity.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Scrub given IMSI on production builds.
 */
public static String scrubSubscriberId(String subscriberId) {
    if (Build.IS_ENG) {
        return subscriberId;
    } else if (subscriberId != null) {
        // TODO: parse this as MCC+MNC instead of hard-coding
        return subscriberId.substring(0, Math.min(6, subscriberId.length())) + "...";
    } else {
        return "null";
    }
}
 
Example 4
Source File: ZygoteInit.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Finish remaining work for the newly forked system server process.
 */
private static Runnable handleSystemServerProcess(ZygoteConnection.Arguments parsedArgs) {
    // set umask to 0077 so new files and directories will default to owner-only permissions.
    // umask一般是用在你初始创建一个目录或者文件的时候赋予他们的权限
    Os.umask(S_IRWXG | S_IRWXO);

    // 设置当前进程名为 "system_server"
    if (parsedArgs.niceName != null) { 
        Process.setArgV0(parsedArgs.niceName);
    }

    final String systemServerClasspath = Os.getenv("SYSTEMSERVERCLASSPATH");
    if (systemServerClasspath != null) {
        // dex 优化操作
        performSystemServerDexOpt(systemServerClasspath);
        // Capturing profiles is only supported for debug or eng builds since selinux normally
        // prevents it.
        boolean profileSystemServer = SystemProperties.getBoolean(
                "dalvik.vm.profilesystemserver", false);
        if (profileSystemServer && (Build.IS_USERDEBUG || Build.IS_ENG)) {
            try {
                prepareSystemServerProfile(systemServerClasspath);
            } catch (Exception e) {
                Log.wtf(TAG, "Failed to set up system server profile", e);
            }
        }
    }

    if (parsedArgs.invokeWith != null) { // invokeWith 一般为空
        String[] args = parsedArgs.remainingArgs;
        // If we have a non-null system server class path, we'll have to duplicate the
        // existing arguments and append the classpath to it. ART will handle the classpath
        // correctly when we exec a new process.
        if (systemServerClasspath != null) {
            String[] amendedArgs = new String[args.length + 2];
            amendedArgs[0] = "-cp";
            amendedArgs[1] = systemServerClasspath;
            System.arraycopy(args, 0, amendedArgs, 2, args.length);
            args = amendedArgs;
        }

        WrapperInit.execApplication(parsedArgs.invokeWith,
                parsedArgs.niceName, parsedArgs.targetSdkVersion,
                VMRuntime.getCurrentInstructionSet(), null, args);

        throw new IllegalStateException("Unexpected return from WrapperInit.execApplication");
    } else {
        ClassLoader cl = null;
        if (systemServerClasspath != null) {
            // 创建类加载器,并赋给当前线程
            cl = createPathClassLoader(systemServerClasspath, parsedArgs.targetSdkVersion);
            
            Thread.currentThread().setContextClassLoader(cl);
        }

        /*
         * Pass the remaining arguments to SystemServer.
         */
        return ZygoteInit.zygoteInit(parsedArgs.targetSdkVersion, parsedArgs.remainingArgs, cl);
    }

    /* should never reach here */
}
 
Example 5
Source File: IpSecAlgorithm.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private static boolean isUnsafeBuild() {
    return Build.IS_DEBUGGABLE && Build.IS_ENG;
}