MuntashirAkon/AppManager · error · java.io.IOException

settings_ssaid.xml is inaccessible.

Error message

settings_ssaid.xml is inaccessible.

What it means

IOException thrown by the SsaidSettings(userId) constructor when the settings_ssaid.xml file for the given user exists (or is expected) but cannot be read (ssaidLocation.canRead() is false). The class needs to parse this file to manage SSAIDs, so it refuses to construct with an inaccessible source.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/ssaid/SsaidSettings.java:49

import io.github.muntashirakon.AppManager.compat.PackageManagerCompat;
import io.github.muntashirakon.AppManager.misc.OsEnvironment;
import io.github.muntashirakon.AppManager.utils.PackageUtils;
import io.github.muntashirakon.io.Path;

@RequiresApi(Build.VERSION_CODES.O)
public class SsaidSettings {
    public static final String SSAID_USER_KEY = "userkey";

    @SuppressWarnings("FieldCanBeLocal")
    private final Object mLock = new Object();
    private final SettingsState mSettingsState;

    @WorkerThread
    public SsaidSettings(@UserIdInt int userId) throws IOException {
        Path ssaidLocation = OsEnvironment.getUserSystemDirectory(userId)
                .findFile("settings_ssaid.xml");
        if (!ssaidLocation.canRead()) {
            throw new IOException("settings_ssaid.xml is inaccessible.");
        }
        mSettingsState = init(ssaidLocation, userId);
    }

    @VisibleForTesting
    public SsaidSettings(Path ssaidLocation, @UserIdInt int userId) throws IOException {
        mSettingsState = init(ssaidLocation, userId);
    }

    @NonNull
    private SettingsState init(Path ssaidLocation, @UserIdInt int userId) throws IOException {
        int ssaidKey = SettingsStateV26.makeKey(SettingsState.SETTINGS_TYPE_SSAID, userId);
        try {
            return new SettingsStateV26(mLock, ssaidLocation, ssaidKey,
                    SettingsState.MAX_BYTES_PER_APP_PACKAGE_UNLIMITED);
        } catch (IllegalStateException e) {
            throw new IOException(e);
        }

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Ensure the app has the required privileges (root or appropriate system permissions) for the target user's directory
  2. Verify the file exists and is readable: adb shell ls -lZ /data/system/users/<id>/settings_ssaid.xml and correct permissions/SELinux context if needed
  3. Confirm the correct userId is passed (getUserId(uid)) — pointing at the wrong user yields a missing file
  4. Catch IOException in the caller and skip SSAID operations for that user with a clear user-facing message

Example fix

// before
SsaidSettings ssaidSettings = new SsaidSettings(userId); // throws if unreadable
// after
SsaidSettings ssaidSettings;
try {
    ssaidSettings = new SsaidSettings(userId);
} catch (IOException e) {
    Log.w(TAG, "settings_ssaid.xml unreadable for user " + userId, e);
    return; // degrade gracefully
}
Defensive patterns

Strategy: try-catch

Validate before calling

Path ssaid = OsEnvironment.getUserSystemDirectory(userId).findFile("settings_ssaid.xml");
if (ssaid == null || !ssaid.canRead()) {
    throw new FileNotFoundException("settings_ssaid.xml not readable for user " + userId);
}

Type guard

boolean canReadSsaid(int userId) {
    Path p = OsEnvironment.getUserSystemDirectory(userId).findFile("settings_ssaid.xml");
    return p != null && p.canRead();
}

Try / catch

try {
    settings = new SsaidSettings(userId);
} catch (IOException e) {
    Log.w(TAG, "settings_ssaid.xml inaccessible for user " + userId, e);
    return; // skip SSAID feature for this user
}

Prevention

When it happens

Trigger: Constructing SsaidSettings for a userId whose user system directory has no readable settings_ssaid.xml — the file is absent, or the process lacks read permission/SELinux access to /data/system/users/<uid>/settings_ssaid.xml; also when the path lookup returns a non-readable entry.

Common situations: Running without sufficient privileges (non-root, missing WRITE_SECURE_SETTINGS-adjacent access); targeting a work profile/secondary user whose directory isn't accessible; file ownership reset after an OTA or failed backup restore.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/25502a383e5c5760. Report an issue: GitHub.