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

Commit 4faaed97 authored by Siva Velusamy's avatar Siva Velusamy Committed by Android (Google) Code Review
Browse files

Merge "ActivityManager: add option to allow OpenGL trace."

parents b48e0291 92a8b22e
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@ public class Am {
    private boolean mWaitOption = false;
    private boolean mStopOption = false;

    private boolean mOpenglTraceOption = false;

    private int mRepeat = 0;

    private String mProfileFile;
@@ -151,6 +153,7 @@ public class Am {
        mDebugOption = false;
        mWaitOption = false;
        mStopOption = false;
        mOpenglTraceOption = false;
        mRepeat = 0;
        mProfileFile = null;
        Uri data = null;
@@ -307,6 +310,8 @@ public class Am {
                mRepeat = Integer.parseInt(nextArgRequired());
            } else if (opt.equals("-S")) {
                mStopOption = true;
            } else if (opt.equals("--opengl-trace")) {
                mOpenglTraceOption = true;
            } else {
                System.err.println("Error: Unknown option: " + opt);
                showUsage();
@@ -445,12 +450,14 @@ public class Am {
            int res;
            if (mWaitOption) {
                result = mAm.startActivityAndWait(null, intent, mimeType,
                            null, 0, null, null, 0, false, mDebugOption,
                            null, 0, null, null, 0, false,
                            mDebugOption, mOpenglTraceOption,
                            mProfileFile, fd, mProfileAutoStop);
                res = result.result;
            } else {
                res = mAm.startActivity(null, intent, mimeType,
                        null, 0, null, null, 0, false, mDebugOption,
                        null, 0, null, null, 0, false,
                        mDebugOption, mOpenglTraceOption,
                        mProfileFile, fd, mProfileAutoStop);
            }
            PrintStream out = mWaitOption ? System.out : System.err;
@@ -1277,7 +1284,7 @@ public class Am {
        System.err.println(
                "usage: am [subcommand] [options]\n" +
                "usage: am start [-D] [-W] [-P <FILE>] [--start-profiler <FILE>]\n" +
                "               [--R COUNT] [-S] <INTENT>\n" +
                "               [--R COUNT] [-S] [--opengl-trace] <INTENT>\n" +
                "       am startservice <INTENT>\n" +
                "       am force-stop <PACKAGE>\n" +
                "       am kill <PACKAGE>\n" +
@@ -1304,6 +1311,7 @@ public class Am {
                "    -R: repeat the activity launch <COUNT> times.  Prior to each repeat,\n" +
                "        the top activity will be finished.\n" +
                "    -S: force stop the target app before starting the activity\n" +
                "    --opengl-trace: enable tracing of OpenGL functions\n" +
                "\n" +
                "am startservice: start a Service.\n" +
                "\n" +
+5 −6
Original line number Diff line number Diff line
@@ -3388,11 +3388,10 @@ public class Activity extends ContextThemeWrapper
                intent.setAllowFds(false);
                result = ActivityManagerNative.getDefault()
                    .startActivity(mMainThread.getApplicationThread(),
                            intent, intent.resolveTypeIfNeeded(
                                    getContentResolver()),
                            intent, intent.resolveTypeIfNeeded(getContentResolver()),
                            null, 0,
                            mToken, mEmbeddedID, requestCode, true, false,
                            null, null, false);
                            mToken, mEmbeddedID, requestCode, true /* onlyIfNeeded */,
                            false, false, null, null, false);
            } catch (RemoteException e) {
                // Empty
            }
+14 −8
Original line number Diff line number Diff line
@@ -124,13 +124,15 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            int requestCode = data.readInt();
            boolean onlyIfNeeded = data.readInt() != 0;
            boolean debug = data.readInt() != 0;
            boolean openglTrace = data.readInt() != 0;
            String profileFile = data.readString();
            ParcelFileDescriptor profileFd = data.readInt() != 0
                    ? data.readFileDescriptor() : null;
            boolean autoStopProfiler = data.readInt() != 0;
            int result = startActivity(app, intent, resolvedType,
                    grantedUriPermissions, grantedMode, resultTo, resultWho,
                    requestCode, onlyIfNeeded, debug, profileFile, profileFd, autoStopProfiler);
                    requestCode, onlyIfNeeded, debug, openglTrace,
                    profileFile, profileFd, autoStopProfiler);
            reply.writeNoException();
            reply.writeInt(result);
            return true;
@@ -150,13 +152,15 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            int requestCode = data.readInt();
            boolean onlyIfNeeded = data.readInt() != 0;
            boolean debug = data.readInt() != 0;
            boolean openglTrace = data.readInt() != 0;
            String profileFile = data.readString();
            ParcelFileDescriptor profileFd = data.readInt() != 0
                    ? data.readFileDescriptor() : null;
            boolean autoStopProfiler = data.readInt() != 0;
            WaitResult result = startActivityAndWait(app, intent, resolvedType,
                    grantedUriPermissions, grantedMode, resultTo, resultWho,
                    requestCode, onlyIfNeeded, debug, profileFile, profileFd, autoStopProfiler);
                    requestCode, onlyIfNeeded, debug, openglTrace,
                    profileFile, profileFd, autoStopProfiler);
            reply.writeNoException();
            result.writeToParcel(reply, 0);
            return true;
@@ -1617,7 +1621,7 @@ class ActivityManagerProxy implements IActivityManager
            String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
            IBinder resultTo, String resultWho,
            int requestCode, boolean onlyIfNeeded,
            boolean debug, String profileFile, ParcelFileDescriptor profileFd,
            boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
            boolean autoStopProfiler) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
@@ -1632,6 +1636,7 @@ class ActivityManagerProxy implements IActivityManager
        data.writeInt(requestCode);
        data.writeInt(onlyIfNeeded ? 1 : 0);
        data.writeInt(debug ? 1 : 0);
        data.writeInt(openglTrace ? 1 : 0);
        data.writeString(profileFile);
        if (profileFd != null) {
            data.writeInt(1);
@@ -1651,7 +1656,7 @@ class ActivityManagerProxy implements IActivityManager
            String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
            IBinder resultTo, String resultWho,
            int requestCode, boolean onlyIfNeeded,
            boolean debug, String profileFile, ParcelFileDescriptor profileFd,
            boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
            boolean autoStopProfiler) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
@@ -1666,6 +1671,7 @@ class ActivityManagerProxy implements IActivityManager
        data.writeInt(requestCode);
        data.writeInt(onlyIfNeeded ? 1 : 0);
        data.writeInt(debug ? 1 : 0);
        data.writeInt(openglTrace ? 1 : 0);
        data.writeString(profileFile);
        if (profileFd != null) {
            data.writeInt(1);
+9 −2
Original line number Diff line number Diff line
@@ -376,6 +376,7 @@ public final class ActivityThread {
        Bundle instrumentationArgs;
        IInstrumentationWatcher instrumentationWatcher;
        int debugMode;
        boolean enableOpenGlTrace;
        boolean restrictedBackupMode;
        boolean persistent;
        Configuration config;
@@ -676,8 +677,8 @@ public final class ActivityThread {
                ComponentName instrumentationName, String profileFile,
                ParcelFileDescriptor profileFd, boolean autoStopProfiler,
                Bundle instrumentationArgs, IInstrumentationWatcher instrumentationWatcher,
                int debugMode, boolean isRestrictedBackupMode, boolean persistent,
                Configuration config, CompatibilityInfo compatInfo,
                int debugMode, boolean enableOpenGlTrace, boolean isRestrictedBackupMode,
                boolean persistent, Configuration config, CompatibilityInfo compatInfo,
                Map<String, IBinder> services, Bundle coreSettings) {

            if (services != null) {
@@ -695,6 +696,7 @@ public final class ActivityThread {
            data.instrumentationArgs = instrumentationArgs;
            data.instrumentationWatcher = instrumentationWatcher;
            data.debugMode = debugMode;
            data.enableOpenGlTrace = enableOpenGlTrace;
            data.restrictedBackupMode = isRestrictedBackupMode;
            data.persistent = persistent;
            data.config = config;
@@ -3912,6 +3914,11 @@ public final class ActivityThread {
            }
        }

        // Enable OpenGL tracing if required
        if (data.enableOpenGlTrace) {
            GLUtils.enableTracing();
        }

        /**
         * Initialize the default http proxy in this process for the reasons we set the time zone.
         */
+8 −5
Original line number Diff line number Diff line
@@ -267,6 +267,7 @@ public abstract class ApplicationThreadNative extends Binder
            IBinder binder = data.readStrongBinder();
            IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
            int testMode = data.readInt();
            boolean openGlTrace = data.readInt() != 0;
            boolean restrictedBackupMode = (data.readInt() != 0);
            boolean persistent = (data.readInt() != 0);
            Configuration config = Configuration.CREATOR.createFromParcel(data);
@@ -275,8 +276,8 @@ public abstract class ApplicationThreadNative extends Binder
            Bundle coreSettings = data.readBundle();
            bindApplication(packageName, info,
                            providers, testName, profileName, profileFd, autoStopProfiler,
                            testArgs, testWatcher, testMode, restrictedBackupMode, persistent,
                            config, compatInfo, services, coreSettings);
                            testArgs, testWatcher, testMode, openGlTrace, restrictedBackupMode,
                            persistent, config, compatInfo, services, coreSettings);
            return true;
        }

@@ -849,8 +850,9 @@ class ApplicationThreadProxy implements IApplicationThread {
    public final void bindApplication(String packageName, ApplicationInfo info,
            List<ProviderInfo> providers, ComponentName testName, String profileName,
            ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs,
            IInstrumentationWatcher testWatcher, int debugMode, boolean restrictedBackupMode,
            boolean persistent, Configuration config, CompatibilityInfo compatInfo,
            IInstrumentationWatcher testWatcher, int debugMode, boolean openGlTrace,
            boolean restrictedBackupMode, boolean persistent,
            Configuration config, CompatibilityInfo compatInfo,
            Map<String, IBinder> services, Bundle coreSettings) throws RemoteException {
        Parcel data = Parcel.obtain();
        data.writeInterfaceToken(IApplicationThread.descriptor);
@@ -874,6 +876,7 @@ class ApplicationThreadProxy implements IApplicationThread {
        data.writeBundle(testArgs);
        data.writeStrongInterface(testWatcher);
        data.writeInt(debugMode);
        data.writeInt(openGlTrace ? 1 : 0);
        data.writeInt(restrictedBackupMode ? 1 : 0);
        data.writeInt(persistent ? 1 : 0);
        config.writeToParcel(data, 0);
Loading