mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Stop leaking the TracingController's BroadcastReciever
https://github.com/domokit/sky_sdk/issues/23 R=abarth@chromium.org Review URL: https://codereview.chromium.org/1150263003
This commit is contained in:
parent
bd7c9160e6
commit
c71032ce2e
@ -38,6 +38,16 @@ public class SkyActivity extends Activity {
|
||||
mTracingController = new TracingController(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see android.app.Activity#onStop()
|
||||
*/
|
||||
@Override
|
||||
protected void onStop() {
|
||||
// Do we need to shut down Sky too?
|
||||
mTracingController.stop();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
mView.loadUrl(url);
|
||||
}
|
||||
|
||||
@ -8,17 +8,16 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import org.chromium.base.JNINamespace;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.chromium.base.JNINamespace;
|
||||
|
||||
/**
|
||||
* A controller for the tracing system.
|
||||
*/
|
||||
@ -40,6 +39,10 @@ class TracingController {
|
||||
mContext.registerReceiver(mBroadcastReceiver, mIntentFilter);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
mContext.unregisterReceiver(mBroadcastReceiver);
|
||||
}
|
||||
|
||||
private String generateTracingFilePath() {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HHmmss", Locale.US);
|
||||
formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user