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

Commit 18754ae4 authored by Vadim Caen's avatar Vadim Caen
Browse files

Flag and skeleton for the back predictability

Test: N/A
Bug: 131727607
Change-Id: I3d554414bccec8b18036974e6701605e0b5603df
parent 50936e9b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import android.os.StrictMode;
import android.os.WorkSource;
import android.service.voice.IVoiceInteractionSession;
import android.view.IRecentsAnimationRunner;
import android.view.IRemoteAnimationRunner;
import android.view.RemoteAnimationDefinition;
import android.view.RemoteAnimationAdapter;
import android.window.IWindowOrganizerController;
@@ -344,4 +345,9 @@ interface IActivityTaskManager {
     * @param caller is the IApplicationThread representing the calling process.
     */
    void setRunningRemoteTransitionDelegate(in IApplicationThread caller);

    /**
     * Prepare the back preview in the server
     */
    void startBackPreview(IRemoteAnimationRunner runner);
}
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.wm.shell.back;

import android.os.SystemProperties;
import android.view.IWindowManager;

import javax.inject.Inject;

/**
 * Handle the preview of what a back gesture will lead to.
 */
public class BackPreviewHandler {

    private static final String BACK_PREDICTABILITY_PROP = "persist.debug.back_predictability";

    public static boolean isEnabled() {
        return SystemProperties.getInt(BACK_PREDICTABILITY_PROP, 0) > 0;
    }

    private final IWindowManager mWmService;

    @Inject
    public BackPreviewHandler(IWindowManager windowManagerService) {
        mWmService = windowManagerService;
    }
}
+15 −0
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ import android.util.SparseArray;
import android.util.TimeUtils;
import android.util.proto.ProtoOutputStream;
import android.view.IRecentsAnimationRunner;
import android.view.IRemoteAnimationRunner;
import android.view.RemoteAnimationAdapter;
import android.view.RemoteAnimationDefinition;
import android.view.WindowManager;
@@ -455,6 +456,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    VrController mVrController;
    KeyguardController mKeyguardController;
    private final ClientLifecycleManager mLifecycleManager;

    @Nullable
    private final BackGestureController mBackGestureController;

    private TaskChangeNotificationController mTaskChangeNotificationController;
    /** The controller for all operations related to locktask. */
    private LockTaskController mLockTaskController;
@@ -814,6 +819,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        mSystemThread = ActivityThread.currentActivityThread();
        mUiContext = mSystemThread.getSystemUiContext();
        mLifecycleManager = new ClientLifecycleManager();
        mBackGestureController = BackGestureController.isEnabled() ? new BackGestureController()
                : null;
        mVisibleActivityProcessTracker = new VisibleActivityProcessTracker(this);
        mInternal = new LocalService();
        GL_ES_VERSION = SystemProperties.getInt("ro.opengles.version", GL_ES_VERSION_UNDEFINED);
@@ -1747,6 +1754,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        }
    }

    @Override
    public void startBackPreview(IRemoteAnimationRunner runner) {
        if (mBackGestureController == null) {
            return;
        }
        mBackGestureController.startBackPreview();
    }

    /**
     * Public API to check if the client is allowed to start an activity on specified display.
     *
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.wm;

import android.os.SystemProperties;

/**
 * Controller to handle actions related to the back gesture on the server side.
 */
public class BackGestureController {

    private static final String BACK_PREDICTABILITY_PROP = "persist.debug.back_predictability";

    public static boolean isEnabled() {
        return SystemProperties.getInt(BACK_PREDICTABILITY_PROP, 0) > 0;
    }

    /**
     * Start a remote animation the back gesture.
     */
    public void startBackPreview() {
    }
}