Skip to content

Play your Steam library's Windows games on a jailbroken PS5.

C++

Explain a missing root grant; keep Maintenance in reach

Leonardo Lobato28f05a3f94f2
diff --git a/README.md b/README.md
index 7ea5509..78912f0 100644
--- a/README.md
+++ b/README.md
@@ -250,6 +250,9 @@ build/homebrew-host/playden-homebrew --simulation --scenario signed-out
Reload ShadowMountPlus.
Until the game is registered, its Cloud saves are not synced before its first launch.
- If every game hangs on its loading spinner, the ELF loader has stopped. Reload it.
+- If Playden opens on **Root access is missing**, it could not get the root access it needs to reach its data in
+ `/data`, so it can't show your games, download or play. Load kstuff and the autoloader (the ELF loader must
+ run too), then open Playden again. The screen's startup error is worth quoting in a report.
- Some controller games show a mouse pointer in a corner of the screen.
- Playden can crash if you open a game page in the first seconds after start-up.
- 32-bit games can run through an x86 translator, which is slower than native. For 32-bit OpenGL games this
diff --git a/src/homebrew/ps5.cpp b/src/homebrew/ps5.cpp
index bc9132b..470c3f4 100644
--- a/src/homebrew/ps5.cpp
+++ b/src/homebrew/ps5.cpp
@@ -91,6 +91,7 @@ int sceSysmoduleGetModuleHandleInternal(uint32_t id, int32_t* handle);
int sceKernelDlsym(int32_t handle, const char* name, void** address);
int sceUserServiceGetForegroundUser(uint32_t* user_id);
int sceUserServiceGetInitialUser(int* user_id);
+int sceUserServiceInitialize(const void* parameters);
}
namespace {
@@ -171,6 +172,38 @@ std::vector<playden::steam::InstallRequest> take_install_requests(bool runtime_r
std::remove(request_path.c_str());
return requests;
}
+
+// Without the root grant Playden can't reach /data, so no service starts: this screen shows
+// until the player quits to Home. A new grant needs a single-threaded title, so it can't be
+// retried once the display is open: opening Playden again is the retry.
+void show_root_access_missing(hui::ps5::Display& display, const playden::ps5::NativeAccessResult& access) {
+ // granted: the grant ran but its data (/data/playden) failed; the screen says so.
+ const char* what = access.granted ? "runtime data unusable after the grant" : "root access missing";
+ hui::sys::log("Playden %s: %s", what, access.error.c_str());
+ playden::app::AppendLogLine("/app0/logs", "launch.log", std::string(what) + ": " + access.error);
+ // The pad belongs to a user; the bootstrap may have stopped before UserService started.
+ sceUserServiceInitialize(nullptr);
+ playden::homebrew::Simulation simulation({}, {}, playden::homebrew::ModelMode::Live);
+ simulation.ShowRootAccessMissing(access.error, access.granted);
+ playden::homebrew::Render renderer(access.launcher_ready ? access.paths.assets_root : std::string("/app0/assets"));
+ hui::ps5::Pad pad;
+ pad.open();
+ hui::InputTracker tracker;
+ std::array<hui::PadSample, 64> samples{};
+ bool presented = false;
+ while (!simulation.state().quit_requested) {
+ const auto count = pad.read(samples);
+ dispatch(simulation, tracker.update(std::span<const hui::PadSample>(samples.data(), count),
+ hui::sys::monotonic_us()));
+ renderer.draw(simulation, display.width(), display.height(), 1.0F / 60.0F);
+ if (!display.swap()) break;
+ if (!presented) {
+ hui::sys::hide_splash_screen();
+ presented = true;
+ }
+ pad.tick(1.0F / 60.0F);
+ }
+}
} // namespace
int main() {
@@ -182,9 +215,17 @@ int main() {
if (display.width() <= 0 && !display.open(3840, 2160)) {
hui::sys::log("Playden Hui display failed"); hui::sys::park();
}
- if (!native_access.launcher_ready) {
- hui::sys::log("Playden launcher paths unavailable: %s", native_access.error.c_str());
- hui::sys::park();
+#if PLAYDEN_UI_SIMULATION
+ // Fixtures need only the package.
+ const bool root_access_missing = !native_access.launcher_ready;
+#else
+ const bool root_access_missing = !native_access.runtime_ready;
+#endif
+ if (root_access_missing) {
+ show_root_access_missing(display, native_access);
+ display.close();
+ hui::sys::quit();
+ return 0;
}
const auto& paths = native_access.paths;
title_root = paths.title_root;
@@ -508,8 +549,6 @@ int main() {
playden::steam::StoreDetailsService store_details(playden::homebrew::StoreFetch(paths.trust_store));
services.SetStoreDetails(&store_details);
services.SetSelfUpdate(&self_update);
- // Without its runtime Playden still lists and downloads games; say why nothing can start.
- if (!native_access.runtime_ready) simulation.UpdateRuntimeProblem(native_access.error);
#endif
#if PLAYDEN_UI_SIMULATION
playden::homebrew::Render renderer(paths.assets_root);
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cpp
index 8333109..ace99bf 100644
--- a/src/homebrew/simulation.cpp
+++ b/src/homebrew/simulation.cpp
@@ -1019,6 +1019,28 @@ void Simulation::ShowLayoutNotice(const std::string& text) {
rebuild_view();
}
+void Simulation::ShowRootAccessMissing(const std::string& raw, bool granted) {
+ if (!live()) return;
+ // One short line: the first failure and the helper's diagnostic are enough to report. The
+ // unused fallback launcher's path check is left out.
+ constexpr std::size_t kDetailLimit = 140;
+ std::string detail = raw;
+ if (const auto from = detail.find("; launcher paths unavailable: "); from != std::string::npos) {
+ const auto to = detail.find("; ", from + 2);
+ detail.erase(from, to == std::string::npos ? std::string::npos : to - from);
+ }
+ if (detail.size() > kDetailLimit) detail = detail.substr(0, kDetailLimit - 1) + "…";
+ state_.root_access_missing = true;
+ state_.root_access_granted = granted;
+ state_.root_access_detail = std::move(detail);
+ state_.notices.clear();
+ state_.navigation.modals.clear();
+ state_.editor.active = false;
+ state_.navigation.route = Route::Startup;
+ state_.navigation.focus_key = "root-quit";
+ rebuild_view();
+}
+
void Simulation::UpdateSelfUpdate(const LiveSelfUpdate& update) {
if (!live()) return;
const LiveSelfUpdate before = state_.self_update;
@@ -3172,6 +3194,12 @@ void Simulation::rebuild_view() {
if (runtime->maintenance_running) item.value = "Working…";
else if (!runtime->maintenance_message.empty()) item.subtitle = runtime->maintenance_message;
}
+ // A title waiting for recovery: only Recreate bottle (or the title's Resume) gets it out.
+ if ((kind == MaintenanceKind::Repair || kind == MaintenanceKind::ClearShaderCache ||
+ kind == MaintenanceKind::BackupSaves) && runtime && runtime->status == "Needs recovery") {
+ item.enabled = false;
+ item.subtitle = "Finish the PS5 title's recovery first, or use Recreate bottle.";
+ }
} else if (action_key.rfind("volume-", 0) == 0) {
item.kind = RowKind::Volume;
if (const auto* volume = find_volume(state_, action_key.substr(7))) {
@@ -3408,6 +3436,20 @@ void Simulation::rebuild_view() {
: installed_part(state_.navigation.focus_key) == 2 ? std::vector<std::string>{"Cross Choose", "Circle Close"}
: std::vector<std::string>{"Circle Close"};
else if (!modal.setting_id.empty()) view_.legends = {"Cross Select", "Triangle Reset", "L1/R1 Jump", "Circle Back"};
+ } else if (state_.navigation.route == Route::Startup && state_.root_access_missing) {
+ if (state_.root_access_granted) {
+ view_.title = "Playden can't start";
+ view_.subtitle = "Playden has root access but can't use its data in /data/playden. "
+ "Restart Playden; if it stays, check that folder's permissions over FTP.";
+ } else {
+ view_.title = "Root access is missing";
+ view_.subtitle = "Without it, Playden can't reach its data, so it can't show your games, download or play. "
+ "Load kstuff and the autoloader, then open Playden again.";
+ }
+ if (!state_.root_access_detail.empty())
+ row("root-detail", RowKind::Status, "Startup error: " + state_.root_access_detail, "").enabled = false;
+ row("root-quit", RowKind::Action, "Quit to Home", "root-quit");
+ view_.legends = {"Cross Quit to Home"};
} else if (state_.navigation.route == Route::Startup) {
view_.title = "Welcome to Playden";
view_.subtitle = live() ? "Connect Steam to load your library." : "Browse the local UI fixture or connect a simulated Steam account.";
@@ -6037,6 +6079,12 @@ bool Simulation::action(const std::string& logical_action) {
else if (logical_action == "l2") state_.controller.l2 = 1.0F;
else if (logical_action == "r2") state_.controller.r2 = 1.0F;
else if (logical_action == "options") state_.controller.options = true;
+ // Without the root grant nothing else runs: Cross (or the action itself) quits to Home.
+ if (state_.root_access_missing) {
+ if (logical_action != "cross" && logical_action != "root-quit") return false;
+ state_.quit_requested = true;
+ return true;
+ }
if (live()) {
if (logical_action == "connect") { open_sign_in(); rebuild_view(); return true; }
if (logical_action == "qr-retry" || logical_action == "qr-refresh") {
@@ -6796,11 +6844,13 @@ std::vector<std::string> Simulation::details_context_actions() const {
!game_prepared(state_.navigation.selected_game_id);
// An installed game not set up yet (a refusal from before Playden restarted is not kept) sets
// itself up first, so Game settings is there before Play is pressed once (#46).
- const bool unprepared = live() && is_installed(state_, state_.navigation.selected_game_id) &&
- !game_prepared(state_.navigation.selected_game_id);
- if (refused || unprepared) actions.insert(actions.begin(), "game-settings");
- if (game_prepared(state_.navigation.selected_game_id))
+ // Maintenance is there for every installed game, whatever its state (a title waiting for
+ // recovery gets out through Recreate bottle); rows that can't run say why.
+ const bool installed = live() && is_installed(state_, state_.navigation.selected_game_id);
+ if (installed || game_prepared(state_.navigation.selected_game_id))
actions.insert(actions.begin(), {"game-settings", "game-maintenance"});
+ else if (refused)
+ actions.insert(actions.begin(), "game-settings");
// A title waiting for the PS5 is ready to play from Home; asking the console again is a side action.
const auto runtime = state_.runtime_games.find(state_.navigation.selected_game_id);
if (live() && runtime != state_.runtime_games.end() && runtime->second.awaiting_registration &&
diff --git a/src/homebrew/simulation.hpp b/src/homebrew/simulation.hpp
index 7c6b992..7e3ecc3 100644
--- a/src/homebrew/simulation.hpp
+++ b/src/homebrew/simulation.hpp
@@ -477,6 +477,10 @@ struct State {
SessionState session = SessionState::Idle;
RuntimeState runtime = RuntimeState::Unavailable;
std::string runtime_problem; // why games can't be prepared or played, in words a person can act on
+ // Live: started without the root grant, so only the "Root access is missing" screen shows.
+ bool root_access_missing = false;
+ std::string root_access_detail; // the startup error, shortened
+ bool root_access_granted = false; // the grant succeeded; its data in /data/playden failed
LogState log_state = LogState::Ready;
std::vector<std::string> log_lines;
int log_offset = 0;
@@ -625,6 +629,10 @@ public:
void UpdateRuntimeProblem(const std::string& raw);
// Live mode: a one-line note from startup's data layout move (a step held back this start).
void ShowLayoutNotice(const std::string& text);
+ // Live mode: startup got no root grant (raw: NativeAccessResult::error). Shows only the
+ // "Root access is missing" screen; its one action quits to Home (quit_requested).
+ // granted: the grant succeeded but Playden can't use /data/playden (other words, same screen).
+ void ShowRootAccessMissing(const std::string& raw, bool granted = false);
// Live mode: Playden's own update, and what the player asked of it: "check" (from Settings),
// "install", "cancel", "restart" (apply at quit; quit follows), "rollback" (put the previous
// version back at quit; quit follows) and "acknowledge" (a finished update's message was shown).
diff --git a/src/homebrew/view.cpp b/src/homebrew/view.cpp
index f154e40..6b025ff 100644
--- a/src/homebrew/view.cpp
+++ b/src/homebrew/view.cpp
@@ -1060,6 +1060,20 @@ class Render::Impl
void draw_startup(ui::Canvas &, const ViewData &view, const State &state)
{
section_label("Playden", 96.0F, 78.0F);
+ if (state.root_access_missing)
+ {
+ // No artwork or account here: the problem, the startup error and the way out.
+ draw_title(view, 96.0F, 292.0F, 1180.0F);
+ float y = 470.0F;
+ for (const ViewRow &row : view.rows)
+ if (row.kind == RowKind::Status)
+ {
+ ui::paragraph(scene_, fonts_.regular, row.title, 96.0F, y, 22.0F, 1180.0F, 30.0F, kAmber, 2);
+ y += 92.0F;
+ }
+ draw_actions(view, 96.0F, y, 560.0F);
+ return;
+ }
draw_title(view, 96.0F, 292.0F, 720.0F);
if (state.startup_loading)
{
@@ -2949,6 +2963,15 @@ class Render::Impl
void draw_footer(ui::Canvas &, const ViewData &view)
{
+ // "Root access is missing" has one action: no Back or Sections.
+ if (current_state_ && current_state_->root_access_missing)
+ {
+ std::vector<ui::Hint> hints;
+ for (std::size_t index = 0; index < view.legends.size(); ++index)
+ hints.push_back({legend_button(view.legends[index], index), legend_text(view.legends[index])});
+ draw_hint_row(scene_, hints, 96.0F);
+ return;
+ }
// The Installed games sheet shows its own hints; the bar behind it would only repeat them, dimmed.
if (view.surface != "installed-games")
{
diff --git a/src/platform/ps5/native_access.cpp b/src/platform/ps5/native_access.cpp
index ec2c7f2..d95c708 100644
--- a/src/platform/ps5/native_access.cpp
+++ b/src/platform/ps5/native_access.cpp
@@ -257,25 +257,29 @@ NativeAccessResult NativeAccessBootstrap::PrepareAccess() {
if (grant_code != 0)
return LauncherFallback(NativeFailure("native data grant", grant_code),
&stable);
+ // From here the grant succeeded: a failure is about the data, not the grant.
+ auto granted_fallback = [&](const std::string& error) {
+ auto result = LauncherFallback(error, &stable);
+ result.granted = true;
+ return result;
+ };
std::string path_error;
if (!ValidatePaths(ops_, stable, options_.known_fresh_state,
StubState::kReadable, &path_error)) {
- return LauncherFallback("stable launcher source is invalid: " + path_error,
- &stable);
+ return granted_fallback("stable launcher source is invalid: " + path_error);
}
std::string stable_identity;
if (!ops_.read_source_identity(ops_.context, stable_root.c_str(),
&stable_identity) ||
stable_identity.empty() || stable_identity != source_identity_) {
- return LauncherFallback("stable launcher source identity does not match",
- &stable);
+ return granted_fallback("stable launcher source identity does not match");
}
runtime_error.clear();
if (!ValidateRuntimeData(ops_, options_, &runtime_error))
- return LauncherFallback(runtime_error, &stable);
+ return granted_fallback(runtime_error);
NativeAccessResult result;
result.launcher_ready = true;
diff --git a/src/platform/ps5/native_access.h b/src/platform/ps5/native_access.h
index e9432c7..a584a8a 100644
--- a/src/platform/ps5/native_access.h
+++ b/src/platform/ps5/native_access.h
@@ -51,8 +51,8 @@ struct NativeAccessOptions {
// Package paths: the title, its assets and trust store, and the stub
// playden-data/logs folders. Granted starts need the stubs only as readable
-// folders; a launcher without the grant keeps its state there, so they must be
-// writable. After the grant, the
+// folders; the fallback without the grant still checks them as writable (its
+// live launcher only shows "Root access is missing"). After the grant, the
// 0.6 layout move fills user_root, user_log_root and games_root (each at the
// new place once its step has moved, else the old in-app one). Not granted:
// they stay empty and the package paths are used.
@@ -82,6 +82,7 @@ inline std::string EffectiveGamesRoot(const NativePaths& paths) {
struct NativeAccessResult {
bool launcher_ready = false;
bool runtime_ready = false;
+ // The data grant succeeded (or wasn't needed); without runtime_ready the data, not the grant, failed.
bool granted = false;
bool already_accessible = false;
NativePaths paths;
diff --git a/tests/homebrew_library_graphical_test.cpp b/tests/homebrew_library_graphical_test.cpp
index 97a849e..8707abb 100644
--- a/tests/homebrew_library_graphical_test.cpp
+++ b/tests/homebrew_library_graphical_test.cpp
@@ -96,6 +96,13 @@ int main(int argc,char** argv) {
assert(renderer.capture_png(output/name,1920,1080));
};
capture("home.png");
+ {
+ Simulation missing({}, {}, ModelMode::Live);
+ missing.ShowRootAccessMissing("native data grant failed (code 2); helper stage=request status=unavailable error=2");
+ for(int i=0;i<16;++i) renderer.draw(missing,1920,1080);
+ assert(renderer.capture_png(output/"root-access-missing.png",1920,1080));
+ assert(renderer.diagnostics().focused_control_key=="root-quit");
+ }
assert(model.action("r1") && model.state().navigation.route==Route::Library);
capture("library.png");
assert(model.action("search"));model.text("CAFÉ");assert(model.action("done"));
diff --git a/tests/homebrew_live_model_test.cpp b/tests/homebrew_live_model_test.cpp
index 26d8762..98a0c48 100644
--- a/tests/homebrew_live_model_test.cpp
+++ b/tests/homebrew_live_model_test.cpp
@@ -248,6 +248,37 @@ void live_settings_follow_the_prepared_title(const std::filesystem::path& base)
activate(model, "details-more");
check(find_row(model, "game-settings") && find_row(model, "game-maintenance"),
"a prepared game's More menu offers Game settings and Maintenance");
+ // A title waiting for recovery keeps Maintenance: Recreate bottle is the way out.
+ {
+ auto recovering = runtime;
+ recovering.status = "Needs recovery";
+ recovering.ready = recovering.prepared = false;
+ recovering.activity = TitleActivity::Stopped;
+ model.UpdateRuntime(playden::homebrew::RuntimeState::Ready, {recovering});
+ activate(model, "cancel");
+ activate(model, "details-more");
+ check(find_row(model, "game-maintenance") != nullptr, "a title needing recovery still offers Maintenance");
+ activate(model, "game-maintenance");
+ model.TakeActivityRequests();
+ model.UpdateRuntime(playden::homebrew::RuntimeState::Ready, {recovering}); // the console's answer
+ const auto* recreate = find_row(model, "maintenance-recreate");
+ check(recreate && recreate->enabled, "Recreate bottle can run while the title waits for recovery");
+ for (const char* key : {"maintenance-repair", "maintenance-shader", "maintenance-backup"}) {
+ const auto* blocked = find_row(model, key);
+ check(blocked && !blocked->enabled &&
+ blocked->subtitle == "Finish the PS5 title's recovery first, or use Recreate bottle.",
+ "Repair, Clear shader cache and Back up saves wait for the title's recovery");
+ }
+ for (const char* key : {"maintenance-repair", "maintenance-shader", "maintenance-backup"}) {
+ (void)model.action(std::string("focus:") + key);
+ (void)model.action("cross");
+ }
+ check(model.TakeMaintenanceRequests().empty(), "the rows waiting for recovery start nothing");
+ const auto* reset = find_row(model, "maintenance-reset");
+ check(reset && reset->subtitle.find("recovery") == std::string::npos, "Reset settings is unchanged during recovery");
+ activate(model, "cancel");
+ model.UpdateRuntime(playden::homebrew::RuntimeState::Ready, {runtime});
+ }
activate(model, "game-settings");
check(model.TakeActivityRequests() == std::vector<playden::homebrew::GameId>{220}, "the sheet asks whether the game runs");
@@ -574,9 +605,74 @@ void live_self_update(const std::filesystem::path& base) {
"update: the finished update is announced once");
}
+// Without the root grant only "Root access is missing" shows; its one action quits to Home.
+void live_root_access_missing() {
+ Simulation model({}, {}, ModelMode::Live);
+ const std::string error = "native data grant failed (code 2); helper stage=request status=unavailable error=2";
+ model.ShowRootAccessMissing(error);
+ const auto& view = model.view();
+ check(model.state().navigation.route == Route::Startup && view.title == "Root access is missing",
+ "root access: the screen shows its title");
+ check(view.subtitle.find("Load kstuff and the autoloader, then open Playden again.") != std::string::npos,
+ "root access: the body says how to fix it");
+ const auto detail = std::find_if(view.rows.begin(), view.rows.end(),
+ [](const auto& row) { return row.key == "root-detail"; });
+ check(detail != view.rows.end() && detail->title == "Startup error: " + error && !detail->enabled,
+ "root access: the startup error is a detail line");
+ check(view.focused_row >= 0 && view.rows[static_cast<std::size_t>(view.focused_row)].key == "root-quit" &&
+ view.rows[static_cast<std::size_t>(view.focused_row)].title == "Quit to Home",
+ "root access: Quit to Home has focus");
+ // Nothing else is reachable: no sign-in, Settings, search or tabs.
+ for (const char* name : {"connect", "options", "circle", "triangle", "r1", "search", "route:settings", "down"})
+ check(!model.action(name), "root access: other actions do nothing");
+ check(model.TakeServiceActions().empty() && !model.state().quit_requested && !model.state().editor.active &&
+ model.state().navigation.modals.empty() && model.state().navigation.route == Route::Startup,
+ "root access: no service action, dialog or route change");
+ check(model.action("cross") && model.state().quit_requested, "root access: Cross quits to Home");
+
+ Simulation long_error({}, {}, ModelMode::Live);
+ long_error.ShowRootAccessMissing(std::string(400, 'x'));
+ const auto& rows = long_error.view().rows;
+ const auto shortened = std::find_if(rows.begin(), rows.end(), [](const auto& row) { return row.key == "root-detail"; });
+ check(shortened != rows.end() && shortened->title.size() < 200 && shortened->title.find("…") != std::string::npos,
+ "root access: a long startup error is shortened");
+
+ // Without the grant the FTP-made stubs fail the fallback's check too: that clause is left out.
+ Simulation stubs({}, {}, ModelMode::Live);
+ stubs.ShowRootAccessMissing("native data grant failed (code 13); launcher paths unavailable: existing Steam state "
+ "root is inaccessible; helper stage=target_preflight status=16 error=16");
+ check(stubs.state().root_access_detail ==
+ "native data grant failed (code 13); helper stage=target_preflight status=16 error=16",
+ "root access: the helper diagnostic survives, the fallback path check does not");
+
+ // The grant ran but its data failed: same screen, other words, no kstuff advice.
+ Simulation granted({}, {}, ModelMode::Live);
+ const std::string data_error = "managed runtime data root is inaccessible";
+ granted.ShowRootAccessMissing(data_error, true);
+ const auto& data_view = granted.view();
+ check(data_view.title == "Playden can't start", "root access: a data failure after the grant has its own title");
+ check(data_view.subtitle == "Playden has root access but can't use its data in /data/playden. "
+ "Restart Playden; if it stays, check that folder's permissions over FTP.",
+ "root access: the body points at /data/playden");
+ check(data_view.subtitle.find("kstuff") == std::string::npos, "root access: no kstuff advice after the grant");
+ const auto data_detail = std::find_if(data_view.rows.begin(), data_view.rows.end(),
+ [](const auto& row) { return row.key == "root-detail"; });
+ check(data_detail != data_view.rows.end() && data_detail->title == "Startup error: " + data_error,
+ "root access: the data failure keeps its detail line");
+ check(data_view.focused_row >= 0 && data_view.rows[static_cast<std::size_t>(data_view.focused_row)].key == "root-quit",
+ "root access: the data failure keeps Quit to Home");
+ check(!granted.action("connect") && granted.action("cross") && granted.state().quit_requested,
+ "root access: the data failure only quits to Home");
+
+ Simulation fixture({}, {}, ModelMode::Simulation);
+ fixture.ShowRootAccessMissing(error);
+ check(!fixture.state().root_access_missing, "root access: the fixture model ignores it");
+}
+
} // namespace
int main() {
+ live_root_access_missing();
live_download_telemetry();
const auto base = std::filesystem::canonical(std::filesystem::temp_directory_path())
/ ("playden-homebrew-live-model-test-" + std::to_string(getpid()));
diff --git a/tests/native_access_test.cpp b/tests/native_access_test.cpp
index 5bacd76..cf5b911 100644
--- a/tests/native_access_test.cpp
+++ b/tests/native_access_test.cpp
@@ -283,7 +283,7 @@ void InvalidOrMissingStableSourceNeverFallsBackAfterGrant() {
wrong.stable_identity_after_grant = "foreign-package";
NativeAccessBootstrap wrong_bootstrap(Ops(wrong), Options());
const auto mismatched = wrong_bootstrap.Prepare();
- CHECK(!mismatched.launcher_ready && !mismatched.runtime_ready);
+ CHECK(!mismatched.launcher_ready && !mismatched.runtime_ready && mismatched.granted);
CHECK(mismatched.paths.title_root.empty());
CHECK(mismatched.error.find("identity") != std::string::npos);
@@ -455,7 +455,7 @@ void StableTitleWithoutManagedAccessIsNotRuntimeReady() {
const auto result = bootstrap.Prepare();
- CHECK(result.launcher_ready && !result.runtime_ready);
+ CHECK(result.launcher_ready && !result.runtime_ready && !result.granted);
CHECK(result.paths.title_root == kStableRoot);
CHECK(result.error.find("grant") != std::string::npos);
CHECK(fake.grants == 1);
@@ -468,11 +468,21 @@ void PostGrantStableTitleSupportsLauncherWithoutManagedAccess() {
const auto result = bootstrap.Prepare();
- CHECK(result.launcher_ready && !result.runtime_ready);
+ // The grant ran: the screen blames the data, not the grant.
+ CHECK(result.launcher_ready && !result.runtime_ready && result.granted);
CHECK(result.paths.title_root == kStableRoot);
CHECK(result.error.find("runtime data") != std::string::npos);
CHECK(fake.paths.find(kAppRoot) == fake.paths.end());
CHECK(fake.grants == 1);
+
+ // A runtime root that is there but not writable.
+ auto read_only = OrdinaryLauncher();
+ read_only.read_only.insert(kRuntimeRoot);
+ NativeAccessBootstrap read_only_bootstrap(Ops(read_only), Options());
+ const auto unwritable = read_only_bootstrap.Prepare();
+ CHECK(unwritable.launcher_ready && !unwritable.runtime_ready && unwritable.granted);
+ CHECK(unwritable.error.find("inaccessible") != std::string::npos);
+ CHECK(read_only.grants == 1);
}
void WritableManagedParentAllowsFirstRuntimeDirectoryCreation() {