I am having trouble copying files to the virtual sdcard on the android emulator. I am creating an app that copies the data/data/package folder to the sdcard. This works fine when the app copies its own package but it won't do it for other apps. I have looked into other topics, but I can't seem to give my app super user status.
问题:
回答1:
From Android Developers, Security and Permissions:
A central design point of the Android security architecture is that no application, by default, has permission to perform any operations that would adversely impact other applications, the operating system, or the user. This includes reading or writing the user's private data (such as contacts or e-mails), reading or writing another application's files, performing network access, keeping the device awake, etc.
Moreover,
Because Android sandboxes applications from each other, applications must explicitly share resources and data. They do this by declaring the permissions they need for additional capabilities not provided by the basic sandbox.
So, this answers your question about why you cannot write data from other applications. In order to do what you want, share data between applications, you need to sign the applications with the same signature and request the same sharedUserId
, as it is shown in the above link.
回答2:
you cannot give your app super user status. the only way a phone can access the data folders is by using a rooted phone. Android is designed so that an app cannot modify other apps without permission. It's a security feature.