Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c655984a authored by TYM Tsai's avatar TYM Tsai
Browse files

Flag removal: pm.optimize_parsing_in_registered_services_cache

Bug: 444286661
Flag: EXEMPT FLAG_REMOVAL
Test: test FrameworksCoreTests_android_content_pm_PreSubmit
Change-Id: I66f08f9c0784ce32ccd3acaaa3aa08f9ff275ebd
parent 859372e2
Loading
Loading
Loading
Loading
+28 −34
Original line number Diff line number Diff line
@@ -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
@@ -538,7 +538,7 @@ public abstract class RegisteredServicesCache<V> {
                    continue;
                }
            }
            }

            try {
                ServiceInfo<V> info = parseServiceInfo(resolveInfo, lastUpdateTime);
                if (info == null) {
@@ -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>(
@@ -567,7 +564,6 @@ public abstract class RegisteredServicesCache<V> {
                        SERVICE_INFO_CACHES_TIMEOUT_MILLIS);
            }
        }
        }

        synchronized (mServicesLock) {
            final UserServices<V> user = findOrCreateUserLocked(userId);
@@ -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() {
+0 −8
Original line number Diff line number Diff line
@@ -285,14 +285,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
+0 −4
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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;