summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/servertransaction/BaseClientRequest.java15
-rw-r--r--core/java/android/app/servertransaction/ClientTransactionItem.java11
-rw-r--r--core/java/android/app/servertransaction/ObjectPool.java54
-rw-r--r--core/java/android/app/servertransaction/ObjectPoolItem.java37
-rw-r--r--core/java/android/app/servertransaction/TransactionExecutor.java1
-rw-r--r--core/java/android/app/servertransaction/TransactionExecutorHelper.java2
-rw-r--r--core/java/android/app/servertransaction/WindowContextWindowRemovalItem.java31
-rw-r--r--core/tests/coretests/src/android/app/servertransaction/ClientTransactionItemTest.java4
-rw-r--r--core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java4
-rw-r--r--services/core/java/com/android/server/wm/WindowContextListenerController.java2
10 files changed, 21 insertions, 140 deletions
diff --git a/core/java/android/app/servertransaction/BaseClientRequest.java b/core/java/android/app/servertransaction/BaseClientRequest.java
index f2751752abd8..bcbb51480821 100644
--- a/core/java/android/app/servertransaction/BaseClientRequest.java
+++ b/core/java/android/app/servertransaction/BaseClientRequest.java
@@ -22,31 +22,34 @@ import android.app.ClientTransactionHandler;
/**
* Base interface for individual requests from server to client.
* Each of them can be prepared before scheduling and, eventually, executed.
+ *
* @hide
*/
-public interface BaseClientRequest extends ObjectPoolItem {
+public interface BaseClientRequest {
/**
* Prepares the client request before scheduling.
* An example of this might be informing about pending updates for some values.
*
- * @param client Target client handler.
+ * @param client target client handler.
*/
default void preExecute(@NonNull ClientTransactionHandler client) {
}
/**
* Executes the request.
- * @param client Target client handler.
- * @param pendingActions Container that may have data pending to be used.
+ *
+ * @param client target client handler.
+ * @param pendingActions container that may have data pending to be used.
*/
void execute(@NonNull ClientTransactionHandler client,
@NonNull PendingTransactionActions pendingActions);
/**
* Performs all actions that need to happen after execution, e.g. report the result to server.
- * @param client Target client handler.
- * @param pendingActions Container that may have data pending to be used.
+ *
+ * @param client target client handler.
+ * @param pendingActions container that may have data pending to be used.
*/
default void postExecute(@NonNull ClientTransactionHandler client,
@NonNull PendingTransactionActions pendingActions) {
diff --git a/core/java/android/app/servertransaction/ClientTransactionItem.java b/core/java/android/app/servertransaction/ClientTransactionItem.java
index 2d35bf104657..99ebe1b975a4 100644
--- a/core/java/android/app/servertransaction/ClientTransactionItem.java
+++ b/core/java/android/app/servertransaction/ClientTransactionItem.java
@@ -75,17 +75,6 @@ public abstract class ClientTransactionItem implements BaseClientRequest, Parcel
pw.append(prefix).println(this);
}
- /**
- * Provides a default empty implementation for progressive cleanup.
- *
- * @deprecated This method is deprecated. The object pool is no longer used, so there's
- * no need to recycle objects.
- * TODO(b/311089192): Remove once ObjectPoolItem inheritance is removed.
- */
- @Override
- @Deprecated
- public void recycle() {}
-
// Parcelable
@Override
diff --git a/core/java/android/app/servertransaction/ObjectPool.java b/core/java/android/app/servertransaction/ObjectPool.java
deleted file mode 100644
index e86ca37b99ca..000000000000
--- a/core/java/android/app/servertransaction/ObjectPool.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2017 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.servertransaction;
-
-/**
- * An object pool that can provide reused objects if available.
- *
- * @hide
- * @deprecated This class is deprecated. Directly create new instances of objects instead of
- * obtaining them from this pool.
- * TODO(b/311089192): Clean up usages of the pool.
- */
-@Deprecated
-class ObjectPool {
-
- /**
- * Obtain an instance of a specific class from the pool
- *
- * @param ignoredItemClass The class of the object we're looking for.
- * @return An instance or null if there is none.
- * @deprecated This method is deprecated. Directly create new instances of objects instead of
- * obtaining them from this pool.
- */
- @Deprecated
- public static <T extends ObjectPoolItem> T obtain(Class<T> ignoredItemClass) {
- return null;
- }
-
- /**
- * Recycle the object to the pool. The object should be properly cleared before this.
- *
- * @param ignoredItem The object to recycle.
- * @see ObjectPoolItem#recycle()
- * @deprecated This method is deprecated. The object pool is no longer used, so there's
- * no need to recycle objects.
- */
- @Deprecated
- public static <T extends ObjectPoolItem> void recycle(T ignoredItem) {
- }
-}
diff --git a/core/java/android/app/servertransaction/ObjectPoolItem.java b/core/java/android/app/servertransaction/ObjectPoolItem.java
deleted file mode 100644
index 0141f6eff53b..000000000000
--- a/core/java/android/app/servertransaction/ObjectPoolItem.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2017 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.servertransaction;
-
-/**
- * Base interface for all lifecycle items that can be put in object pool.
- *
- * @hide
- * @deprecated This interface is deprecated. Objects should no longer be pooled.
- * TODO(b/311089192): Clean up usages of this interface.
- */
-@Deprecated
-public interface ObjectPoolItem {
- /**
- * Clear the contents of the item and putting it to a pool. The implementation should call
- * {@link ObjectPool#recycle(ObjectPoolItem)} passing itself.
- *
- * @deprecated This method is deprecated. The object pool is no longer used, so there's
- * no need to recycle objects.
- */
- @Deprecated
- void recycle();
-}
diff --git a/core/java/android/app/servertransaction/TransactionExecutor.java b/core/java/android/app/servertransaction/TransactionExecutor.java
index 68012e235f97..3a23e6b1b0a6 100644
--- a/core/java/android/app/servertransaction/TransactionExecutor.java
+++ b/core/java/android/app/servertransaction/TransactionExecutor.java
@@ -45,6 +45,7 @@ import java.util.List;
/**
* Class that manages transaction execution in the correct order.
+ *
* @hide
*/
public class TransactionExecutor {
diff --git a/core/java/android/app/servertransaction/TransactionExecutorHelper.java b/core/java/android/app/servertransaction/TransactionExecutorHelper.java
index c44ada7a31da..785fa59a2c13 100644
--- a/core/java/android/app/servertransaction/TransactionExecutorHelper.java
+++ b/core/java/android/app/servertransaction/TransactionExecutorHelper.java
@@ -55,7 +55,7 @@ public class TransactionExecutorHelper {
// Temp holder for lifecycle path.
// No direct transition between two states should take more than one complete cycle of 6 states.
@ActivityLifecycleItem.LifecycleState
- private IntArray mLifecycleSequence = new IntArray(6);
+ private final IntArray mLifecycleSequence = new IntArray(6 /* initialCapacity */);
/**
* Calculate the path through main lifecycle states for an activity and fill
diff --git a/core/java/android/app/servertransaction/WindowContextWindowRemovalItem.java b/core/java/android/app/servertransaction/WindowContextWindowRemovalItem.java
index 1bea4682928a..76b39d5ba1d9 100644
--- a/core/java/android/app/servertransaction/WindowContextWindowRemovalItem.java
+++ b/core/java/android/app/servertransaction/WindowContextWindowRemovalItem.java
@@ -28,12 +28,17 @@ import java.util.Objects;
/**
* {@link android.window.WindowContext} window removal message.
+ *
* @hide
*/
public class WindowContextWindowRemovalItem extends ClientTransactionItem {
- @Nullable
- private IBinder mClientToken;
+ @NonNull
+ private final IBinder mClientToken;
+
+ public WindowContextWindowRemovalItem(@NonNull IBinder clientToken) {
+ mClientToken = requireNonNull(clientToken);
+ }
@Override
public void execute(@NonNull ClientTransactionHandler client,
@@ -41,28 +46,6 @@ public class WindowContextWindowRemovalItem extends ClientTransactionItem {
client.handleWindowContextWindowRemoval(mClientToken);
}
- // ObjectPoolItem implementation
-
- private WindowContextWindowRemovalItem() {}
-
- /** Obtains an instance initialized with provided params. */
- public static WindowContextWindowRemovalItem obtain(@NonNull IBinder clientToken) {
- WindowContextWindowRemovalItem instance =
- ObjectPool.obtain(WindowContextWindowRemovalItem.class);
- if (instance == null) {
- instance = new WindowContextWindowRemovalItem();
- }
- instance.mClientToken = requireNonNull(clientToken);
-
- return instance;
- }
-
- @Override
- public void recycle() {
- mClientToken = null;
- ObjectPool.recycle(this);
- }
-
// Parcelable implementation
/** Writes to Parcel. */
diff --git a/core/tests/coretests/src/android/app/servertransaction/ClientTransactionItemTest.java b/core/tests/coretests/src/android/app/servertransaction/ClientTransactionItemTest.java
index 96d4cf460e6c..f023196250e5 100644
--- a/core/tests/coretests/src/android/app/servertransaction/ClientTransactionItemTest.java
+++ b/core/tests/coretests/src/android/app/servertransaction/ClientTransactionItemTest.java
@@ -185,8 +185,8 @@ public class ClientTransactionItemTest {
@Test
public void testWindowContextWindowRemovalItem_execute() {
- final WindowContextWindowRemovalItem item = WindowContextWindowRemovalItem.obtain(
- mWindowClientToken);
+ final WindowContextWindowRemovalItem item =
+ new WindowContextWindowRemovalItem(mWindowClientToken);
item.execute(mHandler, mPendingActions);
diff --git a/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java b/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java
index c2d56b65e95e..76a53d48229e 100644
--- a/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java
+++ b/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java
@@ -525,10 +525,6 @@ public class TransactionExecutorTests {
}
@Override
- public void recycle() {
- }
-
- @Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
}
diff --git a/services/core/java/com/android/server/wm/WindowContextListenerController.java b/services/core/java/com/android/server/wm/WindowContextListenerController.java
index e98b1a259aa9..87e120c9a15d 100644
--- a/services/core/java/com/android/server/wm/WindowContextListenerController.java
+++ b/services/core/java/com/android/server/wm/WindowContextListenerController.java
@@ -356,7 +356,7 @@ class WindowContextListenerController {
}
}
mDeathRecipient.unlinkToDeath();
- mWpc.scheduleClientTransactionItem(WindowContextWindowRemovalItem.obtain(mClientToken));
+ mWpc.scheduleClientTransactionItem(new WindowContextWindowRemovalItem(mClientToken));
unregister();
}