summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/MemoryDumpActivity.java
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2013-06-26 14:04:59 -0400
committerDaniel Sandler <dsandler@android.com>2013-06-26 14:30:20 -0400
commitf8577a39058fcc07a390c650cf7b8c68949450d9 (patch)
tree0096dfa982b8cbbda92ba3209ce0b7555951345a /src/com/android/launcher3/MemoryDumpActivity.java
parent8540bb8d72496dca3182ac091c2cafaaad597457 (diff)
downloadandroid_packages_apps_Trebuchet-f8577a39058fcc07a390c650cf7b8c68949450d9.tar.gz
android_packages_apps_Trebuchet-f8577a39058fcc07a390c650cf7b8c68949450d9.tar.bz2
android_packages_apps_Trebuchet-f8577a39058fcc07a390c650cf7b8c68949450d9.zip
Start the memory dumper directly.
Launching it as an activity from within Launcher is problematic, so we'll just treat it as a special shortcut and run the dump when the user clicks that shortcut icon. Change-Id: Ibe9f4adcaff674f5bafa9b0fc58b5a86cf5ceb00
Diffstat (limited to 'src/com/android/launcher3/MemoryDumpActivity.java')
-rw-r--r--src/com/android/launcher3/MemoryDumpActivity.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/com/android/launcher3/MemoryDumpActivity.java b/src/com/android/launcher3/MemoryDumpActivity.java
index b437c22e2..37e392881 100644
--- a/src/com/android/launcher3/MemoryDumpActivity.java
+++ b/src/com/android/launcher3/MemoryDumpActivity.java
@@ -133,20 +133,33 @@ public class MemoryDumpActivity extends Activity {
public void onStart() {
super.onStart();
+ startDump(this, new Runnable() {
+ @Override
+ public void run() {
+ finish();
+ }
+ });
+ }
+
+ public static void startDump(final Context context) {
+ startDump(context, null);
+ }
+
+ public static void startDump(final Context context, final Runnable andThen) {
final ServiceConnection connection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
Log.v(TAG, "service connected, dumping...");
- dumpHprofAndShare(MemoryDumpActivity.this,
- ((MemoryTracker.MemoryTrackerInterface)service).getService());
- unbindService(this);
- finish();
+ dumpHprofAndShare(context,
+ ((MemoryTracker.MemoryTrackerInterface) service).getService());
+ context.unbindService(this);
+ if (andThen != null) andThen.run();
}
public void onServiceDisconnected(ComponentName className) {
}
};
Log.v(TAG, "attempting to bind to memory tracker");
- bindService(new Intent(this, MemoryTracker.class),
+ context.bindService(new Intent(context, MemoryTracker.class),
connection, Context.BIND_AUTO_CREATE);
}
}