Loading core/java/android/content/pm/RegisteredServicesCache.java +28 −34 Original line number Diff line number Diff line Loading @@ -521,7 +521,7 @@ public abstract class RegisteredServicesCache<V> { long lastUpdateTime = -1; final android.content.pm.ServiceInfo si = resolveInfo.serviceInfo; final ComponentName componentName = si.getComponentName(); if (Flags.optimizeParsingInRegisteredServicesCache()) { try { PackageInfo packageInfo = pm.getPackageInfoAsUser(si.packageName, PackageManager.MATCH_DIRECT_BOOT_AWARE Loading @@ -538,7 +538,7 @@ public abstract class RegisteredServicesCache<V> { continue; } } } try { ServiceInfo<V> info = parseServiceInfo(resolveInfo, lastUpdateTime); if (info == null) { Loading @@ -546,17 +546,14 @@ public abstract class RegisteredServicesCache<V> { continue; } serviceInfos.add(info); if (Flags.optimizeParsingInRegisteredServicesCache()) { synchronized (mUserIdToServiceInfoCaches) { mUserIdToServiceInfoCaches.add(userId, componentName, info); } } } catch (XmlPullParserException | IOException e) { Log.w(TAG, "Unable to load service info " + resolveInfo.toString(), e); } } if (Flags.optimizeParsingInRegisteredServicesCache()) { synchronized (mUserIdToServiceInfoCaches) { if (mUserIdToServiceInfoCaches.numElementsForKey(userId) > 0) { final ServiceInfoCachesToken<V> token = new ServiceInfoCachesToken<V>( Loading @@ -567,7 +564,6 @@ public abstract class RegisteredServicesCache<V> { SERVICE_INFO_CACHES_TIMEOUT_MILLIS); } } } synchronized (mServicesLock) { final UserServices<V> user = findOrCreateUserLocked(userId); Loading Loading @@ -870,12 +866,10 @@ public abstract class RegisteredServicesCache<V> { synchronized (mServicesLock) { mUserServices.remove(userId); } if (Flags.optimizeParsingInRegisteredServicesCache()) { synchronized (mUserIdToServiceInfoCaches) { mUserIdToServiceInfoCaches.delete(userId); } } } @VisibleForTesting protected List<UserInfo> getUsers() { Loading core/java/android/content/pm/flags.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -278,14 +278,6 @@ flag { description: "Feature flag to check whether a given UID can access a content provider" } flag { name: "optimize_parsing_in_registered_services_cache" namespace: "package_manager_service" description: "Feature flag to optimize RegisteredServicesCache ServiceInfo parsing by using caches." bug: "319137634" is_fixed_read_only: true } flag { name: "always_load_past_certs_v4" is_exported: true Loading core/tests/coretests/src/android/content/pm/RegisteredServicesCacheUnitTest.java +0 −4 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package android.content.pm; import static android.content.pm.Flags.FLAG_OPTIMIZE_PARSING_IN_REGISTERED_SERVICES_CACHE; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.anyInt; Loading @@ -44,7 +42,6 @@ import android.os.Handler; import android.os.Message; import android.os.UserHandle; import android.platform.test.annotations.Presubmit; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.util.AttributeSet; Loading Loading @@ -76,7 +73,6 @@ import java.util.Objects; */ @Presubmit @RunWith(AndroidJUnit4.class) @RequiresFlagsEnabled(FLAG_OPTIMIZE_PARSING_IN_REGISTERED_SERVICES_CACHE) public class RegisteredServicesCacheUnitTest { private static final String TAG = "RegisteredServicesCacheUnitTest"; private static final int U0 = 0; Loading Loading
core/java/android/content/pm/RegisteredServicesCache.java +28 −34 Original line number Diff line number Diff line Loading @@ -521,7 +521,7 @@ public abstract class RegisteredServicesCache<V> { long lastUpdateTime = -1; final android.content.pm.ServiceInfo si = resolveInfo.serviceInfo; final ComponentName componentName = si.getComponentName(); if (Flags.optimizeParsingInRegisteredServicesCache()) { try { PackageInfo packageInfo = pm.getPackageInfoAsUser(si.packageName, PackageManager.MATCH_DIRECT_BOOT_AWARE Loading @@ -538,7 +538,7 @@ public abstract class RegisteredServicesCache<V> { continue; } } } try { ServiceInfo<V> info = parseServiceInfo(resolveInfo, lastUpdateTime); if (info == null) { Loading @@ -546,17 +546,14 @@ public abstract class RegisteredServicesCache<V> { continue; } serviceInfos.add(info); if (Flags.optimizeParsingInRegisteredServicesCache()) { synchronized (mUserIdToServiceInfoCaches) { mUserIdToServiceInfoCaches.add(userId, componentName, info); } } } catch (XmlPullParserException | IOException e) { Log.w(TAG, "Unable to load service info " + resolveInfo.toString(), e); } } if (Flags.optimizeParsingInRegisteredServicesCache()) { synchronized (mUserIdToServiceInfoCaches) { if (mUserIdToServiceInfoCaches.numElementsForKey(userId) > 0) { final ServiceInfoCachesToken<V> token = new ServiceInfoCachesToken<V>( Loading @@ -567,7 +564,6 @@ public abstract class RegisteredServicesCache<V> { SERVICE_INFO_CACHES_TIMEOUT_MILLIS); } } } synchronized (mServicesLock) { final UserServices<V> user = findOrCreateUserLocked(userId); Loading Loading @@ -870,12 +866,10 @@ public abstract class RegisteredServicesCache<V> { synchronized (mServicesLock) { mUserServices.remove(userId); } if (Flags.optimizeParsingInRegisteredServicesCache()) { synchronized (mUserIdToServiceInfoCaches) { mUserIdToServiceInfoCaches.delete(userId); } } } @VisibleForTesting protected List<UserInfo> getUsers() { Loading
core/java/android/content/pm/flags.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -278,14 +278,6 @@ flag { description: "Feature flag to check whether a given UID can access a content provider" } flag { name: "optimize_parsing_in_registered_services_cache" namespace: "package_manager_service" description: "Feature flag to optimize RegisteredServicesCache ServiceInfo parsing by using caches." bug: "319137634" is_fixed_read_only: true } flag { name: "always_load_past_certs_v4" is_exported: true Loading
core/tests/coretests/src/android/content/pm/RegisteredServicesCacheUnitTest.java +0 −4 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package android.content.pm; import static android.content.pm.Flags.FLAG_OPTIMIZE_PARSING_IN_REGISTERED_SERVICES_CACHE; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.anyInt; Loading @@ -44,7 +42,6 @@ import android.os.Handler; import android.os.Message; import android.os.UserHandle; import android.platform.test.annotations.Presubmit; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.util.AttributeSet; Loading Loading @@ -76,7 +73,6 @@ import java.util.Objects; */ @Presubmit @RunWith(AndroidJUnit4.class) @RequiresFlagsEnabled(FLAG_OPTIMIZE_PARSING_IN_REGISTERED_SERVICES_CACHE) public class RegisteredServicesCacheUnitTest { private static final String TAG = "RegisteredServicesCacheUnitTest"; private static final int U0 = 0; Loading