Loading core/java/android/app/ITaskStackListener.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ oneway interface ITaskStackListener { void onTaskStackChanged(); /** Called whenever an Activity is moved to the pinned stack from another stack. */ void onActivityPinned(String packageName); void onActivityPinned(String packageName, int taskId); /** Called whenever an Activity is moved from the pinned stack to another stack. */ void onActivityUnpinned(); Loading core/java/android/app/TaskStackListener.java +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub { } @Override public void onActivityPinned(String packageName) throws RemoteException { public void onActivityPinned(String packageName, int taskId) throws RemoteException { } @Override Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +26 −1 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ package com.android.systemui.pip.phone; import static android.app.ActivityManager.StackId.PINNED_STACK_ID; import static android.view.Display.DEFAULT_DISPLAY; import android.app.ActivityManager; import android.app.ActivityManager.StackInfo; import android.app.IActivityManager; import android.content.ComponentName; import android.content.Context; Loading @@ -33,6 +35,8 @@ import android.view.IWindowManager; import android.view.WindowManagerGlobal; import com.android.systemui.pip.BasePipManager; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.component.ExpandPipEvent; import com.android.systemui.recents.misc.SystemServicesProxy; import com.android.systemui.recents.misc.SystemServicesProxy.TaskStackListener; import com.android.systemui.statusbar.CommandQueue; Loading Loading @@ -65,7 +69,7 @@ public class PipManager implements BasePipManager { */ TaskStackListener mTaskStackListener = new TaskStackListener() { @Override public void onActivityPinned(String packageName) { public void onActivityPinned(String packageName, int taskId) { if (!checkCurrentUserId(false /* debug */)) { return; } Loading Loading @@ -186,6 +190,7 @@ public class PipManager implements BasePipManager { mInputConsumerController); mNotificationController = new PipNotificationController(context, mActivityManager, mTouchHandler.getMotionHelper()); EventBus.getDefault().register(this); } /** Loading @@ -195,6 +200,26 @@ public class PipManager implements BasePipManager { mTouchHandler.onConfigurationChanged(); } /** * Expands the PIP. */ public final void onBusEvent(ExpandPipEvent event) { if (event.clearThumbnailWindows) { try { StackInfo stackInfo = mActivityManager.getStackInfo(PINNED_STACK_ID); if (stackInfo != null && stackInfo.taskIds != null) { SystemServicesProxy ssp = SystemServicesProxy.getInstance(mContext); for (int taskId : stackInfo.taskIds) { ssp.cancelThumbnailTransition(taskId); } } } catch (RemoteException e) { // Do nothing } } mTouchHandler.getMotionHelper().expandPip(false /* skipAnimation */); } /** * Sent from KEYCODE_WINDOW handler in PhoneWindowManager, to request the menu to be shown. */ Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java +21 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,8 @@ import android.widget.LinearLayout; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.component.HidePipMenuEvent; import java.util.ArrayList; import java.util.Collections; Loading Loading @@ -231,6 +233,7 @@ public class PipMenuActivity extends Activity { super.onStop(); cancelDelayedFinish(); EventBus.getDefault().unregister(this); } @Override Loading Loading @@ -290,6 +293,19 @@ public class PipMenuActivity extends Activity { // Do nothing } public final void onBusEvent(HidePipMenuEvent event) { if (mMenuState != MENU_STATE_NONE) { // If the menu is visible in either the closed or full state, then hide the menu and // trigger the animation trigger afterwards event.getAnimationTrigger().increment(); hideMenu(() -> { mHandler.post(() -> { event.getAnimationTrigger().decrement(); }); }, true /* notifyMenuVisibility */); } } private void showMenu(int menuState, Rect stackBounds, Rect movementBounds, boolean allowMenuTimeout) { mAllowMenuTimeout = allowMenuTimeout; Loading Loading @@ -373,11 +389,16 @@ public class PipMenuActivity extends Activity { private void updateFromIntent(Intent intent) { mToControllerMessenger = intent.getParcelableExtra(EXTRA_CONTROLLER_MESSENGER); notifyActivityCallback(mMessenger); // Register for HidePipMenuEvents once we notify the controller of this activity EventBus.getDefault().register(this); ParceledListSlice actions = intent.getParcelableExtra(EXTRA_ACTIONS); if (actions != null) { mActions.clear(); mActions.addAll(actions.getList()); } final int menuState = intent.getIntExtra(EXTRA_MENU_STATE, MENU_STATE_NONE); if (menuState != MENU_STATE_NONE) { Rect stackBounds = intent.getParcelableExtra(EXTRA_STACK_BOUNDS); Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java +19 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ import android.util.Log; import android.view.IWindowManager; 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 java.io.PrintWriter; import java.util.ArrayList; Loading Loading @@ -119,6 +122,7 @@ public class PipMenuActivityController { // The dismiss fraction update is sent frequently, so use a temporary bundle for the message private Bundle mTmpDismissFractionData = new Bundle(); private ReferenceCountedTrigger mOnAttachDecrementTrigger; private boolean mStartActivityRequested; private Messenger mToActivityMessenger; private Messenger mMessenger = new Messenger(new Handler() { Loading Loading @@ -157,6 +161,10 @@ public class PipMenuActivityController { case MESSAGE_UPDATE_ACTIVITY_CALLBACK: { mToActivityMessenger = msg.replyTo; mStartActivityRequested = false; if (mOnAttachDecrementTrigger != null) { mOnAttachDecrementTrigger.decrement(); mOnAttachDecrementTrigger = null; } // Mark the menu as invisible once the activity finishes as well if (mToActivityMessenger == null) { onMenuStateChanged(MENU_STATE_NONE, true /* resize */); Loading @@ -181,6 +189,8 @@ public class PipMenuActivityController { mActivityManager = activityManager; mMediaController = mediaController; mInputConsumerController = inputConsumerController; EventBus.getDefault().register(this); } public void onActivityPinned() { Loading Loading @@ -435,6 +445,15 @@ public class PipMenuActivityController { mMenuState = menuState; } public final void onBusEvent(HidePipMenuEvent event) { if (mStartActivityRequested) { // If the menu has been start-requested, but not actually started, then we defer the // trigger callback until the menu has started and called back to the controller mOnAttachDecrementTrigger = event.getAnimationTrigger(); mOnAttachDecrementTrigger.increment(); } } public void dump(PrintWriter pw, String prefix) { final String innerPrefix = prefix + " "; pw.println(prefix + TAG); Loading Loading
core/java/android/app/ITaskStackListener.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ oneway interface ITaskStackListener { void onTaskStackChanged(); /** Called whenever an Activity is moved to the pinned stack from another stack. */ void onActivityPinned(String packageName); void onActivityPinned(String packageName, int taskId); /** Called whenever an Activity is moved from the pinned stack to another stack. */ void onActivityUnpinned(); Loading
core/java/android/app/TaskStackListener.java +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub { } @Override public void onActivityPinned(String packageName) throws RemoteException { public void onActivityPinned(String packageName, int taskId) throws RemoteException { } @Override Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +26 −1 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ package com.android.systemui.pip.phone; import static android.app.ActivityManager.StackId.PINNED_STACK_ID; import static android.view.Display.DEFAULT_DISPLAY; import android.app.ActivityManager; import android.app.ActivityManager.StackInfo; import android.app.IActivityManager; import android.content.ComponentName; import android.content.Context; Loading @@ -33,6 +35,8 @@ import android.view.IWindowManager; import android.view.WindowManagerGlobal; import com.android.systemui.pip.BasePipManager; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.component.ExpandPipEvent; import com.android.systemui.recents.misc.SystemServicesProxy; import com.android.systemui.recents.misc.SystemServicesProxy.TaskStackListener; import com.android.systemui.statusbar.CommandQueue; Loading Loading @@ -65,7 +69,7 @@ public class PipManager implements BasePipManager { */ TaskStackListener mTaskStackListener = new TaskStackListener() { @Override public void onActivityPinned(String packageName) { public void onActivityPinned(String packageName, int taskId) { if (!checkCurrentUserId(false /* debug */)) { return; } Loading Loading @@ -186,6 +190,7 @@ public class PipManager implements BasePipManager { mInputConsumerController); mNotificationController = new PipNotificationController(context, mActivityManager, mTouchHandler.getMotionHelper()); EventBus.getDefault().register(this); } /** Loading @@ -195,6 +200,26 @@ public class PipManager implements BasePipManager { mTouchHandler.onConfigurationChanged(); } /** * Expands the PIP. */ public final void onBusEvent(ExpandPipEvent event) { if (event.clearThumbnailWindows) { try { StackInfo stackInfo = mActivityManager.getStackInfo(PINNED_STACK_ID); if (stackInfo != null && stackInfo.taskIds != null) { SystemServicesProxy ssp = SystemServicesProxy.getInstance(mContext); for (int taskId : stackInfo.taskIds) { ssp.cancelThumbnailTransition(taskId); } } } catch (RemoteException e) { // Do nothing } } mTouchHandler.getMotionHelper().expandPip(false /* skipAnimation */); } /** * Sent from KEYCODE_WINDOW handler in PhoneWindowManager, to request the menu to be shown. */ Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java +21 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,8 @@ import android.widget.LinearLayout; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.component.HidePipMenuEvent; import java.util.ArrayList; import java.util.Collections; Loading Loading @@ -231,6 +233,7 @@ public class PipMenuActivity extends Activity { super.onStop(); cancelDelayedFinish(); EventBus.getDefault().unregister(this); } @Override Loading Loading @@ -290,6 +293,19 @@ public class PipMenuActivity extends Activity { // Do nothing } public final void onBusEvent(HidePipMenuEvent event) { if (mMenuState != MENU_STATE_NONE) { // If the menu is visible in either the closed or full state, then hide the menu and // trigger the animation trigger afterwards event.getAnimationTrigger().increment(); hideMenu(() -> { mHandler.post(() -> { event.getAnimationTrigger().decrement(); }); }, true /* notifyMenuVisibility */); } } private void showMenu(int menuState, Rect stackBounds, Rect movementBounds, boolean allowMenuTimeout) { mAllowMenuTimeout = allowMenuTimeout; Loading Loading @@ -373,11 +389,16 @@ public class PipMenuActivity extends Activity { private void updateFromIntent(Intent intent) { mToControllerMessenger = intent.getParcelableExtra(EXTRA_CONTROLLER_MESSENGER); notifyActivityCallback(mMessenger); // Register for HidePipMenuEvents once we notify the controller of this activity EventBus.getDefault().register(this); ParceledListSlice actions = intent.getParcelableExtra(EXTRA_ACTIONS); if (actions != null) { mActions.clear(); mActions.addAll(actions.getList()); } final int menuState = intent.getIntExtra(EXTRA_MENU_STATE, MENU_STATE_NONE); if (menuState != MENU_STATE_NONE) { Rect stackBounds = intent.getParcelableExtra(EXTRA_STACK_BOUNDS); Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java +19 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ import android.util.Log; import android.view.IWindowManager; 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 java.io.PrintWriter; import java.util.ArrayList; Loading Loading @@ -119,6 +122,7 @@ public class PipMenuActivityController { // The dismiss fraction update is sent frequently, so use a temporary bundle for the message private Bundle mTmpDismissFractionData = new Bundle(); private ReferenceCountedTrigger mOnAttachDecrementTrigger; private boolean mStartActivityRequested; private Messenger mToActivityMessenger; private Messenger mMessenger = new Messenger(new Handler() { Loading Loading @@ -157,6 +161,10 @@ public class PipMenuActivityController { case MESSAGE_UPDATE_ACTIVITY_CALLBACK: { mToActivityMessenger = msg.replyTo; mStartActivityRequested = false; if (mOnAttachDecrementTrigger != null) { mOnAttachDecrementTrigger.decrement(); mOnAttachDecrementTrigger = null; } // Mark the menu as invisible once the activity finishes as well if (mToActivityMessenger == null) { onMenuStateChanged(MENU_STATE_NONE, true /* resize */); Loading @@ -181,6 +189,8 @@ public class PipMenuActivityController { mActivityManager = activityManager; mMediaController = mediaController; mInputConsumerController = inputConsumerController; EventBus.getDefault().register(this); } public void onActivityPinned() { Loading Loading @@ -435,6 +445,15 @@ public class PipMenuActivityController { mMenuState = menuState; } public final void onBusEvent(HidePipMenuEvent event) { if (mStartActivityRequested) { // If the menu has been start-requested, but not actually started, then we defer the // trigger callback until the menu has started and called back to the controller mOnAttachDecrementTrigger = event.getAnimationTrigger(); mOnAttachDecrementTrigger.increment(); } } public void dump(PrintWriter pw, String prefix) { final String innerPrefix = prefix + " "; pw.println(prefix + TAG); Loading