Save Android account backups through the system document picker

This commit is contained in:
waozi committed 2026-10-21 22:20:55 -03:00
1 parent 8ddcf0b5f0
commit 87f4301dff
13 files changed
+289 -57

No files matched your search

+2
View File
@@ -2,6 +2,8 @@
## [2.1.38] - 2026-10-21
- Android account-key backups use the system Save dialog and confirm that the chosen file was written.
- Shared lists preserve every task when edited, show who already has access, and let members edit and share them.
- Undo restores a deleted task with its comment and completion state.
- The Habits shop scrolls through all recent activity and offers a soda reward symbol.
@@ -0,0 +1,76 @@
package xyz.waozi.inbe;
import android.content.ContentResolver;
import android.content.Intent;
import android.net.Uri;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
/** One system-picked document, staged privately until the native writer finishes. */
public final class DocumentExport {
private File staged;
private Uri destination;
public static Intent picker(String filename, String mimeType) {
if (filename == null || filename.isEmpty() || filename.length() > 240
|| filename.contains("/") || filename.contains("\\") || filename.contains("\0")) {
throw new IllegalArgumentException("Invalid export filename");
}
return new Intent(Intent.ACTION_CREATE_DOCUMENT)
.addCategory(Intent.CATEGORY_OPENABLE)
.setType(mimeType == null || mimeType.isEmpty() ? "application/octet-stream" : mimeType)
.putExtra(Intent.EXTRA_TITLE, filename);
}
public synchronized String selected(File cache, Uri uri) throws IOException {
clear();
if (uri == null || !"content".equals(uri.getScheme())) {
throw new IOException("No document selected");
}
staged = File.createTempFile("document-export-", ".tmp", cache);
destination = uri;
return staged.getAbsolutePath();
}
public synchronized boolean commit(ContentResolver resolver, String path) {
if (staged == null || destination == null || !staged.getAbsolutePath().equals(path)) {
return false;
}
try {
if (!staged.isFile() || staged.length() == 0) {
return false;
}
try (FileInputStream input = new FileInputStream(staged);
OutputStream output = resolver.openOutputStream(destination, "wt")) {
if (output == null) {
return false;
}
byte[] buffer = new byte[8192];
try {
int count;
while ((count = input.read(buffer)) != -1) {
output.write(buffer, 0, count);
}
output.flush();
} finally {
java.util.Arrays.fill(buffer, (byte) 0);
}
}
return true;
} catch (IOException | SecurityException error) {
return false;
} finally {
clear();
}
}
public synchronized void clear() {
if (staged != null) {
staged.delete();
}
staged = null;
destination = null;
}
}
@@ -56,6 +56,8 @@ import java.util.Arrays;
public class MainActivity extends NativeActivity {
private final HttpTransport httpTransport = new HttpTransport();
private final DocumentExport documentExport = new DocumentExport();
private int pendingSaveKind;
private FrameLayout startupView;
private boolean firstFrameReady;
private long startupStarted;
@@ -298,6 +300,7 @@ public class MainActivity extends NativeActivity {
private static final int REQUEST_IMPORT_ZIP = 1001;
private static final int REQUEST_POST_NOTIFICATIONS = 1002;
private static final int REQUEST_QR_SCAN = 1003;
private static final int REQUEST_SAVE_DOCUMENT = 1004;
private static final int REQUEST_HEALTH_CONNECT = HealthConnectExport.REQUEST_CODE;
private static final String DOWNLOAD_CHANNEL_ID = "runtime_downloads";
private static final int DOWNLOAD_NOTIFICATION_ID = 2001;
@@ -730,6 +733,23 @@ public class MainActivity extends NativeActivity {
});
}
public void openSavePicker(String filename, String mimeType, int kind) {
runOnUiThread(() -> {
documentExport.clear();
pendingSaveKind = kind;
try {
startActivityForResult(DocumentExport.picker(filename, mimeType), REQUEST_SAVE_DOCUMENT);
} catch (Exception error) {
Log.e(TAG, "Could not open the document save picker", error);
nativeImportSelectedFile(kind, "");
}
});
}
public boolean savePickedFile(String path) {
return documentExport.commit(getContentResolver(), path);
}
private static String[] parseMimeTypes(String mimeTypesCsv) {
if (mimeTypesCsv == null || mimeTypesCsv.trim().isEmpty()) {
return new String[0];
@@ -911,6 +931,23 @@ public class MainActivity extends NativeActivity {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_SAVE_DOCUMENT) {
if (resultCode != RESULT_OK || data == null || data.getData() == null) {
documentExport.clear();
nativeImportCancelled(pendingSaveKind);
} else {
try {
String path = documentExport.selected(getCacheDir(), data.getData());
nativeImportSelectedFile(pendingSaveKind, path);
} catch (Exception error) {
documentExport.clear();
Log.e(TAG, "Could not prepare the selected document", error);
nativeImportSelectedFile(pendingSaveKind, "");
}
}
return;
}
if (requestCode == REQUEST_HEALTH_CONNECT) {
HealthConnectExport.handleResult(this, resultCode, data, lastHealthConnectPath);
return;
@@ -1,3 +1,4 @@
- Android account-key backups use the system Save dialog and confirm that the chosen file was written.
- Shared lists preserve every task when edited, show who already has access, and let members edit and share them.
- Undo restores a deleted task with its comment and completion state.
- The Habits shop scrolls through all recent activity and offers a soda reward symbol.
+2
View File
@@ -4,6 +4,8 @@ This review continues the 21 October Inbe session. It records the requested fixe
## Changes in this continuation
- Android account-key backups use a system-picked document URI, stage bytes in private storage, and report success only after writing and closing the destination. Cancellation and failed writes remain distinct from success.
- Lists prepares shared edits from the complete account-scoped saved document in `src/cells/lists_command.zi`. The screen's bounded item buffer is a view, not a replacement document. Local sharing reads all saved items from SQLite; shared edits read the complete confirmed cache.
- The Share dialog uses the list's owner and accepted/pending invitations. It copies strings that must survive another host read. Daochi supplies the same collaborator states to authorized members and the owner.
- Undo restores a private item's existing row, retaining its ID, comment, completion and order. Shared undo retains the item ID, comment and completion in the next revision.
+20 -6
View File
@@ -45,6 +45,7 @@ SelfReloadData :: (app: *InnerBreeze, settings: s32) #foreign c "app_reload_afte
self_management: Provider.ManagementProvider;
self_management_started: bool;
self_management_picker: bool;
self_management_picker_kind: s32;
self_management_picker_abandoned: bool;
self_management_scan: bool;
self_management_delivered: bool;
@@ -187,19 +188,24 @@ InbeManagementSnapshot :: (context: *void, output: *Manage.Management) {
InbeManagementChooseFile :: (context: *void, save: bool, output: []u8) -> s32 {
if AndroidPlatform() != 0 {
if save {
return ifx Native.NativeJoin(output, data_root(), "self-account.key") != "" then 1 else -1
}
InbeManagementDiscardPicker()
if self_management_picker_abandoned { return -1 }
if !self_management_picker {
if !AndroidPickerOpen(cast(s32)ANDROID_IMPORT_KIND_SYNC_KEY, "*/*") {
self_management_picker_kind = cast(s32)(ifx save then ANDROID_EXPORT_KIND_SYNC_KEY else ANDROID_IMPORT_KIND_SYNC_KEY)
opened: bool
if save {
opened = AndroidSavePickerOpen(self_management_picker_kind,
"self-account.key", "application/octet-stream")
} else {
opened = AndroidPickerOpen(self_management_picker_kind, "*/*")
}
if !opened {
return -1
}
self_management_picker = true
return 2
}
result := AndroidPickerPoll(cast(s32)ANDROID_IMPORT_KIND_SYNC_KEY, output)
result := AndroidPickerPoll(self_management_picker_kind, output)
if result == .AndroidPickerNone {
return 2
}
@@ -207,6 +213,9 @@ InbeManagementChooseFile :: (context: *void, save: bool, output: []u8) -> s32 {
if result == .AndroidPickerCancelled {
return 0
}
if output.count == 0 || output[0] == cast(u8)0 {
return -1
}
unused CopyCString(TextUntilNul(output), self_management_selected[:])
return 1
}
@@ -219,6 +228,11 @@ InbeManagementChooseFile :: (context: *void, save: bool, output: []u8) -> s32 {
}
InbeManagementDeliver :: (context: *void, path: string) -> bool {
if AndroidPlatform() != 0 {
result := AndroidSavePickerCommit(path)
unused RemoveFile(path)
return result
}
if AndroidPlatform() == 0 && WebPlatform() == 0 {
return true
}
@@ -311,7 +325,7 @@ InbeManagementDiscardPicker :: () {
if !self_management.queue.pending { self_management_picker_abandoned = true }
if !self_management_picker_abandoned { return }
abandoned: [4096]u8
result := AndroidPickerPoll(cast(s32)ANDROID_IMPORT_KIND_SYNC_KEY, abandoned[:])
result := AndroidPickerPoll(self_management_picker_kind, abandoned[:])
if result == .AndroidPickerNone { return }
self_management_picker = false
self_management_picker_abandoned = false
+2
View File
@@ -9,6 +9,8 @@ AndroidImportKind :: enum {
ANDROID_IMPORT_KIND_QR_CODE :: 5
// A photo for the media library, as picked: its own bytes and name.
ANDROID_IMPORT_KIND_MEDIA :: 6
ANDROID_EXPORT_KIND_SYNC_KEY :: 7
ANDROID_EXPORT_KIND_DATA_KEY :: 8
}
using AndroidImportKind;
+38 -8
View File
@@ -1,6 +1,7 @@
// Data transfer choices and account safety prompts remain in Ziran.
c :: #system_library "c";
#import "keys"
#import "crypto"
#import, file "../../app/app.zi";
#import, file "../../app/app_types.zi";
#import, file "../../app/modal_rules.zi";
@@ -73,6 +74,8 @@ free :: (value: *void) #foreign c;
pending_import_path: [4096]u8;
pending_import_info: DataImportInfo;
pending_android_import_kind: s32 = -1;
key_backup_picker_pending: bool;
key_backup_owner: [65]u8;
SettingsDataRect :: (x: s32, y: s32, width: s32,
height: s32) -> Rectangle {
@@ -104,7 +107,7 @@ SettingsDataButtonProps :: (label: string, x: s32, y: s32,
SettingsDataPick :: (title: string, filter: string,
suggested: string, save: bool, output: []u8) -> s32 {
return PickFile(FilePickerProps.{.title = title, .filter = filter,
.suggested_name = suggested, .save = save}, output)
.suggested_name = suggested, .save = save}, output)
}
SettingsDataExportPath :: (filename: string, output: []u8) -> bool {
@@ -217,15 +220,36 @@ SettingsDataImportKeyPath :: (app: *InnerBreeze, path: string) -> s32 {
SettingsDataSaveKey :: (app: *InnerBreeze, filename: string) -> s32 {
account: AccountKeys
defer { SecureWipe(*account.private_key_hex[0], ACCOUNT_PRIVATE_KEY_HEX_SIZE) }
path: [4096]u8
if sync_account_load(*account) == 0 {
return 3
}
if AndroidPlatform() != 0 {
if !SettingsDataExportPath(filename, path[:]) {
kind := cast(s32)ANDROID_EXPORT_KIND_DATA_KEY
if !key_backup_picker_pending {
if sync_account_load(*account) == 0 ||
!AndroidSavePickerOpen(kind, filename, "application/octet-stream") {
return 3
}
key_backup_owner = account.public_id
key_backup_picker_pending = true
return 0
}
picked := AndroidPickerPoll(kind, path[:])
if picked == .AndroidPickerNone {
return 0
}
key_backup_picker_pending = false
if picked == .AndroidPickerCancelled {
return 4
}
if path[0] == cast(u8)0 || sync_account_load(*account) == 0 ||
AppTextFromCString(*account.public_id[0], 65) != AppTextFromCString(*key_backup_owner[0], 65) {
SettingsDataReleaseExportPath(AppTextFromCString(*path[0], 4096))
return 3
}
} else {
if sync_account_load(*account) == 0 {
return 3
}
choice := SettingsDataPick(LocaleText("sync_save_key_dialog_title"),
"Key files | *.key", filename, true, path[:])
if choice == 0 {
@@ -239,9 +263,15 @@ SettingsDataSaveKey :: (app: *InnerBreeze, filename: string) -> s32 {
SettingsDataReleaseExportPath(AppTextFromCString(*path[0], 4096))
return 3
}
if !SettingsDataDeliverExport(
AppTextFromCString(*path[0], 4096), filename,
"application/octet-stream") {
delivered: bool
if AndroidPlatform() != 0 {
delivered = AndroidSavePickerCommit(AppTextFromCString(*path[0], 4096))
SettingsDataReleaseExportPath(AppTextFromCString(*path[0], 4096))
} else {
delivered = SettingsDataDeliverExport(
AppTextFromCString(*path[0], 4096), filename, "application/octet-stream")
}
if !delivered {
SettingsDataReleaseExportPath(AppTextFromCString(*path[0], 4096))
return 3
}
@@ -73,6 +73,7 @@ sync_server_url_key: string = "sync_server_url";
sync_server_url_default: string = "https://api.waozi.xyz";
sync_account_alias_key: string = "sync_account_alias";
save_dialog_callback: SettingsSyncKeySaveDialog;
backup_save_pending: bool;
import_dialog_callback: SettingsSyncKeyImportDialog;
server_anchor: s32;
server_scroll_x: s32;
@@ -550,7 +551,7 @@ SettingsDeviceLinkDraw :: (app: *InnerBreeze, x: s32, width: s32, y: *s32, has_a
return
}
if stage == cast(DeviceLinkStage)DeviceLinkWorking || stage == cast(DeviceLinkStage)DeviceLinkReceived ||
stage == cast(DeviceLinkStage)DeviceLinkConnected || stage == cast(DeviceLinkStage)DeviceLinkFailed {
stage == cast(DeviceLinkStage)DeviceLinkConnected || stage == cast(DeviceLinkStage)DeviceLinkFailed {
message := "device_link_working"
if stage == cast(DeviceLinkStage)DeviceLinkConnected { message = "device_link_connected" }
if stage == cast(DeviceLinkStage)DeviceLinkFailed { message = device_link.error }
@@ -806,17 +807,17 @@ settings_sync_account_draw_backup_modal :: (app: *InnerBreeze) -> s32 {
save := SettingsSyncButtonProps(LocaleText("sync_save_key_file_button"),
x, y, width, AppScale(38), 5230, true)
result: s32 = 0
if backup_save_pending && save_dialog_callback != null {
result = save_dialog_callback(app, "account.key")
backup_save_pending = result == 0
}
save.disabled = backup_save_pending
if Button(app.ui.session, save) != 0 {
if save_dialog_callback != null {
result = save_dialog_callback(app, "account.key")
backup_save_pending = result == 0
} else {
filename: [32]u8
unused AppCopyText("account.key", filename[:])
if sync_account_export_private_key(*account, *filename[0]) != 0 {
result = 2
} else {
result = 3
}
result = 3
}
}
y += AppScale(48)
+26 -35
View File
@@ -1,4 +1,3 @@
#import "file_export"
#import, file "account_types.zi";
#import "crypto"
#import "keys"
@@ -26,7 +25,6 @@ SyncSaveFileData :: (path: *u8, body: *u8, length: s32) -> bool #foreign c "Save
AccountExportPlatform :: () -> s32 #foreign c "inbe_account_export_platform";
sync_public_id_key: string = "sync_public_id";
sync_public_key_key: string = "sync_public_key";
@@ -41,7 +39,7 @@ account_has_values :: (account: *AccountKeys) -> s32 {
return 0
}
if account.public_id[0] == 0 || account.public_key_hex[0] == 0 ||
account.private_key_hex[0] == 0 {
account.private_key_hex[0] == 0 {
return 0
}
return 1
@@ -137,7 +135,7 @@ sync_account_generate :: (account: *AccountKeys) -> s32 {
}
sync_account_import_private_key_preview :: (account: *AccountKeys,
filename: *u8) -> s32 {
filename: *u8) -> s32 {
data_init()
if account == null || filename == null || filename[0] == 0 {
return 0
@@ -152,7 +150,7 @@ sync_account_import_private_key_preview :: (account: *AccountKeys,
}
sync_account_save :: (account: *AccountKeys,
local_data_choice: SyncAccountLocalDataChoice) -> SyncAccountSaveResult {
local_data_choice: SyncAccountLocalDataChoice) -> SyncAccountSaveResult {
owner: string
data_init()
@@ -167,12 +165,12 @@ sync_account_save :: (account: *AccountKeys,
owner = storage_sync_data_owner_public_id()
if owner.count > 0 && sync_account_same_owner(owner, account) == 0 &&
storage_has_local_syncable_data() != 0 {
storage_has_local_syncable_data() != 0 {
if local_data_choice == cast(SyncAccountLocalDataChoice)SYNC_ACCOUNT_LOCAL_DATA_ASK {
return cast(SyncAccountSaveResult)SYNC_ACCOUNT_SAVE_NEEDS_CLEAR
}
if local_data_choice == cast(SyncAccountLocalDataChoice)SYNC_ACCOUNT_LOCAL_DATA_REPLACE &&
storage_clear_local_syncable_data() == 0 {
storage_clear_local_syncable_data() == 0 {
return cast(SyncAccountSaveResult)SYNC_ACCOUNT_SAVE_FAILED
}
}
@@ -196,8 +194,9 @@ sync_account_clear :: () -> s32 {
}
sync_account_export_private_key :: (account: *AccountKeys,
filename: *u8) -> s32 {
filename: *u8) -> s32 {
body: [ACCOUNT_EXPORT_TEXT_SIZE] u8
defer { SecureWipe(*body[0], body.count) }
if account_has_values(account) == 0 || filename == null || filename[0] == 0 {
return 0
@@ -207,42 +206,34 @@ sync_account_export_private_key :: (account: *AccountKeys,
}
len := cast(s32)AppTextFromCString(*body[0], ACCOUNT_EXPORT_TEXT_SIZE).count
platform := AccountExportPlatform()
if platform == 1 || platform == 2 {
return ifx ExportBytes(AppTextFromCString(*body[0], ACCOUNT_EXPORT_TEXT_SIZE),
AppTextFromCString(filename, AccountPathCapacity), "application/octet-stream",
LocaleText("share_sheet_title")) then 1 else 0
} else {
index: s32 = 0
full_path: bool = false
while index < AccountPathCapacity && filename[index] != 0 {
if filename[index] == cast(u8)47 || filename[index] == cast(u8)92 {
full_path = true
}
index += 1
index: s32 = 0
full_path: bool = false
while index < AccountPathCapacity && filename[index] != 0 {
if filename[index] == cast(u8)47 || filename[index] == cast(u8)92 {
full_path = true
}
if index == AccountPathCapacity { return 0 }
if full_path {
return ifx (SyncSaveFileData(filename, *body[0], len)) then (1) else (0)
}
path: [AccountPathCapacity] u8
root: [AccountPathCapacity]u8
if !AppCopyText(data_root(), root[:]) ||
storage_join_path(*path[0], AccountPathCapacity,
*root[0], filename) == 0 {
return 0
}
return ifx (SyncSaveFileData(*path[0], *body[0], len)) then (1) else (0)
index += 1
}
if index == AccountPathCapacity { return 0 }
if full_path {
return ifx SyncSaveFileData(filename, *body[0], len) then 1 else 0
}
path: [AccountPathCapacity]u8
root: [AccountPathCapacity]u8
if !AppCopyText(data_root(), root[:]) ||
storage_join_path(*path[0], AccountPathCapacity, *root[0], filename) == 0 {
return 0
}
return ifx SyncSaveFileData(*path[0], *body[0], len) then 1 else 0
}
sync_account_sign_hex :: (message: *u8, message_len: s64,
out_signature_hex: *u8, out_size: s64) -> s32 {
out_signature_hex: *u8, out_size: s64) -> s32 {
account: AccountKeys
if sync_account_load(*account) == 0 {
return 0
}
return SignAccountKeysHex(*account, message, message_len, out_signature_hex,
out_size)
out_size)
}
@@ -0,0 +1,66 @@
import static org.junit.Assert.*;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.Shadows;
import org.robolectric.annotation.Config;
import xyz.waozi.inbe.DocumentExport;
@RunWith(RobolectricTestRunner.class)
@Config(sdk = {28, 36}, manifest = Config.NONE)
public class DocumentExportTest {
private final Uri destination = Uri.parse("content://documents/document/backup");
@Test public void requestsSystemSaveWithAnExplicitFilename() {
Intent picker = DocumentExport.picker("account.key", "application/octet-stream");
assertEquals(Intent.ACTION_CREATE_DOCUMENT, picker.getAction());
assertTrue(picker.hasCategory(Intent.CATEGORY_OPENABLE));
assertEquals("account.key", picker.getStringExtra(Intent.EXTRA_TITLE));
assertEquals("application/octet-stream", picker.getType());
assertThrows(IllegalArgumentException.class, () -> DocumentExport.picker("../account.key", "*/*"));
}
@Test public void writesTheSelectedUriAndRemovesPrivateStaging() throws Exception {
Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
DocumentExport export = new DocumentExport();
File staged = new File(export.selected(activity.getCacheDir(), destination));
byte[] fixture = "synthetic recovery fixture".getBytes("UTF-8");
Files.write(staged.toPath(), fixture);
ByteArrayOutputStream received = new ByteArrayOutputStream();
Shadows.shadowOf(activity.getContentResolver()).registerOutputStream(destination, received);
assertFalse(export.commit(activity.getContentResolver(), "/another/file"));
assertTrue(export.commit(activity.getContentResolver(), staged.getAbsolutePath()));
assertArrayEquals(fixture, received.toByteArray());
assertFalse(staged.exists());
assertFalse(export.commit(activity.getContentResolver(), staged.getAbsolutePath()));
}
@Test public void cancellationAndProviderFailureNeverReportSuccess() throws Exception {
Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
DocumentExport export = new DocumentExport();
File cancelled = new File(export.selected(activity.getCacheDir(), destination));
export.clear();
assertFalse(cancelled.exists());
assertFalse(export.commit(activity.getContentResolver(), cancelled.getAbsolutePath()));
File staged = new File(export.selected(activity.getCacheDir(), destination));
Files.write(staged.toPath(), new byte[] {1, 2, 3});
Shadows.shadowOf(activity.getContentResolver()).registerOutputStream(destination,
new OutputStream() {
@Override public void write(int value) throws IOException {
throw new IOException("Provider refused the write");
}
});
assertFalse(export.commit(activity.getContentResolver(), staged.getAbsolutePath()));
assertFalse(staged.exists());
}
}
@@ -28,6 +28,7 @@ sourceSets {
test.java.srcDir '.'
}
sourceSets.main.java.include '**/RadioPlayer.java'
sourceSets.main.java.include '**/DocumentExport.java'
dependencies {
compileOnly files("${sdk}/platforms/android-36/android.jar")
+9
View File
@@ -12,6 +12,7 @@ Check :: () -> s32 {
path := "/tmp/inbe-self-picker-test/stale.key"
if !CreatePrivateDirectory("/tmp/inbe-self-picker-test") || !WriteEntireFile(path, "fixture: stale account key") { return 1 }
self_management_picker = true
self_management_picker_kind = cast(s32)AndroidImportKind.ANDROID_IMPORT_KIND_SYNC_KEY
self_management.queue.pending = false
PickerStore(cast(s32)AndroidImportKind.ANDROID_IMPORT_KIND_SYNC_KEY, 0, null)
InbeManagementDiscardPicker()
@@ -26,9 +27,17 @@ Check :: () -> s32 {
selected: [128]u8
if AndroidPickerPoll(cast(s32)AndroidImportKind.ANDROID_IMPORT_KIND_SYNC_KEY, selected[:]) != .AndroidPickerNone { return 5 }
self_management_picker = true
self_management_picker_kind = cast(s32)AndroidImportKind.ANDROID_IMPORT_KIND_SYNC_KEY
self_management.queue.pending = false
PickerStore(cast(s32)AndroidImportKind.ANDROID_IMPORT_KIND_SYNC_KEY, 2, null)
InbeManagementDiscardPicker()
if self_management_picker || self_management_picker_abandoned { return 6 }
if !WriteEntireFile(path, "fixture: abandoned export") { return 7 }
self_management_picker = true
self_management_picker_kind = cast(s32)AndroidImportKind.ANDROID_EXPORT_KIND_SYNC_KEY
self_management.queue.pending = false
PickerStore(self_management_picker_kind, 1, *bytes[0])
InbeManagementDiscardPicker()
if self_management_picker || self_management_picker_abandoned || PathExists(path) { return 8 }
return 0
}