Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db05d4b4 authored by Tamas Berghammer's avatar Tamas Berghammer Committed by android-build-merger
Browse files

Enable logwrapper functionality on user builds

am: 0ca16fa5

Change-Id: Ic18991f9a59f05356fcbcc65acc79be43fc68542
parents 45c2fffc 0ca16fa5
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -399,7 +399,8 @@ public class Process {
     * <var>processClass</var> to start them.
     * <var>processClass</var> to start them.
     * 
     * 
     * When invokeWith is not null, the process will be started as a fresh app
     * When invokeWith is not null, the process will be started as a fresh app
     * and not a zygote fork. Note that this is only allowed for uid 0.
     * and not a zygote fork. Note that this is only allowed for uid 0 or when
     * debugFlags contains DEBUG_ENABLE_DEBUGGER.
     *
     *
     * @param processClass The class to use as the process's main entry
     * @param processClass The class to use as the process's main entry
     *                     point.
     *                     point.
+2 −1
Original line number Original line Diff line number Diff line
@@ -171,7 +171,8 @@ public class ZygoteProcess {
     * <var>processClass</var> to start them.
     * <var>processClass</var> to start them.
     *
     *
     * When invokeWith is not null, the process will be started as a fresh app
     * When invokeWith is not null, the process will be started as a fresh app
     * and not a zygote fork. Note that this is only allowed for uid 0.
     * and not a zygote fork. Note that this is only allowed for uid 0 or when
     * debugFlags contains DEBUG_ENABLE_DEBUGGER.
     *
     *
     * @param processClass The class to use as the process's main entry
     * @param processClass The class to use as the process's main entry
     *                     point.
     *                     point.
+5 −3
Original line number Original line Diff line number Diff line
@@ -697,9 +697,11 @@ class ZygoteConnection {
            throws ZygoteSecurityException {
            throws ZygoteSecurityException {
        int peerUid = peer.getUid();
        int peerUid = peer.getUid();


        if (args.invokeWith != null && peerUid != 0) {
        if (args.invokeWith != null && peerUid != 0 &&
            throw new ZygoteSecurityException("Peer is not permitted to specify "
            (args.debugFlags & Zygote.DEBUG_ENABLE_DEBUGGER) == 0) {
                    + "an explicit invoke-with wrapper command");
            throw new ZygoteSecurityException("Peer is permitted to specify an"
                    + "explicit invoke-with wrapper command only for debuggable"
                    + "applications.");
        }
        }
    }
    }


+10 −1
Original line number Original line Diff line number Diff line
@@ -3778,6 +3778,15 @@ public final class ActivityManagerService extends ActivityManagerNative
                mNativeDebuggingApp = null;
                mNativeDebuggingApp = null;
            }
            }
            String invokeWith = null;
            if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
                // Debuggable apps may include a wrapper script with their library directory.
                String wrapperFileName = app.info.nativeLibraryDir + "/wrap.sh";
                if (new File(wrapperFileName).exists()) {
                    invokeWith = "/system/bin/logwrapper " + wrapperFileName;
                }
            }
            String requiredAbi = (abiOverride != null) ? abiOverride : app.info.primaryCpuAbi;
            String requiredAbi = (abiOverride != null) ? abiOverride : app.info.primaryCpuAbi;
            if (requiredAbi == null) {
            if (requiredAbi == null) {
                requiredAbi = Build.SUPPORTED_ABIS[0];
                requiredAbi = Build.SUPPORTED_ABIS[0];
@@ -3809,7 +3818,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                startResult = Process.start(entryPoint,
                startResult = Process.start(entryPoint,
                        app.processName, uid, uid, gids, debugFlags, mountExternal,
                        app.processName, uid, uid, gids, debugFlags, mountExternal,
                        app.info.targetSdkVersion, app.info.seinfo, requiredAbi, instructionSet,
                        app.info.targetSdkVersion, app.info.seinfo, requiredAbi, instructionSet,
                        app.info.dataDir, null, entryPointArgs);
                        app.info.dataDir, invokeWith, entryPointArgs);
            }
            }
            checkTime(startTime, "startProcess: returned from zygote!");
            checkTime(startTime, "startProcess: returned from zygote!");
            Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
            Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);