mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Merge pull request #2 from lmichaelwar/copilot/update-code-based-on-review-comments
Address code review feedback on virtual display desktop mode fix
This commit is contained in:
commit
25d5778d6f
2 changed files with 22 additions and 12 deletions
|
|
@ -188,8 +188,7 @@ public class NewDisplayCapture extends SurfaceCapture {
|
|||
| VIRTUAL_DISPLAY_FLAG_TOUCH_FEEDBACK_DISABLED;
|
||||
if (Build.VERSION.SDK_INT >= AndroidVersions.API_34_ANDROID_14) {
|
||||
flags |= VIRTUAL_DISPLAY_FLAG_OWN_FOCUS
|
||||
| VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP
|
||||
| VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS;
|
||||
| VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP;
|
||||
}
|
||||
}
|
||||
virtualDisplay = ServiceManager.getDisplayManager()
|
||||
|
|
|
|||
|
|
@ -283,23 +283,34 @@ public final class WindowManager {
|
|||
@TargetApi(AndroidVersions.API_34_ANDROID_14)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setDisplayWindowingMode(int displayId, int windowingMode) {
|
||||
// A Binder token used to identify this organizer during registration/unregistration with the system server
|
||||
IBinder organizerBinder = new Binder();
|
||||
// A Binder token with the correct AIDL interface descriptor, so that any system server
|
||||
// callbacks during registration are properly identified and silently handled
|
||||
IBinder organizerBinder = new Binder() {
|
||||
{
|
||||
attachInterface(null, "android.window.IDisplayAreaOrganizer");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags)
|
||||
throws android.os.RemoteException {
|
||||
if (super.onTransact(code, data, reply, flags)) {
|
||||
return true;
|
||||
}
|
||||
// Silently accept any organizer callback transactions
|
||||
return true;
|
||||
}
|
||||
};
|
||||
Object organizerProxy = null;
|
||||
Object daoController = null;
|
||||
try {
|
||||
// Get the IWindowOrganizerController
|
||||
Class<?> serviceManagerClass = Class.forName("android.os.ServiceManager");
|
||||
Method getServiceMethod = serviceManagerClass.getDeclaredMethod("getService", String.class);
|
||||
IBinder wocBinder = (IBinder) getServiceMethod.invoke(null, "window_organizer");
|
||||
if (wocBinder == null) {
|
||||
// Get the IWindowOrganizerController via ServiceManager
|
||||
IInterface windowOrganizerController = ServiceManager.getService("window_organizer",
|
||||
"android.window.IWindowOrganizerController");
|
||||
if (windowOrganizerController == null) {
|
||||
Ln.w("window_organizer service not available");
|
||||
return;
|
||||
}
|
||||
|
||||
Class<?> iWocStubClass = Class.forName("android.window.IWindowOrganizerController$Stub");
|
||||
Object windowOrganizerController = iWocStubClass.getDeclaredMethod("asInterface", IBinder.class).invoke(null, wocBinder);
|
||||
|
||||
// Get the IDisplayAreaOrganizerController
|
||||
daoController = windowOrganizerController.getClass().getMethod("getDisplayAreaOrganizerController").invoke(windowOrganizerController);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue