Merge "Frameworks/base: Add more systrace points" into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-05-19 00:09:07 +00:00
committed by Android (Google) Code Review
4 changed files with 23 additions and 0 deletions

View File

@@ -4937,6 +4937,7 @@ public final class ActivityThread {
// Isolated processes aren't going to do UI. // Isolated processes aren't going to do UI.
return; return;
} }
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "setupGraphicsSupport");
try { try {
int uid = Process.myUid(); int uid = Process.myUid();
String[] packages = getPackageManager().getPackagesForUid(uid); String[] packages = getPackageManager().getPackagesForUid(uid);
@@ -4949,6 +4950,8 @@ public final class ActivityThread {
} }
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer();
} finally {
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
} }
} }
@@ -5131,6 +5134,7 @@ public final class ActivityThread {
/** /**
* Initialize the default http proxy in this process for the reasons we set the time zone. * Initialize the default http proxy in this process for the reasons we set the time zone.
*/ */
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "Setup proxies");
final IBinder b = ServiceManager.getService(Context.CONNECTIVITY_SERVICE); final IBinder b = ServiceManager.getService(Context.CONNECTIVITY_SERVICE);
if (b != null) { if (b != null) {
// In pre-boot mode (doing initial launch to collect password), not // In pre-boot mode (doing initial launch to collect password), not
@@ -5141,9 +5145,11 @@ public final class ActivityThread {
final ProxyInfo proxyInfo = service.getProxyForNetwork(null); final ProxyInfo proxyInfo = service.getProxyForNetwork(null);
Proxy.setHttpProxySystemProperty(proxyInfo); Proxy.setHttpProxySystemProperty(proxyInfo);
} catch (RemoteException e) { } catch (RemoteException e) {
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer();
} }
} }
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
// Instrumentation info affects the class loader, so load it before // Instrumentation info affects the class loader, so load it before
// setting up the app context. // setting up the app context.
@@ -5215,7 +5221,9 @@ public final class ActivityThread {
// Install the Network Security Config Provider. This must happen before the application // Install the Network Security Config Provider. This must happen before the application
// code is loaded to prevent issues with instances of TLS objects being created before // code is loaded to prevent issues with instances of TLS objects being created before
// the provider is installed. // the provider is installed.
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "NetworkSecurityConfigProvider.install");
NetworkSecurityConfigProvider.install(appContext); NetworkSecurityConfigProvider.install(appContext);
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
// Continue loading instrumentation. // Continue loading instrumentation.
if (ii != null) { if (ii != null) {

View File

@@ -65,7 +65,9 @@ class ApplicationLoaders {
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "setupVulkanLayerPath");
setupVulkanLayerPath(pathClassloader, librarySearchPath); setupVulkanLayerPath(pathClassloader, librarySearchPath);
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
mLoaders.put(zip, pathClassloader); mLoaders.put(zip, pathClassloader);
return pathClassloader; return pathClassloader;

View File

@@ -806,6 +806,8 @@ public final class LoadedApk {
return mApplication; return mApplication;
} }
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "makeApplication");
Application app = null; Application app = null;
String appClass = mApplicationInfo.className; String appClass = mApplicationInfo.className;
@@ -816,7 +818,10 @@ public final class LoadedApk {
try { try {
java.lang.ClassLoader cl = getClassLoader(); java.lang.ClassLoader cl = getClassLoader();
if (!mPackageName.equals("android")) { if (!mPackageName.equals("android")) {
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER,
"initializeJavaContextClassLoader");
initializeJavaContextClassLoader(); initializeJavaContextClassLoader();
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
} }
ContextImpl appContext = ContextImpl.createAppContext(mActivityThread, this); ContextImpl appContext = ContextImpl.createAppContext(mActivityThread, this);
app = mActivityThread.mInstrumentation.newApplication( app = mActivityThread.mInstrumentation.newApplication(
@@ -824,6 +829,7 @@ public final class LoadedApk {
appContext.setOuterContext(app); appContext.setOuterContext(app);
} catch (Exception e) { } catch (Exception e) {
if (!mActivityThread.mInstrumentation.onException(app, e)) { if (!mActivityThread.mInstrumentation.onException(app, e)) {
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
throw new RuntimeException( throw new RuntimeException(
"Unable to instantiate application " + appClass "Unable to instantiate application " + appClass
+ ": " + e.toString(), e); + ": " + e.toString(), e);
@@ -837,6 +843,7 @@ public final class LoadedApk {
instrumentation.callApplicationOnCreate(app); instrumentation.callApplicationOnCreate(app);
} catch (Exception e) { } catch (Exception e) {
if (!instrumentation.onException(app, e)) { if (!instrumentation.onException(app, e)) {
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
throw new RuntimeException( throw new RuntimeException(
"Unable to create application " + app.getClass().getName() "Unable to create application " + app.getClass().getName()
+ ": " + e.toString(), e); + ": " + e.toString(), e);
@@ -857,6 +864,8 @@ public final class LoadedApk {
rewriteRValues(getClassLoader(), packageIdentifiers.valueAt(i), id); rewriteRValues(getClassLoader(), packageIdentifiers.valueAt(i), id);
} }
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
return app; return app;
} }

View File

@@ -16,6 +16,8 @@
package com.android.internal.os; package com.android.internal.os;
import android.os.Trace;
import dalvik.system.PathClassLoader; import dalvik.system.PathClassLoader;
/** /**
@@ -40,11 +42,13 @@ public class PathClassLoaderFactory {
boolean isNamespaceShared) { boolean isNamespaceShared) {
PathClassLoader pathClassloader = new PathClassLoader(dexPath, librarySearchPath, parent); PathClassLoader pathClassloader = new PathClassLoader(dexPath, librarySearchPath, parent);
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "createClassloaderNamespace");
String errorMessage = createClassloaderNamespace(pathClassloader, String errorMessage = createClassloaderNamespace(pathClassloader,
targetSdkVersion, targetSdkVersion,
librarySearchPath, librarySearchPath,
libraryPermittedPath, libraryPermittedPath,
isNamespaceShared); isNamespaceShared);
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
if (errorMessage != null) { if (errorMessage != null) {
throw new UnsatisfiedLinkError("Unable to create namespace for the classloader " + throw new UnsatisfiedLinkError("Unable to create namespace for the classloader " +