diff options
6 files changed, 10 insertions, 70 deletions
diff --git a/config/preloaded-classes b/config/preloaded-classes index 881cfa335700..e43c7d42868c 100644 --- a/config/preloaded-classes +++ b/config/preloaded-classes @@ -417,9 +417,6 @@ android.app.INotificationManager android.app.IProcessObserver$Stub$Proxy android.app.IProcessObserver$Stub android.app.IProcessObserver -android.app.IRequestFinishCallback$Stub$Proxy -android.app.IRequestFinishCallback$Stub -android.app.IRequestFinishCallback android.app.ISearchManager$Stub$Proxy android.app.ISearchManager$Stub android.app.ISearchManager diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 107fb26357aa..4a982dd1a411 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -150,7 +150,6 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -3798,22 +3797,6 @@ public class Activity extends ContextThemeWrapper return false; } - private static final class RequestFinishCallback extends IRequestFinishCallback.Stub { - private final WeakReference<Activity> mActivityRef; - - RequestFinishCallback(WeakReference<Activity> activityRef) { - mActivityRef = activityRef; - } - - @Override - public void requestFinish() { - Activity activity = mActivityRef.get(); - if (activity != null) { - activity.mHandler.post(activity::finishAfterTransition); - } - } - } - /** * Called when the activity has detected the user's press of the back * key. The default implementation simply finishes the current activity, @@ -3837,9 +3820,8 @@ public class Activity extends ContextThemeWrapper try { // Inform activity task manager that the activity received a back press // while at the root of the task. This call allows ActivityTaskManager - // to intercept or defer finishing. - ActivityTaskManager.getService().onBackPressedOnTaskRoot(mToken, - new RequestFinishCallback(new WeakReference<>(this))); + // to intercept or move the task to the back. + ActivityTaskManager.getService().onBackPressedOnTaskRoot(mToken); } catch (RemoteException e) { finishAfterTransition(); } diff --git a/core/java/android/app/IActivityTaskManager.aidl b/core/java/android/app/IActivityTaskManager.aidl index f428b48bb51f..72a3637d8e07 100644 --- a/core/java/android/app/IActivityTaskManager.aidl +++ b/core/java/android/app/IActivityTaskManager.aidl @@ -26,7 +26,6 @@ import android.app.IAppTask; import android.app.IAssistDataReceiver; import android.app.IInstrumentationWatcher; import android.app.IProcessObserver; -import android.app.IRequestFinishCallback; import android.app.IServiceConnection; import android.app.IStopUserCallback; import android.app.ITaskStackListener; @@ -458,9 +457,7 @@ interface IActivityTaskManager { /** * Reports that an Activity received a back key press when there were no additional activities - * on the back stack. If the Activity should be finished, the callback will be invoked. A - * callback is used instead of finishing the activity directly from the server such that the - * client may perform actions prior to finishing. + * on the back stack. */ - void onBackPressedOnTaskRoot(in IBinder activityToken, in IRequestFinishCallback callback); + void onBackPressedOnTaskRoot(in IBinder activityToken); } diff --git a/core/java/android/app/IRequestFinishCallback.aidl b/core/java/android/app/IRequestFinishCallback.aidl deleted file mode 100644 index 3270565727d9..000000000000 --- a/core/java/android/app/IRequestFinishCallback.aidl +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2019 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 android.app; - -/** - * This callback allows ActivityTaskManager to ask the calling Activity - * to finish in response to a call to onBackPressedOnTaskRoot. - * - * {@hide} - */ -oneway interface IRequestFinishCallback { - void requestFinish(); -} diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 029b5547ae29..33bfaabb15ff 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -145,7 +145,6 @@ import android.app.IActivityTaskManager; import android.app.IApplicationThread; import android.app.IAssistDataReceiver; import android.app.INotificationManager; -import android.app.IRequestFinishCallback; import android.app.ITaskStackListener; import android.app.Notification; import android.app.NotificationManager; @@ -2464,7 +2463,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override - public void onBackPressedOnTaskRoot(IBinder token, IRequestFinishCallback callback) { + public void onBackPressedOnTaskRoot(IBinder token) { synchronized (mGlobalLock) { ActivityRecord r = ActivityRecord.isInStackLocked(token); if (r == null) { @@ -2478,18 +2477,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { // callback } else if (stack != null && (stack.isSingleTaskInstance())) { // Single-task stacks are used for activities which are presented in floating - // windows above full screen activities. Instead of directly finishing the - // task, a task change listener is used to notify SystemUI so the action can be - // handled specially. + // windows above full screen activities. A task change listener is used to notify + // SystemUI so the back action can be handled specially. final Task task = r.getTask(); mTaskChangeNotificationController .notifyBackPressedOnTaskRoot(task.getTaskInfo()); } else { - try { - callback.requestFinish(); - } catch (RemoteException e) { - Slog.e(TAG, "Failed to invoke request finish callback", e); - } + moveActivityTaskToBack(token, false /* nonRoot */); } } } diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowOrganizerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowOrganizerTests.java index bd52e9a294fc..800a5d42ce09 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowOrganizerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowOrganizerTests.java @@ -53,7 +53,6 @@ import static org.mockito.ArgumentMatchers.anyInt; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityManager.StackInfo; -import android.app.IRequestFinishCallback; import android.app.PictureInPictureParams; import android.content.pm.ActivityInfo; import android.content.res.Configuration; @@ -976,8 +975,7 @@ public class WindowOrganizerTests extends WindowTestsBase { assertTrue(stack.isOrganized()); // Verify a back pressed does not call the organizer - mWm.mAtmService.onBackPressedOnTaskRoot(activity.token, - new IRequestFinishCallback.Default()); + mWm.mAtmService.onBackPressedOnTaskRoot(activity.token); verify(organizer, never()).onBackPressedOnTaskRoot(any()); // Enable intercepting back @@ -985,8 +983,7 @@ public class WindowOrganizerTests extends WindowTestsBase { true); // Verify now that the back press does call the organizer - mWm.mAtmService.onBackPressedOnTaskRoot(activity.token, - new IRequestFinishCallback.Default()); + mWm.mAtmService.onBackPressedOnTaskRoot(activity.token); verify(organizer, times(1)).onBackPressedOnTaskRoot(any()); } |