-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazily enable the Android components #1002
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,17 +53,12 @@ public final class LeakCanaryInternals { | |
public static final String HUAWEI = "HUAWEI"; | ||
public static final String VIVO = "vivo"; | ||
|
||
private static final Executor fileIoExecutor = newSingleThreadExecutor("File-IO"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AlexanderGH you'll be excited. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm excited when people are excited! I'd love to know why you're excited though :) |
||
public static volatile RefWatcher installedRefWatcher; | ||
|
||
private static final String NOTIFICATION_CHANNEL_ID = "leakcanary"; | ||
|
||
public static volatile Boolean isInAnalyzerProcess; | ||
|
||
public static void executeOnFileIoThread(Runnable runnable) { | ||
fileIoExecutor.execute(runnable); | ||
} | ||
|
||
/** Extracts the class simple name out of a string containing a fully qualified class name. */ | ||
public static String classSimpleName(String className) { | ||
int separator = className.lastIndexOf('.'); | ||
|
@@ -74,16 +69,6 @@ public static String classSimpleName(String className) { | |
} | ||
} | ||
|
||
public static void setEnabled(Context context, final Class<?> componentClass, | ||
final boolean enabled) { | ||
final Context appContext = context.getApplicationContext(); | ||
executeOnFileIoThread(new Runnable() { | ||
@Override public void run() { | ||
setEnabledBlocking(appContext, componentClass, enabled); | ||
} | ||
}); | ||
} | ||
|
||
public static void setEnabledBlocking(Context appContext, Class<?> componentClass, | ||
boolean enabled) { | ||
ComponentName component = new ComponentName(appContext, componentClass); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this now block for a non-zero amount of time on every leak?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, but from an IntentService handler thread so 🤷♂️