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

Commit 5d6a218d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Dismiss docked stack if an activity is shown on top of the lock screen" into nyc-dev

parents b42afe9b 99732940
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1527,7 +1527,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM

        case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            setLockScreenShown(data.readInt() != 0);
            final boolean showing = data.readInt() != 0;
            final boolean occluded = data.readInt() != 0;
            setLockScreenShown(showing, occluded);
            reply.writeNoException();
            return true;
        }
@@ -4922,12 +4924,13 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
        return pfd;
    }
    public void setLockScreenShown(boolean shown) throws RemoteException
    public void setLockScreenShown(boolean showing, boolean occluded) throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(shown ? 1 : 0);
        data.writeInt(showing ? 1 : 0);
        data.writeInt(occluded ? 1 : 0);
        mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
+1 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ public interface IActivityManager extends IInterface {
    public void forceStopPackage(final String packageName, int userId) throws RemoteException;

    // Note: probably don't want to allow applications access to these.
    public void setLockScreenShown(boolean shown) throws RemoteException;
    public void setLockScreenShown(boolean showing, boolean occluded) throws RemoteException;

    public void unhandledBack() throws RemoteException;
    public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException;
+1 −1
Original line number Diff line number Diff line
@@ -1542,7 +1542,7 @@ public class KeyguardViewMediator extends SystemUI {

    private void updateActivityLockScreenState() {
        try {
            ActivityManagerNative.getDefault().setLockScreenShown(mShowing && !mOccluded);
            ActivityManagerNative.getDefault().setLockScreenShown(mShowing, mOccluded);
        } catch (RemoteException e) {
        }
    }
+12 −3
Original line number Diff line number Diff line
@@ -11476,7 +11476,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        mWindowManager.setEventDispatching(mBooted && !mShuttingDown);
    }
    public void setLockScreenShown(boolean shown) {
    public void setLockScreenShown(boolean showing, boolean occluded) {
        if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER)
                != PackageManager.PERMISSION_GRANTED) {
            throw new SecurityException("Requires permission "
@@ -11486,8 +11486,17 @@ public final class ActivityManagerService extends ActivityManagerNative
        synchronized(this) {
            long ident = Binder.clearCallingIdentity();
            try {
                if (DEBUG_LOCKSCREEN) logLockScreen(" shown=" + shown);
                mLockScreenShown = shown ? LOCK_SCREEN_SHOWN : LOCK_SCREEN_HIDDEN;
                if (DEBUG_LOCKSCREEN) logLockScreen(" showing=" + showing + " occluded=" + occluded);
                mLockScreenShown = (showing && !occluded) ? LOCK_SCREEN_SHOWN : LOCK_SCREEN_HIDDEN;
                if (showing && occluded) {
                    // The lock screen is currently showing, but is occluded by a window that can
                    // show on top of the lock screen. In this can we want to dismiss the docked
                    // stack since it will be complicated/risky to try to put the activity on top
                    // of the lock screen in the right fullscreen configuration.
                    mStackSupervisor.moveTasksToFullscreenStackLocked(DOCKED_STACK_ID,
                            mStackSupervisor.mFocusedStack.getStackId() == DOCKED_STACK_ID);
                }
                updateSleepIfNeededLocked();
            } finally {
                Binder.restoreCallingIdentity(ident);