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

Commit 27890381 authored by Florian Mayer's avatar Florian Mayer Committed by Automerger Merge Worker
Browse files

Merge changes from topic "playprofileable" into sc-dev am: 748c3a80

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14328127

Change-Id: I0c19d856a5807473fc472c61b4a096f43dcc361a
parents a33504ba 748c3a80
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11921,6 +11921,7 @@ package android.content.pm {
    method public int getGwpAsanMode();
    method public int getMemtagMode();
    method public int getNativeHeapZeroInitialized();
    method public boolean isProfileable();
    method public boolean isProfileableByShell();
    method public boolean isResourceOverlay();
    method public boolean isVirtualPreload();
+1 −1
Original line number Diff line number Diff line
@@ -6558,7 +6558,7 @@ public final class ActivityThread extends ClientTransactionHandler

        // Allow binder tracing, and application-generated systrace messages if we're profileable.
        boolean isAppDebuggable = (data.appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        boolean isAppProfileable = isAppDebuggable || data.appInfo.isProfileableByShell();
        boolean isAppProfileable = isAppDebuggable || data.appInfo.isProfileable();
        Trace.setAppTracingAllowed(isAppProfileable);
        if ((isAppProfileable || Build.IS_DEBUGGABLE) && data.enableBinderTracking) {
            Binder.enableTracing();
+29 −0
Original line number Diff line number Diff line
@@ -771,6 +771,19 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
    @Retention(RetentionPolicy.SOURCE)
    public @interface ApplicationInfoPrivateFlags {}

    /**
     * Value for {@link #privateFlagsExt}: whether this application can be profiled, either by the
     * shell user or the system.
     * @hide
     */
    public static final int PRIVATE_FLAG_EXT_PROFILEABLE = 1 << 0;

    /** @hide */
    @IntDef(flag = true, prefix = { "PRIVATE_FLAG_EXT_" }, value = {
            PRIVATE_FLAG_EXT_PROFILEABLE,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ApplicationInfoPrivateFlagsExt {}
    /**
     * Constant corresponding to <code>allowed</code> in the
     * {@link android.R.attr#autoRevokePermissions} attribute.
@@ -803,6 +816,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
    @TestApi
    public @ApplicationInfoPrivateFlags int privateFlags;

    /**
     * More private/hidden flags. See {@code PRIVATE_FLAG_EXT_...} constants.
     * @hide
     */
    public @ApplicationInfoPrivateFlagsExt int privateFlagsExt;

    /**
     * @hide
     */
@@ -1771,6 +1790,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        theme = orig.theme;
        flags = orig.flags;
        privateFlags = orig.privateFlags;
        privateFlagsExt = orig.privateFlagsExt;
        requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
        compatibleWidthLimitDp = orig.compatibleWidthLimitDp;
        largestWidthLimitDp = orig.largestWidthLimitDp;
@@ -1855,6 +1875,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        dest.writeInt(theme);
        dest.writeInt(flags);
        dest.writeInt(privateFlags);
        dest.writeInt(privateFlagsExt);
        dest.writeInt(requiresSmallestWidthDp);
        dest.writeInt(compatibleWidthLimitDp);
        dest.writeInt(largestWidthLimitDp);
@@ -1944,6 +1965,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        theme = source.readInt();
        flags = source.readInt();
        privateFlags = source.readInt();
        privateFlagsExt = source.readInt();
        requiresSmallestWidthDp = source.readInt();
        compatibleWidthLimitDp = source.readInt();
        largestWidthLimitDp = source.readInt();
@@ -2363,6 +2385,13 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        return (privateFlags & PRIVATE_FLAG_PROFILEABLE_BY_SHELL) != 0;
    }

    /**
     * Returns whether this application can be profiled, either by the shell user or the system.
     */
    public boolean isProfileable() {
        return (privateFlagsExt & PRIVATE_FLAG_EXT_PROFILEABLE) != 0;
    }

    /**
     * Returns true if the app has declared in its manifest that it wants its split APKs to be
     * loaded into isolated Contexts, with their own ClassLoaders and Resources objects.
+9 −0
Original line number Diff line number Diff line
@@ -802,6 +802,15 @@ public class PackageInfoWithoutStateUtils {
        return privateFlags;
    }

    /** @see ApplicationInfo#privateFlagsExt */
    public static int appInfoPrivateFlagsExt(ParsingPackageRead pkg) {
        // @formatter:off
        int privateFlagsExt =
                flag(pkg.isProfileable(), ApplicationInfo.PRIVATE_FLAG_EXT_PROFILEABLE);
        // @formatter:on
        return privateFlagsExt;
    }

    private static boolean checkUseInstalled(ParsingPackageRead pkg, PackageUserState state,
            @PackageManager.PackageInfoFlags int flags) {
        // If available for the target user
+2 −0
Original line number Diff line number Diff line
@@ -200,6 +200,8 @@ public interface ParsingPackage extends ParsingPackageRead {

    ParsingPackage setProfileableByShell(boolean profileableByShell);

    ParsingPackage setProfileable(boolean profileable);

    ParsingPackage setRequestLegacyExternalStorage(boolean requestLegacyExternalStorage);

    ParsingPackage setAllowNativeHeapPointerTagging(boolean allowNativeHeapPointerTagging);
Loading