{"record":{"id":"25502a383e5c5760","repo":"MuntashirAkon/AppManager","slug":"settings-ssaid-xml-is-inaccessible","errorCode":null,"errorMessage":"settings_ssaid.xml is inaccessible.","messagePattern":"settings_ssaid\\.xml is inaccessible\\.","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/ssaid/SsaidSettings.java","lineNumber":49,"sourceCode":"import io.github.muntashirakon.AppManager.compat.PackageManagerCompat;\nimport io.github.muntashirakon.AppManager.misc.OsEnvironment;\nimport io.github.muntashirakon.AppManager.utils.PackageUtils;\nimport io.github.muntashirakon.io.Path;\n\n@RequiresApi(Build.VERSION_CODES.O)\npublic class SsaidSettings {\n    public static final String SSAID_USER_KEY = \"userkey\";\n\n    @SuppressWarnings(\"FieldCanBeLocal\")\n    private final Object mLock = new Object();\n    private final SettingsState mSettingsState;\n\n    @WorkerThread\n    public SsaidSettings(@UserIdInt int userId) throws IOException {\n        Path ssaidLocation = OsEnvironment.getUserSystemDirectory(userId)\n                .findFile(\"settings_ssaid.xml\");\n        if (!ssaidLocation.canRead()) {\n            throw new IOException(\"settings_ssaid.xml is inaccessible.\");\n        }\n        mSettingsState = init(ssaidLocation, userId);\n    }\n\n    @VisibleForTesting\n    public SsaidSettings(Path ssaidLocation, @UserIdInt int userId) throws IOException {\n        mSettingsState = init(ssaidLocation, userId);\n    }\n\n    @NonNull\n    private SettingsState init(Path ssaidLocation, @UserIdInt int userId) throws IOException {\n        int ssaidKey = SettingsStateV26.makeKey(SettingsState.SETTINGS_TYPE_SSAID, userId);\n        try {\n            return new SettingsStateV26(mLock, ssaidLocation, ssaidKey,\n                    SettingsState.MAX_BYTES_PER_APP_PACKAGE_UNLIMITED);\n        } catch (IllegalStateException e) {\n            throw new IOException(e);\n        }","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/ssaid/SsaidSettings.java#L31-L67","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the app has the required privileges (root or appropriate system permissions) for the target user's directory","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","Confirm the correct userId is passed (getUserId(uid)) — pointing at the wrong user yields a missing file","Catch IOException in the caller and skip SSAID operations for that user with a clear user-facing message"],"exampleFix":"// before\nSsaidSettings ssaidSettings = new SsaidSettings(userId); // throws if unreadable\n// after\nSsaidSettings ssaidSettings;\ntry {\n    ssaidSettings = new SsaidSettings(userId);\n} catch (IOException e) {\n    Log.w(TAG, \"settings_ssaid.xml unreadable for user \" + userId, e);\n    return; // degrade gracefully\n}","handlingStrategy":"try-catch","validationCode":"Path ssaid = OsEnvironment.getUserSystemDirectory(userId).findFile(\"settings_ssaid.xml\");\nif (ssaid == null || !ssaid.canRead()) {\n    throw new FileNotFoundException(\"settings_ssaid.xml not readable for user \" + userId);\n}","typeGuard":"boolean canReadSsaid(int userId) {\n    Path p = OsEnvironment.getUserSystemDirectory(userId).findFile(\"settings_ssaid.xml\");\n    return p != null && p.canRead();\n}","tryCatchPattern":"try {\n    settings = new SsaidSettings(userId);\n} catch (IOException e) {\n    Log.w(TAG, \"settings_ssaid.xml inaccessible for user \" + userId, e);\n    return; // skip SSAID feature for this user\n}","preventionTips":["Check root/permission prerequisites before constructing SsaidSettings","Verify the userId resolves to an existing user directory","Check file SELinux context after OTAs or restores","Gate SSAID UI behind an accessibility probe of the file"],"tags":["android","permissions","file-io","ssaid"],"backgroundTag":"file-read-failed","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}