diff options
| author | 2025-01-15 17:28:03 -0800 | |
|---|---|---|
| committer | 2025-01-15 17:28:03 -0800 | |
| commit | 81705f172d64410191e6fb51ec6983021384b51d (patch) | |
| tree | 1d97a470e2f360daaf9bc727c29f767ea98ebff8 | |
| parent | 4057dd1bff7239033e3fd37a18c7396b969c8fde (diff) | |
| parent | ad4ff82c49fca9db9f7a6b6bd6d5b8702977ab36 (diff) | |
Merge "surfacecontrol: mark mCalls Nullable & fix missing null checks" into main
| -rw-r--r-- | core/java/android/view/SurfaceControl.java | 7 | ||||
| -rw-r--r-- | core/java/android/view/SurfaceControlRegistry.java | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index d7cf3e827695..311fbee2fc4b 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -3026,6 +3026,7 @@ public final class SurfaceControl implements Parcelable { // Only non-null if the SurfaceControlRegistry is enabled. This list tracks the set of calls // made through this transaction object, and is dumped (and cleared) when the transaction is // later applied. + @Nullable ArrayList<String> mCalls; Runnable mFreeNativeResources; @@ -4898,8 +4899,10 @@ public final class SurfaceControl implements Parcelable { SurfaceControlRegistry.getProcessInstance().checkCallStackDebugging( "merge", this, null, "otherTx=" + other.getId()); if (mCalls != null) { - mCalls.addAll(other.mCalls); - other.mCalls.clear(); + if (other.mCalls != null) { + mCalls.addAll(other.mCalls); + other.mCalls.clear(); + } } } mResizedSurfaces.putAll(other.mResizedSurfaces); diff --git a/core/java/android/view/SurfaceControlRegistry.java b/core/java/android/view/SurfaceControlRegistry.java index 121c01be7294..0b528bffe5c5 100644 --- a/core/java/android/view/SurfaceControlRegistry.java +++ b/core/java/android/view/SurfaceControlRegistry.java @@ -334,13 +334,17 @@ public class SurfaceControlRegistry { if (call == APPLY) { // Log the apply and dump the calls on that transaction Log.e(TAG, msg, new Throwable()); - for (int i = 0; i < tx.mCalls.size(); i++) { - Log.d(TAG, " " + tx.mCalls.get(i)); + if (tx.mCalls != null) { + for (int i = 0; i < tx.mCalls.size(); i++) { + Log.d(TAG, " " + tx.mCalls.get(i)); + } } } else if (matchesForCallStackDebugging(sc != null ? sc.getName() : null, call)) { // Otherwise log this call to the transaction if it matches the tracked calls Log.e(TAG, msg, new Throwable()); - tx.mCalls.add(msg); + if (tx.mCalls != null) { + tx.mCalls.add(msg); + } } } else { // Log this call if it matches the tracked calls |