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

Commit ce587546 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Add 'profileable' application manifest tag"

parents eb3d6d9d ce030289
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1209,6 +1209,7 @@ package android {
    field public static final int shareInterpolator = 16843195; // 0x10101bb
    field public static final int shareInterpolator = 16843195; // 0x10101bb
    field public static final int sharedUserId = 16842763; // 0x101000b
    field public static final int sharedUserId = 16842763; // 0x101000b
    field public static final int sharedUserLabel = 16843361; // 0x1010261
    field public static final int sharedUserLabel = 16843361; // 0x1010261
    field public static final int shell = 16844180; // 0x1010594
    field public static final int shortcutDisabledMessage = 16844075; // 0x101052b
    field public static final int shortcutDisabledMessage = 16844075; // 0x101052b
    field public static final int shortcutId = 16844072; // 0x1010528
    field public static final int shortcutId = 16844072; // 0x1010528
    field public static final int shortcutLongLabel = 16844074; // 0x101052a
    field public static final int shortcutLongLabel = 16844074; // 0x101052a
@@ -10833,6 +10834,7 @@ package android.content.pm {
    method public int describeContents();
    method public int describeContents();
    method public void dump(android.util.Printer, java.lang.String);
    method public void dump(android.util.Printer, java.lang.String);
    method public static java.lang.CharSequence getCategoryTitle(android.content.Context, int);
    method public static java.lang.CharSequence getCategoryTitle(android.content.Context, int);
    method public boolean isProfileableByShell();
    method public boolean isVirtualPreload();
    method public boolean isVirtualPreload();
    method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager);
    method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager);
    field public static final int CATEGORY_AUDIO = 1; // 0x1
    field public static final int CATEGORY_AUDIO = 1; // 0x1
+8 −5
Original line number Original line Diff line number Diff line
@@ -5878,14 +5878,17 @@ public final class ActivityThread extends ClientTransactionHandler {
            }
            }
        }
        }


        // Allow application-generated systrace messages if we're debuggable.
        // Allow binder tracing, and application-generated systrace messages if we're profileable.
        boolean isAppDebuggable = (data.appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        boolean isAppProfileable = data.appInfo.isProfileableByShell();
        Trace.setAppTracingAllowed(isAppDebuggable);
        Trace.setAppTracingAllowed(isAppProfileable);
        ThreadedRenderer.setDebuggingEnabled(isAppDebuggable || Build.IS_DEBUGGABLE);
        if (isAppProfileable && data.enableBinderTracking) {
        if (isAppDebuggable && data.enableBinderTracking) {
            Binder.enableTracing();
            Binder.enableTracing();
        }
        }


        // Allow renderer debugging features if we're debuggable.
        boolean isAppDebuggable = (data.appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        ThreadedRenderer.setDebuggingEnabled(isAppDebuggable || Build.IS_DEBUGGABLE);

        /**
        /**
         * Initialize the default http proxy in this process for the reasons we set the time zone.
         * Initialize the default http proxy in this process for the reasons we set the time zone.
         */
         */
+16 −0
Original line number Original line Diff line number Diff line
@@ -635,6 +635,13 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
     */
    public static final int PRIVATE_FLAG_USES_NON_SDK_API = 1 << 22;
    public static final int PRIVATE_FLAG_USES_NON_SDK_API = 1 << 22;


    /**
     * Indicates whether this application can be profiled by the shell user,
     * even when running on a device that is running in user mode.
     * @hide
     */
    public static final int PRIVATE_FLAG_PROFILEABLE_BY_SHELL = 1 << 23;

    /** @hide */
    /** @hide */
    @IntDef(flag = true, prefix = { "PRIVATE_FLAG_" }, value = {
    @IntDef(flag = true, prefix = { "PRIVATE_FLAG_" }, value = {
            PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE,
            PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE,
@@ -654,6 +661,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
            PRIVATE_FLAG_PRIVILEGED,
            PRIVATE_FLAG_PRIVILEGED,
            PRIVATE_FLAG_PRODUCT,
            PRIVATE_FLAG_PRODUCT,
            PRIVATE_FLAG_PRODUCT_SERVICES,
            PRIVATE_FLAG_PRODUCT_SERVICES,
            PRIVATE_FLAG_PROFILEABLE_BY_SHELL,
            PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER,
            PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER,
            PRIVATE_FLAG_SIGNED_WITH_PLATFORM_KEY,
            PRIVATE_FLAG_SIGNED_WITH_PLATFORM_KEY,
            PRIVATE_FLAG_STATIC_SHARED_LIBRARY,
            PRIVATE_FLAG_STATIC_SHARED_LIBRARY,
@@ -1928,6 +1936,14 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        return (privateFlags & PRIVATE_FLAG_VIRTUAL_PRELOAD) != 0;
        return (privateFlags & PRIVATE_FLAG_VIRTUAL_PRELOAD) != 0;
    }
    }


    /**
     * Returns whether or not this application can be profiled by the shell user,
     * even when running on a device that is running in user mode.
     */
    public boolean isProfileableByShell() {
        return (privateFlags & PRIVATE_FLAG_PROFILEABLE_BY_SHELL) != 0;
    }

    /**
    /**
     * Returns true if the app has declared in its manifest that it wants its split APKs to be
     * 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.
     * loaded into isolated Contexts, with their own ClassLoaders and Resources objects.
+10 −0
Original line number Original line Diff line number Diff line
@@ -3547,6 +3547,8 @@ public class PackageParser {
                com.android.internal.R.styleable.AndroidManifestApplication_debuggable,
                com.android.internal.R.styleable.AndroidManifestApplication_debuggable,
                false)) {
                false)) {
            ai.flags |= ApplicationInfo.FLAG_DEBUGGABLE;
            ai.flags |= ApplicationInfo.FLAG_DEBUGGABLE;
            // Debuggable implies profileable
            ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_PROFILEABLE_BY_SHELL;
        }
        }


        if (sa.getBoolean(
        if (sa.getBoolean(
@@ -3913,6 +3915,14 @@ public class PackageParser {
                // Dependencies for app installers; we don't currently try to
                // Dependencies for app installers; we don't currently try to
                // enforce this.
                // enforce this.
                XmlUtils.skipCurrentTag(parser);
                XmlUtils.skipCurrentTag(parser);
            } else if (tagName.equals("profileable")) {
                sa = res.obtainAttributes(parser,
                        com.android.internal.R.styleable.AndroidManifestProfileable);
                if (sa.getBoolean(
                        com.android.internal.R.styleable.AndroidManifestProfileable_shell, false)) {
                    ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_PROFILEABLE_BY_SHELL;
                }
                XmlUtils.skipCurrentTag(parser);


            } else {
            } else {
                if (!RIGID_PARSER) {
                if (!RIGID_PARSER) {
+6 −0
Original line number Original line Diff line number Diff line
@@ -2735,4 +2735,10 @@
        <attr name="name" format="string" />
        <attr name="name" format="string" />
    </declare-styleable>
    </declare-styleable>



    <declare-styleable name="AndroidManifestProfileable" parent="AndroidManifestApplication">
        <!-- Flag indicating whether the application can be profiled by the shell user,
             even when running on a device that is running in user mode. -->
        <attr name="shell" format="boolean" />
    </declare-styleable>
</resources>
</resources>
Loading