Display and control your Android device
Remove unused rotation and fold listeners
Romain Vimonteac711ace68d
diff --git a/server/build_without_gradle.sh b/server/build_without_gradle.shindex d16592b4..e0b69aee 100755--- a/server/build_without_gradle.sh+++ b/server/build_without_gradle.sh@@ -47,10 +47,8 @@ EOFecho "Generating java from aidl..."cd "$SERVER_DIR/src/main/aidl"-"$BUILD_TOOLS_DIR/aidl" -o"$GEN_DIR" -I. android/view/IRotationWatcher.aidl"$BUILD_TOOLS_DIR/aidl" -o"$GEN_DIR" -I. \android/content/IOnPrimaryClipChangedListener.aidl-"$BUILD_TOOLS_DIR/aidl" -o"$GEN_DIR" -I. android/view/IDisplayFoldListener.aidl"$BUILD_TOOLS_DIR/aidl" -o"$GEN_DIR" -I. -p "$ANDROID_AIDL" \android/view/IDisplayWindowListener.aidldiff --git a/server/src/main/aidl/android/view/IDisplayFoldListener.aidl b/server/src/main/aidl/android/view/IDisplayFoldListener.aidldeleted file mode 100644index 2c91149d..00000000--- a/server/src/main/aidl/android/view/IDisplayFoldListener.aidl+++ /dev/null@@ -1,26 +0,0 @@-/*- * Copyright (C) 2019 The Android Open Source Project- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--package android.view;--/**- * {@hide}- */-oneway interface IDisplayFoldListener-{- /** Called when the foldedness of a display changes */- void onDisplayFoldChanged(int displayId, boolean folded);-}diff --git a/server/src/main/aidl/android/view/IRotationWatcher.aidl b/server/src/main/aidl/android/view/IRotationWatcher.aidldeleted file mode 100644index 2cc5e44a..00000000--- a/server/src/main/aidl/android/view/IRotationWatcher.aidl+++ /dev/null@@ -1,25 +0,0 @@-/* //device/java/android/android/hardware/ISensorListener.aidl-**-** Copyright 2008, The Android Open Source Project-**-** Licensed under the Apache License, Version 2.0 (the "License");-** you may not use this file except in compliance with the License.-** You may obtain a copy of the License at-**-** http://www.apache.org/licenses/LICENSE-2.0-**-** Unless required by applicable law or agreed to in writing, software-** distributed under the License is distributed on an "AS IS" BASIS,-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-** See the License for the specific language governing permissions and-** limitations under the License.-*/--package android.view;--/**- * {@hide}- */-interface IRotationWatcher {- oneway void onRotationChanged(int rotation);-}diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/WindowManager.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/WindowManager.javaindex 86dd83f2..04f5abd7 100644--- a/server/src/main/java/com/genymobile/scrcpy/wrappers/WindowManager.java+++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/WindowManager.java@@ -5,9 +5,7 @@ import com.genymobile.scrcpy.util.Ln;import android.annotation.TargetApi;import android.os.IInterface;-import android.view.IDisplayFoldListener;import android.view.IDisplayWindowListener;-import android.view.IRotationWatcher;import java.lang.reflect.Method;@@ -182,52 +180,6 @@ public final class WindowManager {}}- public void registerRotationWatcher(IRotationWatcher rotationWatcher, int displayId) {- try {- Class<?> cls = manager.getClass();- try {- // display parameter added since this commit:- // https://android.googlesource.com/platform/frameworks/base/+/35fa3c26adcb5f6577849fd0df5228b1f67cf2c6%5E%21/#F1- cls.getMethod("watchRotation", IRotationWatcher.class, int.class).invoke(manager, rotationWatcher, displayId);- } catch (NoSuchMethodException e) {- // old version- if (displayId != 0) {- Ln.e("Secondary display rotation not supported on this device");- return;- }- cls.getMethod("watchRotation", IRotationWatcher.class).invoke(manager, rotationWatcher);- }- } catch (Exception e) {- Ln.e("Could not register rotation watcher", e);- }- }-- public void unregisterRotationWatcher(IRotationWatcher rotationWatcher) {- try {- manager.getClass().getMethod("removeRotationWatcher", IRotationWatcher.class).invoke(manager, rotationWatcher);- } catch (Exception e) {- Ln.e("Could not unregister rotation watcher", e);- }- }-- @TargetApi(AndroidVersions.API_29_ANDROID_10)- public void registerDisplayFoldListener(IDisplayFoldListener foldListener) {- try {- manager.getClass().getMethod("registerDisplayFoldListener", IDisplayFoldListener.class).invoke(manager, foldListener);- } catch (Exception e) {- Ln.e("Could not register display fold listener", e);- }- }-- @TargetApi(AndroidVersions.API_29_ANDROID_10)- public void unregisterDisplayFoldListener(IDisplayFoldListener foldListener) {- try {- manager.getClass().getMethod("unregisterDisplayFoldListener", IDisplayFoldListener.class).invoke(manager, foldListener);- } catch (Exception e) {- Ln.e("Could not unregister display fold listener", e);- }- }-@TargetApi(AndroidVersions.API_30_ANDROID_11)public int[] registerDisplayWindowListener(IDisplayWindowListener listener) {try {