diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-06-15 16:38:32 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-06-15 16:38:32 +0000 |
| commit | e0ba6d9dffc533e4c175d693e54f55290a8141de (patch) | |
| tree | 08e88895380c55a0485b141263ea37163de03260 /core/java/android | |
| parent | 4b3418bfed63930dcaca6597b082d18af38a8e8c (diff) | |
| parent | 04035455084047084c2fae99a7892dbca9197802 (diff) | |
Merge "Don't provide read logs for shell-initiated installations." into rvc-dev
Diffstat (limited to 'core/java/android')
5 files changed, 69 insertions, 18 deletions
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index c8dd4d9d9d51..885ffbac3d30 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -205,6 +205,7 @@ public class PackageParser { public static final String TAG_USES_PERMISSION_SDK_M = "uses-permission-sdk-m"; public static final String TAG_USES_SDK = "uses-sdk"; public static final String TAG_USES_SPLIT = "uses-split"; + public static final String TAG_PROFILEABLE = "profileable"; public static final String METADATA_MAX_ASPECT_RATIO = "android.max_aspect"; public static final String METADATA_SUPPORTS_SIZE_CHANGES = "android.supports_size_changes"; @@ -459,6 +460,9 @@ public class PackageParser { public final SigningDetails signingDetails; public final boolean coreApp; public final boolean debuggable; + // This does not represent the actual manifest structure since the 'profilable' tag + // could be used with attributes other than 'shell'. Extend if necessary. + public final boolean profilableByShell; public final boolean multiArch; public final boolean use32bitAbi; public final boolean extractNativeLibs; @@ -470,15 +474,13 @@ public class PackageParser { public final int overlayPriority; public ApkLite(String codePath, String packageName, String splitName, - boolean isFeatureSplit, - String configForSplit, String usesSplitName, boolean isSplitRequired, - int versionCode, int versionCodeMajor, - int revisionCode, int installLocation, List<VerifierInfo> verifiers, - SigningDetails signingDetails, boolean coreApp, - boolean debuggable, boolean multiArch, boolean use32bitAbi, - boolean useEmbeddedDex, boolean extractNativeLibs, boolean isolatedSplits, - String targetPackageName, boolean overlayIsStatic, int overlayPriority, - int minSdkVersion, int targetSdkVersion) { + boolean isFeatureSplit, String configForSplit, String usesSplitName, + boolean isSplitRequired, int versionCode, int versionCodeMajor, int revisionCode, + int installLocation, List<VerifierInfo> verifiers, SigningDetails signingDetails, + boolean coreApp, boolean debuggable, boolean profilableByShell, boolean multiArch, + boolean use32bitAbi, boolean useEmbeddedDex, boolean extractNativeLibs, + boolean isolatedSplits, String targetPackageName, boolean overlayIsStatic, + int overlayPriority, int minSdkVersion, int targetSdkVersion) { this.codePath = codePath; this.packageName = packageName; this.splitName = splitName; @@ -493,6 +495,7 @@ public class PackageParser { this.verifiers = verifiers.toArray(new VerifierInfo[verifiers.size()]); this.coreApp = coreApp; this.debuggable = debuggable; + this.profilableByShell = profilableByShell; this.multiArch = multiArch; this.use32bitAbi = use32bitAbi; this.useEmbeddedDex = useEmbeddedDex; @@ -1573,6 +1576,7 @@ public class PackageParser { int revisionCode = 0; boolean coreApp = false; boolean debuggable = false; + boolean profilableByShell = false; boolean multiArch = false; boolean use32bitAbi = false; boolean extractNativeLibs = true; @@ -1638,6 +1642,10 @@ public class PackageParser { final String attr = attrs.getAttributeName(i); if ("debuggable".equals(attr)) { debuggable = attrs.getAttributeBooleanValue(i, false); + if (debuggable) { + // Debuggable implies profileable + profilableByShell = true; + } } if ("multiArch".equals(attr)) { multiArch = attrs.getAttributeBooleanValue(i, false); @@ -1690,6 +1698,13 @@ public class PackageParser { minSdkVersion = attrs.getAttributeIntValue(i, DEFAULT_MIN_SDK_VERSION); } } + } else if (TAG_PROFILEABLE.equals(parser.getName())) { + for (int i = 0; i < attrs.getAttributeCount(); ++i) { + final String attr = attrs.getAttributeName(i); + if ("shell".equals(attr)) { + profilableByShell = attrs.getAttributeBooleanValue(i, profilableByShell); + } + } } } @@ -1707,8 +1722,9 @@ public class PackageParser { return new ApkLite(codePath, packageSplit.first, packageSplit.second, isFeatureSplit, configForSplit, usesSplitName, isSplitRequired, versionCode, versionCodeMajor, revisionCode, installLocation, verifiers, signingDetails, coreApp, debuggable, - multiArch, use32bitAbi, useEmbeddedDex, extractNativeLibs, isolatedSplits, - targetPackage, overlayIsStatic, overlayPriority, minSdkVersion, targetSdkVersion); + profilableByShell, multiArch, use32bitAbi, useEmbeddedDex, extractNativeLibs, + isolatedSplits, targetPackage, overlayIsStatic, overlayPriority, minSdkVersion, + targetSdkVersion); } /** diff --git a/core/java/android/content/pm/parsing/ApkLiteParseUtils.java b/core/java/android/content/pm/parsing/ApkLiteParseUtils.java index d2172d3741d1..c3e9402a389e 100644 --- a/core/java/android/content/pm/parsing/ApkLiteParseUtils.java +++ b/core/java/android/content/pm/parsing/ApkLiteParseUtils.java @@ -20,7 +20,6 @@ import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED; import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER; -import android.compat.annotation.UnsupportedAppUsage; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageParser; @@ -303,6 +302,7 @@ public class ApkLiteParseUtils { int revisionCode = 0; boolean coreApp = false; boolean debuggable = false; + boolean profilableByShell = false; boolean multiArch = false; boolean use32bitAbi = false; boolean extractNativeLibs = true; @@ -379,6 +379,10 @@ public class ApkLiteParseUtils { switch (attr) { case "debuggable": debuggable = attrs.getAttributeBooleanValue(i, false); + if (debuggable) { + // Debuggable implies profileable + profilableByShell = true; + } break; case "multiArch": multiArch = attrs.getAttributeBooleanValue(i, false); @@ -431,6 +435,13 @@ public class ApkLiteParseUtils { minSdkVersion = attrs.getAttributeIntValue(i, DEFAULT_MIN_SDK_VERSION); } } + } else if (PackageParser.TAG_PROFILEABLE.equals(parser.getName())) { + for (int i = 0; i < attrs.getAttributeCount(); ++i) { + final String attr = attrs.getAttributeName(i); + if ("shell".equals(attr)) { + profilableByShell = attrs.getAttributeBooleanValue(i, profilableByShell); + } + } } } @@ -445,12 +456,13 @@ public class ApkLiteParseUtils { overlayPriority = 0; } - return input.success(new PackageParser.ApkLite(codePath, packageSplit.first, - packageSplit.second, isFeatureSplit, configForSplit, usesSplitName, isSplitRequired, - versionCode, versionCodeMajor, revisionCode, installLocation, verifiers, - signingDetails, coreApp, debuggable, multiArch, use32bitAbi, useEmbeddedDex, - extractNativeLibs, isolatedSplits, targetPackage, overlayIsStatic, overlayPriority, - minSdkVersion, targetSdkVersion)); + return input.success( + new PackageParser.ApkLite(codePath, packageSplit.first, packageSplit.second, + isFeatureSplit, configForSplit, usesSplitName, isSplitRequired, versionCode, + versionCodeMajor, revisionCode, installLocation, verifiers, signingDetails, + coreApp, debuggable, profilableByShell, multiArch, use32bitAbi, + useEmbeddedDex, extractNativeLibs, isolatedSplits, targetPackage, + overlayIsStatic, overlayPriority, minSdkVersion, targetSdkVersion)); } public static ParseResult<Pair<String, String>> parsePackageSplitNames(ParseInput input, diff --git a/core/java/android/os/incremental/IIncrementalService.aidl b/core/java/android/os/incremental/IIncrementalService.aidl index 220ce22ded5c..61e6a05fce37 100644 --- a/core/java/android/os/incremental/IIncrementalService.aidl +++ b/core/java/android/os/incremental/IIncrementalService.aidl @@ -111,6 +111,11 @@ interface IIncrementalService { void deleteStorage(int storageId); /** + * Permanently disable readlogs reporting for a storage given its ID. + */ + void disableReadLogs(int storageId); + + /** * Setting up native library directories and extract native libs onto a storage if needed. */ boolean configureNativeBinaries(int storageId, in @utf8InCpp String apkFullPath, in @utf8InCpp String libDirRelativePath, in @utf8InCpp String abi, boolean extractNativeLibs); diff --git a/core/java/android/os/incremental/IncrementalFileStorages.java b/core/java/android/os/incremental/IncrementalFileStorages.java index 863d86ef88c9..31ccf95ba16f 100644 --- a/core/java/android/os/incremental/IncrementalFileStorages.java +++ b/core/java/android/os/incremental/IncrementalFileStorages.java @@ -153,6 +153,13 @@ public final class IncrementalFileStorages { } /** + * Permanently disables readlogs. + */ + public void disableReadLogs() { + mDefaultStorage.disableReadLogs(); + } + + /** * Resets the states and unbinds storage instances for an installation session. * TODO(b/136132412): make sure unnecessary binds are removed but useful storages are kept */ diff --git a/core/java/android/os/incremental/IncrementalStorage.java b/core/java/android/os/incremental/IncrementalStorage.java index 6200a38fe13c..ca6114f29b9c 100644 --- a/core/java/android/os/incremental/IncrementalStorage.java +++ b/core/java/android/os/incremental/IncrementalStorage.java @@ -418,6 +418,17 @@ public final class IncrementalStorage { private static final int INCFS_MAX_ADD_DATA_SIZE = 128; /** + * Permanently disable readlogs collection. + */ + public void disableReadLogs() { + try { + mService.disableReadLogs(mId); + } catch (RemoteException e) { + e.rethrowFromSystemServer(); + } + } + + /** * Deserialize and validate v4 signature bytes. */ private static void validateV4Signature(@Nullable byte[] v4signatureBytes) |
