Greetings!
I'm stuck at getting this permission in order to get numbers at notification badges for my app. Even trying to change this permission via adb returns:
HTML:
Operation not allowed: java.lang.SecurityException: Permission com.huawei.android.launcher.permission.READ_SETTINGS is not a changeable permission type
This is where I need this permission:
PHP:
context.getContentResolver().query(Uri.parse("content://com.huawei.android.launcher.settings/badge/"), new String[] { "package", "class", "badgenumber" }, null, null, null);
Could anyone help me find a way to set this permission?
Related
Im trying to find out how i would go about creating or removing system files on an already rooted device from within an app. I have been told this code is relevant, im guessing it wont work in the emulator?
Code:
Process process = Runtime.getRuntime().exec("su");
DataOutputStream outputStream = new DataOutputStream(process.getOutputStream());
DataInputStream inputStream = new DataInputStream(process.getInputStream());
outputStream.writeBytes(command + "\n");
outputStream.flush();
process.waitFor();
}
where command is the variable of the command i want to run.
ive run this with "mkdir /system/test" as the string and nothing was created in the emu
I guess the emulator ain't rooted
When I run the android emulator, using the Android 2.2 - API Level 8, by issuing from cmd emulator -avd test (test being the emulator name) I am not given root access. If I open terminal emulator and issue the SU command i recieve permission denied.
I thought the emulator was meant to run in root access?
I wish someone else would shed some light on this as well. I feel like I have been able to gain access to root, using the su command, but I cant remember as it has been a few months since using the emulator.
I also help someone else will look into this...
Sent from my DROIDX using XDA App
ANy update on this topic?
Hey guys, could anyone fill me in on how to get root in the emulator?
Does anyone knows the answer for this?
I tried chaining the commands, but still not working
Code:
try {
Runtime rt = Runtime.getRuntime();
String[] cmd = { "su", "-c", "ls -l /data/data/"};
Process pcs = rt.exec(cmd); //("ls -l /data/data/");
BufferedReader br = new BufferedReader(new InputStreamReader(pcs
.getInputStream()));
String line = null;
while ((line = br.readLine()) != null) {
Log.e("line","line="+line);
}
br.close();
pcs.waitFor();
int ret = pcs.exitValue();
Log.e("ret","ret="+ret);
} catch (Exception e) {
Log.e("Exception", "Exception", e);
}
I'm trying to find a way to bypass an application that has root a root detection method that looks for superuser.apk, then tries to run "su -c ls" and looks for an exception. Any ideas how to get past this. It gets superuser.apk by doing something similar to this (from what I can tell):
List localList = getPackageManager().getInstalledApplications(0);
int rooted = 0;
for(int i = 0; i < localList.size(); i++)
{
if (((ApplicationInfo)localList.get(i)).publicSourceDir.toLowerCase().contains("superuser.apk"))
{
rooted = 1;
}
}
For the "su -c ls" I think it does something like this:
try
{
Runtime.getRuntime().exec("su -c ls");
rooted = 1;
}
catch (Exception localException)
{
rooted = 0;
}
So, it looks like I basically need to change the name of superuser.apk or block the package manager from seeing it. I've been trying to find where it's getting superuser.apk so I can change the name but I can't find where to do that. For the "su -c ls" I'm not sure how to get by that except for patching su so it won't allow that particular command, any other ideas?
Since both superuser and su are open-source, it could be as simple as recompiling superuser under a different name, and su patched, as you point out.
By that recipe just rename su to something random and create a gscript that runs the newsu and creates an su and superuser.apk when you need them, delete them when you don't.
First moved .
Second as stated above u would need your to make ur own special su binary and superuser apk.
Create you program as needed, have it use su to install your own su binary of a different name then use ur orginal apk as teh new superuser.apk. Then finally unstill original su/superuser.apk.
This is not a great method as you will loose root access for all other applications. But afaik you not going to be able to block the package manager from seeing superuser.apk.
Solved: http://forum.xda-developers.com/showthread.php?p=25140897#post25140897
I got problem when i want to install my first application for firefox os. I just wanted to figure out how is installing apps working. So i coded some test pages and create a manifest file. The problems is when i want to install my app from url (blabla.com/install.html) then the error message pop up "INVALID_MANIFEST". But when i put my manifest in emulator, then works... but if i want to install with install.html then shows error msg.
manifest
Code:
{
"name": "My App",
"description": "This is testing application",
"launch_path": "srpskaitedukacija .org/app/index.html",
"icons": {
"128": "/img/icons/mortar-128.png"
},
"developer": {
"name": "Venom",
"url": "srpskaitedukacija.org"
},
"default_locale": "en"
}
Install.html
Code:
<html>
<body>
<p>Aplikacija</p>
<script>
var manifestUrl = "srpskaitedukacija .org/app/manifest.webapp";
var req = navigator.mozApps.installPackage(manifestUrl);
req.onsucces = function(){
alert(this.result.origin);
};
req.onerror = function(){
alert(this.error.name);
};
</script>
</body>
</html>
by the way i put the line in .htacces for running .webapp
Pls help
I want to use su to launch a command and read its output.
I try this code:
Code:
String line;
Process cat=Runtime.getRuntime().exec("su -c \"cat /etc/media_codecs.xml\"");
BufferedReader catStream= new BufferedReader(new InputStreamReader(cat.getInputStream()));
BufferedReader catSerr= new BufferedReader(new InputStreamReader(cat.getErrorStream()));
cat.waitFor();
while((line=catSerr.readLine())!=null)
{
System.out.println(line);
}
while((line=catStream.readLine())!=null)
{
System.out.println(line);
}
If I manually insert this command in the adb shell it works but with this code the phone ask me for root permission and If I accept I can read only this string to the stderr:
tmp-mksh: cat /etc/media_codecs.xml: not found
And there is not stdout code.
Why?
Thanks,
regards
A993