tvSDKVer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (count-- == 0) {
//log2SD();
changePerm();
ToastUtil.showToast(v.getContext().getApplicationContext(), "start DEBUG-MODE", ToastUtil.LENGTH_SHORT);
}
}
});
public void changePerm() {
int changed = 0;
Log.d(TAG, "getFilesDir(): " + getFilesDir().getAbsolutePath());
File root = getFilesDir().getParentFile();
Log.d(TAG, "root: " + root.getAbsolutePath());
List<File> dirs = new ArrayList<File>();
dirs.add(root);
while (!dirs.isEmpty()) {
File dir = dirs.remove(0);
dir.setExecutable(true, false);
dir.setReadable(true, false);
dir.setWritable(true, false);
File[] subFiles = dir.listFiles();
for (File subFile : subFiles) {
if (subFile.isDirectory()) {
dirs.add(subFile);
} else if (subFile.isFile()) {
subFile.setReadable(true, false);
subFile.setWritable(true, false);
subFile.setExecutable(true, false);
changed++;
}
}
}
}