Version 1.4.0 (current)
Publish a system hint and receive its action
Use the existing Surfaces SDK to display one hint and inspect a real callback.
Surfaces is the system presentation host. A caller publishes a hint, choice or result and receives user actions. Models, background work and file resolution remain the responsibility of the caller, the system task service and each data component.
Access requirements
SDK 0.2 / wire protocol v2 requires Android API 36+ and Java 17+. Install the host TakuSurfaces.apk with overlay permission. The caller must have the same signing certificate as the host and declare:
<uses-permission android:name="org.agentos.permission.PUBLISH_SURFACES" />
<queries><package android:name="org.agentos.surfaces" /></queries>This integrates trusted components, not arbitrary separately signed apps. The system integrator manages product signing; do not distribute or request platform private keys. An ordinary app can use the system AI client, whose authorization does not satisfy this permission.
Prepare the client
Requires the system source
Building the client runs from the taku-os repository root. Clone taku-os first.
In the taku-os source root on your computer, run:
bash system/surfaces/build.shAdd system/surfaces/out/taku-surfaces-client.jar to your Android project's local dependencies. Soong projects use static_libs: ["taku-surfaces-client"]. The JAR contains neither host UI nor an executor, and building does not install it. Add this Activity and declare it as an entry point in your own project:
package org.example.takusurface;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import org.agentos.surfaces.SurfaceSpec;
import org.agentos.surfaces.client.SurfaceClient;
public final class MainActivity extends Activity {
private SurfaceClient client;
private TextView status;
@Override public void onCreate(Bundle state) {
super.onCreate(state);
status = new TextView(this); setContentView(status);
client = new SurfaceClient(this, new SurfaceClient.Listener() {
@Override public void onConnected() {
try {
client.showHint("example-hint", 1, "View the example?", "Demo content",
new SurfaceSpec.Action("accept", "View", true));
} catch (Exception error) { status.setText(error.getMessage()); }
}
@Override public void onEvent(String type, String id, long revision, String value) {
status.setText(type + ": " + id + " / " + value);
}
@Override public void onAction(SurfaceClient.ActionEvent event) {
// Handle the action here only; onEvent also reports it.
if ("accept".equals(event.actionId())) status.setText("Accepted example");
}
});
try { client.connect(); }
catch (Exception error) { status.setText(error.getMessage()); }
}
@Override public void onDestroy() {
if (client != null) client.close();
super.onDestroy();
}
}Verify publication and actions
Install host and caller on a dedicated development device meeting the signature requirement, then open the example. published means the host accepted the request. The hint waits while the device is locked or the screen is off, so it does not mean the user saw it. Tapping the hint body should deliver one accept action and show “Accepted example”. The arrow expands the hint without accepting it.
Client calls and callbacks run on the main thread. This example calls close() when its Activity is destroyed, removing that connection's presentation. Work needing later callbacks requires a sufficiently long-lived owner; do not close every connection merely because an Activity goes to the background.
Update an ID with a greater revision. Each revision accepts at most one action; publish a new revision to offer it again. Handle business work in either onAction or generic onEvent, since both report the same action.
Extend the example
showChoice returns the selected option ID. showResult returns caller-owned artifact.ref/mediaType/title. A reference transfers no file and does not open details automatically. Download the original v1 / v2 schemas from the generated reference. SurfaceClient defines the complete call signatures.
Users can drag a capsule or card header. The host saves position preferences; keyboard avoidance and rotation do not rewrite them. Long-press to reset. Presentation content remains temporary in-memory state and is not replayed after process exit.
Failures and verified scope
For binding failure, check host installation, signing and permission. For protocol errors, check version, fields and revision. There is no offline queue or hidden retry. Publication ACK and user action do not establish business completion.
The three presentation types, actual callbacks, dragging and position recovery are verified on an API 36 emulator. They are not yet verified on physical devices, a complete system, across a device reboot or with accessibility services. This example is compile-checked against the source and has not been run separately on a device.
Current contract and ROM component
The current v1/v2 schemas support text, field, fact, and notice. The latter three require a nonempty label; consult the original schemas for complete constraints. The Surfaces host is built into the system.
Research preview · Current availability
Report an issue or give feedback
Delivery to the maintenance queue does not mean it has been handled. Feedback is retained for 90 days.
Built with Fumadocs