Commit b2d2128c authored by David 'Digit' Turner's avatar David 'Digit' Turner
Browse files

ndk-gdb: Support activities with multiple intent categories

This is a fix for http://code.google.com/p/android/issues/detail?id=9400

The main intent-filter in an activity can have multiple categories.
The previous awk script (extract-launchable.awk) only used the last
category to determine whether an activity was launchable.

This modifies it to accept any activity with a main intent-filter
that has at least one category of LAUNCHABLE.

Change-Id: Ia9a6898470acd4cd067d8f6edea8093595f1191c
parent 3c41e4cd
......@@ -62,30 +62,34 @@ BEGIN {
# we enter the corresponding elements within the intent-filter.
else if ( event == "BEGIN-INTENT-FILTER" &&
XML_RPATH == "INTENT-FILTER/ACTIVITY/APPLICATION/MANIFEST/" ) {
action = ""
category = ""
action_main = 0;
category_launcher = 0;
}
# When exiting an <intent-filter>, set the 'launchable' flag to true
# for the current activity if both 'action' and 'category' have the
# correct name.
else if ( event == "END-INTENT-FILTER" &&
XML_RPATH == "ACTIVITY/APPLICATION/MANIFEST/" ) {
if ( action == "android.intent.action.MAIN" &&
category == "android.intent.category.LAUNCHER" ) {
launchable = 1;
if ( category_launcher ) {
launchable = 1;
}
}
# When entering an <action> element inside an <intent-filter>, record
# its name.
else if ( event == "BEGIN-ACTION" &&
XML_RPATH == "ACTION/INTENT-FILTER/ACTIVITY/APPLICATION/MANIFEST/" ) {
action = XML_ATTR["android:name"];
action_main = 0;
if ( XML_ATTR["android:name"] == "android.intent.action.MAIN" ) {
action_main = 1;
}
}
# When entering a <category> element inside an <intent-filter>, record
# its name.
else if ( event == "BEGIN-CATEGORY" &&
XML_RPATH == "CATEGORY/INTENT-FILTER/ACTIVITY/APPLICATION/MANIFEST/" ) {
category = XML_ATTR["android:name"];
if ( action_main && XML_ATTR["android:name"] == "android.intent.category.LAUNCHER" ) {
category_launcher = 1;
}
}
}
}
......
......@@ -68,6 +68,9 @@ IMPORTANT BUG FIXES:
'foo' imports static library 'bar' which imports static library 'zoo',
the libfoo.so will now be linked against both libbar.a and libzoo.a.
- ndk-gdb now works correctly for activities with multiple categories
in their MAIN intent filters.
OTHER CHANGES:
- docs/STABLE-APIS.html: Added missing documentation listing EGL
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellojni"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<application android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".HelloJni"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
.HelloJni
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellojni"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<application android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".HelloJni"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HelloJni2"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.NOT_LAUNCHER_FOR_THIS_TEST" />
</intent-filter>
</activity>
<activity android:name=".HelloJni3"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
.HelloJni
.HelloJni3
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellojni"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<application android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".HelloJni"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.NOT_MAIN_FOR_THIS_TEST" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellojni"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<application android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".HelloJni"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
.HelloJni
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment