Loading core/java/android/app/Activity.java +31 −4 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ import android.transition.Scene; import android.transition.TransitionManager; import android.util.ArrayMap; import android.util.SuperNotCalledException; import android.view.Window.WindowStackCallback; import android.view.Window.WindowControllerCallback; import android.widget.Toolbar; import com.android.internal.app.IVoiceInteractor; Loading Loading @@ -60,6 +60,7 @@ import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.graphics.Rect; import android.media.AudioManager; import android.media.session.MediaController; import android.net.Uri; Loading Loading @@ -673,7 +674,7 @@ public class Activity extends ContextThemeWrapper implements LayoutInflater.Factory2, Window.Callback, KeyEvent.Callback, OnCreateContextMenuListener, ComponentCallbacks2, Window.OnWindowDismissedCallback, WindowStackCallback { Window.OnWindowDismissedCallback, WindowControllerCallback { private static final String TAG = "Activity"; private static final boolean DEBUG_LIFECYCLE = false; Loading Loading @@ -2712,7 +2713,8 @@ public class Activity extends ContextThemeWrapper } /** Called to move the window and its activity/task to a different stack container. /** * Called to move the window and its activity/task to a different stack container. * For example, a window can move between * {@link android.app.ActivityManager#FULLSCREEN_WORKSPACE_STACK_ID} stack and * {@link android.app.ActivityManager#FREEFORM_WORKSPACE_STACK_ID} stack. Loading @@ -2733,6 +2735,31 @@ public class Activity extends ContextThemeWrapper return ActivityManagerNative.getDefault().getActivityStackId(mToken); } /** * Returns the bounds of the task that contains this activity. * * @return Rect The bounds that contains the activity. * @hide */ @Override public Rect getActivityBounds() throws RemoteException { return ActivityManagerNative.getDefault().getActivityBounds(mToken); } /** * Sets the bounds (size and position) of the task or stack that contains this * activity. * NOTE: The requested bounds might not the fully honored by the system depending * on the window placement policy. * * @param newBounds The new target bounds of the activity in task or stack. * @hide */ @Override public void setActivityBounds(Rect newBounds) throws RemoteException { ActivityManagerNative.getDefault().setActivityBounds(mToken, newBounds); } /** * Called to process key events. You can override this to intercept all * key events before they are dispatched to the window. Be sure to call Loading Loading @@ -6211,7 +6238,7 @@ public class Activity extends ContextThemeWrapper mFragments.attachHost(null /*parent*/); mWindow = new PhoneWindow(this); mWindow.setWindowStackCallback(this); mWindow.setWindowControllerCallback(this); mWindow.setCallback(this); mWindow.setOnWindowDismissedCallback(this); mWindow.getLayoutInflater().setPrivateFactory(this); Loading core/java/android/app/ActivityManagerNative.java +47 −0 Original line number Diff line number Diff line Loading @@ -752,6 +752,24 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case GET_ACTIVITY_BOUNDS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); Rect r = getActivityBounds(token); reply.writeNoException(); r.writeToParcel(reply, 0); return true; } case SET_ACTIVITY_BOUNDS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); Rect r = Rect.CREATOR.createFromParcel(data); setActivityBounds(token, r); reply.writeNoException(); return true; } case POSITION_TASK_IN_STACK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int taskId = data.readInt(); Loading Loading @@ -5902,6 +5920,35 @@ class ActivityManagerProxy implements IActivityManager return rect; } @Override public void setActivityBounds(IBinder token, Rect r) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); r.writeToParcel(data, 0); mRemote.transact(SET_ACTIVITY_BOUNDS_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); } @Override public Rect getActivityBounds(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); mRemote.transact(GET_ACTIVITY_BOUNDS_TRANSACTION, data, reply, 0); reply.readException(); Rect rect = Rect.CREATOR.createFromParcel(reply); data.recycle(); reply.recycle(); return rect; } @Override public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException { Parcel data = Parcel.obtain(); Loading core/java/android/app/IActivityManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -490,6 +490,9 @@ public interface IActivityManager extends IInterface { throws RemoteException; public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException; public void resizeTask(int taskId, Rect bounds) throws RemoteException; public void setActivityBounds(IBinder token, Rect bounds) throws RemoteException; public Rect getActivityBounds(IBinder token) throws RemoteException; public Rect getTaskBounds(int taskId) throws RemoteException; public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException; Loading Loading @@ -887,4 +890,6 @@ public interface IActivityManager extends IInterface { int GET_ACTIVITY_STACK_ID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 343; int MOVE_ACTIVITY_TO_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 344; int REPORT_SIZE_CONFIGURATIONS = IBinder.FIRST_CALL_TRANSACTION + 345; int GET_ACTIVITY_BOUNDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 346; int SET_ACTIVITY_BOUNDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 347; } core/java/android/view/Window.java +27 −8 Original line number Diff line number Diff line Loading @@ -28,8 +28,9 @@ import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; import android.graphics.PixelFormat; import android.graphics.Rect; import android.media.session.MediaController; import android.net.Uri; import android.os.Bundle; Loading Loading @@ -183,7 +184,7 @@ public abstract class Window { private TypedArray mWindowStyle; private Callback mCallback; private OnWindowDismissedCallback mOnWindowDismissedCallback; private WindowStackCallback mWindowStackCallback; private WindowControllerCallback mWindowControllerCallback; private WindowManager mWindowManager; private IBinder mAppToken; private String mAppName; Loading Loading @@ -479,8 +480,9 @@ public abstract class Window { } /** @hide */ public interface WindowStackCallback { /** Called to move the window and its activity/task to a different stack container. public interface WindowControllerCallback { /** * Called to move the window and its activity/task to a different stack container. * For example, a window can move between * {@link android.app.ActivityManager#FULLSCREEN_WORKSPACE_STACK_ID} stack and * {@link android.app.ActivityManager#FREEFORM_WORKSPACE_STACK_ID} stack. Loading @@ -491,6 +493,23 @@ public abstract class Window { /** Returns the current stack Id for the window. */ int getWindowStackId() throws RemoteException; /** * Returns the bounds of the task that contains this activity. * * @return Rect The bounds that contains the activity. */ Rect getActivityBounds() throws RemoteException; /** * Sets the bounds (size and position) of the task or stack that contains this * activity. * NOTE: The requested bounds might not the fully honored by the system depending * on the window placement policy. * * @param newBounds The new target bounds of the activity in task or stack. */ void setActivityBounds(Rect newBounds) throws RemoteException; } public Window(Context context) { Loading Loading @@ -682,13 +701,13 @@ public abstract class Window { } /** @hide */ public final void setWindowStackCallback(WindowStackCallback wscb) { mWindowStackCallback = wscb; public final void setWindowControllerCallback(WindowControllerCallback wccb) { mWindowControllerCallback = wccb; } /** @hide */ public final WindowStackCallback getWindowStackCallback() { return mWindowStackCallback; public final WindowControllerCallback getWindowControllerCallback() { return mWindowControllerCallback; } /** Loading core/java/com/android/internal/policy/PhoneWindow.java +1 −1 Original line number Diff line number Diff line Loading @@ -5199,7 +5199,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { **/ private int getWorkspaceId() { int workspaceId = FULLSCREEN_WORKSPACE_STACK_ID; WindowStackCallback callback = getWindowStackCallback(); WindowControllerCallback callback = getWindowControllerCallback(); if (callback != null) { try { workspaceId = callback.getWindowStackId(); Loading Loading
core/java/android/app/Activity.java +31 −4 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ import android.transition.Scene; import android.transition.TransitionManager; import android.util.ArrayMap; import android.util.SuperNotCalledException; import android.view.Window.WindowStackCallback; import android.view.Window.WindowControllerCallback; import android.widget.Toolbar; import com.android.internal.app.IVoiceInteractor; Loading Loading @@ -60,6 +60,7 @@ import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.graphics.Rect; import android.media.AudioManager; import android.media.session.MediaController; import android.net.Uri; Loading Loading @@ -673,7 +674,7 @@ public class Activity extends ContextThemeWrapper implements LayoutInflater.Factory2, Window.Callback, KeyEvent.Callback, OnCreateContextMenuListener, ComponentCallbacks2, Window.OnWindowDismissedCallback, WindowStackCallback { Window.OnWindowDismissedCallback, WindowControllerCallback { private static final String TAG = "Activity"; private static final boolean DEBUG_LIFECYCLE = false; Loading Loading @@ -2712,7 +2713,8 @@ public class Activity extends ContextThemeWrapper } /** Called to move the window and its activity/task to a different stack container. /** * Called to move the window and its activity/task to a different stack container. * For example, a window can move between * {@link android.app.ActivityManager#FULLSCREEN_WORKSPACE_STACK_ID} stack and * {@link android.app.ActivityManager#FREEFORM_WORKSPACE_STACK_ID} stack. Loading @@ -2733,6 +2735,31 @@ public class Activity extends ContextThemeWrapper return ActivityManagerNative.getDefault().getActivityStackId(mToken); } /** * Returns the bounds of the task that contains this activity. * * @return Rect The bounds that contains the activity. * @hide */ @Override public Rect getActivityBounds() throws RemoteException { return ActivityManagerNative.getDefault().getActivityBounds(mToken); } /** * Sets the bounds (size and position) of the task or stack that contains this * activity. * NOTE: The requested bounds might not the fully honored by the system depending * on the window placement policy. * * @param newBounds The new target bounds of the activity in task or stack. * @hide */ @Override public void setActivityBounds(Rect newBounds) throws RemoteException { ActivityManagerNative.getDefault().setActivityBounds(mToken, newBounds); } /** * Called to process key events. You can override this to intercept all * key events before they are dispatched to the window. Be sure to call Loading Loading @@ -6211,7 +6238,7 @@ public class Activity extends ContextThemeWrapper mFragments.attachHost(null /*parent*/); mWindow = new PhoneWindow(this); mWindow.setWindowStackCallback(this); mWindow.setWindowControllerCallback(this); mWindow.setCallback(this); mWindow.setOnWindowDismissedCallback(this); mWindow.getLayoutInflater().setPrivateFactory(this); Loading
core/java/android/app/ActivityManagerNative.java +47 −0 Original line number Diff line number Diff line Loading @@ -752,6 +752,24 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case GET_ACTIVITY_BOUNDS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); Rect r = getActivityBounds(token); reply.writeNoException(); r.writeToParcel(reply, 0); return true; } case SET_ACTIVITY_BOUNDS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); Rect r = Rect.CREATOR.createFromParcel(data); setActivityBounds(token, r); reply.writeNoException(); return true; } case POSITION_TASK_IN_STACK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int taskId = data.readInt(); Loading Loading @@ -5902,6 +5920,35 @@ class ActivityManagerProxy implements IActivityManager return rect; } @Override public void setActivityBounds(IBinder token, Rect r) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); r.writeToParcel(data, 0); mRemote.transact(SET_ACTIVITY_BOUNDS_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); } @Override public Rect getActivityBounds(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); mRemote.transact(GET_ACTIVITY_BOUNDS_TRANSACTION, data, reply, 0); reply.readException(); Rect rect = Rect.CREATOR.createFromParcel(reply); data.recycle(); reply.recycle(); return rect; } @Override public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException { Parcel data = Parcel.obtain(); Loading
core/java/android/app/IActivityManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -490,6 +490,9 @@ public interface IActivityManager extends IInterface { throws RemoteException; public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException; public void resizeTask(int taskId, Rect bounds) throws RemoteException; public void setActivityBounds(IBinder token, Rect bounds) throws RemoteException; public Rect getActivityBounds(IBinder token) throws RemoteException; public Rect getTaskBounds(int taskId) throws RemoteException; public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException; Loading Loading @@ -887,4 +890,6 @@ public interface IActivityManager extends IInterface { int GET_ACTIVITY_STACK_ID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 343; int MOVE_ACTIVITY_TO_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 344; int REPORT_SIZE_CONFIGURATIONS = IBinder.FIRST_CALL_TRANSACTION + 345; int GET_ACTIVITY_BOUNDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 346; int SET_ACTIVITY_BOUNDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 347; }
core/java/android/view/Window.java +27 −8 Original line number Diff line number Diff line Loading @@ -28,8 +28,9 @@ import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; import android.graphics.PixelFormat; import android.graphics.Rect; import android.media.session.MediaController; import android.net.Uri; import android.os.Bundle; Loading Loading @@ -183,7 +184,7 @@ public abstract class Window { private TypedArray mWindowStyle; private Callback mCallback; private OnWindowDismissedCallback mOnWindowDismissedCallback; private WindowStackCallback mWindowStackCallback; private WindowControllerCallback mWindowControllerCallback; private WindowManager mWindowManager; private IBinder mAppToken; private String mAppName; Loading Loading @@ -479,8 +480,9 @@ public abstract class Window { } /** @hide */ public interface WindowStackCallback { /** Called to move the window and its activity/task to a different stack container. public interface WindowControllerCallback { /** * Called to move the window and its activity/task to a different stack container. * For example, a window can move between * {@link android.app.ActivityManager#FULLSCREEN_WORKSPACE_STACK_ID} stack and * {@link android.app.ActivityManager#FREEFORM_WORKSPACE_STACK_ID} stack. Loading @@ -491,6 +493,23 @@ public abstract class Window { /** Returns the current stack Id for the window. */ int getWindowStackId() throws RemoteException; /** * Returns the bounds of the task that contains this activity. * * @return Rect The bounds that contains the activity. */ Rect getActivityBounds() throws RemoteException; /** * Sets the bounds (size and position) of the task or stack that contains this * activity. * NOTE: The requested bounds might not the fully honored by the system depending * on the window placement policy. * * @param newBounds The new target bounds of the activity in task or stack. */ void setActivityBounds(Rect newBounds) throws RemoteException; } public Window(Context context) { Loading Loading @@ -682,13 +701,13 @@ public abstract class Window { } /** @hide */ public final void setWindowStackCallback(WindowStackCallback wscb) { mWindowStackCallback = wscb; public final void setWindowControllerCallback(WindowControllerCallback wccb) { mWindowControllerCallback = wccb; } /** @hide */ public final WindowStackCallback getWindowStackCallback() { return mWindowStackCallback; public final WindowControllerCallback getWindowControllerCallback() { return mWindowControllerCallback; } /** Loading
core/java/com/android/internal/policy/PhoneWindow.java +1 −1 Original line number Diff line number Diff line Loading @@ -5199,7 +5199,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { **/ private int getWorkspaceId() { int workspaceId = FULLSCREEN_WORKSPACE_STACK_ID; WindowStackCallback callback = getWindowStackCallback(); WindowControllerCallback callback = getWindowControllerCallback(); if (callback != null) { try { workspaceId = callback.getWindowStackId(); Loading