Loading core/java/android/app/Activity.java +9 −0 Original line number Diff line number Diff line Loading @@ -2760,6 +2760,15 @@ public class Activity extends ContextThemeWrapper ActivityManagerNative.getDefault().setActivityBounds(mToken, newBounds); } /** * Activates this activity, hence bringing it to the top and giving it focus. * Note: This will only work for activities which are located on the freeform desktop. * @hide */ public void activateActivity() throws RemoteException { ActivityManagerNative.getDefault().activateActivity(mToken); } /** * 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 core/java/android/app/ActivityManagerNative.java +21 −1 Original line number Diff line number Diff line Loading @@ -827,10 +827,18 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case ACTIVATE_ACTIVITY_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); activateActivity(token); reply.writeNoException(); return true; } case SET_FOCUSED_TASK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int taskId = data.readInt(); setFocusedStack(taskId); setFocusedTask(taskId); reply.writeNoException(); return true; } Loading Loading @@ -3623,6 +3631,18 @@ class ActivityManagerProxy implements IActivityManager return focusedStackId; } @Override public void activateActivity(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); mRemote.transact(ACTIVATE_ACTIVITY_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); } @Override public void setFocusedTask(int taskId) throws RemoteException { Parcel data = Parcel.obtain(); Loading core/java/android/app/IActivityManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ public interface IActivityManager extends IInterface { public boolean isInHomeStack(int taskId) throws RemoteException; public void setFocusedStack(int stackId) throws RemoteException; public int getFocusedStackId() throws RemoteException; public void activateActivity(IBinder token) throws RemoteException; public void setFocusedTask(int taskId) throws RemoteException; public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException; public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException; Loading Loading @@ -892,4 +893,5 @@ public interface IActivityManager extends IInterface { 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; int ACTIVATE_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 348; } core/java/android/view/Window.java +5 −0 Original line number Diff line number Diff line Loading @@ -510,6 +510,11 @@ public abstract class Window { * @param newBounds The new target bounds of the activity in task or stack. */ void setActivityBounds(Rect newBounds) throws RemoteException; /** * Activates this activity, hence bringing it to the top and giving it focus. */ void activateActivity() throws RemoteException; } public Window(Context context) { Loading core/java/com/android/internal/widget/NonClientDecorView.java +16 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,8 @@ public class NonClientDecorView extends LinearLayout implements View.OnClickList // When there is no decor we should not react to anything. return false; } // Ensure that the activity is active. activateActivity(); // A drag action is started if we aren't dragging already and the starting event is // either a left mouse button or any other input device. if (!mDragging && Loading Loading @@ -346,4 +348,18 @@ public class NonClientDecorView extends LinearLayout implements View.OnClickList } } } /** * Activates the activity - means setting the focus and moving it to the top of the stack. */ private void activateActivity() { Window.WindowControllerCallback callback = mOwner.getWindowControllerCallback(); if (callback != null) { try { callback.activateActivity(); } catch (RemoteException ex) { Log.e(TAG, "Failed to activate the activity."); } } } } Loading
core/java/android/app/Activity.java +9 −0 Original line number Diff line number Diff line Loading @@ -2760,6 +2760,15 @@ public class Activity extends ContextThemeWrapper ActivityManagerNative.getDefault().setActivityBounds(mToken, newBounds); } /** * Activates this activity, hence bringing it to the top and giving it focus. * Note: This will only work for activities which are located on the freeform desktop. * @hide */ public void activateActivity() throws RemoteException { ActivityManagerNative.getDefault().activateActivity(mToken); } /** * 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
core/java/android/app/ActivityManagerNative.java +21 −1 Original line number Diff line number Diff line Loading @@ -827,10 +827,18 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case ACTIVATE_ACTIVITY_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); activateActivity(token); reply.writeNoException(); return true; } case SET_FOCUSED_TASK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int taskId = data.readInt(); setFocusedStack(taskId); setFocusedTask(taskId); reply.writeNoException(); return true; } Loading Loading @@ -3623,6 +3631,18 @@ class ActivityManagerProxy implements IActivityManager return focusedStackId; } @Override public void activateActivity(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); mRemote.transact(ACTIVATE_ACTIVITY_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); } @Override public void setFocusedTask(int taskId) throws RemoteException { Parcel data = Parcel.obtain(); Loading
core/java/android/app/IActivityManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ public interface IActivityManager extends IInterface { public boolean isInHomeStack(int taskId) throws RemoteException; public void setFocusedStack(int stackId) throws RemoteException; public int getFocusedStackId() throws RemoteException; public void activateActivity(IBinder token) throws RemoteException; public void setFocusedTask(int taskId) throws RemoteException; public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException; public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException; Loading Loading @@ -892,4 +893,5 @@ public interface IActivityManager extends IInterface { 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; int ACTIVATE_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 348; }
core/java/android/view/Window.java +5 −0 Original line number Diff line number Diff line Loading @@ -510,6 +510,11 @@ public abstract class Window { * @param newBounds The new target bounds of the activity in task or stack. */ void setActivityBounds(Rect newBounds) throws RemoteException; /** * Activates this activity, hence bringing it to the top and giving it focus. */ void activateActivity() throws RemoteException; } public Window(Context context) { Loading
core/java/com/android/internal/widget/NonClientDecorView.java +16 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,8 @@ public class NonClientDecorView extends LinearLayout implements View.OnClickList // When there is no decor we should not react to anything. return false; } // Ensure that the activity is active. activateActivity(); // A drag action is started if we aren't dragging already and the starting event is // either a left mouse button or any other input device. if (!mDragging && Loading Loading @@ -346,4 +348,18 @@ public class NonClientDecorView extends LinearLayout implements View.OnClickList } } } /** * Activates the activity - means setting the focus and moving it to the top of the stack. */ private void activateActivity() { Window.WindowControllerCallback callback = mOwner.getWindowControllerCallback(); if (callback != null) { try { callback.activateActivity(); } catch (RemoteException ex) { Log.e(TAG, "Failed to activate the activity."); } } } }