Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions apps/redmi1s-demo/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { reportAppAction } from "@pocketjs/framework/host";
import Hero from "../hero/app.tsx";

export default function Redmi1SHero() {
return (
<Hero
actionLabel="Tap Hero"
deviceLabel="running on a 2014 Redmi 1S."
headline="JSX on Redmi."
onAction={(count) => reportAppAction("hero_tap", count)}
presentationHz={60}
runtimeLabel="RUST + QUICKJS + GLES2"
spinnerFrameStep={6}
/>
);
}
5 changes: 5 additions & 0 deletions apps/redmi1s-demo/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @title PocketJS: Redmi 1S Hero
import { mount } from "@pocketjs/framework/solid";
import Redmi1SHero from "./app.tsx";

mount(() => <Redmi1SHero />);
24 changes: 24 additions & 0 deletions apps/redmi1s-demo/pocket.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://pocketjs.dev/schema/pocket-2.json",
"pocket": 2,
"id": "dev.pocket-stack.redmi1s-demo",
"name": "pocketjs-redmi1s-hero",
"title": "PocketJS: Redmi 1S Hero",
"version": "0.1.0",
"engine": {
"capabilities": {
"requires": ["input.touch", "text.glyphs.baked"]
}
},
"app": {
"entry": "apps/redmi1s-demo/main.tsx",
"output": "redmi1s-demo-main",
"framework": "solid",
"viewport": {
"fixed": {
"logical": [360, 640],
"presentation": "native"
}
}
}
}
58 changes: 58 additions & 0 deletions docs/REDMI1S.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Redmi 1S host

The Redmi 1S host runs PocketJS on the 2014 `armani` handset with MIUI V5,
Android 4.3, and API 18.

## Hardware contract

- **The target is the ARMv7 `HM 1S` with a 720x1280 display at 320 dpi.** The
tool refuses a different model, codename, Android release, SDK level, ABI,
display size, or density.
- **The app renders a 360x640 logical viewport into a 720x1280 EGL window.**
Touch coordinates are converted back to the logical viewport before PocketJS
performs hit testing.
- **NativeActivity creates an OpenGL ES 2 context and links `libGLESv2`.** The
PocketJS DrawList backend submits geometry, textures, blending, and frames to
the Adreno 305. Initialization stops if EGL, GLES2, or the expected surface
cannot be created.
- **The APK contains an `armeabi-v7a` native library and targets API 18.** The
Rust core uses the pinned nightly toolchain and the guest runtime uses the
pinned QuickJS revision in `tools/cli/redmi1s-toolchain.json`.
- **The native link rejects unresolved symbols.** Rust panics abort before they
can unwind across the C ABI.
- **The launcher icon is generated from `hosts/iphone4s/Icon.svg`.** The build
writes 48, 72, 96, and 144 pixel Android density assets from this
high-resolution reconstruction of the classic chrome Pocket icon.

## Build and install

Run these commands from the repository root:

```sh
bun redmi1s setup
bun redmi1s doctor
bun redmi1s build
bun redmi1s deploy
bun redmi1s launch
bun redmi1s accept
```

`setup` prepares the Rust target, pinned QuickJS source, and local debug signing
key. `doctor` checks the installed SDK/NDK tools and the exact connected phone.
`build` writes the signed APK and a hash receipt under `dist/redmi1s/`.

## Hardware receipts

The native host writes `status.txt` inside the app data directory. `bun redmi1s
status` reads it through `run-as` and requires all of these observations:

- **The installed build ID matches the local build receipt.**
- **The live renderer is GLES2 on `Adreno (TM) 305`.**
- **Guest frame and EGL swap counters advance between samples.**
- **A 720x1280 `glReadPixels` capture succeeds and has a nonzero hash.**
- **The physical surface and logical viewport match the target contract.**

`bun redmi1s accept` also injects an Android touch and requires the PocketJS
guest to report the `hero_tap` action. It writes the GPU readback to
`dist/redmi1s/device-frame.png` and the Android compositor screenshot to
`dist/redmi1s/device-screen.png` for visual inspection.
30 changes: 30 additions & 0 deletions hosts/android-redmi1s/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.pocket_stack.redmi1s_demo"
android:versionCode="1"
android:versionName="0.1.0">
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="18" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-feature android:name="android.hardware.touchscreen" android:required="true" />
<application
android:allowBackup="false"
android:debuggable="true"
android:hardwareAccelerated="true"
android:hasCode="false"
android:icon="@drawable/icon"
android:label="PocketJS">
<activity
android:name="android.app.NativeActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="PocketJS"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<meta-data android:name="android.app.lib_name" android:value="pocketjs" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
18 changes: 18 additions & 0 deletions hosts/android-redmi1s/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Redmi 1S Android host

This host packages PocketJS as an Android `NativeActivity` for the Redmi 1S
(`armani`) on MIUI V5/Android 4.3.

- **The APK contains an ARMv7 native library and no Java runtime.**
- **EGL creates an OpenGL ES 2 context and the PocketJS DrawList backend sends
geometry, texture uploads, blending, and presentation to the Adreno 305.**
- **The app refuses to run if the surface is not 720x1280 or GLES2 setup fails.**
- **The native link rejects unresolved symbols, and Rust panics abort before
they can unwind across the C ABI.**
- **Touch coordinates are converted from the physical surface to the 360x640
logical viewport before they enter PocketJS.**
- **The launcher icon is rasterized from `hosts/iphone4s/Icon.svg`, the
high-resolution reconstruction of the classic chrome Pocket icon.**

Use `bun redmi1s build`, `bun redmi1s deploy`, `bun redmi1s launch`, and
`bun redmi1s accept` from the repository root.
Loading