Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f051f5a authored by Andrii Kulian's avatar Andrii Kulian
Browse files

Remember task which is being locked

We need to remember task which requested to be locked
because we can accidentally lock another task after
user interacts with pinning request dialog.

Bug: 27876860
Change-Id: Ie8e607df4380dd33ea9b3474afc247b02e31de07
parent 1feca76b
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -2575,9 +2575,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
        }

        case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
        case START_SYSTEM_LOCK_TASK_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            startLockTaskModeOnCurrent();
            int taskId = data.readInt();
            startSystemLockTaskMode(taskId);
            reply.writeNoException();
            return true;
        }
@@ -2589,9 +2590,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
        }

        case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
        case STOP_SYSTEM_LOCK_TASK_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            stopLockTaskModeOnCurrent();
            stopSystemLockTaskMode();
            reply.writeNoException();
            return true;
        }
@@ -6380,11 +6381,12 @@ class ActivityManagerProxy implements IActivityManager
    }

    @Override
    public void startLockTaskModeOnCurrent() throws RemoteException {
    public void startSystemLockTaskMode(int taskId) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
        data.writeInt(taskId);
        mRemote.transact(START_SYSTEM_LOCK_TASK_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
        reply.recycle();
@@ -6402,11 +6404,11 @@ class ActivityManagerProxy implements IActivityManager
    }

    @Override
    public void stopLockTaskModeOnCurrent() throws RemoteException {
    public void stopSystemLockTaskMode() throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
        mRemote.transact(STOP_SYSTEM_LOCK_TASK_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
        reply.recycle();
+4 −4
Original line number Diff line number Diff line
@@ -554,7 +554,7 @@ public interface IActivityManager extends IInterface {

    public int getActivityDisplayId(IBinder activityToken) throws RemoteException;

    public void startLockTaskModeOnCurrent() throws RemoteException;
    public void startSystemLockTaskMode(int taskId) throws RemoteException;

    public void startLockTaskMode(int taskId) throws RemoteException;

@@ -562,7 +562,7 @@ public interface IActivityManager extends IInterface {

    public void stopLockTaskMode() throws RemoteException;

    public void stopLockTaskModeOnCurrent() throws RemoteException;
    public void stopSystemLockTaskMode() throws RemoteException;

    public boolean isInLockTaskMode() throws RemoteException;

@@ -948,8 +948,8 @@ public interface IActivityManager extends IInterface {
    int START_VOICE_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+218;
    int GET_ACTIVITY_OPTIONS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+219;
    int GET_APP_TASKS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+220;
    int START_LOCK_TASK_BY_CURRENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+221;
    int STOP_LOCK_TASK_BY_CURRENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+222;
    int START_SYSTEM_LOCK_TASK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+221;
    int STOP_SYSTEM_LOCK_TASK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+222;
    int FINISH_VOICE_TASK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+223;
    int IS_TOP_OF_TASK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+224;
    int REQUEST_VISIBLE_BEHIND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+225;
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ oneway interface IStatusBar
    void toggleSplitScreen();
    void preloadRecentApps();
    void cancelPreloadRecentApps();
    void showScreenPinningRequest();
    void showScreenPinningRequest(int taskId);

    void toggleKeyboardShortcutsMenu(int deviceId);

+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ oneway interface IRecentsSystemUserCallbacks {
    void registerNonSystemUserCallbacks(IBinder nonSystemUserCallbacks, int userId);

    void updateRecentsVisibility(boolean visible);
    void startScreenPinning();
    void startScreenPinning(int taskId);
    void sendRecentsDrawnEvent();
    void sendDockingTopTaskEvent(int dragMode, in Rect initialRect);
    void sendLaunchRecentsEvent();
+2 −2
Original line number Diff line number Diff line
@@ -598,13 +598,13 @@ public class Recents extends SystemUI
    public final void onBusEvent(final ScreenPinningRequestEvent event) {
        int processUser = sSystemServicesProxy.getProcessUser();
        if (sSystemServicesProxy.isSystemUser(processUser)) {
            mImpl.onStartScreenPinning(event.applicationContext);
            mImpl.onStartScreenPinning(event.applicationContext, event.taskId);
        } else {
            postToSystemUser(new Runnable() {
                @Override
                public void run() {
                    try {
                        mUserToSystemCallbacks.startScreenPinning();
                        mUserToSystemCallbacks.startScreenPinning(event.taskId);
                    } catch (RemoteException e) {
                        Log.e(TAG, "Callback failed", e);
                    }
Loading