Handle window movement/resize/close on our side and not in Android
This leads to much better performance and user interaction. Resizing still has some flickering but that is a different area of problems.
This commit is contained in:
parent
bd6e17ef70
commit
65531a3b82
17 changed files with 230 additions and 41 deletions
|
|
@ -31,5 +31,24 @@ status_t BpActivityManager::setFocusedTask(int32_t id) {
|
|||
return remote()->transact(IActivityManager::SET_FOCUSED_TASK, data, &reply);
|
||||
}
|
||||
|
||||
status_t BpActivityManager::removeTask(int32_t id) {
|
||||
Parcel data, reply;
|
||||
data.writeInterfaceToken(IActivityManager::getInterfaceDescriptor());
|
||||
data.writeInt32(id);
|
||||
return remote()->transact(IActivityManager::REMOVE_TASK, data, &reply);
|
||||
}
|
||||
|
||||
status_t BpActivityManager::resizeTask(int32_t id, const anbox::graphics::Rect &rect, int resize_mode) {
|
||||
Parcel data, reply;
|
||||
data.writeInterfaceToken(IActivityManager::getInterfaceDescriptor());
|
||||
data.writeInt32(id);
|
||||
data.writeInt32(resize_mode);
|
||||
data.writeInt32(rect.left());
|
||||
data.writeInt32(rect.top());
|
||||
data.writeInt32(rect.right());
|
||||
data.writeInt32(rect.bottom());
|
||||
return remote()->transact(IActivityManager::RESIZE_TASK, data, &reply);
|
||||
}
|
||||
|
||||
IMPLEMENT_META_INTERFACE(ActivityManager, "android.app.IActivityManager");
|
||||
} // namespace android
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
#include "anbox/graphics/rect.h"
|
||||
|
||||
namespace android {
|
||||
class IActivityManager : public IInterface {
|
||||
public:
|
||||
|
|
@ -35,9 +37,13 @@ public:
|
|||
enum {
|
||||
// This needs to stay synchronized with frameworks/base/core/java/android/app/IActivityManager.java
|
||||
SET_FOCUSED_TASK = IBinder::FIRST_CALL_TRANSACTION + 130,
|
||||
REMOVE_TASK = IBinder::FIRST_CALL_TRANSACTION + 131,
|
||||
RESIZE_TASK = IBinder::FIRST_CALL_TRANSACTION + 285,
|
||||
};
|
||||
|
||||
virtual status_t setFocusedTask(int32_t id) = 0;
|
||||
virtual status_t removeTask(int32_t id) = 0;
|
||||
virtual status_t resizeTask(int32_t id, const anbox::graphics::Rect &rect, int resize_mode) = 0;
|
||||
};
|
||||
|
||||
class BpActivityManager : public BpInterface<IActivityManager> {
|
||||
|
|
@ -45,6 +51,8 @@ public:
|
|||
BpActivityManager(const sp<IBinder> &binder);
|
||||
|
||||
status_t setFocusedTask(int32_t id) override;
|
||||
status_t removeTask(int32_t id) override;
|
||||
status_t resizeTask(int32_t id, const anbox::graphics::Rect &rect, int resize_mode);
|
||||
};
|
||||
} // namespace android
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -119,8 +119,6 @@ void AndroidApiSkeleton::launch_application(anbox::protobuf::bridge::LaunchAppli
|
|||
void AndroidApiSkeleton::set_focused_task(anbox::protobuf::bridge::SetFocusedTask const *request,
|
||||
anbox::protobuf::rpc::Void *response,
|
||||
google::protobuf::Closure *done) {
|
||||
(void) response;
|
||||
|
||||
connect_services();
|
||||
|
||||
if (activity_manager_.get())
|
||||
|
|
@ -130,4 +128,35 @@ void AndroidApiSkeleton::set_focused_task(anbox::protobuf::bridge::SetFocusedTas
|
|||
|
||||
done->Run();
|
||||
}
|
||||
|
||||
void AndroidApiSkeleton::remove_task(anbox::protobuf::bridge::RemoveTask const *request,
|
||||
anbox::protobuf::rpc::Void *response,
|
||||
google::protobuf::Closure *done) {
|
||||
connect_services();
|
||||
|
||||
if (activity_manager_.get())
|
||||
activity_manager_->removeTask(request->id());
|
||||
else
|
||||
response->set_error("ActivityManager is not available");
|
||||
|
||||
done->Run();
|
||||
|
||||
}
|
||||
|
||||
void AndroidApiSkeleton::resize_task(anbox::protobuf::bridge::ResizeTask const *request,
|
||||
anbox::protobuf::rpc::Void *response,
|
||||
google::protobuf::Closure *done) {
|
||||
connect_services();
|
||||
|
||||
if (activity_manager_.get()) {
|
||||
auto r = request->rect();
|
||||
activity_manager_->resizeTask(request->id(),
|
||||
anbox::graphics::Rect{r.left(), r.top(), r.right(), r.bottom()},
|
||||
request->resize_mode());
|
||||
} else {
|
||||
response->set_error("ActivityManager is not available");
|
||||
}
|
||||
|
||||
done->Run();
|
||||
}
|
||||
} // namespace anbox
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ class InstallApplication;
|
|||
class LaunchApplication;
|
||||
class SetDnsServers;
|
||||
class SetFocusedTask;
|
||||
class RemoveTask;
|
||||
class ResizeTask;
|
||||
} // namespace bridge
|
||||
namespace rpc {
|
||||
class Void;
|
||||
|
|
@ -57,6 +59,14 @@ public:
|
|||
anbox::protobuf::rpc::Void *response,
|
||||
google::protobuf::Closure *done);
|
||||
|
||||
void remove_task(anbox::protobuf::bridge::RemoveTask const *request,
|
||||
anbox::protobuf::rpc::Void *response,
|
||||
google::protobuf::Closure *done);
|
||||
|
||||
void resize_task(anbox::protobuf::bridge::ResizeTask const *request,
|
||||
anbox::protobuf::rpc::Void *response,
|
||||
google::protobuf::Closure *done);
|
||||
|
||||
private:
|
||||
void wait_for_process(core::posix::ChildProcess &process,
|
||||
anbox::protobuf::rpc::Void *response);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define LOG_TAG "Anboxd"
|
||||
|
||||
#include "android/service/message_processor.h"
|
||||
#include "android/service/android_api_skeleton.h"
|
||||
|
||||
|
|
@ -35,10 +37,14 @@ MessageProcessor::~MessageProcessor() {
|
|||
}
|
||||
|
||||
void MessageProcessor::dispatch(rpc::Invocation const& invocation) {
|
||||
if (invocation.method_name() == "launch_application")
|
||||
invoke(this, platform_api_.get(), &AndroidApiSkeleton::launch_application, invocation);
|
||||
else if (invocation.method_name() == "set_focused_task")
|
||||
invoke(this, platform_api_.get(), &AndroidApiSkeleton::set_focused_task, invocation);
|
||||
if (invocation.method_name() == "launch_application")
|
||||
invoke(this, platform_api_.get(), &AndroidApiSkeleton::launch_application, invocation);
|
||||
else if (invocation.method_name() == "set_focused_task")
|
||||
invoke(this, platform_api_.get(), &AndroidApiSkeleton::set_focused_task, invocation);
|
||||
else if (invocation.method_name() == "remove_task")
|
||||
invoke(this, platform_api_.get(), &AndroidApiSkeleton::remove_task, invocation);
|
||||
else if (invocation.method_name() == "resize_task")
|
||||
invoke(this, platform_api_.get(), &AndroidApiSkeleton::resize_task, invocation);
|
||||
}
|
||||
|
||||
void MessageProcessor::process_event_sequence(const std::string&) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue