Merge "Fix potential NPE when ActivityClientRecord is null" am: f47829a8eb

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2336783

Change-Id: I1c6968b21c25a525d680d31b74755a9a26b43839
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Louis Chang
2022-12-16 14:46:57 +00:00
committed by Automerger Merge Worker

View File

@@ -31,6 +31,7 @@ import android.app.ActivityThread.ActivityClientRecord;
import android.app.ClientTransactionHandler;
import android.os.IBinder;
import android.util.IntArray;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
@@ -43,6 +44,7 @@ import java.util.List;
* @hide
*/
public class TransactionExecutorHelper {
private static final String TAG = TransactionExecutorHelper.class.getSimpleName();
// A penalty applied to path with destruction when looking for the shortest one.
private static final int DESTRUCTION_PENALTY = 10;
@@ -162,6 +164,11 @@ public class TransactionExecutorHelper {
if (finalStates == null || finalStates.length == 0) {
return UNDEFINED;
}
if (r == null) {
// Early return because the ActivityClientRecord hasn't been created or cannot be found.
Log.w(TAG, "ActivityClientRecord was null");
return UNDEFINED;
}
final int currentState = r.getLifecycleState();
int closestState = UNDEFINED;