Merge "Fix ClassCastException from toArray()."
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user