android 11添加切换分屏功能

时间:2024-11-26 13:07:59
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index b6c6afd523b3..981bab3263e4 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -25,7 +25,10 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.Nullable; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.content.res.Configuration; import android.graphics.Matrix; import android.graphics.Rect; @@ -36,8 +39,10 @@ import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; import android.util.AttributeSet; +import android.util.Log; import android.util.Slog; import android.view.Display; +import android.view.GestureDetector; import android.view.MotionEvent; import android.view.PointerIcon; import android.view.SurfaceControl; @@ -55,6 +60,8 @@ import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; import android.widget.FrameLayout; +import android.window.WindowContainerTransaction; +import android.window.WindowOrganizer; import com.android.internal.graphics.SfVsyncFrameCallbackProvider; import com.android.internal.logging.MetricsLogger; @@ -77,6 +84,8 @@ public class DividerView extends FrameLayout implements OnTouchListener, OnComputeInternalInsetsListener { private static final String TAG = "DividerView"; private static final boolean DEBUG = Divider.DEBUG; + private GestureDetector mDoubleTapDetector; + boolean mToggleSplitScreen; public interface DividerCallbacks { void onDraggingStart(); @@ -175,6 +184,16 @@ public class DividerView extends FrameLayout implements OnTouchListener, private final Handler mHandler = new Handler(); + private static final String ACTION_TOGGLE_SPLIT_SCREEN = "action_toggle_split_screen"; + private BroadcastReceiver mToggleSplitScreenReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (intent.getAction().equals(ACTION_TOGGLE_SPLIT_SCREEN)){ + toggleSplitScreen("receive toggle_split_screen broadcast"); + } + } + };