
On Android, HWPX can arrive as application/octet-stream: an 18-row intent matrix and the intent filter that fits it
A viewer that only registers document MIME types misses every .hwpx that arrives as octet-stream. Accept octet-stream through one alias, and decide what the file is from its bytes, not its name.
Building the SugarDoc HWP viewer 3/8
HWP and HWPX are the document formats of Hancom Office, the Korean word processor. If your viewer app opens .hwp files but is missing from the "Open with" list for .hwpx, the file probably arrived as application/octet-stream, the type for unknown binary data. On a Galaxy S21 (Android 15), Chrome's download list handed us .hwpx as octet-stream, while Samsung My Files sent application/vnd.hancom.hwpx. On October 5, 2026 we sent documents to the release build of our HWP viewer, SugarDoc, from different apps and in different ways, wrote down 18 rows of what arrived, and then corrected the manifest against that matrix and the E2E runs that followed. Filling in the matrix turned up one crash on a share sent without a read grant. A day later, accepting octet-stream shares made the app appear twice in the chooser for a */* share.
Contents (9)
- The same .hwpx came in under two MIME types
- One alias that takes octet-stream, and a byte check behind it
- A share without a read grant crashed SendEntryActivity
- Adding a SEND alias listed the app twice
- Why not */*, pathPattern, or off by default
- KakaoTalk opened the files, but nobody wrote down the MIME type
- Building the same intent matrix for your app with adb
- Next: mail app MIME types, and the setting under an open reader
- FAQ
The same .hwpx came in under two MIME types
Eleven of the 18 rows come from real apps sending a document: Samsung My Files (4 rows), Chrome (4) and Files (3). The other seven are a debug sender app (2) and adb (5). While the reader was on screen we read typ= and flg= from dumpsys activity activities.
| Sender (device) | .hwpx | .hwp | NEW_TASK | |
|---|---|---|---|---|
| Samsung My Files (S21) | vnd.hancom.hwpx | x-hwp | pdf | no (0x3000001) |
| Chrome download list (S21) | octet-stream | x-hwp | opened by Chrome | yes (0x13000003) |
| Files (emulator, API 35) | octet-stream | x-hwp | pdf | no (0x23000003) |
Each sender gets its MIME type from a different place. Chrome passed on whatever the download server sent. Files (DocumentsUI) relies on the MIME table of the system image, and the emulator image had no entry for hwpx; when we checked the AOSP MIME table on October 4 it listed x-hwp but not hwpx. Only My Files attached a Hancom type. In an engine test on October 3, My Files sent an .hwpx as vnd.hancom.hwpx even though MediaStore had recorded it as application/octet-stream.
Our early research notes assumed that .hwp files arrive as octet-stream too. They don't: in the matrix all three apps sent .hwp as application/x-hwp. Only .hwpx came through as an unknown file, so a viewer that registers only document types opens .hwp yet is missing from the "Open with" list for .hwpx. The user-side fixes are in How to open an HWPX or HWP file on Android.

PDFs from Chrome never reached us. Chrome opened downloaded PDFs in its own viewer, and the "Open" button in the download-complete message only showed the download list. No filter can change that, so the matrix conclusion just notes that a Chrome PDF has to go through My Files.
One alias that takes octet-stream, and a byte check behind it
VIEW is received by a single activity-alias, .reader.OpenUnknownFile. One filter holds the 11 document MIME types and five generic ones. One filter means one entry in the chooser.
<activity-alias android:name=".reader.OpenUnknownFile"
android:enabled="true" android:exported="true"
android:targetActivity=".reader.ReaderActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<!-- 11 document types: pdf, x-pdf, x-hwp, haansofthwp, vnd.hancom.hwp,
vnd.haansoft-hwp, hwp+zip, x-hwp+zip, haansofthwpx,
vnd.hancom.hwpx, x-hwpx -->
<data android:mimeType="application/vnd.hancom.hwpx" />
<!-- 5 generic types -->
<data android:mimeType="application/octet-stream" />
<data android:mimeType="binary/octet-stream" />
<data android:mimeType="application/x-download" />
<data android:mimeType="application/download" />
<data android:mimeType="application/force-download" />
</intent-filter>
</activity-alias>
x-download is there because on October 4 attachments from korea.kr, a Korean government website, arrived with that type and Chrome did not remap it. Every type is lowercase: the Android documentation says MIME matching in the framework is case-sensitive.
Taking octet-stream puts the app in the chooser for every unnamed file, so the reader reads the first 64 KB and decides the format from bytes, copying the whole file first when the proof sits further in. A PDF needs %PDF- in its first 1 KB. HWP 5 needs a CFB container whose FileHeader says "HWP Document File". HWPX needs a ZIP whose first entry is a stored mimetype reading application/hwp+zip. HWP 3 has its own signature. The MIME type and file name can only soften a verdict, never create one. On a local set of 635 files (255 documents, the rest files that must be rejected) the check made no wrong calls.
The last two matrix rows test this on a device. We built a 4 KiB file with an m4a header (ftyp M4A) and sent it named .hwp with type application/x-hwp. On the S21 the chooser started 197 to 215 ms after the VIEW; with only one other app able to take the file, the system went straight to the phone's other office viewer, and no copy stayed in our app. The emulator has no other app that takes HWP, so there we sent the same file as application/pdf; the hand-off to Google Drive's PDF viewer took 435 ms.
A share without a read grant crashed SendEntryActivity
Shares (SEND) land in SendEntryActivity, which has no UI: it forwards to the reader in onCreate and finishes. In one adb row of the October 5 matrix we shared a PDF with only EXTRA_STREAM and no --grant-read-uri-permission. The activity died with a SecurityException and took the process with it.
- The sender passed a URI but no read permission for it.
- The code the agent wrote added
FLAG_GRANT_READ_URI_PERMISSIONto the intent it forwarded to the reader, trying to pass on a grant the app never held. - The system refused that
startActivitywith a SecurityException, the exception escaped onCreate, and the process went down.
The fix, SendForward, catches only that exception and forwards again without the grant flag and without ClipData. The reader then tries the URI and, if it can't read it, shows the "can't access" screen (E1).
fun start(forward: Intent, start: (Intent) -> Unit) {
try {
start(forward)
} catch (e: SecurityException) {
start(withoutGrant(forward)) // drop the grant flag and ClipData
}
}
A JVM unit test pins this down, and the device smoke script sends an ungranted SEND on every run. In the 1.0.0 (3) regression on October 8, the eight smoke checks that include this step passed 8 of 8 on both the S21 (Android 15) and the S20 (Android 13). In the matrix only the adb row with the grant removed produced the crash; none of the real-app rows did. We don't know which apps, if any, share this way.
Adding a SEND alias listed the app twice
In the E2E run of October 5 and 6, a scenario that simulates a mail share drew the first page in 21 of 25 cases on the S21 and 20 of 25 on the S20 in its final round. Every failure was an .hwpx shared as octet-stream, because the first design accepted SEND only for the 11 document types. The E2E report suggested deciding after measuring real mail apps; on October 6 the operator chose to accept octet-stream shares first, and the code comment records the reason as "mail apps share .hwpx that way".
The agent added a new alias, SendUnknownFile, for octet-stream shares. After that, a share typed */* matched both the existing SendEntryActivity filter and the new alias, because Android matches a */* intent against any typed filter. The S20 chooser showed two identical "SugarDoc" entries; on the S21 an extra one-item resolver step appeared.
On October 7 we changed it so that only one component is enabled for any given intent. SendEntryActivity lost its filter and became exported=false, and SEND now goes through one of two aliases: SendUnknownFile (11 document types plus octet-stream) while the setting is on, SendDocument (11 types) while it is off. After SEND was fixed, the recheck found that VIEW */* also matched both ReaderActivity and OpenUnknownFile, a layout that had been there since the October 5 matrix. Tests assumed the ReaderActivity filter, so it was set aside at first and given the same treatment later that day. When the setting changes, the alias taking over is enabled before the other is disabled, so there can briefly be two entries but never zero.
We checked with cmd package query-activities. On the S21 release build with the setting on, VIEW for */*, pdf, hwpx and octet-stream all resolved to OpenUnknownFile alone; with it off, to ViewDocument alone, and octet-stream to nothing. A recheck the same day showed one "SugarDoc" in both the "Open with" and the share choosers.
Keep exactly one enabled component per action for each MIME type.
Why not */*, pathPattern, or off by default
We never declared a */* filter; it would put a document viewer in the list for every photo and recording. Octet-stream carries the same risk on a smaller scale, limited to unnamed files, and the byte check hands non-documents straight on. application/zip and application/unknown stay out until a real app is seen sending them.
Matching .hwpx with pathPattern doesn't work for content URIs. My Files handed us a URI shaped like content://media/external/file/N, with no file name in the path. The Android documentation says the path attributes of <data> mean something only when the filter names a host. You can widen the host to * so the path condition applies to any sender, but a URI like that has no extension in its path to match. On October 4 we read a competing app's manifest: it accepted octet-stream only under a pathPattern, and its reviews included complaints that .hwpx didn't appear in the "Open with" list. That link between the manifest and the reviews is our inference.
Shipping the generic alias switched off was the other option. In the matrix, turning the setting off and sending an octet-stream VIEW removed the app from the chooser, so off by default means .hwpx from Chrome and Files never lists us. On October 5 the operator approved on by default. The decision table weighed being listed in "Open with" against backlash at an app that grabs files. The setting "Show for all file types" lets users turn it off, and the product spec says a high rejection rate on the generic alias sends us back to off by default or to fewer MIME types.
KakaoTalk opened the files, but nobody wrote down the MIME type
The agent could not test KakaoTalk, Korea's main messaging app: a second account has to send the file. The matrix put KakaoTalk, Naver Mail (a Korean webmail service) and Gmail in a separate table of checks for the owner. The October 9 release record has the operator's result: on a Galaxy S23, four test folders sent from another KakaoTalk account (an HWPX official letter, an HWP5 official letter, a PDF and an old HWP3 file) all opened in the viewer. The record has no MIME type and no NEW_TASK flag. Today's filter takes both the document types and octet-stream, so the fact that the files opened doesn't tell us which one KakaoTalk used.
The device coverage is narrow too. The matrix ran on the S21 (Android 15) and an API 35 emulator, and the regression added the S20 (Android 13). We didn't look at other manufacturers' file apps, and Files by Google wasn't installed on any test device.
Building the same intent matrix for your app with adb
- Open an .hwpx, an .hwp and a .pdf from each sender. While your reader is on screen, record the MIME type, flags and authority. Leave file names out.
adb shell dumpsys activity activities | grep -A3 <package> - Count how many times your package matches each type. For VIEW and SEND alike,
*/*, each document type and octet-stream should give exactly one.adb shell cmd package query-activities --brief \ -a android.intent.action.VIEW -t '*/*' -d content://x/y - Share without a read grant. The app must not crash; it should end on its "can't access" screen.
adb shell am start -a android.intent.action.SEND \ -t application/pdf --eu android.intent.extra.STREAM <content URI> - VIEW a non-document, such as an m4a, named .hwp with a document MIME type. Check that it goes to the chooser and that no copy stays in app storage.
- Turn the generic-type setting off and send an octet-stream VIEW. Your app should be missing from the chooser and come back when the setting is on again.
- Messenger and mail apps need a second account to send from.
The engine side is in Building an Android HWP viewer: rhwp in a WebView, measured on 222 documents, and the same app's PDF path problem is in androidx.pdf beta01 runs your Application.onCreate a second time, in an isolated process, and the PDF silently never opens.
Next: mail app MIME types, and the setting under an open reader
We haven't opened a Naver Mail or Gmail attachment yet. Mail apps were the stated reason for accepting octet-stream shares, so recording their MIME types with dumpsys comes first. We also haven't tried switching the setting while a reader opened through the alias that gets disabled is still on screen; the system might close that reader, or returning to it from Recents might fail. The rule to roll back on a high rejection rate is written down, but there is no record yet of anyone reading that number.
FAQ
What is the MIME type of an .hwpx file on Android?
It depends on the sending app. On October 5, 2026, Samsung My Files sent application/vnd.hancom.hwpx, while Chrome's download list and Files on the emulator sent application/octet-stream. Our filter lists application/haansofthwpx, application/vnd.hancom.hwpx, application/x-hwpx, application/hwp+zip and octet-stream together.
Can I match .hwpx with pathPattern in an intent filter?
Not for content URIs. The URI Samsung My Files handed us, content://media/external/file/N, carries no file name to match. Match on MIME type and check the bytes.
Sources: the SugarDoc repository's intent matrix QA document (2026-10-05), on-device E2E reports (Oct 5 to 7) and the 1.0.0 release record (Oct 8 and 9). Device serials and document names are left out.
This note is written from values SugarMount measured itself; an AI coding agent was used to draft it.