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

Commit fc0e80ae authored by Alan Stokes's avatar Alan Stokes Committed by Android (Google) Code Review
Browse files

Merge "Fix ClassCastException from toArray()."

parents a16c3781 ee59d546
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ import android.util.Log;
import android.util.LruCache;
import android.util.Slog;

import libcore.util.EmptyArray;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
@@ -301,7 +303,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor {
        for (String person: second) {
            people.add(person);
        }
        return (String[]) people.toArray();
        return people.toArray(EmptyArray.STRING);
    }

    @Nullable
+7 −6
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ import com.android.server.pm.dex.DexManager;
import com.android.server.security.VerityUtils;

import libcore.io.IoUtils;
import libcore.util.EmptyArray;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -212,7 +213,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
    private static final String ATTR_SIGNATURE = "signature";

    private static final String PROPERTY_NAME_INHERIT_NATIVE = "pi.inherit_native_on_dont_kill";
    private static final int[] EMPTY_CHILD_SESSION_ARRAY = {};
    private static final int[] EMPTY_CHILD_SESSION_ARRAY = EmptyArray.INT;
    private static final FileInfo[] EMPTY_FILE_INFO_ARRAY = {};

    private static final String SYSTEM_DATA_LOADER_PACKAGE = "android";

@@ -375,8 +377,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
    // TODO(b/146080380): merge file list with Callback installation.
    private IncrementalFileStorages mIncrementalFileStorages;

    private static final String[] EMPTY_STRING_ARRAY = new String[]{};

    private static final FileFilter sAddedApkFilter = new FileFilter() {
        @Override
        public boolean accept(File file) {
@@ -731,7 +731,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        if (!isDataLoaderInstallation()) {
            String[] result = stageDir.list();
            if (result == null) {
                result = EMPTY_STRING_ARRAY;
                result = EmptyArray.STRING;
            }
            return result;
        }
@@ -3120,7 +3120,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        }

        if (grantedRuntimePermissions.size() > 0) {
            params.grantedRuntimePermissions = (String[]) grantedRuntimePermissions.toArray();
            params.grantedRuntimePermissions =
                    grantedRuntimePermissions.toArray(EmptyArray.STRING);
        }

        if (whitelistedRestrictedPermissions.size() > 0) {
@@ -3139,7 +3140,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {

        FileInfo[] fileInfosArray = null;
        if (!files.isEmpty()) {
            fileInfosArray = (FileInfo[]) files.toArray();
            fileInfosArray = files.toArray(EMPTY_FILE_INFO_ARRAY);
        }

        InstallSource installSource = InstallSource.create(installInitiatingPackageName,
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
import static org.xmlpull.v1.XmlPullParser.START_TAG;

import android.content.pm.PackageInstaller;
import android.platform.test.annotations.Presubmit;
import android.util.AtomicFile;
import android.util.Slog;
import android.util.Xml;
@@ -57,6 +58,7 @@ import java.util.Arrays;
import java.util.List;

@RunWith(AndroidJUnit4.class)
@Presubmit
public class PackageInstallerSessionTest {
    @Rule
    public TemporaryFolder mTemporaryFolder = new TemporaryFolder();