{"record":{"id":"b8256868ccc82ddb","repo":"asLody/VirtualApp","slug":"who-are-you","errorCode":null,"errorMessage":"Who are you?","messagePattern":"Who are you\\?","errorType":"exception","errorClass":"SecurityException","httpStatus":null,"severity":"error","filePath":"VirtualApp/lib/src/main/java/com/lody/virtual/server/am/VActivityManagerService.java","lineNumber":240,"sourceCode":"            while (iterator.hasNext()) {\n                ServiceRecord r = iterator.next();\n                if (r.process != null && r.process.pid == record.pid) {\n                    iterator.remove();\n                }\n            }\n            mMainStack.processDied(record);\n        }\n    }\n\n\n    @Override\n    public IBinder acquireProviderClient(int userId, ProviderInfo info) {\n        ProcessRecord callerApp;\n        synchronized (mPidsSelfLocked) {\n            callerApp = findProcessLocked(getCallingPid());\n        }\n        if (callerApp == null) {\n            throw new SecurityException(\"Who are you?\");\n        }\n        String processName = info.processName;\n        ProcessRecord r;\n        synchronized (this) {\n            r = startProcessIfNeedLocked(processName, userId, info.packageName);\n        }\n        if (r != null && r.client.asBinder().isBinderAlive()) {\n            try {\n                return r.client.acquireProviderClient(info);\n            } catch (RemoteException e) {\n                e.printStackTrace();\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public ComponentName getCallingActivity(int userId, IBinder token) {","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/asLody/VirtualApp/blob/666fefcb5d3f39cc944001c3457c38ffd6544c87/VirtualApp/lib/src/main/java/com/lody/virtual/server/am/VActivityManagerService.java#L222-L258","documentation":"acquireProviderClient() resolves the calling process via VActivityManagerService's mPidsSelfLocked map. If findProcessLocked(getCallingPid()) returns null, the caller is not a process VirtualApp spawned or recorded, and it throws SecurityException(\"Who are you?\") to reject untrusted/unregistered callers.","triggerScenarios":"A process whose PID is not in VActivityManagerService's process table requests a provider client: the call is made from a process not launched through VirtualApp (e.g. an outside app binding the service directly), the ProcessRecord was removed (process killed/restarted) before acquireProviderClient ran, or the provider request races with process startup.","commonSituations":"ContentProvider access from a newly forked app process before VActivityManager registered it; multi-process apps where a secondary process was started natively (not via VirtualApp); timing issues after the virtual process was killed by the system and re-attached without re-registering.","solutions":["Ensure the caller process is started through VirtualApp's VActivityManager/StubActivity path so its ProcessRecord is registered in mPidsSelfLocked.","Retry after the process has fully initialized; if the process was killed, restart it via the virtual framework before accessing providers.","Verify provider access goes through the in-app ContentResolver (virtualized), not a raw cross-app binder call from an unmanaged process.","Check for races: acquire the provider after ActivityThread/daemon installProvider startup completes, or add the caller record earlier in process setup."],"exampleFix":"// before (raw call from an unregistered process)\nIBinder client = vAms.acquireProviderClient(userId, providerInfo);\n// after (go through the virtualized resolver in the managed process)\nContentResolver resolver = getContext().getContentResolver();\nCursor c = resolver.query(VirtualAppProvider.uriFor(userId, providerInfo), ...);","handlingStrategy":"retry","validationCode":"ProcessRecord rec = VActivityManagerService.get().findProcessLocked(android.os.Process.myPid());\nif (rec == null) {\n    throw new IllegalStateException(\"Process not registered with VirtualApp; cannot acquire provider client\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    IBinder client = vAms.acquireProviderClient(userId, providerInfo);\n} catch (SecurityException e) {\n    if (\"Who are you?\".equals(e.getMessage())) {\n        // caller not registered: re-attach/restart the process via VirtualApp then retry once\n        vAms.startProcessIfNeedLocked(processName, userId, packageName);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Only access virtual providers from processes launched through VirtualApp's StubActivity/daemon path.","Avoid direct binder calls to VActivityManagerService from unmanaged or external apps.","Handle process-death/restart flows so the ProcessRecord is re-registered before provider access.","Watch startup ordering: acquire providers only after the virtual process table is populated."],"tags":["android","security","process-management","virtualapp"],"backgroundTag":"permission-denied","analyzedSha":"666fefcb5d3f39cc944001c3457c38ffd6544c87","analyzedAt":"2026-09-09T11:09:01.694Z","contentChangedAt":"2026-09-09T11:09:01.694Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}