Enable flipper android to use different ports based on prop

Summary:
Part 1 of enabling flipper to run on custom ports: android SDK.
Still to go: iOS SDK and desktop

This should allow you to run mobile apps that use flipper on different ports than the default (8089,8088).

`adb shell`
`su`
`setprop flipper.ports 1111,2222`

From what I can tell, this only works on rooted devices.

Reviewed By: passy

Differential Revision: D13753238

fbshipit-source-id: c5f370c9d8c7382e8c17fb81d4010c642ef7c114
This commit is contained in:
John Knox
2019-01-24 03:08:42 -08:00
committed by Facebook Github Bot
parent c68e74c6a0
commit 324a7ae873
9 changed files with 171 additions and 92 deletions

View File

@@ -1,9 +1,8 @@
/*
* Copyright (c) Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*/
#include <memory>
@@ -465,6 +464,8 @@ class JFlipperClient : public jni::HybridClass<JFlipperClient> {
jni::alias_ref<jclass>,
JEventBase* callbackWorker,
JEventBase* connectionWorker,
int insecurePort,
int securePort,
const std::string host,
const std::string os,
const std::string device,
@@ -472,20 +473,17 @@ class JFlipperClient : public jni::HybridClass<JFlipperClient> {
const std::string app,
const std::string appId,
const std::string privateAppDirectory) {
FlipperClient::init({
{
std::move(host),
std::move(os),
std::move(device),
std::move(deviceId),
std::move(app),
std::move(appId),
std::move(privateAppDirectory)
},
callbackWorker->eventBase(),
connectionWorker->eventBase()
});
FlipperClient::init({{std::move(host),
std::move(os),
std::move(device),
std::move(deviceId),
std::move(app),
std::move(appId),
std::move(privateAppDirectory)},
callbackWorker->eventBase(),
connectionWorker->eventBase(),
insecurePort,
securePort});
}
private: