handle drag-and-drop events as ACTION_SEND Intents

This commit is contained in:
Julian Winkler
2025-07-14 12:25:04 +02:00
parent 0064677755
commit b7843665ef
5 changed files with 56 additions and 0 deletions

View File

@@ -547,6 +547,30 @@ public class Context extends Object {
return true;
}
/* For use from native code */
static Activity resolveActivityInternal(Intent intent) throws ReflectiveOperationException {
String className = null;
if (intent.getComponent() != null) {
className = intent.getComponent().getClassName();
} else {
int best_score = -5;
for (PackageParser.Activity activity: pkg.activities) {
for (PackageParser.IntentInfo intentInfo: activity.intents) {
int score = intentInfo.match(intent.getAction(), intent.getType(), intent.getScheme(), intent.getData(), intent.getCategories(), "Context");
if (score > best_score && score > 0) {
className = activity.className;
best_score = score;
}
}
}
}
if (className != null) {
return Activity.internalCreateActivity(className, this_application.native_window, intent);
} else {
return null;
}
}
public void startActivity(Intent intent) {
Slog.i(TAG, "startActivity(" + intent + ") called");
if (intent.getAction() != null && intent.getAction().equals("android.intent.action.CHOOSER")) {