diff options
author | Siva Velusamy <vsiva@google.com> | 2012-03-09 16:24:04 -0800 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2012-03-12 12:18:53 -0700 |
commit | 92a8b22e7410e74e1cba1b856333116652af8a5c (patch) | |
tree | fd340b33bdcf7d2b5f84d9f9454a5805efff54b6 /core/java/android | |
parent | 64d10a1da0a702ffeb086ad9c4a632f2712f1dad (diff) | |
download | frameworks_base-92a8b22e7410e74e1cba1b856333116652af8a5c.zip frameworks_base-92a8b22e7410e74e1cba1b856333116652af8a5c.tar.gz frameworks_base-92a8b22e7410e74e1cba1b856333116652af8a5c.tar.bz2 |
ActivityManager: add option to allow OpenGL trace.
This patch adds an option to enable tracing of OpenGL functions.
OpenGL tracing can be enabled by passing "--opengl-trace" option
to am start. This option requires either a device in debug mode,
or that the application itself has debug permission set.
Change-Id: I77788bfe97c9108943b1f947ce81afe8293d78a0
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/app/Activity.java | 11 | ||||
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 22 | ||||
-rw-r--r-- | core/java/android/app/ActivityThread.java | 11 | ||||
-rw-r--r-- | core/java/android/app/ApplicationThreadNative.java | 13 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 4 | ||||
-rw-r--r-- | core/java/android/app/IApplicationThread.java | 2 | ||||
-rw-r--r-- | core/java/android/app/Instrumentation.java | 5 |
7 files changed, 42 insertions, 26 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index f895431..4ff99d0 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -3388,17 +3388,16 @@ 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 } - + Instrumentation.checkStartActivityResult(result, intent); - + if (requestCode >= 0) { // If this start is requesting a result, we can avoid making // the activity visible until the result is received. Setting diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index b952649..7daaf7d 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -120,17 +120,19 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR); int grantedMode = data.readInt(); IBinder resultTo = data.readStrongBinder(); - String resultWho = data.readString(); + String resultWho = data.readString(); 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; @@ -146,17 +148,19 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR); int grantedMode = data.readInt(); IBinder resultTo = data.readStrongBinder(); - String resultWho = data.readString(); + String resultWho = data.readString(); 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; @@ -1607,17 +1611,17 @@ class ActivityManagerProxy implements IActivityManager { mRemote = remote; } - + public IBinder asBinder() { return mRemote; } - + public int startActivity(IApplicationThread caller, Intent intent, 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); diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index aa15f39..2610d87 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -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. */ diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index e75d7b4..437362b 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -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,11 +276,11 @@ 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; } - + case SCHEDULE_EXIT_TRANSACTION: { data.enforceInterface(IApplicationThread.descriptor); @@ -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); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index ea2545f..acebf58 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -84,12 +84,12 @@ public interface IActivityManager extends IInterface { public int startActivity(IApplicationThread caller, Intent intent, String resolvedType, Uri[] grantedUriPermissions, int grantedMode, IBinder resultTo, String resultWho, int requestCode, - boolean onlyIfNeeded, boolean debug, String profileFile, + boolean onlyIfNeeded, boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException; public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent, String resolvedType, Uri[] grantedUriPermissions, int grantedMode, IBinder resultTo, String resultWho, int requestCode, - boolean onlyIfNeeded, boolean debug, String profileFile, + boolean onlyIfNeeded, boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException; public int startActivityWithConfig(IApplicationThread caller, Intent intent, String resolvedType, Uri[] grantedUriPermissions, diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index 6ad1736..70029d2 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -89,7 +89,7 @@ public interface IApplicationThread extends IInterface { void bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers, ComponentName testName, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArguments, IInstrumentationWatcher testWatcher, - int debugMode, boolean restrictedBackupMode, boolean persistent, + int debugMode, boolean openGlTrace, boolean restrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services, Bundle coreSettings) throws RemoteException; void scheduleExit() throws RemoteException; diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index c037ffb..a34e1d3 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -1384,7 +1384,7 @@ public class Instrumentation { .startActivity(whoThread, intent, intent.resolveTypeIfNeeded(who.getContentResolver()), null, 0, token, target != null ? target.mEmbeddedID : null, - requestCode, false, false, null, null, false); + requestCode, false, false, false, null, null, false); checkStartActivityResult(result, intent); } catch (RemoteException e) { } @@ -1482,7 +1482,8 @@ public class Instrumentation { .startActivity(whoThread, intent, intent.resolveTypeIfNeeded(who.getContentResolver()), null, 0, token, target != null ? target.mWho : null, - requestCode, false, false, null, null, false); + requestCode, false, false /* debug */, false /* openglTrace */, + null, null, false); checkStartActivityResult(result, intent); } catch (RemoteException e) { } |