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

Commit 86974463 authored by Michael Wright's avatar Michael Wright Committed by Android (Google) Code Review
Browse files

Merge "Added support for supports-input manifest element" into klp-dev

parents 23e2bba4 eaeb1904
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1311,6 +1311,9 @@ public class PackageParser {
                // Just skip this tag
                XmlUtils.skipCurrentTag(parser);
                continue;
            } else if (tagName.equals("supports-input")) {
                XmlUtils.skipCurrentTag(parser);
                continue;
                
            } else if (tagName.equals("eat-comment")) {
                // Just skip this tag
+18 −5
Original line number Diff line number Diff line
@@ -1718,20 +1718,20 @@
    
    <!-- Attributes that can be supplied in an AndroidManifest.xml
         <code>screen</code> tag, a child of <code>compatible-screens</code>,
         which is itseld a child of the root
         which is itself a child of the root
         {@link #AndroidManifest manifest} tag. -->
    <declare-styleable name="AndroidManifestCompatibleScreensScreen"
                       parent="AndroidManifest.AndroidManifestCompatibleScreens">
        <!-- Specifies a compatible screen size, as per the device
             configuration screen size bins. -->
        <attr name="screenSize">
            <!-- A small screen configuration, at least 240x320db. -->
            <!-- A small screen configuration, at least 240x320dp. -->
            <enum name="small" value="200" />
            <!-- A normal screen configuration, at least 320x480db. -->
            <!-- A normal screen configuration, at least 320x480dp. -->
            <enum name="normal" value="300" />
            <!-- A large screen configuration, at least 400x530db. -->
            <!-- A large screen configuration, at least 400x530dp. -->
            <enum name="large" value="400" />
            <!-- An extra large screen configuration, at least 600x800db. -->
            <!-- An extra large screen configuration, at least 600x800dp. -->
            <enum name="xlarge" value="500" />
        </attr>
        <!-- Specifies a compatible screen density, as per the device
@@ -1748,6 +1748,19 @@
        </attr>
    </declare-styleable>

    <!-- The <code>input-type</code> tag is a child of the <code>supports-input</code> tag, which
         is itself a child of the root {@link #AndroidManifest manifest} tag. Each
         <code>input-type</code> tag specifices the name of a specific input device type. When
         grouped with the other elements of the parent <code>supports-input</code> tag it defines
         a collection of input devices, which when all used together, are considered a supported
         input mechanism for the application. There may be multiple <code>supports-input</code>
         tags defined, each containing a different combination of input device types. -->
    <declare-styleable name="AndroidManifestSupportsInputInputType"
                       parent="AndroidManifest.AndroidManifestSupportsInput">
        <!-- Specifices the name of the input device type -->
        <attr name="name" />
    </declare-styleable>

    <!-- The attribute that holds a Base64-encoded public key. -->
    <attr name="publicKey" format="string" />

+87 −50
Original line number Diff line number Diff line
@@ -621,6 +621,7 @@ int doDump(Bundle* bundle)
            bool isLauncherActivity = false;
            bool isSearchable = false;
            bool withinApplication = false;
            bool withinSupportsInput = false;
            bool withinReceiver = false;
            bool withinService = false;
            bool withinIntentFilter = false;
@@ -711,11 +712,26 @@ int doDump(Bundle* bundle)
            String8 activityIcon;
            String8 receiverName;
            String8 serviceName;
            Vector<String8> supportedInput;
            while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
                if (code == ResXMLTree::END_TAG) {
                    depth--;
                    if (depth < 2) {
                        if (withinSupportsInput && !supportedInput.isEmpty()) {
                            printf("supports-input: '");
                            const size_t N = supportedInput.size();
                            for (size_t i=0; i<N; i++) {
                                printf("%s", supportedInput[i].string());
                                if (i != N - 1) {
                                    printf("' '");
                                } else {
                                    printf("'\n");
                                }
                            }
                            supportedInput.clear();
                        }
                        withinApplication = false;
                        withinSupportsInput = false;
                    } else if (depth < 3) {
                        if (withinActivity && isMainActivity && isLauncherActivity) {
                            const char *aName = getComponentName(pkg, activityName);
@@ -910,6 +926,8 @@ int doDump(Bundle* bundle)
                            printf(" reqFiveWayNav='%d'", reqFiveWayNav);
                        }
                        printf("\n");
                    } else if (tag == "supports-input") {
                        withinSupportsInput = true;
                    } else if (tag == "supports-screens") {
                        smallScreen = getIntegerAttribute(tree,
                                SMALL_SCREEN_ATTR, NULL, 1);
@@ -1086,28 +1104,32 @@ int doDump(Bundle* bundle)
                            }
                        }
                    }
                } else if (depth == 3 && withinApplication) {
                } else if (depth == 3) {
                    withinActivity = false;
                    withinReceiver = false;
                    withinService = false;
                    hasIntentFilter = false;
                    if (withinApplication) {
                        if(tag == "activity") {
                            withinActivity = true;
                            activityName = getAttribute(tree, NAME_ATTR, &error);
                            if (error != "") {
                            fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", error.string());
                                fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n",
                                        error.string());
                                goto bail;
                            }

                            activityLabel = getResolvedAttribute(&res, tree, LABEL_ATTR, &error);
                            if (error != "") {
                            fprintf(stderr, "ERROR getting 'android:label' attribute: %s\n", error.string());
                                fprintf(stderr, "ERROR getting 'android:label' attribute: %s\n",
                                        error.string());
                                goto bail;
                            }

                            activityIcon = getResolvedAttribute(&res, tree, ICON_ATTR, &error);
                            if (error != "") {
                            fprintf(stderr, "ERROR getting 'android:icon' attribute: %s\n", error.string());
                                fprintf(stderr, "ERROR getting 'android:icon' attribute: %s\n",
                                        error.string());
                                goto bail;
                            }

@@ -1125,7 +1147,9 @@ int doDump(Bundle* bundle)
                        } else if (tag == "uses-library") {
                            String8 libraryName = getAttribute(tree, NAME_ATTR, &error);
                            if (error != "") {
                            fprintf(stderr, "ERROR getting 'android:name' attribute for uses-library: %s\n", error.string());
                                fprintf(stderr,
                                        "ERROR getting 'android:name' attribute for uses-library"
                                        " %s\n", error.string());
                                goto bail;
                            }
                            int req = getIntegerAttribute(tree,
@@ -1137,7 +1161,9 @@ int doDump(Bundle* bundle)
                            receiverName = getAttribute(tree, NAME_ATTR, &error);

                            if (error != "") {
                            fprintf(stderr, "ERROR getting 'android:name' attribute for receiver: %s\n", error.string());
                                fprintf(stderr,
                                        "ERROR getting 'android:name' attribute for receiver:"
                                        " %s\n", error.string());
                                goto bail;
                            }
                        } else if (tag == "service") {
@@ -1145,7 +1171,18 @@ int doDump(Bundle* bundle)
                            serviceName = getAttribute(tree, NAME_ATTR, &error);

                            if (error != "") {
                            fprintf(stderr, "ERROR getting 'android:name' attribute for service: %s\n", error.string());
                                fprintf(stderr, "ERROR getting 'android:name' attribute for"
                                        " service: %s\n", error.string());
                                goto bail;
                            }
                        }
                    } else if (withinSupportsInput && tag == "input-type") {
                        String8 name = getAttribute(tree, NAME_ATTR, &error);
                        if (name != "" && error == "") {
                            supportedInput.add(name);
                        } else {
                            fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n",
                                    error.string());
                            goto bail;
                        }
                    }