OSDN Git Service

Revert "4/ Update SysUI shared lib for Recents transition"
authorJorim Jaggi <jjaggi@google.com>
Thu, 25 Jan 2018 14:21:18 +0000 (15:21 +0100)
committerJorim Jaggi <jjaggi@google.com>
Thu, 25 Jan 2018 14:21:18 +0000 (15:21 +0100)
This reverts commit 9f6ba8df3b4c7706a054d3375469e913dbd499eb.

Breaks presubmits

packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
packages/SystemUI/shared/src/com/android/systemui/shared/system/AssistDataReceiverCompat.java [moved from packages/SystemUI/shared/src/com/android/systemui/shared/system/AssistDataReceiver.java with 80% similarity]
packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java [deleted file]
packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationListener.java [deleted file]
packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
packages/SystemUI/src/com/android/systemui/pip/phone/InputConsumerController.java [moved from packages/SystemUI/shared/src/com/android/systemui/shared/system/InputConsumerController.java with 70% similarity]
packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java

index da50776..cc4bc58 100644 (file)
@@ -29,9 +29,4 @@ interface ISystemUiProxy {
      */
     GraphicBufferCompat screenshot(in Rect sourceCrop, int width, int height, int minLayer,
             int maxLayer, boolean useIdentityTransform, int rotation);
-
-    /**
-     * Called when the overview service has started the recents animation.
-     */
-    void onRecentsAnimationStarted();
 }
index f9e1069..c9a6ea9 100644 (file)
@@ -32,7 +32,6 @@ import android.app.AppGlobals;
 import android.app.IAssistDataReceiver;
 import android.app.WindowConfiguration.ActivityType;
 import android.content.Context;
-import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
@@ -49,10 +48,7 @@ import android.os.RemoteException;
 import android.os.UserHandle;
 import android.util.IconDrawableFactory;
 import android.util.Log;
-import android.view.IRecentsAnimationController;
-import android.view.IRecentsAnimationRunner;
 
-import android.view.RemoteAnimationTarget;
 import com.android.systemui.shared.recents.model.Task;
 import com.android.systemui.shared.recents.model.Task.TaskKey;
 import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -247,9 +243,10 @@ public class ActivityManagerWrapper {
     /**
      * Starts the recents activity. The caller should manage the thread on which this is called.
      */
-    public void startRecentsActivity(Intent intent, AssistDataReceiver assistDataReceiver,
-            RecentsAnimationListener animationHandler, Consumer<Boolean> resultCallback,
+    public void startRecentsActivity(AssistDataReceiverCompat assistDataReceiver, Bundle options,
+            ActivityOptions opts, int userId, Consumer<Boolean> resultCallback,
             Handler resultCallbackHandler) {
+        Bundle activityOptions = opts != null ? opts.toBundle() : null;
         try {
             IAssistDataReceiver receiver = null;
             if (assistDataReceiver != null) {
@@ -262,24 +259,8 @@ public class ActivityManagerWrapper {
                     }
                 };
             }
-            IRecentsAnimationRunner runner = null;
-            if (animationHandler != null) {
-                runner = new IRecentsAnimationRunner.Stub() {
-                    public void onAnimationStart(IRecentsAnimationController controller,
-                            RemoteAnimationTarget[] apps) {
-                        final RecentsAnimationControllerCompat controllerCompat =
-                                new RecentsAnimationControllerCompat(controller);
-                        final RemoteAnimationTargetCompat[] appsCompat =
-                                RemoteAnimationTargetCompat.wrap(apps);
-                        animationHandler.onAnimationStart(controllerCompat, appsCompat);
-                    }
-
-                    public void onAnimationCanceled() {
-                        animationHandler.onAnimationCanceled();
-                    }
-                };
-            }
-            ActivityManager.getService().startRecentsActivity(intent, receiver, runner);
+            ActivityManager.getService().startRecentsActivity(receiver, options, activityOptions,
+                    userId);
             if (resultCallback != null) {
                 resultCallbackHandler.post(new Runnable() {
                     @Override
@@ -22,7 +22,7 @@ import android.os.Bundle;
 /**
  * Abstract class for assist data receivers.
  */
-public abstract class AssistDataReceiver {
-    public void onHandleAssistData(Bundle resultData) {}
-    public void onHandleAssistScreenshot(Bitmap screenshot) {}
+public abstract class AssistDataReceiverCompat {
+    public abstract void onHandleAssistData(Bundle resultData);
+    public abstract void onHandleAssistScreenshot(Bitmap screenshot);
 }
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java
deleted file mode 100644 (file)
index 9a7abf8..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2018 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 com.android.systemui.shared.system;
-
-import android.app.ActivityManager.TaskSnapshot;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.IRecentsAnimationController;
-
-import com.android.systemui.shared.recents.model.ThumbnailData;
-
-public class RecentsAnimationControllerCompat {
-
-    private static final String TAG = RecentsAnimationControllerCompat.class.getSimpleName();
-
-    private IRecentsAnimationController mAnimationController;
-
-    public RecentsAnimationControllerCompat(IRecentsAnimationController animationController) {
-        mAnimationController = animationController;
-    }
-
-    public ThumbnailData screenshotTask(int taskId) {
-        try {
-            TaskSnapshot snapshot = mAnimationController.screenshotTask(taskId);
-            return snapshot != null ? new ThumbnailData(snapshot) : new ThumbnailData();
-        } catch (RemoteException e) {
-            Log.e(TAG, "Failed to screenshot task", e);
-            return new ThumbnailData();
-        }
-    }
-
-    public void setInputConsumerEnabled(boolean enabled) {
-        try {
-            mAnimationController.setInputConsumerEnabled(enabled);
-        } catch (RemoteException e) {
-            Log.e(TAG, "Failed to set input consumer enabled state", e);
-        }
-    }
-
-    public void finish(boolean toHome) {
-        try {
-            mAnimationController.finish(toHome);
-        } catch (RemoteException e) {
-            Log.e(TAG, "Failed to finish recents animation", e);
-        }
-    }
-}
\ No newline at end of file
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationListener.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationListener.java
deleted file mode 100644 (file)
index bf6179d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2017 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 com.android.systemui.shared.system;
-
-public interface RecentsAnimationListener {
-
-    /**
-     * Called when the animation into Recents can start. This call is made on the binder thread.
-     */
-    void onAnimationStart(RecentsAnimationControllerCompat controller,
-            RemoteAnimationTargetCompat[] apps);
-
-    /**
-     * Called when the animation into Recents was canceled. This call is made on the binder thread.
-     */
-    void onAnimationCanceled();
-}
\ No newline at end of file
index b6e49ae..244c1b9 100644 (file)
@@ -77,15 +77,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
                 Binder.restoreCallingIdentity(token);
             }
         }
-
-        public void onRecentsAnimationStarted() {
-            long token = Binder.clearCallingIdentity();
-            try {
-                notifyRecentsAnimationStarted();
-            } finally {
-                Binder.restoreCallingIdentity(token);
-            }
-        }
     };
 
     private final BroadcastReceiver mLauncherAddedReceiver = new BroadcastReceiver() {
@@ -223,12 +214,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
         }
     }
 
-    private void notifyRecentsAnimationStarted() {
-        for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
-            mConnectionCallbacks.get(i).onRecentsAnimationStarted();
-        }
-    }
-
     @Override
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println(TAG_OPS + " state:");
@@ -239,7 +224,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
     }
 
     public interface OverviewProxyListener {
-        default void onConnectionChanged(boolean isConnected) {}
-        default void onRecentsAnimationStarted() {}
+        void onConnectionChanged(boolean isConnected);
     }
 }
  * limitations under the License.
  */
 
-package com.android.systemui.shared.system;
+package com.android.systemui.pip.phone;
 
 import static android.view.WindowManager.INPUT_CONSUMER_PIP;
-import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION;
 
 import android.os.Binder;
 import android.os.IBinder;
@@ -30,12 +29,11 @@ import android.view.InputChannel;
 import android.view.InputEvent;
 import android.view.IWindowManager;
 import android.view.MotionEvent;
-import android.view.WindowManagerGlobal;
 
 import java.io.PrintWriter;
 
 /**
- * Manages the input consumer that allows the SystemUI to directly receive touch input.
+ * Manages the input consumer that allows the SystemUI to control the PiP.
  */
 public class InputConsumerController {
 
@@ -57,12 +55,12 @@ public class InputConsumerController {
     }
 
     /**
-     * Input handler used for the input consumer. Input events are batched and consumed with the
+     * Input handler used for the PiP input consumer. Input events are batched and consumed with the
      * SurfaceFlinger vsync.
      */
-    private final class InputEventReceiver extends BatchedInputEventReceiver {
+    private final class PipInputEventReceiver extends BatchedInputEventReceiver {
 
-        public InputEventReceiver(InputChannel inputChannel, Looper looper) {
+        public PipInputEventReceiver(InputChannel inputChannel, Looper looper) {
             super(inputChannel, looper, Choreographer.getSfInstance());
         }
 
@@ -70,6 +68,7 @@ public class InputConsumerController {
         public void onInputEvent(InputEvent event, int displayId) {
             boolean handled = true;
             try {
+                // To be implemented for input handling over Pip windows
                 if (mListener != null && event instanceof MotionEvent) {
                     MotionEvent ev = (MotionEvent) event;
                     handled = mListener.onTouchEvent(ev);
@@ -82,35 +81,15 @@ public class InputConsumerController {
 
     private final IWindowManager mWindowManager;
     private final IBinder mToken;
-    private final String mName;
 
-    private InputEventReceiver mInputEventReceiver;
+    private PipInputEventReceiver mInputEventReceiver;
     private TouchListener mListener;
     private RegistrationListener mRegistrationListener;
 
-    /**
-     * @param name the name corresponding to the input consumer that is defined in the system.
-     */
-    public InputConsumerController(IWindowManager windowManager, String name) {
+    public InputConsumerController(IWindowManager windowManager) {
         mWindowManager = windowManager;
         mToken = new Binder();
-        mName = name;
-    }
-
-    /**
-     * @return A controller for the pip input consumer.
-     */
-    public static InputConsumerController getPipInputConsumer() {
-        return new InputConsumerController(WindowManagerGlobal.getWindowManagerService(),
-                INPUT_CONSUMER_PIP);
-    }
-
-    /**
-     * @return A controller for the recents animation input consumer.
-     */
-    public static InputConsumerController getRecentsAnimationInputConsumer() {
-        return new InputConsumerController(WindowManagerGlobal.getWindowManagerService(),
-                INPUT_CONSUMER_RECENTS_ANIMATION);
+        registerInputConsumer();
     }
 
     /**
@@ -146,12 +125,12 @@ public class InputConsumerController {
         if (mInputEventReceiver == null) {
             final InputChannel inputChannel = new InputChannel();
             try {
-                mWindowManager.destroyInputConsumer(mName);
-                mWindowManager.createInputConsumer(mToken, mName, inputChannel);
+                mWindowManager.destroyInputConsumer(INPUT_CONSUMER_PIP);
+                mWindowManager.createInputConsumer(mToken, INPUT_CONSUMER_PIP, inputChannel);
             } catch (RemoteException e) {
-                Log.e(TAG, "Failed to create input consumer", e);
+                Log.e(TAG, "Failed to create PIP input consumer", e);
             }
-            mInputEventReceiver = new InputEventReceiver(inputChannel, Looper.myLooper());
+            mInputEventReceiver = new PipInputEventReceiver(inputChannel, Looper.myLooper());
             if (mRegistrationListener != null) {
                 mRegistrationListener.onRegistrationChanged(true /* isRegistered */);
             }
@@ -164,9 +143,9 @@ public class InputConsumerController {
     public void unregisterInputConsumer() {
         if (mInputEventReceiver != null) {
             try {
-                mWindowManager.destroyInputConsumer(mName);
+                mWindowManager.destroyInputConsumer(INPUT_CONSUMER_PIP);
             } catch (RemoteException e) {
-                Log.e(TAG, "Failed to destroy input consumer", e);
+                Log.e(TAG, "Failed to destroy PIP input consumer", e);
             }
             mInputEventReceiver.dispose();
             mInputEventReceiver = null;
index 24d0126..36531bb 100644 (file)
 
 package com.android.systemui.pip.phone;
 
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
+import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
 import static android.view.Display.DEFAULT_DISPLAY;
-import static android.view.WindowManager.INPUT_CONSUMER_PIP;
 
 import android.app.ActivityManager;
+import android.app.ActivityManager.StackInfo;
 import android.app.IActivityManager;
 import android.content.ComponentName;
 import android.content.Context;
@@ -41,7 +43,6 @@ import com.android.systemui.recents.events.component.ExpandPipEvent;
 import com.android.systemui.recents.misc.SysUiTaskStackChangeListener;
 import com.android.systemui.recents.misc.SystemServicesProxy;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
-import com.android.systemui.shared.system.InputConsumerController;
 
 import java.io.PrintWriter;
 
@@ -173,8 +174,7 @@ public class PipManager implements BasePipManager {
         }
         ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener);
 
-        mInputConsumerController = InputConsumerController.getPipInputConsumer();
-        mInputConsumerController.registerInputConsumer();
+        mInputConsumerController = new InputConsumerController(mWindowManager);
         mMediaController = new PipMediaController(context, mActivityManager);
         mMenuController = new PipMenuActivityController(context, mActivityManager, mMediaController,
                 mInputConsumerController);
index 26fced3..9fb201b 100644 (file)
@@ -23,6 +23,7 @@ import android.app.ActivityManager.StackInfo;
 import android.app.ActivityOptions;
 import android.app.IActivityManager;
 import android.app.RemoteAction;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ParceledListSlice;
@@ -42,7 +43,6 @@ import com.android.systemui.pip.phone.PipMediaController.ActionListener;
 import com.android.systemui.recents.events.EventBus;
 import com.android.systemui.recents.events.component.HidePipMenuEvent;
 import com.android.systemui.recents.misc.ReferenceCountedTrigger;
-import com.android.systemui.shared.system.InputConsumerController;
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
index b253517..c0fed34 100644 (file)
@@ -46,7 +46,6 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.os.logging.MetricsLoggerWrapper;
 import com.android.internal.policy.PipSnapAlgorithm;
 import com.android.systemui.R;
-import com.android.systemui.shared.system.InputConsumerController;
 import com.android.systemui.statusbar.FlingAnimationUtils;
 
 import java.io.PrintWriter;
index 445fb24..9bef0ee 100644 (file)
@@ -104,7 +104,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
     private DeadZone mDeadZone;
     private final NavigationBarTransitions mBarTransitions;
     private final OverviewProxyService mOverviewProxyService;
-    private boolean mRecentsAnimationStarted;
 
     // workaround for LayoutTransitions leaving the nav buttons in a weird state (bug 5549288)
     final static boolean WORKAROUND_INVALID_LAYOUT = true;
@@ -206,18 +205,10 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
         }
     }
 
-    private final OverviewProxyListener mOverviewProxyListener = new OverviewProxyListener() {
-        @Override
-        public void onConnectionChanged(boolean isConnected) {
-            setSlippery(!isConnected);
-            setDisabledFlags(mDisabledFlags, true);
-            setUpSwipeUpOnboarding(isConnected);
-        }
-
-        @Override
-        public void onRecentsAnimationStarted() {
-            mRecentsAnimationStarted = true;
-        }
+    private final OverviewProxyListener mOverviewProxyListener = isConnected -> {
+        setSlippery(!isConnected);
+        setDisabledFlags(mDisabledFlags, true);
+        setUpSwipeUpOnboarding(isConnected);
     };
 
     public NavigationBarView(Context context, AttributeSet attrs) {
@@ -279,26 +270,12 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
         if (mGestureHelper.onTouchEvent(event)) {
             return true;
         }
-        return mRecentsAnimationStarted || super.onTouchEvent(event);
+        return super.onTouchEvent(event);
     }
 
     @Override
     public boolean onInterceptTouchEvent(MotionEvent event) {
-        int action = event.getActionMasked();
-        if (action == MotionEvent.ACTION_DOWN) {
-            mRecentsAnimationStarted = false;
-        } else if (action == MotionEvent.ACTION_UP) {
-            // If the overview proxy service has not started the recents animation then clean up
-            // after it to ensure that the nav bar buttons still work
-            if (mOverviewProxyService.getProxy() != null && !mRecentsAnimationStarted) {
-                try {
-                    ActivityManager.getService().cancelRecentsAnimation();
-                } catch (RemoteException e) {
-                    Log.e(TAG, "Could not cancel recents animation");
-                }
-            }
-        }
-        return mRecentsAnimationStarted || mGestureHelper.onInterceptTouchEvent(event);
+        return mGestureHelper.onInterceptTouchEvent(event);
     }
 
     public void abortCurrentGesture() {