add cmd+opt+ctrl+D to globally invoke dev menu for Android

Reviewed By: frantic

Differential Revision: D5280788

fbshipit-source-id: ce11d122ee17a2ba8d8aa2e91fc6639610791577
This commit is contained in:
Yu Wang 2017-06-20 16:52:31 -07:00 committed by Facebook Github Bot
parent a2b0ee0fc3
commit 01adc71ade
2 changed files with 17 additions and 0 deletions

View File

@ -98,6 +98,7 @@ public class DevServerHelper {
public interface PackagerCommandListener { public interface PackagerCommandListener {
void onPackagerReloadCommand(); void onPackagerReloadCommand();
void onPackagerDevMenuCommand();
void onCaptureHeapCommand(final Responder responder); void onCaptureHeapCommand(final Responder responder);
void onPokeSamplingProfilerCommand(final Responder responder); void onPokeSamplingProfilerCommand(final Responder responder);
} }
@ -145,6 +146,12 @@ public class DevServerHelper {
commandListener.onPackagerReloadCommand(); commandListener.onPackagerReloadCommand();
} }
}); });
handlers.put("devMenu", new NotificationOnlyHandler() {
@Override
public void onNotification(@Nullable Object params) {
commandListener.onPackagerDevMenuCommand();
}
});
handlers.put("captureHeap", new RequestOnlyHandler() { handlers.put("captureHeap", new RequestOnlyHandler() {
@Override @Override
public void onRequest(@Nullable Object params, Responder responder) { public void onRequest(@Nullable Object params, Responder responder) {

View File

@ -682,6 +682,16 @@ public class DevSupportManagerImpl implements
}); });
} }
@Override
public void onPackagerDevMenuCommand() {
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
showDevOptionsDialog();
}
});
}
@Override @Override
public void onCaptureHeapCommand(final Responder responder) { public void onCaptureHeapCommand(final Responder responder) {
UiThreadUtil.runOnUiThread(new Runnable() { UiThreadUtil.runOnUiThread(new Runnable() {