Merge changes I815bb92e,I1777f84c into rvc-dev
* changes: Adjust AndroidPackage String interning Add package parsing v1 vs v2 benchmark
This commit is contained in:
34
apct-tests/perftests/core/Android.bp
Normal file
34
apct-tests/perftests/core/Android.bp
Normal file
@@ -0,0 +1,34 @@
|
||||
android_test {
|
||||
name: "CorePerfTests",
|
||||
|
||||
resource_dirs: ["res"],
|
||||
srcs: [
|
||||
"src/**/*.java",
|
||||
"src/**/*.kt",
|
||||
"src/android/os/ISomeService.aidl",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
"androidx.appcompat_appcompat",
|
||||
"androidx.test.rules",
|
||||
"androidx.annotation_annotation",
|
||||
"apct-perftests-overlay-apps",
|
||||
"apct-perftests-resources-manager-apps",
|
||||
"apct-perftests-utils",
|
||||
"guava",
|
||||
],
|
||||
|
||||
libs: ["android.test.base"],
|
||||
|
||||
platform_apis: true,
|
||||
|
||||
jni_libs: ["libperftestscore_jni"],
|
||||
|
||||
// Use google-fonts/dancing-script for the performance metrics
|
||||
// ANDROIDMK TRANSLATION ERROR: Only $(LOCAL_PATH)/.. values are allowed
|
||||
// LOCAL_ASSET_DIR := $(TOP)/external/google-fonts/dancing-script
|
||||
|
||||
test_suites: ["device-tests"],
|
||||
certificate: "platform",
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
|
||||
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
|
||||
LOCAL_SRC_FILES := \
|
||||
$(call all-java-files-under, src) \
|
||||
src/android/os/ISomeService.aidl
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||
androidx.appcompat_appcompat \
|
||||
androidx.test.rules \
|
||||
androidx.annotation_annotation \
|
||||
apct-perftests-overlay-apps \
|
||||
apct-perftests-resources-manager-apps \
|
||||
apct-perftests-utils \
|
||||
guava
|
||||
|
||||
LOCAL_JAVA_LIBRARIES := android.test.base
|
||||
|
||||
LOCAL_PACKAGE_NAME := CorePerfTests
|
||||
LOCAL_PRIVATE_PLATFORM_APIS := true
|
||||
|
||||
LOCAL_JNI_SHARED_LIBRARIES := libperftestscore_jni
|
||||
|
||||
# Use google-fonts/dancing-script for the performance metrics
|
||||
LOCAL_ASSET_DIR := $(TOP)/external/google-fonts/dancing-script
|
||||
|
||||
LOCAL_COMPATIBILITY_SUITE += device-tests
|
||||
LOCAL_CERTIFICATE := platform
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.os
|
||||
|
||||
import android.content.pm.PackageParser
|
||||
import android.content.pm.PackageParserCacheHelper.ReadHelper
|
||||
import android.content.pm.PackageParserCacheHelper.WriteHelper
|
||||
import android.content.pm.parsing.ParsingPackageImpl
|
||||
import android.content.pm.parsing.ParsingPackageRead
|
||||
import android.content.pm.parsing.ParsingPackageUtils
|
||||
import android.content.pm.parsing.result.ParseTypeImpl
|
||||
import android.content.res.TypedArray
|
||||
import android.perftests.utils.BenchmarkState
|
||||
import android.perftests.utils.PerfStatusReporter
|
||||
import androidx.test.filters.LargeTest
|
||||
import com.android.internal.util.ConcurrentUtils
|
||||
import libcore.io.IoUtils
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.util.concurrent.ArrayBlockingQueue
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized::class)
|
||||
class PackageParsingPerfTest {
|
||||
|
||||
companion object {
|
||||
private const val PARALLEL_QUEUE_CAPACITY = 10
|
||||
private const val PARALLEL_MAX_THREADS = 4
|
||||
|
||||
private const val QUEUE_POLL_TIMEOUT_SECONDS = 5L
|
||||
|
||||
// TODO: Replace this with core version of SYSTEM_PARTITIONS
|
||||
val FOLDERS_TO_TEST = listOf(
|
||||
Environment.getRootDirectory(),
|
||||
Environment.getVendorDirectory(),
|
||||
Environment.getOdmDirectory(),
|
||||
Environment.getOemDirectory(),
|
||||
Environment.getOemDirectory(),
|
||||
Environment.getSystemExtDirectory()
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
fun parameters(): Array<Params> {
|
||||
val apks = FOLDERS_TO_TEST
|
||||
.filter(File::exists)
|
||||
.map(File::walkTopDown)
|
||||
.flatMap(Sequence<File>::asIterable)
|
||||
.filter { it.name.endsWith(".apk") }
|
||||
|
||||
return arrayOf(
|
||||
Params(1, apks) { ParallelParser1(it?.let(::PackageCacher1)) },
|
||||
Params(2, apks) { ParallelParser2(it?.let(::PackageCacher2)) }
|
||||
)
|
||||
}
|
||||
|
||||
data class Params(
|
||||
val version: Int,
|
||||
val apks: List<File>,
|
||||
val cacheDirToParser: (File?) -> ParallelParser<*>
|
||||
) {
|
||||
// For test name formatting
|
||||
override fun toString() = "v$version"
|
||||
}
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
var perfStatusReporter = PerfStatusReporter()
|
||||
|
||||
@get:Rule
|
||||
var testFolder = TemporaryFolder()
|
||||
|
||||
@Parameterized.Parameter(0)
|
||||
lateinit var params: Params
|
||||
|
||||
private val state: BenchmarkState get() = perfStatusReporter.benchmarkState
|
||||
private val apks: List<File> get() = params.apks
|
||||
|
||||
@Test
|
||||
fun sequentialNoCache() {
|
||||
params.cacheDirToParser(null).use { parser ->
|
||||
while (state.keepRunning()) {
|
||||
apks.forEach { parser.parse(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun sequentialCached() {
|
||||
params.cacheDirToParser(testFolder.newFolder()).use { parser ->
|
||||
// Fill the cache
|
||||
apks.forEach { parser.parse(it) }
|
||||
|
||||
while (state.keepRunning()) {
|
||||
apks.forEach { parser.parse(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parallelNoCache() {
|
||||
params.cacheDirToParser(null).use { parser ->
|
||||
while (state.keepRunning()) {
|
||||
apks.forEach { parser.submit(it) }
|
||||
repeat(apks.size) { parser.take() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parallelCached() {
|
||||
params.cacheDirToParser(testFolder.newFolder()).use { parser ->
|
||||
// Fill the cache
|
||||
apks.forEach { parser.parse(it) }
|
||||
|
||||
while (state.keepRunning()) {
|
||||
apks.forEach { parser.submit(it) }
|
||||
repeat(apks.size) { parser.take() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ParallelParser<PackageType : Parcelable>(
|
||||
private val cacher: PackageCacher<PackageType>? = null
|
||||
) : AutoCloseable {
|
||||
private val queue = ArrayBlockingQueue<Any>(PARALLEL_QUEUE_CAPACITY)
|
||||
private val service = ConcurrentUtils.newFixedThreadPool(
|
||||
PARALLEL_MAX_THREADS, "package-parsing-test",
|
||||
Process.THREAD_PRIORITY_FOREGROUND)
|
||||
|
||||
fun submit(file: File) = service.submit { queue.put(parse(file)) }
|
||||
|
||||
fun take() = queue.poll(QUEUE_POLL_TIMEOUT_SECONDS, TimeUnit.SECONDS)
|
||||
|
||||
override fun close() {
|
||||
service.shutdownNow()
|
||||
}
|
||||
|
||||
fun parse(file: File) = cacher?.getCachedResult(file)
|
||||
?: parseImpl(file).also { cacher?.cacheResult(file, it) }
|
||||
|
||||
protected abstract fun parseImpl(file: File): PackageType
|
||||
}
|
||||
|
||||
class ParallelParser1(private val cacher: PackageCacher1? = null)
|
||||
: ParallelParser<PackageParser.Package>(cacher) {
|
||||
val parser = PackageParser().apply {
|
||||
setCallback { true }
|
||||
}
|
||||
|
||||
override fun parseImpl(file: File) = parser.parsePackage(file, 0, cacher != null)
|
||||
}
|
||||
|
||||
class ParallelParser2(cacher: PackageCacher2? = null)
|
||||
: ParallelParser<ParsingPackageRead>(cacher) {
|
||||
val input = ThreadLocal.withInitial { ParseTypeImpl() }
|
||||
val parser = ParsingPackageUtils(false, null, null,
|
||||
object : ParsingPackageUtils.Callback {
|
||||
override fun hasFeature(feature: String) = true
|
||||
|
||||
override fun startParsingPackage(
|
||||
packageName: String,
|
||||
baseCodePath: String,
|
||||
codePath: String,
|
||||
manifestArray: TypedArray,
|
||||
isCoreApp: Boolean
|
||||
) = ParsingPackageImpl(packageName, baseCodePath, codePath, manifestArray)
|
||||
})
|
||||
|
||||
override fun parseImpl(file: File) =
|
||||
parser.parsePackage(input.get()!!.reset(), file, 0).result
|
||||
}
|
||||
|
||||
abstract class PackageCacher<PackageType : Parcelable>(private val cacheDir: File) {
|
||||
|
||||
fun getCachedResult(file: File): PackageType? {
|
||||
val cacheFile = File(cacheDir, file.name)
|
||||
if (!cacheFile.exists()) {
|
||||
return null
|
||||
}
|
||||
|
||||
val bytes = IoUtils.readFileAsByteArray(cacheFile.absolutePath)
|
||||
val parcel = Parcel.obtain().apply {
|
||||
unmarshall(bytes, 0, bytes.size)
|
||||
setDataPosition(0)
|
||||
}
|
||||
ReadHelper(parcel).apply { startAndInstall() }
|
||||
return fromParcel(parcel).also {
|
||||
parcel.recycle()
|
||||
}
|
||||
}
|
||||
|
||||
fun cacheResult(file: File, parsed: Parcelable) {
|
||||
val cacheFile = File(cacheDir, file.name)
|
||||
if (cacheFile.exists()) {
|
||||
if (!cacheFile.delete()) {
|
||||
throw IllegalStateException("Unable to delete cache file: $cacheFile")
|
||||
}
|
||||
}
|
||||
val cacheEntry = toCacheEntry(parsed)
|
||||
return FileOutputStream(cacheFile).use { fos -> fos.write(cacheEntry) }
|
||||
}
|
||||
|
||||
private fun toCacheEntry(pkg: Parcelable): ByteArray {
|
||||
val parcel = Parcel.obtain()
|
||||
val helper = WriteHelper(parcel)
|
||||
pkg.writeToParcel(parcel, 0 /* flags */)
|
||||
helper.finishAndUninstall()
|
||||
return parcel.marshall().also {
|
||||
parcel.recycle()
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract fun fromParcel(parcel: Parcel): PackageType
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-implementation of v1's cache, since that's gone in R+.
|
||||
*/
|
||||
class PackageCacher1(cacheDir: File) : PackageCacher<PackageParser.Package>(cacheDir) {
|
||||
override fun fromParcel(parcel: Parcel) = PackageParser.Package(parcel)
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-implementation of the server side PackageCacher, as it's inaccessible here.
|
||||
*/
|
||||
class PackageCacher2(cacheDir: File) : PackageCacher<ParsingPackageRead>(cacheDir) {
|
||||
override fun fromParcel(parcel: Parcel) = ParsingPackageImpl(parcel)
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,7 @@ import com.android.internal.util.Parcelling.BuiltIn.ForInternedStringArray;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedStringList;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedStringSet;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedStringValueMap;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForStringSet;
|
||||
|
||||
import java.security.PublicKey;
|
||||
import java.util.Collections;
|
||||
@@ -87,16 +88,15 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
private static final String TAG = "PackageImpl";
|
||||
|
||||
public static ForBoolean sForBoolean = Parcelling.Cache.getOrCreate(ForBoolean.class);
|
||||
public static ForInternedString sForString = Parcelling.Cache.getOrCreate(
|
||||
public static ForInternedString sForInternedString = Parcelling.Cache.getOrCreate(
|
||||
ForInternedString.class);
|
||||
public static ForInternedStringArray sForStringArray = Parcelling.Cache.getOrCreate(
|
||||
public static ForInternedStringArray sForInternedStringArray = Parcelling.Cache.getOrCreate(
|
||||
ForInternedStringArray.class);
|
||||
public static ForInternedStringList sForStringList = Parcelling.Cache.getOrCreate(
|
||||
public static ForInternedStringList sForInternedStringList = Parcelling.Cache.getOrCreate(
|
||||
ForInternedStringList.class);
|
||||
public static ForInternedStringValueMap sForStringValueMap = Parcelling.Cache.getOrCreate(
|
||||
ForInternedStringValueMap.class);
|
||||
public static ForInternedStringSet sForStringSet = Parcelling.Cache.getOrCreate(
|
||||
ForInternedStringSet.class);
|
||||
public static ForInternedStringValueMap sForInternedStringValueMap =
|
||||
Parcelling.Cache.getOrCreate(ForInternedStringValueMap.class);
|
||||
public static ForStringSet sForStringSet = Parcelling.Cache.getOrCreate(ForStringSet.class);
|
||||
protected static ParsedIntentInfo.StringPairListParceler sForIntentInfoPairs =
|
||||
Parcelling.Cache.getOrCreate(ParsedIntentInfo.StringPairListParceler.class);
|
||||
|
||||
@@ -414,8 +414,8 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
public ParsingPackageImpl(@NonNull String packageName, @NonNull String baseCodePath,
|
||||
@NonNull String codePath, @Nullable TypedArray manifestArray) {
|
||||
this.packageName = TextUtils.safeIntern(packageName);
|
||||
this.baseCodePath = TextUtils.safeIntern(baseCodePath);
|
||||
this.codePath = TextUtils.safeIntern(codePath);
|
||||
this.baseCodePath = baseCodePath;
|
||||
this.codePath = codePath;
|
||||
|
||||
if (manifestArray != null) {
|
||||
versionCode = manifestArray.getInteger(R.styleable.AndroidManifest_versionCode, 0);
|
||||
@@ -495,18 +495,6 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setVersionName(String versionName) {
|
||||
this.versionName = TextUtils.safeIntern(versionName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackage setCompileSdkVersionCodename(String compileSdkVersionCodename) {
|
||||
this.compileSdkVersionCodeName = TextUtils.safeIntern(compileSdkVersionCodename);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object hideAsParsed() {
|
||||
// There is no equivalent for core-only parsing
|
||||
@@ -548,15 +536,14 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl addOriginalPackage(String originalPackage) {
|
||||
this.originalPackages = CollectionUtils.add(this.originalPackages,
|
||||
TextUtils.safeIntern(originalPackage));
|
||||
this.originalPackages = CollectionUtils.add(this.originalPackages, originalPackage);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackage addOverlayable(String overlayableName, String actorName) {
|
||||
this.overlayables = CollectionUtils.add(this.overlayables,
|
||||
TextUtils.safeIntern(overlayableName), TextUtils.safeIntern(actorName));
|
||||
this.overlayables = CollectionUtils.add(this.overlayables, overlayableName,
|
||||
TextUtils.safeIntern(actorName));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -710,8 +697,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl addQueriesProvider(String authority) {
|
||||
this.queriesProviders = CollectionUtils.add(this.queriesProviders,
|
||||
TextUtils.safeIntern(authority));
|
||||
this.queriesProviders = CollectionUtils.add(this.queriesProviders, authority);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -776,20 +762,9 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl asSplit(
|
||||
String[] splitNames,
|
||||
String[] splitCodePaths,
|
||||
int[] splitRevisionCodes,
|
||||
SparseArray<int[]> splitDependencies
|
||||
) {
|
||||
public ParsingPackageImpl asSplit(String[] splitNames, String[] splitCodePaths,
|
||||
int[] splitRevisionCodes, SparseArray<int[]> splitDependencies) {
|
||||
this.splitNames = splitNames;
|
||||
|
||||
if (this.splitNames != null) {
|
||||
for (int index = 0; index < this.splitNames.length; index++) {
|
||||
splitNames[index] = TextUtils.safeIntern(splitNames[index]);
|
||||
}
|
||||
}
|
||||
|
||||
this.splitCodePaths = splitCodePaths;
|
||||
this.splitRevisionCodes = splitRevisionCodes;
|
||||
this.splitDependencies = splitDependencies;
|
||||
@@ -814,27 +789,9 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setProcessName(String processName) {
|
||||
this.processName = TextUtils.safeIntern(processName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setRealPackage(@Nullable String realPackage) {
|
||||
this.realPackage = TextUtils.safeIntern(realPackage);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setRestrictedAccountType(@Nullable String restrictedAccountType) {
|
||||
this.restrictedAccountType = TextUtils.safeIntern(restrictedAccountType);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setRequiredAccountType(@Nullable String requiredAccountType) {
|
||||
this.requiredAccountType = TextUtils.nullIfEmpty(TextUtils.safeIntern(requiredAccountType));
|
||||
this.requiredAccountType = TextUtils.nullIfEmpty(requiredAccountType);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -844,72 +801,12 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setOverlayTargetName(@Nullable String overlayTargetName) {
|
||||
this.overlayTargetName = TextUtils.safeIntern(overlayTargetName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setOverlayCategory(@Nullable String overlayCategory) {
|
||||
this.overlayCategory = TextUtils.safeIntern(overlayCategory);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setVolumeUuid(@Nullable String volumeUuid) {
|
||||
this.volumeUuid = TextUtils.safeIntern(volumeUuid);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setAppComponentFactory(@Nullable String appComponentFactory) {
|
||||
this.appComponentFactory = TextUtils.safeIntern(appComponentFactory);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setBackupAgentName(@Nullable String backupAgentName) {
|
||||
this.backupAgentName = TextUtils.safeIntern(backupAgentName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setClassLoaderName(@Nullable String classLoaderName) {
|
||||
this.classLoaderName = TextUtils.safeIntern(classLoaderName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setClassName(@Nullable String className) {
|
||||
this.className = TextUtils.safeIntern(className);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setManageSpaceActivityName(@Nullable String manageSpaceActivityName) {
|
||||
this.manageSpaceActivityName = TextUtils.safeIntern(manageSpaceActivityName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setPermission(@Nullable String permission) {
|
||||
this.permission = TextUtils.safeIntern(permission);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setTaskAffinity(@Nullable String taskAffinity) {
|
||||
this.taskAffinity = TextUtils.safeIntern(taskAffinity);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setZygotePreloadName(@Nullable String zygotePreloadName) {
|
||||
this.zygotePreloadName = TextUtils.safeIntern(zygotePreloadName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setStaticSharedLibName(String staticSharedLibName) {
|
||||
this.staticSharedLibName = TextUtils.safeIntern(staticSharedLibName);
|
||||
@@ -1044,27 +941,27 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
dest.writeInt(this.versionCode);
|
||||
dest.writeInt(this.versionCodeMajor);
|
||||
dest.writeInt(this.baseRevisionCode);
|
||||
sForString.parcel(this.versionName, dest, flags);
|
||||
sForInternedString.parcel(this.versionName, dest, flags);
|
||||
dest.writeInt(this.compileSdkVersion);
|
||||
sForString.parcel(this.compileSdkVersionCodeName, dest, flags);
|
||||
sForString.parcel(this.packageName, dest, flags);
|
||||
sForString.parcel(this.realPackage, dest, flags);
|
||||
sForString.parcel(this.baseCodePath, dest, flags);
|
||||
dest.writeString(this.compileSdkVersionCodeName);
|
||||
sForInternedString.parcel(this.packageName, dest, flags);
|
||||
dest.writeString(this.realPackage);
|
||||
dest.writeString(this.baseCodePath);
|
||||
dest.writeBoolean(this.requiredForAllUsers);
|
||||
sForString.parcel(this.restrictedAccountType, dest, flags);
|
||||
sForString.parcel(this.requiredAccountType, dest, flags);
|
||||
sForString.parcel(this.overlayTarget, dest, flags);
|
||||
sForString.parcel(this.overlayTargetName, dest, flags);
|
||||
sForString.parcel(this.overlayCategory, dest, flags);
|
||||
dest.writeString(this.restrictedAccountType);
|
||||
dest.writeString(this.requiredAccountType);
|
||||
sForInternedString.parcel(this.overlayTarget, dest, flags);
|
||||
dest.writeString(this.overlayTargetName);
|
||||
dest.writeString(this.overlayCategory);
|
||||
dest.writeInt(this.overlayPriority);
|
||||
dest.writeBoolean(this.overlayIsStatic);
|
||||
sForStringValueMap.parcel(this.overlayables, dest, flags);
|
||||
sForString.parcel(this.staticSharedLibName, dest, flags);
|
||||
sForInternedStringValueMap.parcel(this.overlayables, dest, flags);
|
||||
sForInternedString.parcel(this.staticSharedLibName, dest, flags);
|
||||
dest.writeLong(this.staticSharedLibVersion);
|
||||
sForStringList.parcel(this.libraryNames, dest, flags);
|
||||
sForStringList.parcel(this.usesLibraries, dest, flags);
|
||||
sForStringList.parcel(this.usesOptionalLibraries, dest, flags);
|
||||
sForStringList.parcel(this.usesStaticLibraries, dest, flags);
|
||||
sForInternedStringList.parcel(this.libraryNames, dest, flags);
|
||||
sForInternedStringList.parcel(this.usesLibraries, dest, flags);
|
||||
sForInternedStringList.parcel(this.usesOptionalLibraries, dest, flags);
|
||||
sForInternedStringList.parcel(this.usesStaticLibraries, dest, flags);
|
||||
dest.writeLongArray(this.usesStaticLibrariesVersions);
|
||||
|
||||
if (this.usesStaticLibrariesCertDigests == null) {
|
||||
@@ -1072,23 +969,23 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
} else {
|
||||
dest.writeInt(this.usesStaticLibrariesCertDigests.length);
|
||||
for (int index = 0; index < this.usesStaticLibrariesCertDigests.length; index++) {
|
||||
sForStringArray.parcel(this.usesStaticLibrariesCertDigests[index], dest, flags);
|
||||
dest.writeStringArray(this.usesStaticLibrariesCertDigests[index]);
|
||||
}
|
||||
}
|
||||
|
||||
sForString.parcel(this.sharedUserId, dest, flags);
|
||||
sForInternedString.parcel(this.sharedUserId, dest, flags);
|
||||
dest.writeInt(this.sharedUserLabel);
|
||||
dest.writeTypedList(this.configPreferences);
|
||||
dest.writeTypedList(this.reqFeatures);
|
||||
dest.writeTypedList(this.featureGroups);
|
||||
dest.writeByteArray(this.restrictUpdateHash);
|
||||
sForStringList.parcel(this.originalPackages, dest, flags);
|
||||
sForStringList.parcel(this.adoptPermissions, dest, flags);
|
||||
sForStringList.parcel(this.requestedPermissions, dest, flags);
|
||||
sForStringList.parcel(this.implicitPermissions, dest, flags);
|
||||
dest.writeStringList(this.originalPackages);
|
||||
sForInternedStringList.parcel(this.adoptPermissions, dest, flags);
|
||||
sForInternedStringList.parcel(this.requestedPermissions, dest, flags);
|
||||
sForInternedStringList.parcel(this.implicitPermissions, dest, flags);
|
||||
sForStringSet.parcel(this.upgradeKeySets, dest, flags);
|
||||
dest.writeMap(this.keySetMapping);
|
||||
sForStringList.parcel(this.protectedBroadcasts, dest, flags);
|
||||
sForInternedStringList.parcel(this.protectedBroadcasts, dest, flags);
|
||||
dest.writeTypedList(this.activities);
|
||||
dest.writeTypedList(this.receivers);
|
||||
dest.writeTypedList(this.services);
|
||||
@@ -1100,20 +997,20 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
sForIntentInfoPairs.parcel(this.preferredActivityFilters, dest, flags);
|
||||
dest.writeMap(this.processes);
|
||||
dest.writeBundle(this.metaData);
|
||||
sForString.parcel(this.volumeUuid, dest, flags);
|
||||
sForInternedString.parcel(this.volumeUuid, dest, flags);
|
||||
dest.writeParcelable(this.signingDetails, flags);
|
||||
sForString.parcel(this.codePath, dest, flags);
|
||||
dest.writeString(this.codePath);
|
||||
dest.writeBoolean(this.use32BitAbi);
|
||||
dest.writeBoolean(this.visibleToInstantApps);
|
||||
dest.writeBoolean(this.forceQueryable);
|
||||
dest.writeParcelableList(this.queriesIntents, flags);
|
||||
sForStringList.parcel(this.queriesPackages, dest, flags);
|
||||
sForString.parcel(this.appComponentFactory, dest, flags);
|
||||
sForString.parcel(this.backupAgentName, dest, flags);
|
||||
sForInternedStringList.parcel(this.queriesPackages, dest, flags);
|
||||
dest.writeString(this.appComponentFactory);
|
||||
dest.writeString(this.backupAgentName);
|
||||
dest.writeInt(this.banner);
|
||||
dest.writeInt(this.category);
|
||||
sForString.parcel(this.classLoaderName, dest, flags);
|
||||
sForString.parcel(this.className, dest, flags);
|
||||
dest.writeString(this.classLoaderName);
|
||||
dest.writeString(this.className);
|
||||
dest.writeInt(this.compatibleWidthLimitDp);
|
||||
dest.writeInt(this.descriptionRes);
|
||||
dest.writeBoolean(this.enabled);
|
||||
@@ -1124,27 +1021,27 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
dest.writeInt(this.labelRes);
|
||||
dest.writeInt(this.largestWidthLimitDp);
|
||||
dest.writeInt(this.logo);
|
||||
sForString.parcel(this.manageSpaceActivityName, dest, flags);
|
||||
dest.writeString(this.manageSpaceActivityName);
|
||||
dest.writeFloat(this.maxAspectRatio);
|
||||
dest.writeFloat(this.minAspectRatio);
|
||||
dest.writeInt(this.minSdkVersion);
|
||||
dest.writeInt(this.networkSecurityConfigRes);
|
||||
dest.writeCharSequence(this.nonLocalizedLabel);
|
||||
sForString.parcel(this.permission, dest, flags);
|
||||
sForString.parcel(this.processName, dest, flags);
|
||||
dest.writeString(this.permission);
|
||||
dest.writeString(this.processName);
|
||||
dest.writeInt(this.requiresSmallestWidthDp);
|
||||
dest.writeInt(this.roundIconRes);
|
||||
dest.writeInt(this.targetSandboxVersion);
|
||||
dest.writeInt(this.targetSdkVersion);
|
||||
sForString.parcel(this.taskAffinity, dest, flags);
|
||||
dest.writeString(this.taskAffinity);
|
||||
dest.writeInt(this.theme);
|
||||
dest.writeInt(this.uiOptions);
|
||||
sForString.parcel(this.zygotePreloadName, dest, flags);
|
||||
sForStringArray.parcel(this.splitClassLoaderNames, dest, flags);
|
||||
sForStringArray.parcel(this.splitCodePaths, dest, flags);
|
||||
dest.writeString(this.zygotePreloadName);
|
||||
dest.writeStringArray(this.splitClassLoaderNames);
|
||||
dest.writeStringArray(this.splitCodePaths);
|
||||
dest.writeSparseArray(this.splitDependencies);
|
||||
dest.writeIntArray(this.splitFlags);
|
||||
sForStringArray.parcel(this.splitNames, dest, flags);
|
||||
dest.writeStringArray(this.splitNames);
|
||||
dest.writeIntArray(this.splitRevisionCodes);
|
||||
|
||||
dest.writeBoolean(this.externalStorage);
|
||||
@@ -1203,50 +1100,51 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
this.versionCode = in.readInt();
|
||||
this.versionCodeMajor = in.readInt();
|
||||
this.baseRevisionCode = in.readInt();
|
||||
this.versionName = sForString.unparcel(in);
|
||||
this.versionName = sForInternedString.unparcel(in);
|
||||
this.compileSdkVersion = in.readInt();
|
||||
this.compileSdkVersionCodeName = sForString.unparcel(in);
|
||||
this.packageName = sForString.unparcel(in);
|
||||
this.realPackage = sForString.unparcel(in);
|
||||
this.baseCodePath = sForString.unparcel(in);
|
||||
this.compileSdkVersionCodeName = in.readString();
|
||||
this.packageName = sForInternedString.unparcel(in);
|
||||
this.realPackage = in.readString();
|
||||
this.baseCodePath = in.readString();
|
||||
this.requiredForAllUsers = in.readBoolean();
|
||||
this.restrictedAccountType = sForString.unparcel(in);
|
||||
this.requiredAccountType = sForString.unparcel(in);
|
||||
this.overlayTarget = sForString.unparcel(in);
|
||||
this.overlayTargetName = sForString.unparcel(in);
|
||||
this.overlayCategory = sForString.unparcel(in);
|
||||
this.restrictedAccountType = in.readString();
|
||||
this.requiredAccountType = in.readString();
|
||||
this.overlayTarget = sForInternedString.unparcel(in);
|
||||
this.overlayTargetName = in.readString();
|
||||
this.overlayCategory = in.readString();
|
||||
this.overlayPriority = in.readInt();
|
||||
this.overlayIsStatic = in.readBoolean();
|
||||
this.overlayables = sForStringValueMap.unparcel(in);
|
||||
this.staticSharedLibName = sForString.unparcel(in);
|
||||
this.overlayables = sForInternedStringValueMap.unparcel(in);
|
||||
this.staticSharedLibName = sForInternedString.unparcel(in);
|
||||
this.staticSharedLibVersion = in.readLong();
|
||||
this.libraryNames = sForStringList.unparcel(in);
|
||||
this.usesLibraries = sForStringList.unparcel(in);
|
||||
this.usesOptionalLibraries = sForStringList.unparcel(in);
|
||||
this.usesStaticLibraries = sForStringList.unparcel(in);
|
||||
this.libraryNames = sForInternedStringList.unparcel(in);
|
||||
this.usesLibraries = sForInternedStringList.unparcel(in);
|
||||
this.usesOptionalLibraries = sForInternedStringList.unparcel(in);
|
||||
this.usesStaticLibraries = sForInternedStringList.unparcel(in);
|
||||
this.usesStaticLibrariesVersions = in.createLongArray();
|
||||
|
||||
int digestsSize = in.readInt();
|
||||
if (digestsSize >= 0) {
|
||||
this.usesStaticLibrariesCertDigests = new String[digestsSize][];
|
||||
for (int index = 0; index < digestsSize; index++) {
|
||||
this.usesStaticLibrariesCertDigests[index] = sForStringArray.unparcel(in);
|
||||
this.usesStaticLibrariesCertDigests[index] = sForInternedStringArray.unparcel(in);
|
||||
}
|
||||
}
|
||||
|
||||
this.sharedUserId = sForString.unparcel(in);
|
||||
this.sharedUserId = sForInternedString.unparcel(in);
|
||||
this.sharedUserLabel = in.readInt();
|
||||
this.configPreferences = in.createTypedArrayList(ConfigurationInfo.CREATOR);
|
||||
this.reqFeatures = in.createTypedArrayList(FeatureInfo.CREATOR);
|
||||
this.featureGroups = in.createTypedArrayList(FeatureGroupInfo.CREATOR);
|
||||
this.restrictUpdateHash = in.createByteArray();
|
||||
this.originalPackages = sForStringList.unparcel(in);
|
||||
this.adoptPermissions = sForStringList.unparcel(in);
|
||||
this.requestedPermissions = sForStringList.unparcel(in);
|
||||
this.implicitPermissions = sForStringList.unparcel(in);
|
||||
this.originalPackages = in.createStringArrayList();
|
||||
this.adoptPermissions = sForInternedStringList.unparcel(in);
|
||||
this.requestedPermissions = sForInternedStringList.unparcel(in);
|
||||
this.implicitPermissions = sForInternedStringList.unparcel(in);
|
||||
this.upgradeKeySets = sForStringSet.unparcel(in);
|
||||
this.keySetMapping = in.readHashMap(boot);
|
||||
this.protectedBroadcasts = sForStringList.unparcel(in);
|
||||
this.protectedBroadcasts = sForInternedStringList.unparcel(in);
|
||||
|
||||
this.activities = in.createTypedArrayList(ParsedActivity.CREATOR);
|
||||
this.receivers = in.createTypedArrayList(ParsedActivity.CREATOR);
|
||||
this.services = in.createTypedArrayList(ParsedService.CREATOR);
|
||||
@@ -1258,20 +1156,20 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
this.preferredActivityFilters = sForIntentInfoPairs.unparcel(in);
|
||||
this.processes = in.readHashMap(boot);
|
||||
this.metaData = in.readBundle(boot);
|
||||
this.volumeUuid = sForString.unparcel(in);
|
||||
this.volumeUuid = sForInternedString.unparcel(in);
|
||||
this.signingDetails = in.readParcelable(boot);
|
||||
this.codePath = sForString.unparcel(in);
|
||||
this.codePath = in.readString();
|
||||
this.use32BitAbi = in.readBoolean();
|
||||
this.visibleToInstantApps = in.readBoolean();
|
||||
this.forceQueryable = in.readBoolean();
|
||||
this.queriesIntents = in.createTypedArrayList(Intent.CREATOR);
|
||||
this.queriesPackages = sForStringList.unparcel(in);
|
||||
this.appComponentFactory = sForString.unparcel(in);
|
||||
this.backupAgentName = sForString.unparcel(in);
|
||||
this.queriesPackages = sForInternedStringList.unparcel(in);
|
||||
this.appComponentFactory = in.readString();
|
||||
this.backupAgentName = in.readString();
|
||||
this.banner = in.readInt();
|
||||
this.category = in.readInt();
|
||||
this.classLoaderName = sForString.unparcel(in);
|
||||
this.className = sForString.unparcel(in);
|
||||
this.classLoaderName = in.readString();
|
||||
this.className = in.readString();
|
||||
this.compatibleWidthLimitDp = in.readInt();
|
||||
this.descriptionRes = in.readInt();
|
||||
this.enabled = in.readBoolean();
|
||||
@@ -1282,27 +1180,27 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
this.labelRes = in.readInt();
|
||||
this.largestWidthLimitDp = in.readInt();
|
||||
this.logo = in.readInt();
|
||||
this.manageSpaceActivityName = sForString.unparcel(in);
|
||||
this.manageSpaceActivityName = in.readString();
|
||||
this.maxAspectRatio = in.readFloat();
|
||||
this.minAspectRatio = in.readFloat();
|
||||
this.minSdkVersion = in.readInt();
|
||||
this.networkSecurityConfigRes = in.readInt();
|
||||
this.nonLocalizedLabel = in.readCharSequence();
|
||||
this.permission = sForString.unparcel(in);
|
||||
this.processName = sForString.unparcel(in);
|
||||
this.permission = in.readString();
|
||||
this.processName = in.readString();
|
||||
this.requiresSmallestWidthDp = in.readInt();
|
||||
this.roundIconRes = in.readInt();
|
||||
this.targetSandboxVersion = in.readInt();
|
||||
this.targetSdkVersion = in.readInt();
|
||||
this.taskAffinity = sForString.unparcel(in);
|
||||
this.taskAffinity = in.readString();
|
||||
this.theme = in.readInt();
|
||||
this.uiOptions = in.readInt();
|
||||
this.zygotePreloadName = sForString.unparcel(in);
|
||||
this.splitClassLoaderNames = sForStringArray.unparcel(in);
|
||||
this.splitCodePaths = sForStringArray.unparcel(in);
|
||||
this.zygotePreloadName = in.readString();
|
||||
this.splitClassLoaderNames = in.createStringArray();
|
||||
this.splitCodePaths = in.createStringArray();
|
||||
this.splitDependencies = in.readSparseArray(boot);
|
||||
this.splitFlags = in.createIntArray();
|
||||
this.splitNames = sForStringArray.unparcel(in);
|
||||
this.splitNames = in.createStringArray();
|
||||
this.splitRevisionCodes = in.createIntArray();
|
||||
this.externalStorage = in.readBoolean();
|
||||
this.baseHardwareAccelerated = in.readBoolean();
|
||||
@@ -1323,7 +1221,6 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
this.multiArch = in.readBoolean();
|
||||
this.extractNativeLibs = in.readBoolean();
|
||||
this.game = in.readBoolean();
|
||||
|
||||
this.resizeableActivity = sForBoolean.unparcel(in);
|
||||
|
||||
this.staticSharedLibrary = in.readBoolean();
|
||||
@@ -2581,4 +2478,94 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
preserveLegacyExternalStorage = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setVersionName(String versionName) {
|
||||
this.versionName = versionName;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackage setCompileSdkVersionCodename(String compileSdkVersionCodename) {
|
||||
this.compileSdkVersionCodeName = compileSdkVersionCodename;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setProcessName(String processName) {
|
||||
this.processName = processName;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setRealPackage(@Nullable String realPackage) {
|
||||
this.realPackage = realPackage;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setRestrictedAccountType(@Nullable String restrictedAccountType) {
|
||||
this.restrictedAccountType = restrictedAccountType;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setOverlayTargetName(@Nullable String overlayTargetName) {
|
||||
this.overlayTargetName = overlayTargetName;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setOverlayCategory(@Nullable String overlayCategory) {
|
||||
this.overlayCategory = overlayCategory;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setAppComponentFactory(@Nullable String appComponentFactory) {
|
||||
this.appComponentFactory = appComponentFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setBackupAgentName(@Nullable String backupAgentName) {
|
||||
this.backupAgentName = backupAgentName;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setClassLoaderName(@Nullable String classLoaderName) {
|
||||
this.classLoaderName = classLoaderName;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setClassName(@Nullable String className) {
|
||||
this.className = className;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setManageSpaceActivityName(@Nullable String manageSpaceActivityName) {
|
||||
this.manageSpaceActivityName = manageSpaceActivityName;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setPermission(@Nullable String permission) {
|
||||
this.permission = permission;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setTaskAffinity(@Nullable String taskAffinity) {
|
||||
this.taskAffinity = taskAffinity;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setZygotePreloadName(@Nullable String zygotePreloadName) {
|
||||
this.zygotePreloadName = zygotePreloadName;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE;
|
||||
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
|
||||
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION;
|
||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForString;
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString;
|
||||
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
@@ -29,13 +29,11 @@ import android.content.ComponentName;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageParser;
|
||||
import android.content.pm.parsing.ParsingPackageImpl;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
import com.android.internal.util.Parcelling;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedString;
|
||||
|
||||
/** @hide **/
|
||||
@@ -268,11 +266,11 @@ public class ParsedActivity extends ParsedMainComponent {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeInt(this.theme);
|
||||
dest.writeInt(this.uiOptions);
|
||||
sForString.parcel(this.targetActivity, dest, flags);
|
||||
sForString.parcel(this.parentActivityName, dest, flags);
|
||||
dest.writeString(this.targetActivity);
|
||||
dest.writeString(this.parentActivityName);
|
||||
dest.writeString(this.taskAffinity);
|
||||
dest.writeInt(this.privateFlags);
|
||||
sForString.parcel(this.permission, dest, flags);
|
||||
sForInternedString.parcel(this.permission, dest, flags);
|
||||
dest.writeInt(this.launchMode);
|
||||
dest.writeInt(this.documentLaunchMode);
|
||||
dest.writeInt(this.maxRecents);
|
||||
@@ -311,11 +309,11 @@ public class ParsedActivity extends ParsedMainComponent {
|
||||
super(in);
|
||||
this.theme = in.readInt();
|
||||
this.uiOptions = in.readInt();
|
||||
this.targetActivity = sForString.unparcel(in);
|
||||
this.parentActivityName = sForString.unparcel(in);
|
||||
this.targetActivity = in.readString();
|
||||
this.parentActivityName = in.readString();
|
||||
this.taskAffinity = in.readString();
|
||||
this.privateFlags = in.readInt();
|
||||
this.permission = sForString.unparcel(in);
|
||||
this.permission = sForInternedString.unparcel(in);
|
||||
this.launchMode = in.readInt();
|
||||
this.documentLaunchMode = in.readInt();
|
||||
this.maxRecents = in.readInt();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.content.pm.parsing.component;
|
||||
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForString;
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString;
|
||||
|
||||
import android.annotation.CallSuper;
|
||||
import android.annotation.NonNull;
|
||||
@@ -131,7 +131,7 @@ public abstract class ParsedComponent implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
sForString.parcel(this.name, dest, flags);
|
||||
dest.writeString(this.name);
|
||||
dest.writeInt(this.getIcon());
|
||||
dest.writeInt(this.getLabelRes());
|
||||
dest.writeCharSequence(this.getNonLocalizedLabel());
|
||||
@@ -139,7 +139,7 @@ public abstract class ParsedComponent implements Parcelable {
|
||||
dest.writeInt(this.getBanner());
|
||||
dest.writeInt(this.getDescriptionRes());
|
||||
dest.writeInt(this.getFlags());
|
||||
sForString.parcel(this.packageName, dest, flags);
|
||||
sForInternedString.parcel(this.packageName, dest, flags);
|
||||
sForIntentInfos.parcel(this.getIntents(), dest, flags);
|
||||
dest.writeBundle(this.metaData);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public abstract class ParsedComponent implements Parcelable {
|
||||
// We use the boot classloader for all classes that we load.
|
||||
final ClassLoader boot = Object.class.getClassLoader();
|
||||
//noinspection ConstantConditions
|
||||
this.name = sForString.unparcel(in);
|
||||
this.name = in.readString();
|
||||
this.icon = in.readInt();
|
||||
this.labelRes = in.readInt();
|
||||
this.nonLocalizedLabel = in.readCharSequence();
|
||||
@@ -157,7 +157,7 @@ public abstract class ParsedComponent implements Parcelable {
|
||||
this.descriptionRes = in.readInt();
|
||||
this.flags = in.readInt();
|
||||
//noinspection ConstantConditions
|
||||
this.packageName = sForString.unparcel(in);
|
||||
this.packageName = sForInternedString.unparcel(in);
|
||||
this.intents = sForIntentInfos.unparcel(in);
|
||||
this.metaData = in.readBundle(boot);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.content.pm.parsing.component;
|
||||
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForString;
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.ComponentName;
|
||||
@@ -25,7 +25,6 @@ import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
import com.android.internal.util.Parcelling;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedString;
|
||||
|
||||
/** @hide */
|
||||
@@ -69,16 +68,16 @@ public class ParsedInstrumentation extends ParsedComponent {
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
sForString.parcel(this.targetPackage, dest, flags);
|
||||
sForString.parcel(this.targetProcesses, dest, flags);
|
||||
sForInternedString.parcel(this.targetPackage, dest, flags);
|
||||
sForInternedString.parcel(this.targetProcesses, dest, flags);
|
||||
dest.writeBoolean(this.handleProfiling);
|
||||
dest.writeBoolean(this.functionalTest);
|
||||
}
|
||||
|
||||
protected ParsedInstrumentation(Parcel in) {
|
||||
super(in);
|
||||
this.targetPackage = sForString.unparcel(in);
|
||||
this.targetProcesses = sForString.unparcel(in);
|
||||
this.targetPackage = sForInternedString.unparcel(in);
|
||||
this.targetProcesses = sForInternedString.unparcel(in);
|
||||
this.handleProfiling = in.readByte() != 0;
|
||||
this.functionalTest = in.readByte() != 0;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.content.pm.parsing.component;
|
||||
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForString;
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.os.Parcel;
|
||||
@@ -24,7 +24,6 @@ import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
import com.android.internal.util.Parcelling;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedString;
|
||||
|
||||
/** @hide */
|
||||
@@ -79,7 +78,7 @@ public class ParsedMainComponent extends ParsedComponent {
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
sForString.parcel(this.processName, dest, flags);
|
||||
sForInternedString.parcel(this.processName, dest, flags);
|
||||
dest.writeBoolean(this.directBootAware);
|
||||
dest.writeBoolean(this.enabled);
|
||||
dest.writeBoolean(this.exported);
|
||||
@@ -89,7 +88,7 @@ public class ParsedMainComponent extends ParsedComponent {
|
||||
|
||||
protected ParsedMainComponent(Parcel in) {
|
||||
super(in);
|
||||
this.processName = sForString.unparcel(in);
|
||||
this.processName = sForInternedString.unparcel(in);
|
||||
this.directBootAware = in.readBoolean();
|
||||
this.enabled = in.readBoolean();
|
||||
this.exported = in.readBoolean();
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package android.content.pm.parsing.component;
|
||||
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForString;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.pm.PermissionInfo;
|
||||
import android.os.Parcel;
|
||||
@@ -26,7 +24,6 @@ import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.DataClass;
|
||||
import com.android.internal.util.Parcelling;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedString;
|
||||
|
||||
/** @hide */
|
||||
@@ -123,7 +120,7 @@ public class ParsedPermission extends ParsedComponent {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeString(this.backgroundPermission);
|
||||
sForString.parcel(this.group, dest, flags);
|
||||
dest.writeString(this.group);
|
||||
dest.writeInt(this.requestRes);
|
||||
dest.writeInt(this.protectionLevel);
|
||||
dest.writeBoolean(this.tree);
|
||||
@@ -135,7 +132,7 @@ public class ParsedPermission extends ParsedComponent {
|
||||
// We use the boot classloader for all classes that we load.
|
||||
final ClassLoader boot = Object.class.getClassLoader();
|
||||
this.backgroundPermission = in.readString();
|
||||
this.group = sForString.unparcel(in);
|
||||
this.group = in.readString();
|
||||
this.requestRes = in.readInt();
|
||||
this.protectionLevel = in.readInt();
|
||||
this.tree = in.readBoolean();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.content.pm.parsing.component;
|
||||
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForString;
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
@@ -28,7 +28,6 @@ import android.os.PatternMatcher;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
import com.android.internal.util.Parcelling;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedString;
|
||||
|
||||
/** @hide **/
|
||||
@@ -106,10 +105,10 @@ public class ParsedProvider extends ParsedMainComponent {
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
sForString.parcel(this.authority, dest, flags);
|
||||
dest.writeString(this.authority);
|
||||
dest.writeBoolean(this.syncable);
|
||||
sForString.parcel(this.readPermission, dest, flags);
|
||||
sForString.parcel(this.writePermission, dest, flags);
|
||||
sForInternedString.parcel(this.readPermission, dest, flags);
|
||||
sForInternedString.parcel(this.writePermission, dest, flags);
|
||||
dest.writeBoolean(this.grantUriPermissions);
|
||||
dest.writeBoolean(this.forceUriPermissions);
|
||||
dest.writeBoolean(this.multiProcess);
|
||||
@@ -124,10 +123,10 @@ public class ParsedProvider extends ParsedMainComponent {
|
||||
protected ParsedProvider(Parcel in) {
|
||||
super(in);
|
||||
//noinspection ConstantConditions
|
||||
this.authority = sForString.unparcel(in);
|
||||
this.authority = in.readString();
|
||||
this.syncable = in.readBoolean();
|
||||
this.readPermission = sForString.unparcel(in);
|
||||
this.writePermission = sForString.unparcel(in);
|
||||
this.readPermission = sForInternedString.unparcel(in);
|
||||
this.writePermission = sForInternedString.unparcel(in);
|
||||
this.grantUriPermissions = in.readBoolean();
|
||||
this.forceUriPermissions = in.readBoolean();
|
||||
this.multiProcess = in.readBoolean();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.content.pm.parsing.component;
|
||||
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForString;
|
||||
import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.ComponentName;
|
||||
@@ -25,7 +25,6 @@ import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
import com.android.internal.util.Parcelling;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedString;
|
||||
|
||||
/** @hide **/
|
||||
@@ -67,7 +66,7 @@ public class ParsedService extends ParsedMainComponent {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeInt(this.foregroundServiceType);
|
||||
sForString.parcel(this.permission, dest, flags);
|
||||
sForInternedString.parcel(this.permission, dest, flags);
|
||||
}
|
||||
|
||||
public ParsedService() {
|
||||
@@ -76,7 +75,7 @@ public class ParsedService extends ParsedMainComponent {
|
||||
protected ParsedService(Parcel in) {
|
||||
super(in);
|
||||
this.foregroundServiceType = in.readInt();
|
||||
this.permission = sForString.unparcel(in);
|
||||
this.permission = sForInternedString.unparcel(in);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ParsedService> CREATOR = new Creator<ParsedService>() {
|
||||
|
||||
@@ -167,6 +167,33 @@ public interface Parcelling<T> {
|
||||
}
|
||||
}
|
||||
|
||||
class ForStringSet implements Parcelling<Set<String>> {
|
||||
@Override
|
||||
public void parcel(Set<String> item, Parcel dest, int parcelFlags) {
|
||||
if (item == null) {
|
||||
dest.writeInt(-1);
|
||||
} else {
|
||||
dest.writeInt(item.size());
|
||||
for (String string : item) {
|
||||
dest.writeString(string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> unparcel(Parcel source) {
|
||||
final int size = source.readInt();
|
||||
if (size < 0) {
|
||||
return emptySet();
|
||||
}
|
||||
Set<String> set = new ArraySet<>();
|
||||
for (int count = 0; count < size; count++) {
|
||||
set.add(source.readString());
|
||||
}
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
||||
class ForInternedStringSet implements Parcelling<Set<String>> {
|
||||
@Override
|
||||
public void parcel(Set<String> item, Parcel dest, int parcelFlags) {
|
||||
|
||||
@@ -21,31 +21,23 @@ import android.annotation.Nullable;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageParser;
|
||||
import android.content.pm.SharedLibraryInfo;
|
||||
import android.content.pm.parsing.ParsingPackage;
|
||||
import android.content.pm.parsing.ParsingPackageImpl;
|
||||
import android.content.pm.parsing.component.ParsedActivity;
|
||||
import android.content.pm.parsing.component.ParsedMainComponent;
|
||||
import android.content.pm.parsing.component.ParsedProvider;
|
||||
import android.content.pm.parsing.component.ParsedService;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Environment;
|
||||
import android.os.Parcel;
|
||||
import android.os.UserHandle;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.CollectionUtils;
|
||||
import com.android.internal.util.DataClass;
|
||||
import com.android.internal.util.Parcelling;
|
||||
import com.android.internal.util.Parcelling.BuiltIn.ForInternedString;
|
||||
import com.android.server.pm.parsing.PackageInfoUtils;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@@ -486,16 +478,16 @@ public final class PackageImpl extends ParsingPackageImpl implements ParsedPacka
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
sForString.parcel(this.manifestPackageName, dest, flags);
|
||||
sForInternedString.parcel(this.manifestPackageName, dest, flags);
|
||||
dest.writeBoolean(this.stub);
|
||||
sForString.parcel(this.nativeLibraryDir, dest, flags);
|
||||
sForString.parcel(this.nativeLibraryRootDir, dest, flags);
|
||||
dest.writeString(this.nativeLibraryDir);
|
||||
dest.writeString(this.nativeLibraryRootDir);
|
||||
dest.writeBoolean(this.nativeLibraryRootRequiresIsa);
|
||||
sForString.parcel(this.primaryCpuAbi, dest, flags);
|
||||
sForString.parcel(this.secondaryCpuAbi, dest, flags);
|
||||
sForString.parcel(this.secondaryNativeLibraryDir, dest, flags);
|
||||
sForString.parcel(this.seInfo, dest, flags);
|
||||
sForString.parcel(this.seInfoUser, dest, flags);
|
||||
sForInternedString.parcel(this.primaryCpuAbi, dest, flags);
|
||||
sForInternedString.parcel(this.secondaryCpuAbi, dest, flags);
|
||||
dest.writeString(this.secondaryNativeLibraryDir);
|
||||
dest.writeString(this.seInfo);
|
||||
dest.writeString(this.seInfoUser);
|
||||
dest.writeInt(this.uid);
|
||||
dest.writeBoolean(this.coreApp);
|
||||
dest.writeBoolean(this.system);
|
||||
@@ -511,16 +503,16 @@ public final class PackageImpl extends ParsingPackageImpl implements ParsedPacka
|
||||
|
||||
public PackageImpl(Parcel in) {
|
||||
super(in);
|
||||
this.manifestPackageName = sForString.unparcel(in);
|
||||
this.manifestPackageName = sForInternedString.unparcel(in);
|
||||
this.stub = in.readBoolean();
|
||||
this.nativeLibraryDir = sForString.unparcel(in);
|
||||
this.nativeLibraryRootDir = sForString.unparcel(in);
|
||||
this.nativeLibraryDir = in.readString();
|
||||
this.nativeLibraryRootDir = in.readString();
|
||||
this.nativeLibraryRootRequiresIsa = in.readBoolean();
|
||||
this.primaryCpuAbi = sForString.unparcel(in);
|
||||
this.secondaryCpuAbi = sForString.unparcel(in);
|
||||
this.secondaryNativeLibraryDir = sForString.unparcel(in);
|
||||
this.seInfo = sForString.unparcel(in);
|
||||
this.seInfoUser = sForString.unparcel(in);
|
||||
this.primaryCpuAbi = sForInternedString.unparcel(in);
|
||||
this.secondaryCpuAbi = sForInternedString.unparcel(in);
|
||||
this.secondaryNativeLibraryDir = in.readString();
|
||||
this.seInfo = in.readString();
|
||||
this.seInfoUser = in.readString();
|
||||
this.uid = in.readInt();
|
||||
this.coreApp = in.readBoolean();
|
||||
this.system = in.readBoolean();
|
||||
|
||||
Reference in New Issue
Block a user