Guys. Everyone I need your undivided attention please. This might be it. This may be the key we have been seeking. However a once wise man said "these aren't the keys you're looking for" A true geek knows the reference. Now serious business.
Ok I did some research. So this Boolean folder is important. In fact this may be the jem we need.
In /system/bin you have two executables getsebool and setsebool. I'm going to explain this as easy as possible.
An*SELinux boolean*is a single string (hopefully sufficiently interpretable) that changes how SELinux reacts. With*getsebool*you can get a list of booleans and their current value. Changing SELinux booleans can be done through*setsebool*(where you add the desired state of the boolean, such as*on*or*off) or*togglesebool*(which flips the current value of a boolean).
Click to expand...
Click to collapse
Let's play a little game. Unfortunately for this to do anything, you need to be root already i think.
Code:
getsebool -a
This will list any booleans set in the SElinux policy and their values (on or off). On the HD 10, there is one boolean present. At the moment, this device is the only one I have run into that has anything set in the booleans. I own about a dozen different devices (phones and tablets) all of them work and are either rooted or boot loader unlocked (only my Moto E4 isnt). Not a single one of them have anything in the booleans in this folder, except for this HD 10. It is wiped clean on every other device. HD 10 boolean:
Code:
$ su
# getsebool -a
device_unlocked --> off
Here's the fun part:
Code:
# setsebool device_unlocked on
# getsebool device_unlocked
device_unlocked --> on
However there is a problem with changing this value, even being root:
When you do this, the changed value will take effect immediately but only for the duration that the current loaded policy is active. That means, if the system reboots, you loose the changes. Or when you explicitly would reload the SELinux policy, you loose the changes. On the other hand, switching booleans this way is fast and helps you to debug problems.
Click to expand...
Click to collapse
There is a way to change this, running a simple command. However I'm certain the bin file or files have been modified and the commands removed from the policy.
Code:
setsebool -P device_unlocked on
In a normal world, the above command would make the value we set persist upon a reboot. So why alter the policy? That doesn't make sense to me. I know as an OEM you can write said policy, but why go through the massive effort if only to leave this boolean in place? Now given this potential massive discovery, what does this now mean? Did I just do what I think I did? Was this really that easy?
I was not able to find the single log entry of the event on my HD 10. However the Fire 7, even with the custom ROM by @ggow, has the same boolean and value. I did the same steps on that tablet and I was able to get the single log entry. Can we get excited and jump...or cry for joy yet? I am totally lost in this neck of the woods.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
References:
https://wiki.gentoo.org/wiki/SELinux/Tutorials/Using_SELinux_booleans
https://www.thegeekdiary.com/understanding-selinux-booleans/
Well this may or may not be anything. A few months ago I discovered a booleans in /sys/fs/selinux/booleans called 'device_unlocked'. You can set the bool, but the value persists to 'off' (of course) when you reboot. In a terminal:
Code:
su
setsebool device_unlocked on
getsebool device_unlocked
on
Reboot and it will be set to 'off'. Well thanks to the su.d shell commands/script I found here on xda, I can now make that persists on reboot. In a terminal:
Code:
su
mount -o remount,rw /system
mkdir /system/su.d
chmod 700 /system/su.d
echo "#!/system/bin/sh" > /system/su.d/unlocked.sh
echo "setsebool device_unlocked on" > /system/su.d/unlocked.sh
echo "on" > /sys/fs/selinux/booleans/device_unlocked
chmod 700 /system/su.d/unlocked.sh
No need to reboot. Now the question is...what is it?
If you have an unlocked tablet now, in a shell do this:
Code:
su
getsebool -a
device_unlocked --> on
it's definitely tied into the unlocking procedure. Because my fire 7 says 'on' and I never set the bool.
Sent from my Amazon KFSUWI using XDA Labs
Related
ok, I've decided to make my own theme, there's a lot of work to do since really I have no so much skills for photoshop and stuff, but this is my first try!!!
for this first release it just have a few changes, the style will be orange themed, for now only this:
Wifi at all states
Battery at normal, charging and unknow state
Unlock halo and Unlock ring are now an orange hexagon (inspired by HC you know)
And I hope daily there will be new changes.
NOTE: I'm not shure how to make an update.zip for our CWM, so, if there is someone can explain how to make one, I will be grateful.
For now just unrar rar file and put framework-res.apk, SystemUI.apk and installtheme.sh on /sdcard
open cmd and type this commands:
adb shell
su
cd /sdcard
sh installtheme.sh
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
looks promising. How would one go about removing this theme?
swampy67 said:
looks promising. How would one go about removing this theme?
Click to expand...
Click to collapse
You mean get back to original theme? Just replace originals apk on sdcard and run installtheme.sh
thanks ill give it a shot
Do you have the wallpaper your using? Anywhere or do I need to find it online?
Here's a wallpaper I modified just took the original honeycomb that is installed made if fire ambe orange. To offset the lockscreen's bright orange.
http://www.mediafire.com/?jpdc7ku7d309b2t
here you have
http://www.flickr.com/photos/azeected/4635280640/sizes/o/
It looks great thanks so much
tab stuck on acer logo after initial reboot
my bad i was using incorrect rom
export PATH=/data/local/bin:$PATH
$ export PATH=/data/local/bin:$PATH
$adb shell
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
error: device not found
$su
# cd/sdcard
cd/sdcard: not found
#
abditerex said:
export PATH=/data/local/bin:$PATH
$ export PATH=/data/local/bin:$PATH
$adb shell
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
error: device not found
$su
# cd/sdcard
cd/sdcard: not found
#
Click to expand...
Click to collapse
looks like adb donĀ“t detect your device (do you have usb-debugging on?)
BTW: the right is "cd(space)/sdcard
I'm hoping to be able to get some feedback and bounce this idea around. I wasn't able to figure out the right terms for a google search with good results even though I spent a while trying.
From an Android application, I want to determine where the busybox binary is installed on the system or data partition. I was hoping for a pure java solution, but I don't think there are any android java APIs for calling the shell PATH variable...
I also wanted to avoid hard coding the common linux binary directories (ex. /system/bin and /system/xbin, etc.)
From a shell perspective, I would usually run busybox find / -name busybox to locate it. Or I'd run busybox which busybox .. none of these are pure Android java solutions.
There are only two ways I'm aware of:
1) Using the linux binary "which". I could compile this for arm (or use the busybox applet) and package this binary into the application, have it extract when the application loads and execute and parse the output. Could do the same with the find linux binary...
2) Use the RootTools method Stericson published - InternalMethods.java. Although his approach uses a root shell to run dd to copy it from /init.rc (permissions usually read only for root) into /data/local/tmp and set it 777 so the android application and parse it for the export PATH line.
EDIT: found another method .. kind of an interesting approach.
http://osdir.com/ml/AndroidDevelopers/2009-03/msg04053.html
ps | grep /system/bin/sh
cat /proc/<pid>/environ
have to parse some of that output, but it seems to work thru adb shell w/o root.
I very well might have overlooked something or missed another approach. Any other ideas or other approaches?
Thanks in advance!
Include busybox with your app, no need to worry about its version
Couldn't you use java.lang.System.getenv()?
http://developer.android.com/reference/java/lang/System.html#getenv(java.lang.String)
doixanh said:
Include busybox with your app, no need to worry about its version
Click to expand...
Click to collapse
lol. unfortunately the scope of my app is only to show the user where their busybox binary is currently located, not provide them with a busybox binary.
Gene Poole said:
Couldn't you use java.lang.System.getenv()?
http://developer.android.com/reference/java/lang/System.html#getenv(java.lang.String)
Click to expand...
Click to collapse
Wow! very interesting. Sad I couldn't find this in all my searching through the android docs.
Two questions after looking over the information I can probably answer through testing, but can't test at the moment. If anybody knows the answer, would be helpful. Otherwise I'll post back when I am able to test.
1) Would the SecurityManager block a 3rd party app from using this call as it might be reserved for only apps signed with platform keys? I can compile and test watching logcat to see if it blocks this call.
2) For the getenv(String name) method, what value should be passed as the string? I can probably bypass this by just running the getenv w/o a string to have it return the Map and sort through the map.
Thanks for the help/suggestions/feedback!
Finally had a chance to test!
Gene Poole said:
Couldn't you use java.lang.System.getenv()?
http://developer.android.com/reference/java/lang/System.html#getenv(java.lang.String)
Click to expand...
Click to collapse
Turns out to be the perfect answer!!
This is the exact command I was looking for:
textBox.setText(System.getenv("PATH"));
Found a great test example for implementing real quick - How do I get Environment Variables?
Here is the output on my EVO 3D:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
i tried system/bin/screenshot, it doesn't work, it make screenshots, but colors are totally messed up
what i tried is:
Code:
adb shell
screenshot /media/001.png
what you obtain is a blueish screenshot, with messed up colors
i would like to use it with cron4phone to make timed screenshots to use with the screensaver, so i can have the page i'm reading as screensaver
any idea how to fix it?
Tried the screenshot app?
apeine said:
Tried the screenshot app?
Click to expand...
Click to collapse
nope, how to launch them from cron4phone?
i use the screenshot
and it work great
chriscsh said:
i use the screenshot
and it work great
Click to expand...
Click to collapse
can you start it from the shell?
no
but you can set the delay time for take a screenshot
I tried
Code:
screenshot /sdcard/001.png
in terminal emulator and it worked for me.
larryflynt said:
I tried
Code:
screenshot /sdcard/001.png
in terminal emulator and it worked for me.
Click to expand...
Click to collapse
which version? (1.0.0, 1.0.1, 1.1)
aren't you getting blueish colors?
May be the emulator windows has easy to render colors, try to take screenshot of the launcher with icons please
Did you know a free screenshot app where you can specific the path to save the file.
It woud be nice to save the screenshot to /media/screensavers/
Try this instead
Code:
/system/bin/screencap -p /outputlocation/out.png
The Nook frame buffer is RGB565.
The emulator framebuffer isn't.
You can always just dump the framebuffer raw and convert it to a PNG externally.
Code:
cat /dev/graphics/fb0 > /sdcard/raw
i tried running it in my app and the image return is blank.
Runtime.getRuntime().exec("/system/bin/screencap -p "+TouchOverlay.getFolder()+ cName + ".jpg");
I ve also tried both bmp and png format with no avail.
Is there anything permission i need set to get the image?
To access the frame buffer you must be a member of the graphics group.
An application runs as a user like "APP_14".
You could add your user to the group manually.
You could hack an existing permission to automatically include your user in the group.
You could add a new permission to automatically include your user in the group.
You could spawn a process to run su.
Renate NST said:
To access the frame buffer you must be a member of the graphics group.
An application runs as a user like "APP_14".
You could add your user to the group manually.
You could hack an existing permission to automatically include your user in the group.
You could add a new permission to automatically include your user in the group.
You could spawn a process to run su.
Click to expand...
Click to collapse
Thanks for the reply!
I would prefer not to use super user but unable to find resources guiding me on adding the permission. Whats the permission called? Couldnt find one that fits your description.
Oops, it's actually easier than I was thinking.
I was thinking of something else.
The permission is just android.permission.SCREENSHOT
What I said before is true for hacking a group like audio.
You can take decent screenshots using Android SDK.
on NST :
- "Nook Color Tools" -> "All Settings" -> "Development" -> USB debugging [X] -> Auto Mount [ ]
- connect nook to your PC with USB cable
- run "ddms" from your Android SDK folder
-select "Device > Screen Capture" (or Ctrl-S) to take a screenshot
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Just saying.
It is kind of a off-topic but I think that a screenshot thread is a good place to post that info.
Mmm.. delicious,
I wish the actual e-ink screen looked this good in reality. Maybe someday.
How to take a proper screenshot from framebuffer with ADB and FFMPEG
Here's what I use:
Code:
% adb pull /dev/graphics/fb0
% ffmpeg -f rawvideo -pix_fmt rgb565 -s 600x800 -i fb0 -frames 1 -vcodec png screenshot.png
The full script that also timestamps the generated files:
Code:
@echo off
set ffmpeg=ffmpeg.exe
set framebuffer_dev=/dev/graphics/fb0
set screenshot_file_name=nook_%date%_%time:~0,2%%time:~3,2%%time:~6,2%
echo BEGIN %~n0
echo Pulling raw framebuffer data from device...
adb pull %framebuffer_dev% %screenshot_file_name%.raw
echo Converting framebuffer to PNG format: %screenshot_file_name%.png
%ffmpeg% -loglevel quiet -f rawvideo -pix_fmt rgb565 -s 600x800 -i %screenshot_file_name%.raw -frames 1 -vcodec png -y %screenshot_file_name%.png
echo Removing raw framebuffer data...
del /f /q %screenshot_file_name%.raw
echo END %~n0
Example output (the automatically-generated filename is nook_2015-03-11_105313.png):
The script is attached, along with another one that will remove all the previously-generated screenshots. To work it needs ADB and FFMPEG (download link).
I use the free app Screenshot Ultimate for all my screenshotting needs. I do take quite a few - see my profile's "NTG Homescreens" albums for all of the homescreens I've used in the past.
Here's an example of what Screenshot Ultimate can do:
All you need is the empty frame and the aforementioned app to create beauties like this!
If you want something a bit less ultimate you can download nookbits.exe from the signature.
Code:
adb pull /dev/graphics/fb0 raw
nookbits /f /b2 raw snap.png
(/b is optional border)
I've been looking for how to control the LEDs on our blade for quite some time now, and, since I didn't find anything, I decided to try myself and succeeded.
Heres the How-to:
1. Install the Android SDK(Or just ADB)
2. Run "adb shell"
3. Run any of these commands:
Activate Backlight-leds(White): echo 255 > /sys/class/leds/button-backlight/brightness
Deactivate(White) echo 0 > /sys/class/leds/button-backlight/brightness
Activate Red leds: echo 255 > /sys/class/leds/red/brightness
Deactivate echo 0 > /sys/class/leds/red/brightness
Blink: echo 1 > /sys/class/leds/red/blink
echo 0 > /sys/class/leds/red/blink
Activate Green leds: echo 255 > /sys/class/leds/green/brightness
Deactivate echo 0 > /sys/class/leds/green/brightness
Blink: echo 1 > /sys/class/leds/red/blink
echo 0 > /sys/class/leds/red/blink
Just a little tip: If you want to control the green or red led, you have to "deactivate"(Turn off brightness) of the White ones..
yellow is red + green.
wbaw said:
yellow is red + green.
Click to expand...
Click to collapse
Hmm, that makes sense, for some reason i can't get it working, the red led just keeps overriding the green
Edit: The only thing I'm able to make thus far is Orange with Red: 100; Green: 255;
is it possible to run this commands inside an android app or shell script without adb?
frapeti said:
is it possible to run this commands inside an android app or shell script without adb?
Click to expand...
Click to collapse
typically yes. you have to invoke the "sh" command when using an app so that it can also port root permissions to superuser to grant. i am working on that for my thunderbolt. my attempt will be to set the LED to full brightness (beyond the 128 setting that the system allows) and get the LED to stay on for more than the 1 second that it does. YES i am aware that setting my LED to beyond the default max can of all things shorten the life of it. i really dont care about that. i have insurance on my phone anyhow. so if i break it, i pay the copay and presto! new phone.
anyhow, back to the topic at hand...
so, i will get to programming that shell command pretty soon, once i figure out how to integrate and build apps to android... lol. i know how it works in theory, and know linux commands, but its another thing entirely to build something and have it work.
Hello all, need a help solving a problem. I want to switch the back -led on and off. i can access the sys/class/leds/button-backlight and can change the brightness of the variable to "170", the thing is the variable's value is changin, but the LED is not glowing! ,i tried "1" and it has the same response. Lemme post a screenshot indicating my situation here!
My device : Letv Le X509
Status: Rooted
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This screenshot indicates the files that i have within the leds folder.
Since 3 months im having audio problems with my moto g4 plus , when i checked log
its something like
/proc/asound/card---/state failed:no such directory
i posted a thread in another forum and advised to check the proc directory, so using root explorer and on comparison with the xda member's asound directory, i found that the card0 folder in which the state file is there is missing
I got the files and tried to copy paste them using many root browsers
result: permission denied,cant copy..etc
tried pushing through adb, tried asb shell su and then cp command
i can write to almost all directories in the root but not proc
I know that /proc is a directory linked to the kernel where info about all running process is stored
but Pasting the missing file is the only thing that can save my phone, heard that i need a insecure kernel to do that,
Can anyone please help me with this?? i badly need to write to /proc
Can any kernel developer make a insecure kernel with these requirements for stock android 7.0.0 xt1643(Sorry,if i sounded noob)
Have you tried to mount the 'proc' partition?
From a terminal emulator app, type:
# su
# mount -o remount,rw /proc
Whether this display an error message, install BusyBox (i recommend this one) and type:
# su
# busybox mount -o remount,rw /proc
Always without the numeral sign.
moonlightdrive said:
Have you tried to mount the 'proc' partition?
From a terminal emulator app, type:
# su
# mount -o remount,rw /proc
Whether this display an error message, install BusyBox (i recommend this one) and type:
# su
# busybox mount -o remount,rw /proc
Always without the numeral sign.
Click to expand...
Click to collapse
Still, couldnt write to proc.See here
Note: I just checked whether i can write or not using cat and mkdir commands
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Karthik Veenam said:
Since 3 months im having audio problems with my moto g4 plus , when i checked log
its something like
/proc/asound/card---/state failed:no such directory
i posted a thread in another forum and advised to check the proc directory, so using root explorer and on comparison with the xda member's asound directory, i found that the card0 folder in which the state file is there is missing
I got the files and tried to copy paste them using many root browsers
result: permission denied,cant copy..etc
tried pushing through adb, tried asb shell su and then cp command
i can write to almost all directories in the root but not proc
I know that /proc is a directory linked to the kernel where info about all running process is stored
but Pasting the missing file is the only thing that can save my phone, heard that i need a insecure kernel to do that,
Can anyone please help me with this?? i badly need to write to /proc
Can any kernel developer make a insecure kernel with these requirements for stock android 7.0.0 xt1643(Sorry,if i sounded noob)
Click to expand...
Click to collapse
did you found the solution to the audio problem,
the same problem happened to me too.
dot know what to do.
Moto G4 audio not working
Moto G4 audio not working (works after reboot for 2mins and audio goes off)...suddenly my mobile rebooted and after that no audio is playing
Tried hard reset changed custom roms ,stock ROM 6.0 and nougat
Still issues not solved
Tried lot of ways but not working
Please anybody share the method to solve the issue (I have been trying for 2 weeks )
Please help!!