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

Commit 6d00c1ab authored by Chris Wailes's avatar Chris Wailes
Browse files

Change USAP name to application name as soon as possible.

This patch changes the location where the process's name is changed to
that of the application being launched.  It also attempts to use the
package name if the "nice name" is missing.

Test: m & flash & boot
Change-Id: Id3a3d0b2b66d31c48274f8a986e86e9ed1d28f34
parent 27c76207
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -549,6 +549,8 @@ public final class Zygote {
            }
        }

        setAppProcessName(args, "USAP");

        applyUidSecurityPolicy(args, peerCredentials);
        applyDebuggerSystemProperty(args);

@@ -613,10 +615,6 @@ public final class Zygote {

        disableExecuteOnly(args.mTargetSdkVersion);

        if (args.mNiceName != null) {
            Process.setArgV0(args.mNiceName);
        }

        // End of the postFork event.
        Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);

@@ -625,6 +623,16 @@ public final class Zygote {
                                     null /* classLoader */);
    }

    static void setAppProcessName(ZygoteArguments args, String loggingTag) {
        if (args.mNiceName != null) {
            Process.setArgV0(args.mNiceName);
        } else if (args.mPackageName != null) {
            Process.setArgV0(args.mPackageName);
        } else {
            Log.w(loggingTag, "Unable to set package name.");
        }
    }

    private static final String USAP_ERROR_PREFIX = "Invalid command to USAP: ";

    /**
+1 −3
Original line number Diff line number Diff line
@@ -573,9 +573,7 @@ class ZygoteConnection {
            }
        }

        if (parsedArgs.mNiceName != null) {
            Process.setArgV0(parsedArgs.mNiceName);
        }
        Zygote.setAppProcessName(parsedArgs, TAG);

        // End of the postFork event.
        Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);