public void addNewLine(String newLine,String type){
try {
log = new File(Environment.getDataDirectory
(),"logger");
if(!log.exists())
log.createNewFile();
logTmp = File.createTempFile("logger", ".tmp",
Environment.getDataDirectory());
fis = new FileInputStream(log);
isr = new InputStreamReader(fis);
br = new BufferedReader(isr);
fos = new FileOutputStream(logTmp);
ps = new PrintStream(fos);
String line = br.readLine();
while(line != null){
ps.println(line);
line = br.readLine();
}
//Line of send Message
if(type.equals("sms"))
ps.println("Invio di un messaggio al numero: " + newLine);
log.delete();
logTmp.renameTo(log);
br.close();
isr.close();
fis.close();
ps.close();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
I compiled the android source and when run the emulator, in the logcat
i have this error:
java.io.IOException: Parent directory of file is not writable
Why this error and what's the solution?
Thanks
Nothing ideas????
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.
Nothing ideas????
thanks in advance
On 27 Gen, 19:06, Dianne Hackborn <hack...@android.com> wrote:
> It looks like you are trying to write a file to /data/data, but only the
> system uid has permission to do that.
>
> Also... please be extremely careful about doing whatever it is you are
> doing. You are making the framework generate various files under the feet
> of whatever application is using it. You could easily leave trash files
> around that never get cleaned up (for example if your process gets kill
> while this code is running).
>
> > android-platfo...@googlegroups.com<android-platform%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-platform?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer
I do not know how to get the system uid privileges.
I have modified PackageManagerService.java and in this class i'm able
to
create,read and write the file while in the SmsManager.java i'm not
able, why??
It is possible for a service in framework level to get the system uid
privileges?
What is the mechanism that rules this privileges?
What is the level at which my own service can obtain this privileges?
On Jan 28, 3:00 pm, Dianne Hackborn <hack...@android.com> wrote:
> On Thu, Jan 28, 2010 at 1:38 AM, Ben Linus <fabriziomazzar...@gmail.com>wrote:
>
> > I do not know how to get the system uid privileges.
>
> You can't. You are modifying framework library code that runs in each
> application's process, under their own UID.
>
> > I have modified PackageManagerService.java and in this class i'm able
> > to
> > create,read and write the file while in the SmsManager.java i'm not
> > able, why??
>
> The package manager service runs in the system process, as the system uid,
> and the system is the only thing that can modify those directories.
>
> > It is possible for a service in framework level to get the system uid
> > privileges?
>
> Absolutely positively not.
>
> > What is the mechanism that rules this privileges?
>
> Basic security as perhttp://developer.android.com/guide/topics/security/security.html
>
> > What is the level at which my own service can obtain this privileges?
>
> You need to have code running in the system process.
>
> --
> Dianne Hackborn
> Android framework engineer
That is all just under the assumption that he wants to be strictly
limited to working through android. There is also the option of using
native binaries setuid as system user... However, it is likely not to
go over well as a submission to AOSP unless it can be PROVEN safe and
valuable -- which is EXTREMELY difficult since setuid binaries bring
with them the risk of privilege escalation vulnerabilities.