Merge "[nfc test] Add test coverage for RoutingTableEntry." into main
diff --git a/MEMORY_OWNERS b/MEMORY_OWNERS
index 89ce5140..12aa295 100644
--- a/MEMORY_OWNERS
+++ b/MEMORY_OWNERS
@@ -2,5 +2,4 @@
 tjmercier@google.com
 kaleshsingh@google.com
 jyescas@google.com
-carlosgalo@google.com
 jji@google.com
diff --git a/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java
index c775280..ed669be 100644
--- a/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java
@@ -63,12 +63,14 @@
 
     @Test
     @Parameters(method = "getData")
-    public void timeZipFileOpenClose(int numEntries) throws Exception {
+    public void timeZipFileOpen(int numEntries) throws Exception {
         setUp(numEntries);
         BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
         while (state.keepRunning()) {
             ZipFile zf = new ZipFile(mFile);
+            state.pauseTiming();
             zf.close();
+            state.resumeTiming();
         }
     }
 
diff --git a/api/api.go b/api/api.go
index aa89c24..b8f30a242 100644
--- a/api/api.go
+++ b/api/api.go
@@ -103,7 +103,7 @@
 
 func (a *CombinedApis) GenerateAndroidBuildActions(ctx android.ModuleContext) {
 	ctx.WalkDeps(func(child, parent android.Module) bool {
-		if _, ok := child.(java.AndroidLibraryDependency); ok && child.Name() != "framework-res" {
+		if _, ok := android.OtherModuleProvider(ctx, child, java.AndroidLibraryInfoProvider); ok && child.Name() != "framework-res" {
 			// Stubs of BCP and SSCP libraries should not have any dependencies on apps
 			// This check ensures that we do not run into circular dependencies when UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true
 			ctx.ModuleErrorf(
diff --git a/core/java/android/content/pm/flags.aconfig b/core/java/android/content/pm/flags.aconfig
index b541d86..609377e 100644
--- a/core/java/android/content/pm/flags.aconfig
+++ b/core/java/android/content/pm/flags.aconfig
@@ -152,7 +152,7 @@
     name: "cache_sdk_system_features"
     namespace: "system_performance"
     description: "Feature flag to enable optimized cache for SDK-defined system feature lookups."
-    bug: "375000483"
+    bug: "326623529"
 }
 
 flag {
diff --git a/core/java/android/net/thread/flags.aconfig b/core/java/android/net/thread/flags.aconfig
index afb982b..100d50d 100644
--- a/core/java/android/net/thread/flags.aconfig
+++ b/core/java/android/net/thread/flags.aconfig
@@ -17,5 +17,5 @@
     is_exported: true
     namespace: "thread_network"
     description: "Controls whether the Android Thread feature is enabled"
-    bug: "301473012"
+    bug: "384596973"
 }
diff --git a/core/java/android/os/OWNERS b/core/java/android/os/OWNERS
index f3bb514..727dcba 100644
--- a/core/java/android/os/OWNERS
+++ b/core/java/android/os/OWNERS
@@ -4,6 +4,8 @@
 
 # PowerManager
 per-file IPowerManager.aidl = file:/services/core/java/com/android/server/power/OWNERS
+per-file IScreenTimeoutPolicyListener.aidl = file:/services/core/java/com/android/server/power/OWNERS
+per-file IWakeLockCallback.aidl = file:/services/core/java/com/android/server/power/OWNERS
 per-file PowerManager.java = file:/services/core/java/com/android/server/power/OWNERS
 per-file PowerManagerInternal.java = file:/services/core/java/com/android/server/power/OWNERS
 
diff --git a/core/java/android/view/contentcapture/OWNERS b/core/java/android/view/contentcapture/OWNERS
index 9ac273f..30f4cae 100644
--- a/core/java/android/view/contentcapture/OWNERS
+++ b/core/java/android/view/contentcapture/OWNERS
@@ -1,4 +1,5 @@
 # Bug component: 544200
 
-hackz@google.com
-shivanker@google.com
+dariofreni@google.com
+klikli@google.com
+shikhamalhotra@google.com
diff --git a/core/java/com/android/internal/util/LATENCY_TRACKER_OWNERS b/core/java/com/android/internal/util/LATENCY_TRACKER_OWNERS
index 7755000..3ed902f 100644
--- a/core/java/com/android/internal/util/LATENCY_TRACKER_OWNERS
+++ b/core/java/com/android/internal/util/LATENCY_TRACKER_OWNERS
@@ -1,3 +1,5 @@
 # TODO(b/274465475): Migrate LatencyTracker testing to its own module
 marcinoc@google.com
 ilkos@google.com
+jjaggi@google.com
+nicomazz@google.com
diff --git a/libs/protoutil/Android.bp b/libs/protoutil/Android.bp
index 28856c8..a59149c 100644
--- a/libs/protoutil/Android.bp
+++ b/libs/protoutil/Android.bp
@@ -59,7 +59,6 @@
     apex_available: [
         "//apex_available:platform",
         "com.android.os.statsd",
-        "test_com.android.os.statsd",
     ],
 }
 
diff --git a/media/java/android/media/FadeManagerConfiguration.java b/media/java/android/media/FadeManagerConfiguration.java
index 6d84e70..b91a5b5 100644
--- a/media/java/android/media/FadeManagerConfiguration.java
+++ b/media/java/android/media/FadeManagerConfiguration.java
@@ -673,6 +673,7 @@
         return config != null ? config.getDuration() : DURATION_NOT_SET;
     }
 
+    @Nullable
     private VolumeShaper.Configuration getVolumeShaperConfigFromWrapper(
             FadeVolumeShaperConfigsWrapper wrapper, boolean isFadeIn) {
         // if no volume shaper config is available, return null
diff --git a/nfc/tests/src/android/nfc/NfcManagerTest.java b/nfc/tests/src/android/nfc/NfcManagerTest.java
new file mode 100644
index 0000000..06314cc
--- /dev/null
+++ b/nfc/tests/src/android/nfc/NfcManagerTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2024 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.nfc;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import com.android.dx.mockito.inline.extended.ExtendedMockito;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.MockitoSession;
+import org.mockito.quality.Strictness;
+
+@RunWith(AndroidJUnit4.class)
+public class NfcManagerTest {
+
+    private MockitoSession mMockitoSession;
+    private NfcManager mNfcManager;
+    @Mock
+    private Context mContext;
+
+    @Before
+    public void setUp() {
+        mMockitoSession = ExtendedMockito.mockitoSession()
+                .mockStatic(NfcAdapter.class)
+                .strictness(Strictness.LENIENT)
+                .startMocking();
+        MockitoAnnotations.initMocks(this);
+
+        when(NfcAdapter.getNfcAdapter(any())).thenReturn(mock(NfcAdapter.class));
+        when(mContext.getApplicationContext()).thenReturn(mContext);
+        mNfcManager = new NfcManager(mContext);
+    }
+
+    @After
+    public void tearDown() {
+        mMockitoSession.finishMocking();
+    }
+
+    @Test
+    public void testGetDefaultAdapter() {
+        NfcAdapter nfcAdapter = mNfcManager.getDefaultAdapter();
+        assertThat(nfcAdapter).isNotNull();
+    }
+}
diff --git a/nfc/tests/src/android/nfc/cardemulation/CardemulationTest.java b/nfc/tests/src/android/nfc/cardemulation/CardemulationTest.java
new file mode 100644
index 0000000..a215835
--- /dev/null
+++ b/nfc/tests/src/android/nfc/cardemulation/CardemulationTest.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2024 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.nfc.cardemulation;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.app.role.RoleManager;
+import android.content.ComponentName;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.nfc.Constants;
+import android.nfc.INfcCardEmulation;
+import android.nfc.NfcAdapter;
+import android.os.RemoteException;
+import android.os.UserHandle;
+import android.provider.Settings;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import com.android.dx.mockito.inline.extended.ExtendedMockito;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.MockitoSession;
+import org.mockito.quality.Strictness;
+
+@RunWith(AndroidJUnit4.class)
+public class CardemulationTest {
+
+    private CardEmulation mCardEmulation;
+    @Mock
+    private Context mContext;
+    @Mock
+    private INfcCardEmulation mINfcCardEmulation;
+    @Mock
+    private NfcAdapter mNfcAdapter;
+    @Mock
+    private PackageManager mPackageManager;
+    private MockitoSession mMockitoSession;
+
+    @Before
+    public void setUp() {
+        mMockitoSession = ExtendedMockito.mockitoSession()
+                .mockStatic(NfcAdapter.class)
+                .mockStatic(Settings.Secure.class)
+                .strictness(Strictness.LENIENT)
+                .startMocking();
+        MockitoAnnotations.initMocks(this);
+
+        when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION))
+                .thenReturn(true);
+        when(mContext.getApplicationContext()).thenReturn(mContext);
+        when(mContext.getPackageManager()).thenReturn(mPackageManager);
+        assertThat(mNfcAdapter).isNotNull();
+        when(mNfcAdapter.getCardEmulationService()).thenReturn(mINfcCardEmulation);
+        when(mNfcAdapter.getContext()).thenReturn(mContext);
+        mCardEmulation = CardEmulation.getInstance(mNfcAdapter);
+    }
+
+    @After
+    public void tearDown() {
+        mMockitoSession.finishMocking();
+    }
+
+    @Test
+    public void testIsDefaultServiceForCategory() throws RemoteException {
+        ComponentName componentName = mock(ComponentName.class);
+        UserHandle userHandle = mock(UserHandle.class);
+        when(userHandle.getIdentifier()).thenReturn(1);
+        when(mContext.getUser()).thenReturn(userHandle);
+        when(mINfcCardEmulation.isDefaultServiceForCategory(1, componentName,
+                "payment")).thenReturn(true);
+        boolean result = mCardEmulation.isDefaultServiceForCategory(componentName,
+                "payment");
+        assertThat(result).isTrue();
+        verify(mINfcCardEmulation).isDefaultServiceForCategory(1, componentName,
+                "payment");
+
+    }
+
+    @Test
+    public void testIsDefaultServiceForAid() throws RemoteException {
+        ComponentName componentName = mock(ComponentName.class);
+        UserHandle userHandle = mock(UserHandle.class);
+        when(userHandle.getIdentifier()).thenReturn(1);
+        when(mContext.getUser()).thenReturn(userHandle);
+        when(mINfcCardEmulation.isDefaultServiceForAid(1, componentName,
+                "payment")).thenReturn(true);
+        boolean result = mCardEmulation.isDefaultServiceForAid(componentName,
+                "payment");
+        assertThat(result).isTrue();
+        verify(mINfcCardEmulation).isDefaultServiceForAid(1, componentName,
+                "payment");
+    }
+
+    @Test
+    public void testCategoryAllowsForegroundPreference() throws Settings.SettingNotFoundException {
+        when(mContext.createContextAsUser(any(), anyInt())).thenReturn(mContext);
+        RoleManager roleManager = mock(RoleManager.class);
+        when(roleManager.isRoleAvailable(RoleManager.ROLE_WALLET)).thenReturn(false);
+        when(mContext.getSystemService(RoleManager.class)).thenReturn(roleManager);
+        ContentResolver contentResolver = mock(ContentResolver.class);
+        when(mContext.getContentResolver()).thenReturn(contentResolver);
+        when(Settings.Secure.getInt(contentResolver, Constants
+                .SETTINGS_SECURE_NFC_PAYMENT_FOREGROUND)).thenReturn(1);
+        boolean result = mCardEmulation.categoryAllowsForegroundPreference("payment");
+        assertThat(result).isTrue();
+    }
+
+    @Test
+    public void testGetSelectionModeForCategory() throws RemoteException {
+        when(mINfcCardEmulation.isDefaultPaymentRegistered()).thenReturn(true);
+        int result = mCardEmulation.getSelectionModeForCategory("payment");
+        assertThat(result).isEqualTo(0);
+    }
+
+    @Test
+    public void testSetShouldDefaultToObserveModeForService() throws RemoteException {
+        UserHandle userHandle = mock(UserHandle.class);
+        when(userHandle.getIdentifier()).thenReturn(1);
+        when(mContext.getUser()).thenReturn(userHandle);
+        ComponentName componentName = mock(ComponentName.class);
+        when(mINfcCardEmulation.setShouldDefaultToObserveModeForService(1, componentName, true))
+                .thenReturn(true);
+        boolean result = mCardEmulation
+                .setShouldDefaultToObserveModeForService(componentName, true);
+        assertThat(result).isTrue();
+        verify(mINfcCardEmulation).setShouldDefaultToObserveModeForService(1, componentName, true);
+    }
+
+    @Test
+    public void testRegisterPollingLoopFilterForService()throws RemoteException {
+        UserHandle userHandle = mock(UserHandle.class);
+        when(userHandle.getIdentifier()).thenReturn(1);
+        when(mContext.getUser()).thenReturn(userHandle);
+        ComponentName componentName = mock(ComponentName.class);
+        when(mINfcCardEmulation.registerPollingLoopFilterForService(anyInt(),
+                any(), anyString(), anyBoolean())).thenReturn(true);
+        boolean result = mCardEmulation.registerPollingLoopFilterForService(componentName,
+                "A0000000041010", true);
+        assertThat(result).isTrue();
+        verify(mINfcCardEmulation)
+                .registerPollingLoopFilterForService(anyInt(), any(), anyString(), anyBoolean());
+    }
+
+    @Test
+    public void testRemovePollingLoopFilterForService()throws RemoteException {
+        UserHandle userHandle = mock(UserHandle.class);
+        when(userHandle.getIdentifier()).thenReturn(1);
+        when(mContext.getUser()).thenReturn(userHandle);
+        ComponentName componentName = mock(ComponentName.class);
+        when(mINfcCardEmulation.removePollingLoopFilterForService(anyInt(), any(), anyString()))
+                .thenReturn(true);
+        boolean result = mCardEmulation
+                .removePollingLoopFilterForService(componentName, "A0000000041010");
+        assertThat(result).isTrue();
+        verify(mINfcCardEmulation).removePollingLoopFilterForService(anyInt(), any(), anyString());
+    }
+}
diff --git a/nfc/tests/src/android/nfc/dta/NfcDtaTest.java b/nfc/tests/src/android/nfc/dta/NfcDtaTest.java
new file mode 100644
index 0000000..38fb7ef
--- /dev/null
+++ b/nfc/tests/src/android/nfc/dta/NfcDtaTest.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 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.nfc.dta;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.nfc.INfcDta;
+import android.nfc.NfcAdapter;
+import android.os.RemoteException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+public class NfcDtaTest {
+    private final String mServiceName = "serviceName";
+    private final int mServiceSap = 1;
+    private final int mMiu = 1;
+    private final int mRwSize = 1;
+    private final int mTestCaseId = 1;
+    @Mock
+    private NfcAdapter mMockNfcAdapter;
+    @Mock
+    private INfcDta mMockService;
+    @Mock
+    private Context mMockContext;
+
+    private NfcDta mNfcDta;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        when(mMockNfcAdapter.getContext()).thenReturn(mMockContext);
+        when(mMockNfcAdapter.getNfcDtaInterface()).thenReturn(mMockService);
+
+        mNfcDta = NfcDta.getInstance(mMockNfcAdapter);
+    }
+
+    @Test
+    public void testEnableData() throws RemoteException {
+        assertTrue(mNfcDta.enableDta());
+        verify(mMockService).enableDta();
+    }
+
+    @Test
+    public void testEnableDataWithRemoteException() throws RemoteException {
+        doThrow(new RemoteException()).when(mMockService).enableDta();
+
+        assertFalse(mNfcDta.enableDta());
+        verify(mMockService).enableDta();
+    }
+
+    @Test
+    public void testDisableData() throws RemoteException {
+        assertTrue(mNfcDta.disableDta());
+        verify(mMockService).disableDta();
+    }
+
+    @Test
+    public void testDisableDataWithRemoteException() throws RemoteException {
+        doThrow(new RemoteException()).when(mMockService).disableDta();
+
+        assertFalse(mNfcDta.disableDta());
+        verify(mMockService).disableDta();
+    }
+
+    @Test
+    public void testEnableServer() throws RemoteException {
+        when(mMockService.enableServer(mServiceName, mServiceSap, mMiu, mRwSize,
+                mTestCaseId)).thenReturn(true);
+
+        mNfcDta.enableServer(mServiceName, mServiceSap, mMiu, mRwSize, mTestCaseId);
+        verify(mMockService).enableServer(mServiceName, mServiceSap, mMiu, mRwSize, mTestCaseId);
+    }
+
+    @Test
+    public void testEnableServerWithRemoteException() throws RemoteException {
+        doThrow(new RemoteException()).when(mMockService).enableServer(mServiceName, mServiceSap,
+                mMiu,
+                mRwSize, mTestCaseId);
+
+        mNfcDta.enableServer(mServiceName, mServiceSap, mMiu, mRwSize, mTestCaseId);
+        verify(mMockService).enableServer(mServiceName, mServiceSap, mMiu, mRwSize, mTestCaseId);
+    }
+
+    @Test
+    public void testDisableServer() throws RemoteException {
+        assertTrue(mNfcDta.disableServer());
+        verify(mMockService).disableServer();
+    }
+
+    @Test
+    public void testDisableServerWithRemoteException() throws RemoteException {
+        doThrow(new RemoteException()).when(mMockService).disableServer();
+
+        assertFalse(mNfcDta.disableServer());
+        verify(mMockService).disableServer();
+    }
+
+    @Test
+    public void testEnableClient() throws RemoteException {
+        when(mMockService.enableClient(mServiceName, mMiu, mRwSize, mTestCaseId)).thenReturn(true);
+
+        mNfcDta.enableClient(mServiceName, mMiu, mRwSize, mTestCaseId);
+        verify(mMockService).enableClient(mServiceName, mMiu, mRwSize, mTestCaseId);
+    }
+
+    @Test
+    public void testEnableClientWithRemoteException() throws RemoteException {
+        doThrow(new RemoteException()).when(mMockService).enableClient(mServiceName, mMiu, mRwSize,
+                mTestCaseId);
+
+        mNfcDta.enableClient(mServiceName, mMiu, mRwSize, mTestCaseId);
+        verify(mMockService).enableClient(mServiceName, mMiu, mRwSize, mTestCaseId);
+    }
+
+    @Test
+    public void testDisableClient() throws RemoteException {
+        assertTrue(mNfcDta.disableClient());
+        verify(mMockService).disableClient();
+    }
+
+    @Test
+    public void testDisableClientWithRemoteException() throws RemoteException {
+        doThrow(new RemoteException()).when(mMockService).disableClient();
+
+        assertFalse(mNfcDta.disableClient());
+        verify(mMockService).disableClient();
+    }
+
+    @Test
+    public void testRegisterMessageService() throws RemoteException {
+        String msgServiceName = "sampleServiceName";
+        when(mMockService.registerMessageService(msgServiceName)).thenReturn(true);
+
+        mNfcDta.registerMessageService(msgServiceName);
+        verify(mMockService).registerMessageService(msgServiceName);
+    }
+
+    @Test
+    public void testRegisterMessageServiceWithRemoteException() throws RemoteException {
+        String msgServiceName = "sampleServiceName";
+        doThrow(new RemoteException()).when(mMockService).registerMessageService(msgServiceName);
+
+        assertFalse(mNfcDta.registerMessageService(msgServiceName));
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testGetInstanceWithNullPointerException() {
+        NfcDta.getInstance(null);
+    }
+
+    @Test(expected = UnsupportedOperationException.class)
+    public void testGetInstanceWithUnsupportedOperationExceptionForNfcAdapterContext() {
+        when(mMockNfcAdapter.getContext()).thenReturn(null);
+
+        NfcDta.getInstance(mMockNfcAdapter);
+    }
+}
diff --git a/nfc/tests/src/android/nfc/tech/NfcATest.java b/nfc/tests/src/android/nfc/tech/NfcATest.java
new file mode 100644
index 0000000..40076eb
--- /dev/null
+++ b/nfc/tests/src/android/nfc/tech/NfcATest.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2024 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.nfc.tech;
+
+import static android.nfc.tech.NfcA.EXTRA_ATQA;
+import static android.nfc.tech.NfcA.EXTRA_SAK;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.nfc.ErrorCodes;
+import android.nfc.INfcTag;
+import android.nfc.Tag;
+import android.nfc.TransceiveResult;
+import android.os.Bundle;
+import android.os.RemoteException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.IOException;
+
+public class NfcATest {
+    @Mock
+    private Tag mMockTag;
+    @Mock
+    private INfcTag mMockTagService;
+    @Mock
+    private Bundle mMockBundle;
+    private NfcA mNfcA;
+    private final byte[] mSampleArray = new byte[] {1, 2, 3};
+
+    @Before
+    public void setUp() throws RemoteException {
+        MockitoAnnotations.initMocks(this);
+        when(mMockBundle.getShort(EXTRA_SAK)).thenReturn((short) 1);
+        when(mMockBundle.getByteArray(EXTRA_ATQA)).thenReturn(mSampleArray);
+        when(mMockTag.getTechExtras(TagTechnology.NFC_A)).thenReturn(mMockBundle);
+
+        mNfcA = new NfcA(mMockTag);
+    }
+
+    @Test
+    public void testGetNfcAWithTech() {
+        Tag mockTag = mock(Tag.class);
+        when(mockTag.getTechExtras(TagTechnology.NFC_A)).thenReturn(mMockBundle);
+        when(mockTag.hasTech(TagTechnology.NFC_A)).thenReturn(true);
+
+        assertNotNull(NfcA.get(mockTag));
+        verify(mockTag).getTechExtras(TagTechnology.NFC_A);
+        verify(mockTag).hasTech(TagTechnology.NFC_A);
+    }
+
+    @Test
+    public void testGetNfcAWithoutTech() {
+        when(mMockTag.hasTech(TagTechnology.NFC_A)).thenReturn(false);
+        assertNull(NfcA.get(mMockTag));
+    }
+
+    @Test
+    public void testGetAtga() {
+        assertNotNull(mNfcA.getAtqa());
+    }
+
+    @Test
+    public void testGetSak() {
+        assertEquals((short) 1, mNfcA.getSak());
+    }
+
+    @Test
+    public void testTransceive() throws IOException, RemoteException {
+        TransceiveResult mockTransceiveResult = mock(TransceiveResult.class);
+        when(mMockTag.getConnectedTechnology()).thenReturn(TagTechnology.NFC_A);
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        when(mMockTag.getServiceHandle()).thenReturn(1);
+        when(mMockTagService.transceive(1, mSampleArray, true))
+                .thenReturn(mockTransceiveResult);
+        when(mockTransceiveResult.getResponseOrThrow()).thenReturn(mSampleArray);
+
+        mNfcA.transceive(mSampleArray);
+        verify(mMockTag).getTagService();
+        verify(mMockTag).getServiceHandle();
+    }
+
+    @Test
+    public void testGetMaxTransceiveLength() throws RemoteException {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        when(mMockTagService.getMaxTransceiveLength(TagTechnology.NFC_A)).thenReturn(1);
+
+        mNfcA.getMaxTransceiveLength();
+        verify(mMockTag).getTagService();
+    }
+
+    @Test
+    public void testSetTimeout() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.setTimeout(TagTechnology.NFC_A, 1000)).thenReturn(
+                    ErrorCodes.SUCCESS);
+
+            mNfcA.setTimeout(1000);
+            verify(mMockTag).getTagService();
+            verify(mMockTagService).setTimeout(TagTechnology.NFC_A, 1000);
+        } catch (Exception e) {
+            fail("Unexpected exception during valid setTimeout: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSetTimeoutInvalidTimeout() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.setTimeout(TagTechnology.NFC_A, -1)).thenReturn(
+                    ErrorCodes.ERROR_TIMEOUT);
+
+            assertThrows(IllegalArgumentException.class, () -> mNfcA.setTimeout(-1));
+        } catch (Exception e) {
+            fail("Unexpected exception during invalid setTimeout: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSetTimeoutRemoteException() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.setTimeout(TagTechnology.NFC_A, 1000)).thenThrow(
+                    new RemoteException());
+
+            mNfcA.setTimeout(1000); // Should not throw an exception but log it
+            verify(mMockTag).getTagService();
+            verify(mMockTagService).setTimeout(TagTechnology.NFC_A, 1000);
+        } catch (Exception e) {
+            fail("Unexpected exception during RemoteException in setTimeout: " + e.getMessage());
+        }
+
+    }
+
+    @Test
+    public void testGetTimeout() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.getTimeout(TagTechnology.NFC_A)).thenReturn(2000);
+
+            assertEquals(2000, mNfcA.getTimeout());
+            verify(mMockTag).getTagService();
+            verify(mMockTagService).getTimeout(TagTechnology.NFC_A);
+        } catch (Exception e) {
+            fail("Unexpected exception during valid getTimeout: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testGetTimeoutRemoteException() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.getTimeout(TagTechnology.NFC_A)).thenThrow(new RemoteException());
+
+            assertEquals(0, mNfcA.getTimeout());
+        } catch (Exception e) {
+            fail("Unexpected exception during RemoteException in getTimeout: " + e.getMessage());
+        }
+    }
+}
diff --git a/nfc/tests/src/android/nfc/tech/NfcBTest.java b/nfc/tests/src/android/nfc/tech/NfcBTest.java
new file mode 100644
index 0000000..98d6070
--- /dev/null
+++ b/nfc/tests/src/android/nfc/tech/NfcBTest.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2024 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.nfc.tech;
+
+import static android.nfc.tech.NfcB.EXTRA_APPDATA;
+import static android.nfc.tech.NfcB.EXTRA_PROTINFO;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.nfc.INfcTag;
+import android.nfc.Tag;
+import android.nfc.TransceiveResult;
+import android.os.Bundle;
+import android.os.RemoteException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.IOException;
+
+public class NfcBTest {
+    private final byte[] mSampleAppDate = new byte[] {1, 2, 3};
+    private final byte[] mSampleProtInfo = new byte[] {3, 2, 1};
+    @Mock
+    private Tag mMockTag;
+    @Mock
+    private Bundle mMockBundle;
+    @Mock
+    private INfcTag mMockTagService;
+    private NfcB mNfcB;
+
+    @Before
+    public void setUp() throws RemoteException {
+        MockitoAnnotations.initMocks(this);
+        when(mMockBundle.getByteArray(EXTRA_APPDATA)).thenReturn(mSampleAppDate);
+        when(mMockBundle.getByteArray(EXTRA_PROTINFO)).thenReturn(mSampleProtInfo);
+        when(mMockTag.getTechExtras(TagTechnology.NFC_B)).thenReturn(mMockBundle);
+
+        mNfcB = new NfcB(mMockTag);
+    }
+
+    @Test
+    public void testGetApplicationData() {
+        assertNotNull(mNfcB.getApplicationData());
+    }
+
+    @Test
+    public void testGetProtocolInfo() {
+        assertNotNull(mNfcB.getProtocolInfo());
+    }
+
+    @Test
+    public void testGetNfcBInstance() {
+        Tag tag = mock(Tag.class);
+        when(tag.hasTech(TagTechnology.NFC_B)).thenReturn(true);
+        when(tag.getTechExtras(TagTechnology.NFC_B)).thenReturn(mMockBundle);
+
+        assertNotNull(NfcB.get(tag));
+        verify(tag).hasTech(TagTechnology.NFC_B);
+        verify(tag).getTechExtras(TagTechnology.NFC_B);
+    }
+
+    @Test
+    public void testGetNfcBNullInstance() {
+        Tag tag = mock(Tag.class);
+        when(tag.hasTech(TagTechnology.NFC_B)).thenReturn(false);
+
+        assertNull(NfcB.get(tag));
+        verify(tag).hasTech(TagTechnology.NFC_B);
+        verify(tag, never()).getTechExtras(TagTechnology.NFC_B);
+    }
+
+
+    @Test
+    public void testTransceive() throws IOException, RemoteException {
+        byte[] sampleData = new byte[] {1, 2, 3, 4, 5};
+        TransceiveResult mockTransceiveResult = mock(TransceiveResult.class);
+        when(mMockTag.getConnectedTechnology()).thenReturn(TagTechnology.NFC_B);
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        when(mMockTag.getServiceHandle()).thenReturn(1);
+        when(mMockTagService.transceive(1, sampleData, true))
+                .thenReturn(mockTransceiveResult);
+        when(mockTransceiveResult.getResponseOrThrow()).thenReturn(sampleData);
+
+        mNfcB.transceive(sampleData);
+        verify(mMockTag).getTagService();
+        verify(mMockTag).getServiceHandle();
+    }
+
+    @Test
+    public void testGetMaxTransceiveLength() throws RemoteException {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        when(mMockTagService.getMaxTransceiveLength(TagTechnology.NFC_B)).thenReturn(1);
+
+        mNfcB.getMaxTransceiveLength();
+        verify(mMockTag).getTagService();
+    }
+}
diff --git a/nfc/tests/src/android/nfc/tech/NfcFTest.java b/nfc/tests/src/android/nfc/tech/NfcFTest.java
new file mode 100644
index 0000000..31a6943
--- /dev/null
+++ b/nfc/tests/src/android/nfc/tech/NfcFTest.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2010 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.nfc.tech;
+
+import static android.nfc.tech.NfcF.EXTRA_PMM;
+import static android.nfc.tech.NfcF.EXTRA_SC;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.nfc.ErrorCodes;
+import android.nfc.INfcTag;
+import android.nfc.Tag;
+import android.nfc.TransceiveResult;
+import android.os.Bundle;
+import android.os.RemoteException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.IOException;
+
+public class NfcFTest {
+    private final byte[] mSampleSystemCode = new byte[] {1, 2, 3};
+    private final byte[] mSampleManufacturer = new byte[] {3, 2, 1};
+    @Mock
+    private Tag mMockTag;
+    @Mock
+    private INfcTag mMockTagService;
+    @Mock
+    private Bundle mMockBundle;
+    private NfcF mNfcF;
+
+    @Before
+    public void setUp() throws RemoteException {
+        MockitoAnnotations.initMocks(this);
+        when(mMockBundle.getByteArray(EXTRA_SC)).thenReturn(mSampleSystemCode);
+        when(mMockBundle.getByteArray(EXTRA_PMM)).thenReturn(mSampleManufacturer);
+        when(mMockTag.getTechExtras(TagTechnology.NFC_F)).thenReturn(mMockBundle);
+
+        mNfcF = new NfcF(mMockTag);
+    }
+
+    @Test
+    public void testGetSystemCode() {
+        assertNotNull(mNfcF.getSystemCode());
+    }
+
+    @Test
+    public void testGetManufacturer() {
+        assertNotNull(mNfcF.getManufacturer());
+    }
+
+    @Test
+    public void testGetNfcFInstanceWithTech() {
+        Tag tag = mock(Tag.class);
+        when(tag.getTechExtras(TagTechnology.NFC_F)).thenReturn(mMockBundle);
+        when(tag.hasTech(TagTechnology.NFC_F)).thenReturn(true);
+
+        assertNotNull(NfcF.get(tag));
+        verify(tag).getTechExtras(TagTechnology.NFC_F);
+        verify(tag).hasTech(TagTechnology.NFC_F);
+    }
+
+    @Test
+    public void testGetNfcFInstanceWithoutTech() {
+        Tag tag = mock(Tag.class);
+        when(tag.hasTech(TagTechnology.NFC_F)).thenReturn(false);
+
+        assertNull(NfcF.get(tag));
+        verify(tag).hasTech(TagTechnology.NFC_F);
+        verify(tag, never()).getTechExtras(TagTechnology.NFC_F);
+    }
+
+    @Test
+    public void testTransceive() throws IOException, RemoteException {
+        byte[] sampleData = new byte[]{1, 2, 3, 4, 5};
+        TransceiveResult mockTransceiveResult = mock(TransceiveResult.class);
+        when(mMockTag.getConnectedTechnology()).thenReturn(TagTechnology.NFC_F);
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        when(mMockTag.getServiceHandle()).thenReturn(1);
+        when(mMockTagService.transceive(1, sampleData, true))
+                .thenReturn(mockTransceiveResult);
+        when(mockTransceiveResult.getResponseOrThrow()).thenReturn(sampleData);
+
+        mNfcF.transceive(sampleData);
+        verify(mMockTag).getTagService();
+        verify(mMockTag).getServiceHandle();
+    }
+
+    @Test
+    public void testGetMaxTransceiveLength() throws RemoteException {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        when(mMockTagService.getMaxTransceiveLength(TagTechnology.NFC_F)).thenReturn(1);
+
+        mNfcF.getMaxTransceiveLength();
+        verify(mMockTag).getTagService();
+    }
+
+    @Test
+    public void testGetTimeout() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.getTimeout(TagTechnology.NFC_F)).thenReturn(2000);
+
+            assertEquals(2000, mNfcF.getTimeout());
+            verify(mMockTag).getTagService();
+            verify(mMockTagService).getTimeout(TagTechnology.NFC_F);
+        } catch (Exception e) {
+            fail("Unexpected exception during valid getTimeout: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testGetTimeoutRemoteException() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.getTimeout(TagTechnology.NFC_F)).thenThrow(new RemoteException());
+
+            assertEquals(0, mNfcF.getTimeout());
+        } catch (Exception e) {
+            fail("Unexpected exception during RemoteException in getTimeout: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSetTimeout() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.setTimeout(TagTechnology.NFC_F, 1000)).thenReturn(
+                    ErrorCodes.SUCCESS);
+
+            mNfcF.setTimeout(1000);
+            verify(mMockTag).getTagService();
+            verify(mMockTagService).setTimeout(TagTechnology.NFC_F, 1000);
+        } catch (Exception e) {
+            fail("Unexpected exception during valid setTimeout: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSetTimeoutInvalidTimeout() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.setTimeout(TagTechnology.NFC_F, -1)).thenReturn(
+                    ErrorCodes.ERROR_TIMEOUT);
+
+            assertThrows(IllegalArgumentException.class, () -> mNfcF.setTimeout(-1));
+        } catch (Exception e) {
+            fail("Unexpected exception during invalid setTimeout: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSetTimeoutRemoteException() {
+        when(mMockTag.getTagService()).thenReturn(mMockTagService);
+        try {
+            when(mMockTagService.setTimeout(TagTechnology.NFC_F, 1000)).thenThrow(
+                    new RemoteException());
+
+            mNfcF.setTimeout(1000);
+            verify(mMockTag).getTagService();
+            verify(mMockTagService).setTimeout(TagTechnology.NFC_F, 1000);
+        } catch (Exception e) {
+            fail("Unexpected exception during RemoteException in setTimeout: " + e.getMessage());
+        }
+    }
+}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DeviceConfigService.java b/packages/SettingsProvider/src/com/android/providers/settings/DeviceConfigService.java
index 38becd4..c3af44b 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DeviceConfigService.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DeviceConfigService.java
@@ -119,27 +119,7 @@
         for (String line : MyShellCommand.listAll(iprovider)) {
             pw.println(line);
         }
-
-        ArrayList<String> missingFiles = new ArrayList<String>();
-        for (String fileName : sAconfigTextProtoFilesOnDevice) {
-            File aconfigFile = new File(fileName);
-            if (!aconfigFile.exists()) {
-                missingFiles.add(fileName);
-            }
-        }
-
-        if (missingFiles.isEmpty()) {
-            pw.println("\nAconfig flags:");
-            for (String name : MyShellCommand.listAllAconfigFlags(iprovider)) {
-                pw.println(name);
-            }
-        } else {
-            pw.println("\nFailed to dump aconfig flags due to missing files:");
-            for (String fileName : missingFiles) {
-                pw.println(fileName);
-            }
-        }
-    }
+   }
 
     private static HashSet<String> getAconfigFlagNamesInDeviceConfig() {
         HashSet<String> nameSet = new HashSet<String>();
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt
index b00c8ad..8a6a0d6 100644
--- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt
+++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt
@@ -70,6 +70,7 @@
             // The predictive back APIs will automatically animate the progress for us in this case
             // so there is no need to animate it.
             cancelSpec = snap(),
+            animationScope = layoutImpl.animationScope,
         )
     }
 }
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/Seek.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/Seek.kt
index 715d979..2b33224 100644
--- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/Seek.kt
+++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/Seek.kt
@@ -30,6 +30,8 @@
 import com.android.compose.animation.scene.UserActionResult
 import com.android.compose.animation.scene.createSwipeAnimation
 import kotlin.coroutines.cancellation.CancellationException
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Job
 import kotlinx.coroutines.coroutineScope
 import kotlinx.coroutines.flow.Flow
 import kotlinx.coroutines.flow.collectLatest
@@ -141,6 +143,7 @@
     progress: Flow<Float>,
     commitSpec: AnimationSpec<Float>?,
     cancelSpec: AnimationSpec<Float>?,
+    animationScope: CoroutineScope? = null,
 ) {
     fun animateOffset(targetContent: T, spec: AnimationSpec<Float>?) {
         if (state.transitionState != animation.contentTransition || animation.isAnimatingOffset()) {
@@ -176,12 +179,20 @@
         }
 
         // Start the transition.
-        state.startTransition(animation.contentTransition)
+        animationScope?.launch { startTransition(state, animation, collectionJob) }
+            ?: startTransition(state, animation, collectionJob)
+    }
+}
 
-        // The transition is done. Cancel the collection in case the transition was finished because
-        // it was interrupted by another transition.
-        if (collectionJob.isActive) {
-            collectionJob.cancel()
-        }
+private suspend fun <T : ContentKey> startTransition(
+    state: MutableSceneTransitionLayoutStateImpl,
+    animation: SwipeAnimation<T>,
+    progressCollectionJob: Job,
+) {
+    state.startTransition(animation.contentTransition)
+    // The transition is done. Cancel the collection in case the transition was finished
+    // because it was interrupted by another transition.
+    if (progressCollectionJob.isActive) {
+        progressCollectionJob.cancel()
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingStartModule.kt b/packages/SystemUI/src/com/android/systemui/classifier/FalsingStartModule.kt
index a9f8f37..4246430 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingStartModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingStartModule.kt
@@ -27,5 +27,5 @@
     @Binds
     @IntoMap
     @ClassKey(FalsingCoreStartable::class)
-    fun bindFalsingCoreStartable(falsingCoreStartable: FalsingCoreStartable?): CoreStartable?
+    fun bindFalsingCoreStartable(falsingCoreStartable: FalsingCoreStartable): CoreStartable
 }
diff --git a/packages/SystemUI/src/com/android/systemui/smartspace/dagger/SmartspaceModule.kt b/packages/SystemUI/src/com/android/systemui/smartspace/dagger/SmartspaceModule.kt
index ea4e065..3a5245d 100644
--- a/packages/SystemUI/src/com/android/systemui/smartspace/dagger/SmartspaceModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/smartspace/dagger/SmartspaceModule.kt
@@ -65,8 +65,8 @@
     @Binds
     @Named(LOCKSCREEN_SMARTSPACE_PRECONDITION)
     abstract fun bindSmartspacePrecondition(
-        lockscreenPrecondition: LockscreenPrecondition?
-    ): SmartspacePrecondition?
+        lockscreenPrecondition: LockscreenPrecondition
+    ): SmartspacePrecondition
 
     @BindsOptionalOf
     @Named(GLANCEABLE_HUB_SMARTSPACE_DATA_PLUGIN)
diff --git a/packages/SystemUI/src/com/android/systemui/util/EventLogModule.kt b/packages/SystemUI/src/com/android/systemui/util/EventLogModule.kt
index ca0876c..27ada23 100644
--- a/packages/SystemUI/src/com/android/systemui/util/EventLogModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/util/EventLogModule.kt
@@ -22,5 +22,5 @@
 
 @Module
 interface EventLogModule {
-    @SysUISingleton @Binds fun bindEventLog(eventLogImpl: EventLogImpl?): EventLog?
+    @SysUISingleton @Binds fun bindEventLog(eventLogImpl: EventLogImpl): EventLog
 }
diff --git a/packages/Vcn/framework-b/src/android/net/vcn/VcnTransportInfo.java b/packages/Vcn/framework-b/src/android/net/vcn/VcnTransportInfo.java
index 3638429..a760b12 100644
--- a/packages/Vcn/framework-b/src/android/net/vcn/VcnTransportInfo.java
+++ b/packages/Vcn/framework-b/src/android/net/vcn/VcnTransportInfo.java
@@ -161,7 +161,14 @@
         return 0;
     }
 
-    /** @hide */
+    /**
+     * Create a copy of a {@link VcnTransportInfo} with some fields redacted based on the
+     * permissions held by the receiving app.
+     *
+     * @param redactions bitmask of redactions that needs to be performed on this instance.
+     * @return the copy of this instance with the necessary redactions.
+     * @hide
+     */
     @FlaggedApi(FLAG_MAINLINE_VCN_MODULE_API)
     @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
     @Override
diff --git a/services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java b/services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java
index 3224b27..c234ee4 100644
--- a/services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java
+++ b/services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java
@@ -1616,7 +1616,13 @@
      * lock because this calls out to WindowManagerService.
      */
     void addWindowTokensForAllDisplays() {
-        final Display[] displays = mDisplayManager.getDisplays();
+        Display[] displays = {};
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            displays = mDisplayManager.getDisplays();
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
         for (int i = 0; i < displays.length; i++) {
             final int displayId = displays[i].getDisplayId();
             addWindowTokenForDisplay(displayId);
@@ -1652,7 +1658,13 @@
     }
 
     public void onRemoved() {
-        final Display[] displays = mDisplayManager.getDisplays();
+        Display[] displays = {};
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            displays = mDisplayManager.getDisplays();
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
         for (int i = 0; i < displays.length; i++) {
             final int displayId = displays[i].getDisplayId();
             onDisplayRemoved(displayId);
diff --git a/services/core/java/com/android/server/OWNERS b/services/core/java/com/android/server/OWNERS
index c15cf34..6858e29 100644
--- a/services/core/java/com/android/server/OWNERS
+++ b/services/core/java/com/android/server/OWNERS
@@ -31,6 +31,7 @@
 per-file *TimeUpdate* = file:/services/core/java/com/android/server/timezonedetector/OWNERS
 per-file DynamicSystemService.java = file:/packages/DynamicSystemInstallationService/OWNERS
 per-file GestureLauncherService.java = file:platform/packages/apps/EmergencyInfo:/OWNERS
+per-file GestureLauncherService.java = file:/INPUT_OWNERS
 per-file MmsServiceBroker.java = file:/telephony/OWNERS
 per-file NetIdManager.java = file:/services/core/java/com/android/server/net/OWNERS
 per-file PackageWatchdog.java = file:/services/core/java/com/android/server/crashrecovery/OWNERS
diff --git a/services/core/java/com/android/server/am/PhantomProcessList.java b/services/core/java/com/android/server/am/PhantomProcessList.java
index 2ec1aed..5bd9c05 100644
--- a/services/core/java/com/android/server/am/PhantomProcessList.java
+++ b/services/core/java/com/android/server/am/PhantomProcessList.java
@@ -112,23 +112,10 @@
     private final ActivityManagerService mService;
     private final Handler mKillHandler;
 
-    private static final int CGROUP_V1 = 0;
-    private static final int CGROUP_V2 = 1;
-    private static final String[] CGROUP_PATH_PREFIXES = {
-        "/acct/uid_" /* cgroup v1 */,
-        "/sys/fs/cgroup/uid_" /* cgroup v2 */
-    };
-    private static final String CGROUP_PID_PREFIX = "/pid_";
-    private static final String CGROUP_PROCS = "/cgroup.procs";
-
-    @VisibleForTesting
-    int mCgroupVersion = CGROUP_V1;
-
     PhantomProcessList(final ActivityManagerService service) {
         mService = service;
         mKillHandler = service.mProcessList.sKillHandler;
         mInjector = new Injector();
-        probeCgroupVersion();
     }
 
     @VisibleForTesting
@@ -157,9 +144,15 @@
         final int appPid = app.getPid();
         InputStream input = mCgroupProcsFds.get(appPid);
         if (input == null) {
-            final String path = getCgroupFilePath(app.info.uid, appPid);
+            String path = null;
             try {
+                path = getCgroupFilePath(app.info.uid, appPid);
                 input = mInjector.openCgroupProcs(path);
+            } catch (IllegalArgumentException e) {
+                if (DEBUG_PROCESSES) {
+                    Slog.w(TAG, "Unable to obtain cgroup.procs path ", e);
+                }
+                return;
             } catch (FileNotFoundException | SecurityException e) {
                 if (DEBUG_PROCESSES) {
                     Slog.w(TAG, "Unable to open " + path, e);
@@ -207,18 +200,9 @@
         }
     }
 
-    private void probeCgroupVersion() {
-        for (int i = CGROUP_PATH_PREFIXES.length - 1; i >= 0; i--) {
-            if ((new File(CGROUP_PATH_PREFIXES[i] + Process.SYSTEM_UID)).exists()) {
-                mCgroupVersion = i;
-                break;
-            }
-        }
-    }
-
     @VisibleForTesting
     String getCgroupFilePath(int uid, int pid) {
-        return CGROUP_PATH_PREFIXES[mCgroupVersion] + uid + CGROUP_PID_PREFIX + pid + CGROUP_PROCS;
+        return nativeGetCgroupProcsPath(uid, pid);
     }
 
     static String getProcessName(int pid) {
@@ -605,4 +589,7 @@
             return PhantomProcessList.getProcessName(pid);
         }
     }
+
+    private static native String nativeGetCgroupProcsPath(int uid, int pid)
+            throws IllegalArgumentException;
 }
diff --git a/services/core/java/com/android/server/audio/FadeOutManager.java b/services/core/java/com/android/server/audio/FadeOutManager.java
index 4d5bce5..fedfe51 100644
--- a/services/core/java/com/android/server/audio/FadeOutManager.java
+++ b/services/core/java/com/android/server/audio/FadeOutManager.java
@@ -199,7 +199,9 @@
             for (AudioPlaybackConfiguration apc : players) {
                 final VolumeShaper.Configuration volShaper =
                         mFadeConfigurations.getFadeOutVolumeShaperConfig(apc.getAudioAttributes());
-                fa.addFade(apc, /* skipRamp= */ false, volShaper);
+                if (volShaper != null) {
+                    fa.addFade(apc, /* skipRamp= */ false, volShaper);
+                }
             }
         }
     }
@@ -249,7 +251,7 @@
             final VolumeShaper.Configuration volShaper =
                     mFadeConfigurations.getFadeOutVolumeShaperConfig(apc.getAudioAttributes());
             final FadedOutApp fa = mUidToFadedAppsMap.get(apc.getClientUid());
-            if (fa == null) {
+            if (fa == null || volShaper == null) {
                 return;
             }
             fa.addFade(apc, /* skipRamp= */ true, volShaper);
diff --git a/services/core/java/com/android/server/powerstats/PowerStatsLogger.java b/services/core/java/com/android/server/powerstats/PowerStatsLogger.java
index e80a86d..4fd026a 100644
--- a/services/core/java/com/android/server/powerstats/PowerStatsLogger.java
+++ b/services/core/java/com/android/server/powerstats/PowerStatsLogger.java
@@ -285,14 +285,20 @@
     }
 
     private void updateCacheFile(String cacheFilename, byte[] data) {
+        AtomicFile atomicCachedFile = null;
+        FileOutputStream fos = null;
         try {
-            final AtomicFile atomicCachedFile =
+            atomicCachedFile =
                     new AtomicFile(new File(mDataStoragePath, cacheFilename));
-            final FileOutputStream fos = atomicCachedFile.startWrite();
+            fos = atomicCachedFile.startWrite();
             fos.write(data);
             atomicCachedFile.finishWrite(fos);
         } catch (IOException e) {
             Slog.e(TAG, "Failed to write current data to cached file", e);
+            if (fos != null) {
+                atomicCachedFile.failWrite(fos);
+            }
+            return;
         }
     }
 
diff --git a/services/core/java/com/android/server/wm/CameraStateMonitor.java b/services/core/java/com/android/server/wm/CameraStateMonitor.java
index 8bfef6d..4140c04 100644
--- a/services/core/java/com/android/server/wm/CameraStateMonitor.java
+++ b/services/core/java/com/android/server/wm/CameraStateMonitor.java
@@ -106,8 +106,10 @@
     }
 
     void startListeningToCameraState() {
-        mCameraManager.registerAvailabilityCallback(
-                mWmService.mContext.getMainExecutor(), mAvailabilityCallback);
+        if (mCameraManager != null) {
+            mCameraManager.registerAvailabilityCallback(
+                    mWmService.mContext.getMainExecutor(), mAvailabilityCallback);
+        }
         mIsRunning = true;
     }
 
diff --git a/services/core/java/com/android/server/wm/ContentRecorder.java b/services/core/java/com/android/server/wm/ContentRecorder.java
index 0aca511..1b48986 100644
--- a/services/core/java/com/android/server/wm/ContentRecorder.java
+++ b/services/core/java/com/android/server/wm/ContentRecorder.java
@@ -350,6 +350,15 @@
             return;
         }
 
+        final SurfaceControl sourceSurface = mRecordedWindowContainer.getSurfaceControl();
+        if (sourceSurface == null || !sourceSurface.isValid()) {
+            ProtoLog.v(WM_DEBUG_CONTENT_RECORDING,
+                    "Content Recording: Unable to start recording for display %d since the "
+                            + "surface is null or have been released.",
+                    mDisplayContent.getDisplayId());
+            return;
+        }
+
         final int contentToRecord = mContentRecordingSession.getContentToRecord();
 
         // TODO(b/297514518) Do not start capture if the app is in PIP, the bounds are inaccurate.
@@ -377,8 +386,7 @@
                 mDisplayContent.getDisplayId(), mDisplayContent.getDisplayInfo().state);
 
         // Create a mirrored hierarchy for the SurfaceControl of the DisplayArea to capture.
-        mRecordedSurface = SurfaceControl.mirrorSurface(
-                mRecordedWindowContainer.getSurfaceControl());
+        mRecordedSurface = SurfaceControl.mirrorSurface(sourceSurface);
         SurfaceControl.Transaction transaction =
                 mDisplayContent.mWmService.mTransactionFactory.get()
                         // Set the mMirroredSurface's parent to the root SurfaceControl for this
diff --git a/services/core/java/com/android/server/wm/OWNERS b/services/core/java/com/android/server/wm/OWNERS
index 98521d3..dede767 100644
--- a/services/core/java/com/android/server/wm/OWNERS
+++ b/services/core/java/com/android/server/wm/OWNERS
@@ -21,6 +21,7 @@
 pdwilliams@google.com
 charlesccchen@google.com
 marziana@google.com
+mcarli@google.com
 
 # Files related to background activity launches
 per-file Background*Start* = set noparent
diff --git a/services/core/java/com/android/server/wm/RecentTasks.java b/services/core/java/com/android/server/wm/RecentTasks.java
index 9da848a..9cde397 100644
--- a/services/core/java/com/android/server/wm/RecentTasks.java
+++ b/services/core/java/com/android/server/wm/RecentTasks.java
@@ -1488,9 +1488,9 @@
             boolean skipExcludedCheck) {
         if (!skipExcludedCheck) {
             // Keep the most recent task of home display even if it is excluded from recents.
-            final boolean isExcludeFromRecents =
-                    (task.getBaseIntent().getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
-                            == FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
+            final boolean isExcludeFromRecents = task.getBaseIntent() != null
+                    && (task.getBaseIntent().getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
+                    == FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
             if (isExcludeFromRecents) {
                 if (DEBUG_RECENTS_TRIM_TASKS) {
                     Slog.d(TAG,
diff --git a/services/core/java/com/android/server/wm/ScreenRecordingCallbackController.java b/services/core/java/com/android/server/wm/ScreenRecordingCallbackController.java
index ad4faab..e1b6e5d 100644
--- a/services/core/java/com/android/server/wm/ScreenRecordingCallbackController.java
+++ b/services/core/java/com/android/server/wm/ScreenRecordingCallbackController.java
@@ -95,8 +95,9 @@
         if (mediaProjectionInfo.getLaunchCookie() == null) {
             mRecordedWC = (WindowContainer) mWms.mRoot.getDefaultDisplay();
         } else {
-            mRecordedWC = mWms.mRoot.getActivity(activity -> activity.mLaunchCookie
-                    == mediaProjectionInfo.getLaunchCookie().binder).getTask();
+            final ActivityRecord matchingActivity = mWms.mRoot.getActivity(activity ->
+                    activity.mLaunchCookie == mediaProjectionInfo.getLaunchCookie().binder);
+            mRecordedWC = matchingActivity != null ? matchingActivity.getTask() : null;
         }
     }
 
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index 2c03902..97ae6be 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -79,6 +79,7 @@
         ":lib_oomConnection_native",
         ":lib_anrTimer_native",
         ":lib_lazilyRegisteredServices_native",
+        ":lib_phantomProcessList_native",
     ],
 
     include_dirs: [
@@ -264,3 +265,10 @@
         "com_android_server_vr_VrManagerService.cpp",
     ],
 }
+
+filegroup {
+    name: "lib_phantomProcessList_native",
+    srcs: [
+        "com_android_server_am_PhantomProcessList.cpp",
+    ],
+}
diff --git a/services/core/jni/com_android_server_am_PhantomProcessList.cpp b/services/core/jni/com_android_server_am_PhantomProcessList.cpp
new file mode 100644
index 0000000..0c5e6d8
--- /dev/null
+++ b/services/core/jni/com_android_server_am_PhantomProcessList.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+#include <jni.h>
+#include <nativehelper/JNIHelp.h>
+#include <processgroup/processgroup.h>
+
+namespace android {
+namespace {
+
+jstring getCgroupProcsPath(JNIEnv* env, jobject clazz, jint uid, jint pid) {
+    if (uid < 0) {
+        jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException", "uid is negative: %d", uid);
+        return nullptr;
+    }
+
+    std::string path;
+    if (!CgroupGetAttributePathForProcess("CgroupProcs", uid, pid, path)) {
+        path.clear();
+    }
+
+    return env->NewStringUTF(path.c_str());
+}
+
+const JNINativeMethod sMethods[] = {
+        {"nativeGetCgroupProcsPath", "(II)Ljava/lang/String;", (void*)getCgroupProcsPath},
+};
+
+} // anonymous namespace
+
+int register_android_server_am_PhantomProcessList(JNIEnv* env) {
+    const char* className = "com/android/server/am/PhantomProcessList";
+    return jniRegisterNativeMethods(env, className, sMethods, NELEM(sMethods));
+}
+
+} // namespace android
\ No newline at end of file
diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp
index df37ec3..a12eb31 100644
--- a/services/core/jni/onload.cpp
+++ b/services/core/jni/onload.cpp
@@ -70,6 +70,7 @@
 int register_com_android_server_SystemClockTime(JNIEnv* env);
 int register_android_server_display_smallAreaDetectionController(JNIEnv* env);
 int register_com_android_server_accessibility_BrailleDisplayConnection(JNIEnv* env);
+int register_android_server_am_PhantomProcessList(JNIEnv* env);
 
 // Note: Consider adding new JNI entrypoints for optional services to
 // LazyJniRegistrar instead, and relying on lazy registration.
@@ -135,5 +136,6 @@
     register_com_android_server_SystemClockTime(env);
     register_android_server_display_smallAreaDetectionController(env);
     register_com_android_server_accessibility_BrailleDisplayConnection(env);
+    register_android_server_am_PhantomProcessList(env);
     return JNI_VERSION_1_4;
 }
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index ac95f04..c80d6db 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -3033,10 +3033,10 @@
         if (com.android.ranging.flags.Flags.rangingStackEnabled()) {
             if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_UWB)
                     || context.getPackageManager().hasSystemFeature(
-                            PackageManager.FEATURE_WIFI_RTT)
+                            PackageManager.FEATURE_WIFI_AWARE)
                     || (com.android.ranging.flags.Flags.rangingCsEnabled()
                             && context.getPackageManager().hasSystemFeature(
-                                    PackageManager.FEATURE_BLUETOOTH_LE_CHANNEL_SOUNDING))) {
+                                    PackageManager.FEATURE_BLUETOOTH_LE))) {
                 t.traceBegin("RangingService");
                 // TODO: b/375264320 - Remove after RELEASE_RANGING_STACK is ramped to next.
                 try {
diff --git a/services/permission/java/com/android/server/permission/access/permission/AppIdPermissionPolicy.kt b/services/permission/java/com/android/server/permission/access/permission/AppIdPermissionPolicy.kt
index d2c91ff..232bb83 100644
--- a/services/permission/java/com/android/server/permission/access/permission/AppIdPermissionPolicy.kt
+++ b/services/permission/java/com/android/server/permission/access/permission/AppIdPermissionPolicy.kt
@@ -286,14 +286,21 @@
                 return@forEach
             }
             var newFlags = oldFlags
+            val isSystemOrInstalled =
+                packageState.isSystem || packageState.getUserStateOrDefault(userId).isInstalled
             newFlags =
                 if (
-                    newFlags.hasBits(PermissionFlags.ROLE) ||
-                        newFlags.hasBits(PermissionFlags.PREGRANT)
+                    isSystemOrInstalled && (
+                        newFlags.hasBits(PermissionFlags.ROLE) ||
+                            newFlags.hasBits(PermissionFlags.PREGRANT)
+                    )
                 ) {
                     newFlags or PermissionFlags.RUNTIME_GRANTED
                 } else {
-                    newFlags andInv PermissionFlags.RUNTIME_GRANTED
+                    newFlags andInv (
+                        PermissionFlags.RUNTIME_GRANTED or PermissionFlags.ROLE or
+                            PermissionFlags.PREGRANT
+                    )
                 }
             newFlags = newFlags andInv USER_SETTABLE_MASK
             if (newFlags.hasBits(PermissionFlags.LEGACY_GRANTED)) {
diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
index c31594a..fc585c9 100644
--- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
@@ -16,6 +16,8 @@
 
 package com.android.server.profcollect;
 
+import static android.content.Intent.ACTION_BATTERY_LOW;
+import static android.content.Intent.ACTION_BATTERY_OKAY;
 import static android.content.Intent.ACTION_SCREEN_OFF;
 import static android.content.Intent.ACTION_SCREEN_ON;
 
@@ -77,6 +79,7 @@
     static boolean sVerityEnforced;
     static boolean sIsInteractive;
     static boolean sAdbActive;
+    static boolean sIsBatteryLow;
 
     private static IProfCollectd sIProfcollect;
     private static ProfcollectForwardingService sSelfService;
@@ -91,7 +94,11 @@
     private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
-            if (ACTION_SCREEN_ON.equals(intent.getAction())) {
+            if (ACTION_BATTERY_LOW.equals(intent.getAction())) {
+                sIsBatteryLow = true;
+            } else if (ACTION_BATTERY_OKAY.equals(intent.getAction())) {
+                sIsBatteryLow = false;
+            } else if (ACTION_SCREEN_ON.equals(intent.getAction())) {
                 Log.d(LOG_TAG, "Received broadcast that the device became interactive, was "
                         + sIsInteractive);
                 sIsInteractive = true;
@@ -141,6 +148,8 @@
             context.getResources().getBoolean(R.bool.config_profcollectReportUploaderEnabled);
 
         final IntentFilter filter = new IntentFilter();
+        filter.addAction(ACTION_BATTERY_LOW);
+        filter.addAction(ACTION_BATTERY_OKAY);
         filter.addAction(ACTION_SCREEN_ON);
         filter.addAction(ACTION_SCREEN_OFF);
         filter.addAction(INTENT_UPLOAD_PROFILES);
diff --git a/services/profcollect/src/com/android/server/profcollect/Utils.java b/services/profcollect/src/com/android/server/profcollect/Utils.java
index b754ca1..c109f5cf 100644
--- a/services/profcollect/src/com/android/server/profcollect/Utils.java
+++ b/services/profcollect/src/com/android/server/profcollect/Utils.java
@@ -118,6 +118,7 @@
         }
         return ProfcollectForwardingService.sVerityEnforced
             && !ProfcollectForwardingService.sAdbActive
-            && ProfcollectForwardingService.sIsInteractive;
+            && ProfcollectForwardingService.sIsInteractive
+            && !ProfcollectForwardingService.sIsBatteryLow;
     }
 }
diff --git a/services/tests/PermissionServiceMockingTests/src/com/android/server/permission/test/AppIdPermissionPolicyPermissionResetTest.kt b/services/tests/PermissionServiceMockingTests/src/com/android/server/permission/test/AppIdPermissionPolicyPermissionResetTest.kt
index 1237095..8b357862d 100644
--- a/services/tests/PermissionServiceMockingTests/src/com/android/server/permission/test/AppIdPermissionPolicyPermissionResetTest.kt
+++ b/services/tests/PermissionServiceMockingTests/src/com/android/server/permission/test/AppIdPermissionPolicyPermissionResetTest.kt
@@ -72,7 +72,8 @@
         } else {
             mockPackageState(
                 APP_ID_1,
-                mockAndroidPackage(PACKAGE_NAME_1, requestedPermissions = setOf(PERMISSION_NAME_0))
+                mockAndroidPackage(PACKAGE_NAME_1, requestedPermissions = setOf(PERMISSION_NAME_0)),
+                true
             )
         }
         setPermissionFlags(APP_ID_1, USER_ID_0, PERMISSION_NAME_0, oldFlags)
diff --git a/services/tests/mockingservicestests/jni/Android.bp b/services/tests/mockingservicestests/jni/Android.bp
index 94d4b95..03bd73c 100644
--- a/services/tests/mockingservicestests/jni/Android.bp
+++ b/services/tests/mockingservicestests/jni/Android.bp
@@ -24,6 +24,7 @@
         ":lib_freezer_native",
         ":lib_oomConnection_native",
         ":lib_lazilyRegisteredServices_native",
+        ":lib_phantomProcessList_native",
         "onload.cpp",
     ],
 
diff --git a/services/tests/mockingservicestests/jni/onload.cpp b/services/tests/mockingservicestests/jni/onload.cpp
index 9b4c817..30fa7de 100644
--- a/services/tests/mockingservicestests/jni/onload.cpp
+++ b/services/tests/mockingservicestests/jni/onload.cpp
@@ -28,6 +28,7 @@
 int register_android_server_am_Freezer(JNIEnv* env);
 int register_android_server_am_OomConnection(JNIEnv* env);
 int register_android_server_utils_LazyJniRegistrar(JNIEnv* env);
+int register_android_server_am_PhantomProcessList(JNIEnv* env);
 };
 
 using namespace android;
@@ -46,5 +47,6 @@
     register_android_server_am_Freezer(env);
     register_android_server_am_OomConnection(env);
     register_android_server_utils_LazyJniRegistrar(env);
+    register_android_server_am_PhantomProcessList(env);
     return JNI_VERSION_1_4;
 }
diff --git a/services/tests/servicestests/src/com/android/server/OWNERS b/services/tests/servicestests/src/com/android/server/OWNERS
index d8a9400..69feb1d 100644
--- a/services/tests/servicestests/src/com/android/server/OWNERS
+++ b/services/tests/servicestests/src/com/android/server/OWNERS
@@ -6,5 +6,6 @@
 per-file *Network* = file:/services/core/java/com/android/server/net/OWNERS
 per-file BatteryServiceTest.java = file:platform/hardware/interfaces:/health/OWNERS
 per-file GestureLauncherServiceTest.java = file:platform/packages/apps/EmergencyInfo:/OWNERS
+per-file GestureLauncherServiceTest.java = file:/INPUT_OWNERS
 per-file PinnerServiceTest.java = file:/apct-tests/perftests/OWNERS
 per-file SecurityStateTest.java = file:/SECURITY_STATE_OWNERS