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

Commit 79b292ea authored by Jiakai Zhang's avatar Jiakai Zhang
Browse files

Remove a wtf log from notifyDexLoad.

We added a wtf log to verify an assumption we made when we were
developing ART Service. Now it has been years and we haven't seen this
log being reported, so we can reach the conclusion that our assumption
has been verified and we can remove this log.

Bug: 258223472
Bug: 6527146
Test: Presubmit
Flag: EXEMPT cleanup
Change-Id: I9be98ac06040502c392563758d6e5d6d5bc3d943
parent 303e66e5
Loading
Loading
Loading
Loading
+0 −46
Original line number Diff line number Diff line
@@ -235,7 +235,6 @@ import com.android.server.pm.permission.PermissionManagerService;
import com.android.server.pm.permission.PermissionManagerServiceInternal;
import com.android.server.pm.pkg.AndroidPackage;
import com.android.server.pm.pkg.ArchiveState;
import com.android.server.pm.pkg.PackageState;
import com.android.server.pm.pkg.PackageStateInternal;
import com.android.server.pm.pkg.PackageUserState;
import com.android.server.pm.pkg.PackageUserStateInternal;
@@ -259,8 +258,6 @@ import com.android.server.utils.WatchedSparseBooleanArray;
import com.android.server.utils.WatchedSparseIntArray;
import com.android.server.utils.Watcher;

import dalvik.system.VMRuntime;

import libcore.util.EmptyArray;
import libcore.util.HexEncoding;

@@ -5700,54 +5697,11 @@ public class PackageManagerService implements PackageSender, TestUtilityService
            }

            UserHandle user = Binder.getCallingUserHandle();
            int userId = user.getIdentifier();

            // Proxy the call to either ART Service or the legacy implementation. If the
            // implementation is switched with the system property, the dex usage info will be
            // incomplete, with these effects:
            //
            // -  Shared dex files may temporarily get compiled for private use.
            // -  Secondary dex files may not get compiled at all.
            // -  Stale compiled artifacts for secondary dex files may not get cleaned up.
            //
            // This recovers in the first background dexopt after the depending apps have been
            // loaded for the first time.

            DexUseManagerLocal dexUseManager = DexOptHelper.getDexUseManagerLocal();
            // TODO(chiuwinson): Retrieve filtered snapshot from Computer instance instead.
            try (PackageManagerLocal.FilteredSnapshot filteredSnapshot =
                    LocalManagerRegistry.getManager(PackageManagerLocal.class)
                            .withFilteredSnapshot(callingUid, user)) {
                if (loaderIsa != null) {
                    // Check that loaderIsa agrees with the ISA that dexUseManager will
                    // determine.
                    PackageState loadingPkgState =
                            filteredSnapshot.getPackageState(loadingPackageName);
                    // If we don't find the loading package just pass it through and let
                    // dexUseManager throw on it.
                    if (loadingPkgState != null) {
                        String loadingPkgAbi = loadingPkgState.getPrimaryCpuAbi();
                        if (loadingPkgAbi == null) {
                            loadingPkgAbi = Build.SUPPORTED_ABIS[0];
                        }
                        String loadingPkgDexCodeIsa =
                                InstructionSets.getDexCodeInstructionSet(
                                        VMRuntime.getInstructionSet(loadingPkgAbi));
                        if (!loaderIsa.equals(loadingPkgDexCodeIsa)) {
                            // TODO(b/251903639): We make this a wtf to surface any situations
                            // where this argument doesn't correspond to our expectations. Later
                            // it should be turned into an IllegalArgumentException, when we can
                            // assume it's the caller that's wrong rather than us.
                            Log.wtf(TAG,
                                    "Invalid loaderIsa in notifyDexLoad call from "
                                            + loadingPackageName + ", uid " + callingUid
                                            + ": expected " + loadingPkgDexCodeIsa + ", got "
                                            + loaderIsa);
                            return;
                        }
                    }
                }

                // This is called from binder, so exceptions thrown here are caught and handled
                // by it.
                dexUseManager.notifyDexContainersLoaded(