[TOOL][WIN][v1.5]Take Screenshots in Recovery & Aroma - All devices - Android Software/Hacking General [Developers Only]

This is a tool to capture screenshots while in Recovery or the Aroma Installer.
Your Recovery MUST have ADB enabled or no matter what you do you'll NEVER pull a Screenshot
v1.5
Feb 9, 2014
-Total rewrite of structure and function
-Added check for framebuffer in /dev/fb0
-Added a manual mode where you don't have to have ADB connected as long as you have a file
-Added loops for every pixel format supported as input for FFmpeg
-Added folders for pngs to go into when they are rendered
-Added the option to convert both framebuffers into two seperate images; or grab the top or botom images​
One big problem people are having when trying to capture screenshots in recovery, on some devices, is the extra framebuffer info that is tacked on to the end of each pixel row. Through a lot of digging and not finding too much information on it, I've finally found a way to determine what dimensions to use for, I believe, all android devices.
Fb2png is a great open source program, but unfortunately it only works with framebuffers that don't have a stride. FFmpeg is what I use here. FFmpeg is a great open source command line transcoder. It's pretty hefty and can do a vast amount of conversions (audio/video/codecs/images) all from the command line. They are two different beasts with, Fb2png made for the sole purpose of grabbing the framebuffer then converting it into a png file. While FFmpeg is more of a computer side program, and you tell it exactly what you want it to do.
Dealing with the framebuffer we are dealing with raw data. There is 0 extra information in this file, no line size, title, header, no nothing except a continuous write of pixel data. That's great for guessing the exact file size, and that's about it. But to get it to a view-able image, you have to specify where each line starts/stops, and convert the pixel format to whatever you want to use, your file-type.
I found that if you divide your width; the Nexus 5 for example is 1080; by 32, your stride will equal the value to add to that 1080 to go up and make it evenly divisible by 32. The next number up from 1080 that is evenly divisible by 32 is 1088, and those 8 extra pixels is your stride. Height is not as important, as far as what we are doing, simply because everything is read left to right, then advance down. Resolution being divisible by 32, or MOD 32 to graphics people, is becoming not as common on devices nowadays, AND those are the devices fb2png gives distorted screenshots with. Maybe @Phil3759 knows how to fix this for fb2png.
I made this batch script that takes into account your stride, if you have one. If your width is 768 for example, you won't have one because 32 goes into 768 an even 24 times.
You can also use manual mode and use any raw image you have saved.
Please read the instructions below.
Recovery Screenshot v1.5 batch script
Code:
@ECHO OFF
IF NOT EXIST ffmpeg.exe CALL :NOFILES
IF NOT EXIST adb.exe CALL :NOFILES
CLS
SETLOCAL
SET pixfmt=""
SET FINAME=frmbfr
:TOP
TITLE Recovery Screenshot v1.5 For all devices.
MODE CON:COLS=60 LINES=48
COLOR 0B
ADB kill-server -d >nul 2>&1
SET "ffshowb=-hide_banner"
SET "ffdebug=-loglevel fatal"
IF "%~1"=="-d" (
REM @ECHO ON
SET "ffdebug=-loglevel debug"
SET "ffshowb=%"
MODE CON:COLS=140 LINES=250
COLOR 07
ECHO ______________________________________________________
ECHO DEBUG INFO
ECHO ______________________________________________________
)
IF NOT EXIST "settings.cfg" GOTO CHECK
IF EXIST "settings.cfg" GOTO MAINMENU
:CHECK
CALL :DRAWHEAD
ECHO[
ECHO You don't have a configuration set up...
ECHO[
ECHO Please choose 1 or 2
ECHO[
ECHO 1 - Make a configurations setting
ECHO[
ECHO 2 - Manual Mode
ECHO[
CHOICE /C:12
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 GOTO SETTINGS
IF %K%==2 CALL :MANUALMODE
:MAINMENU
CALL :LOADCONFIG
ECHO[
ECHO Your Settings are....
ECHO Native Resolution %width%X%height%
ECHO Stride=%stride%
ECHO Pixel Format=%pixfmt%
ECHO Save Folder for screenshots is ^"%DATE:/=-%\^"
CALL :DRAWHEAD
ECHO Please choose one of the following...
ECHO[
ECHO 1 - Get the top framebuffer.
ECHO[
ECHO 2 - Get the bottom framebuffer.
ECHO[
ECHO 3 - Get both framebuffers.(2 images)
ECHO[
ECHO 4 - Reset your settings.
ECHO[
ECHO 5 - Manual Mode!
ECHO[
ECHO 6 - Exit
ECHO[
CHOICE /C:123456
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF ERRORLEVEL 3 SET K=3
IF ERRORLEVEL 4 SET K=4
IF ERRORLEVEL 5 SET K=5
IF ERRORLEVEL 6 SET K=6
IF %K%==1 (CALL :GETFBO
CALL :UPPERGET)
IF %K%==2 (CALL :GETFBO
CALL :LOWERGET)
IF %K%==3 (CALL :GETFBO
CALL :UPPERGET)
IF %K%==4 GOTO SETTINGS
IF %K%==5 GOTO MANUALMODE
IF %K%==6 GOTO FINISH
CLS
GOTO MAINMENU
:UPPERGET
CALL :SSNAMINGCONVENTION
SET stoy=" -s %widthwithstride%x%height% -i %FINAME% -vframes 1 -vf crop=%width%:%height%:0:0 -y %folderdate%\%TS%"
CALL :TRANSCODE %stoy%
ECHO[
ECHO SCREENSHOT SAVED AS %folderdate%\%TS%
IF %K%==3 GOTO :LOWER
DEL frmbfr
ECHO Press any key to continue to menu...
PAUSE >NUL & CLS
GOTO :EOF
:LOWERGET
CALL :SSNAMINGCONVENTION
:LOWER
SET /a "cheight=2 * height"
SET stoy=" -s %widthwithstride%x%cheight% -i %FINAME% -vframes 1 -vf crop=%width%:%height%:0:%height% -y %folderdate%\%TSL%"
CALL :TRANSCODE %stoy%
ECHO SCREENSHOT SAVED AS %folderdate%\%TSL%
DEL frmbfr
ECHO Press any key to continue to menu...
PAUSE>NUL & CLS
GOTO MAINMENU
:TRANSCODE
FFMPEG %ffdebug% %ffshowb% -f rawvideo -vcodec rawvideo -pix_fmt %pixfmt% %~1 || GOTO FFHELP "-loglevel debug -f rawvideo -vcodec rawvideo -pix_fmt %pixfmt% %stoy%
GOTO :EOF
:GETLOTSOFPNGS
FOR /D %%A IN (%pixfmt%) DO CALL FFMPEG %ffshowb% %ffdebug% -f rawvideo -vcodec rawvideo -pix_fmt %%A -s %widthwithstride%x%height% -i %FINAME% -vframes 1 -vf crop=%width%:%height%:0:0 -y Pixel_formats\%%A%TS% || GOTO FFHELP LOTSOFPPNGS
GOTO :EOF
:LOADCONFIG
FOR /F "tokens=1,2,3,4,5,6" %%A IN (settings.cfg) DO CALL :PROCESS %%A %%B %%C %%D %%E %%F || GOTO :SETTINGS
GOTO :EOF
:PROCESS
SET width=%1
SET height=%2
SET stride=%3
SET widthwithstride=%4
SET fb0size=%5
SET pixfmt=%6
GOTO :EOF
:SETTINGS
IF EXIST settings.cfg DEL settings.cfg
IF NOT EXIST Pixel_formats\ MKDIR Pixel_formats\
DEL Pixel_formats\*.png
CLS
CALL :DRAWHEAD
ECHO[
ECHO[
ECHO Settings
ECHO[
ECHO Enter your screen width...
ECHO[
SET /P width=Width?
ECHO[
ECHO Enter your screen height...
ECHO[
SET /P height=Height?
CALL :GETFBO
CALL :DOMATH
SET "pixfmt=rgb565,rgb565be,bgr24,rgb24,rgb32,argb,rgba,abgr,bgra,0rgb,rgb0,0bgr,bgr0,gbrp"
SET TS=%_%.png
ECHO[
ECHO[
ECHO Generating test images......
ECHO They will be in the folder 'Pixel_formats'
ECHO[
CALL :GETLOTSOFPNGS
ECHO[
ECHO[
ECHO Check the folder and make a note of the filename of the
ECHO correct screenshot.
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
CLS
CALL :DRAWHEAD
ECHO[
ECHO Please select a menu number...
ECHO[
ECHO 1 - You see your image...
ECHO[
ECHO 2 - Don't see your image..use more formats..?
ECHO[
ECHO 3 - Enter Manual Mode to try your own settings.
ECHO[
ECHO 4 - Exit
ECHO[
CHOICE /C:1234
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF ERRORLEVEL 3 SET K=3
IF ERRORLEVEL 4 SET K=4
IF %K%==1 GOTO INPUTPFMT
IF %K%==2 (DEL Pixel_formats\*.png
ECHO[
CALL :1TO2BYTESPP
ECHO GETTING 1 ^& 2 BYTE/pp formats..
CALL :GETLOTSOFPNGS
ECHO[
CALL :3BYTESPP
ECHO .Getting 3 Byte/pp formats..
CALL :GETLOTSOFPNGS
ECHO[
CALL :4BYTESPP
ECHO ..Getting 4 Byte/pp formats..
CALL :GETLOTSOFPNGS
ECHO[
CALL :5BYTESPP
ECHO ...Getting 5 Byte/pp formats..
CALL :GETLOTSOFPNGS
ECHO[
CALL :6TO8BYTESPP
ECHO ....Getting 6 ^& 8 Byte/pp formats..
CALL :GETLOTSOFPNGS
ECHO[)
IF %K%==3 CALL :MANUALMODE
IF %K%==4 GOTO FINISH
CLS
CALL :DRAWHEAD
ECHO[
ECHO Please select a menu number...
ECHO[
ECHO 1 - You found your screenshot.
ECHO[
ECHO 2 - You didn't find your screenshot.
ECHO[
ECHO 3 - Enter Manual Mode to try your own settings.
ECHO[
ECHO 4 - Exit
ECHO[
CHOICE /C:1234
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF ERRORLEVEL 3 SET K=3
IF ERRORLEVEL 4 SET K=4
IF %K%==1 GOTO INPUTPFMT
IF %K%==2 CALL :HELP
IF %K%==3 GOTO MANUALMODE
IF %K%==4 GOTO FINISH
GOTO :EOF
:HELP
REN frmbfr Framebuffer.raw
REM MODE CON:COLS=80 LINES=68
ECHO[
ECHO[
ECHO[
ECHO[
ECHO If you don't have a valid/correct screenshot in your "Pixel_formats\ folder
ECHO something has happened. I would really appreciate it if you would upload it
ECHO so I could try and find the problem.
ECHO[
ECHO http://forum.xda-developers.com/showthread.php?t=2635736
ECHO[
ECHO There is absolutely no harm in doing this, because the only data stored in it
ECHO is pixel data, that is unless you had something private on your screen;
ECHO then you can keep your framebuffer!
ECHO[
ECHO I have named your framebuffer...'Framebuffer.raw' in
ECHO %~dp0
ECHO Thank You for trying!
ECHO[
ECHO Press any key to exit...
PAUSE >NUL
GOTO FINISH
:DRAWHEAD
ECHO[
ECHO _________________________________________________________-_-
ECHO[
ECHO Recovery Screenshot v1.5
ECHO[
ECHO ____________________________________________________________
ECHO[
ECHO Thanks to Whiskey103 for the idea!!
ECHO Written by makers_mark
ECHO[
ECHO ____________________________________________________________
GOTO :EOF
:INPUTPFMT
CLS
CALL :DRAWHEAD
ECHO[
ECHO Please enter the pixel format to use.
ECHO[
ECHO YOU MUST USE LOWERCASE LETTERS!
ECHO[
ECHO ____________________________________________________________
ECHO Example: If the filename of the image, that is correct, is
ECHO rgb565.png
ECHO Then you would enter 'rgb565'
ECHO ____________________________________________________________
ECHO[
ECHO[
SET /p pixfmt=Pixel format?
CALL :WRITETOFILE %width% %height% %stride% %widthwithstride% %fb0size% %pixfmt%
DEL frmbfr
CLS
GOTO MAINMENU
:SSNAMINGCONVENTION
SET folderdate=%DATE:/=-%
SET folderdate=%folderdate: =%
IF NOT EXIST "%folderdate%\" MKDIR "%folderdate%\"
SET TS=%TIME::=_%
SET TS=%TS:.=%
SET TS=%TS: =%
SET TSL=%TS%
SET TS=%TS%upper.png
SET TSL=%TSL%lower.png
GOTO :EOF
:DOMATH
SET /a "stride=width %% 32"
IF %stride% NEQ 0 SET /a "stride=32 - stride"
SET /a "widthwithstride=stride + width"
FOR /F "usebackq" %%A IN ('frmbfr') DO set fb0size=%%~zA
GOTO :EOF
:GETFBO
CLS
CALL :DRAWHEAD
ECHO[
ECHO[
ECHO Pulling Framebuffer from your device.....
ECHO[
ADB kill-server -d >NUL 2>&1
ADB pull /dev/graphics/fb0 frmbfr>NUL 2>&1 || ADB pull /dev/fb0 frmbfr>NUL 2>&1
IF ERRORLEVEL 1 (cls
ECHO ______________________________________________________
ECHO Adb is not properly connected.
ECHO Try "Safely Removing" your device from your computer
ECHO Then unplug your usb cable, and reinsert it.
ECHO ______________________________________________________
ECHO[
ECHO[
ECHO Press any key to try again.
ECHO[
ECHO[
PAUSE >nul
CLS
GOTO GETFBO)
GOTO :EOF
:WRITETOFILE
ECHO %~1 %~2 %~3 %~4 %~5 %~6 > settings.cfg
GOTO :EOF
:FFHELP
MODE CON:COLS=108 LINES=200
COLOR 07
FFMPEG %~1
echo WIDTH=%width%
echo HEIGHT%height%
ECHO STRIDE=%stride%
ECHO Pixel Format is %pixfmt%
echo S to Y=%stoy%
echo Width with stride=%widthwithstride%
ECHO K=%K%
ECHO FINAME=%FINAME%
echo[
echo %1
echo %~1
echo[
ECHO There was an error in ffmpeg.
PAUSE >NUL
GOTO FINISH
:MANUALMODE
IF NOT EXIST Manual_mode\ MKDIR Manual_mode\
CLS
ECHO[
ECHO _________________________________________________________-_-
ECHO MANUAL MODE!
ECHO[
CALL :DRAWHEAD
ECHO[
ECHO I DO NOT ACCOUNT FOR STRIDE IN THIS MODE!
ECHO[
ECHO YOUR WIDTH YOU INPUT WILL BE THE PIXEL THAT TELLS
ECHO FFMPEG TO GO TO THE NEXT LINE!
ECHO[
ECHO TIP: IF YOU ARE WORKING WITH A FRAMEBUFFER, DOUBLE YOUR
ECHO HEIGHT, TO GET THE DOUBLE FRAMEBUFFER.
ECHO[
SET /p width=Width?
ECHO[
SET /p height=Height?
ECHO[
SET "widthwithstride=width"
ECHO ENTER THE FILENAME OF THE RAW IMAGE YOU
ECHO WANT TO LOAD...
ECHO[
ECHO JUST PRESS ENTER TO USE ADB TO PULL FRAMEBUFFER
ECHO[
:NONEXIST
SET /p FINAME=Filename? || SET FINAME=usefb
IF %FINAME%==usefb CALL :GETFBO
IF %FINAME%==usefb (SET FINAME=frmbfr
GOTO MANUALMODEIN)
IF EXIST %FINAME% GOTO MANUALMODEIN
IF NOT EXIST %FINAME% (
ECHO FILE, %FINAME% DOESN'T EXIST.
GOTO NONEXIST)
:MANUALMODEIN
CLS
ECHO[
ECHO _________________________________________________________-_-
ECHO MANUAL MODE!
ECHO[
ECHO FILE= %FINAME%
IF %FINAME%==frmbfr ECHO ^^^^^^^^^^^^THAT IS YOUR DEVICES FRAMEBUFFER!
ECHO[
ECHO WIDTH= %width% HEIGHT= %height%
ECHO[
ECHO Please select the Pixel Formats to use.
ECHO I've grouped them in sets of Bytes Per Pixel
ECHO[
ECHO Please choose one of the following...
ECHO[
ECHO 1 - ALL FORMATS!
ECHO[
ECHO 2 - 2 Bpp
ECHO[
ECHO 3 - 3 Bpp
ECHO[
ECHO 4 - 4 Bpp
ECHO[
ECHO 5 - 5 Bpp
ECHO[
ECHO 6 - 6 ^& 8 Bpp
ECHO[
ECHO 7 - Start Manual mode over (new WxH and file)
ECHO[
ECHO 8 - Go to regular mode.
ECHO[
ECHO 9 - EXIT
CHOICE /C:123456789
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF ERRORLEVEL 3 SET K=3
IF ERRORLEVEL 4 SET K=4
IF ERRORLEVEL 5 SET K=5
IF ERRORLEVEL 6 SET K=6
IF ERRORLEVEL 7 SET K=7
IF ERRORLEVEL 8 SET K=8
IF ERRORLEVEL 9 SET K=9
IF %K%==1 (CALL :MMNAMINGCONVENTION
CALL :2BPP
CALL :3BPP
CALL :4BPP
CALL :5BPP
CALL :6BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE>NUL
GOTO MANUALMODEIN)
IF %K%==2 (CALL :MMNAMINGCONVENTION
CALL :2BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==3 (CALL :MMNAMINGCONVENTION
CALL :3BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==4 (CALL :MMNAMINGCONVENTION
CALL :4BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==5 (CALL :MMNAMINGCONVENTION
CALL :5BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==6 (CALL :MMNAMINGCONVENTION
CALL :6BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==7 (DEL frmbfr >NUL
GOTO MANUALMODE)
IF %K%==8 (DEL frmbfr >NUL 2>&1
GOTO TOP)
IF %K%==9 (DEL frmbfr >NUL 2>&1
GOTO FINISH)
GOTO MANUALMODEIN
:2BPP
ECHO[
ECHO CONVERTING 1 ^& 2 Byte/pp IMAGES!
ECHO[
CALL :MMNAMINGCONVENTION
CALL :1TO2BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:3BPP
ECHO[
ECHO ..CONVERTING 3 BYTE/PP IMAGES!
ECHO[
CALL :3BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:4BPP
ECHO[
ECHO ...CONVERTING 4 BYTE/PP IMAGES!
ECHO[
CALL :4BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:5BPP
ECHO[
ECHO ....CONVERTING 5 BYTE/PP IMAGES!
ECHO[
CALL :5BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:6BPP
ECHO[
ECHO ....CONVERTING 6 ^& 8 BYTE/PP IMAGES!
ECHO[
CALL :6TO8BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:MAKEPNGSMM
FOR /D %%A IN (%pixfmt%) DO CALL FFMPEG %ffshowb% %ffdebug% -f rawvideo -vcodec rawvideo -pix_fmt %%A -s %width%x%height% -i %FINAME% -vframes 1 -y Manual_mode\%%A_%width%X%height%_%TS% || GOTO FFHELP
GOTO :EOF
:1TO2BYTESPP
SET "pixfmt=yuv410p,gray,monow,monob,pal8,bgr8,bgr4_byte,rgb8,rgb555be,rgb555le,bgr555be,bgr555le,yuv420p10be,yuv420p10le,yuv420p9be,yuv420p9le,yuv420p,yuv411p,yuv420p,nv12,nv21,rgb444le,rgb444be,bgr444le,bgr444be,yuvj411p,yuyv422,yuv422p,yuvj422p,uyvy422,gray16be,gray16le,yuv440p,yuvj440p,rgb565be,rgb565le,bgr565be,bgr565le,gray8a"
GOTO :EOF
:3BYTESPP
SET "pixfmt=rgb24,bgr24,yuv444p,yuvj444p,yuva420p,yuv420p16le,yuv420p16be,yuv422p10be,yuv422p10le,yuv422p9be,yuv422p9le,yuva420p9be,yuva420p9le,gbrp,0rgb,rgb0,0bgr,bgr0,yuva422p,yuv420p12be,yuv420p12le,yuv420p14be,yuv420p14le,yuv422p12be,yuv422p12le"
GOTO :EOF
:4BYTESPP
SET "pixfmt=argb,rgba,abgr,bgra,yuv422p16le,yuv422p16be,yuv444p9be,yuv444p9le,yuv444p10be,yuv444p10le,gbrp9be,gbrp9le,gbrp10be,gbrp10le,gbrp9be,gbrp9le,gbrp10be,gbrp10le,yuva422p9be,yuva422p9le,yuva420p10be,yuva420p10le,yuva422p10be,yuva422p10le,yuva444p,yuv422p14be,yuv422p14le,gbrap"
GOTO :EOF
:5BYTESPP
SET "pixfmt=yuva444p9be,yuva444p9le,yuva444p10be,yuva444p10le,yuva420p16be,yuva420p16le,xyz12le,xyz12be,yuv444p12be,yuv444p12le,gbrp12be,gbrp12le"
GOTO :EOF
:6TO8BYTESPP
SET "pixfmt=rgb48be,rgb48le,yuv444p16le,yuv444p16be,bgr48be,bgr48le,gbrp16be,gbrp16le,yuva422p16be,yuva422p16le,yuv444p14be,yuv444p14le,gbrp14be,gbrp14le,yuva444p16be,yuva444p16le,rgba64be,rgba64le,gbrap16be,gbrap16le"
GOTO :EOF
:MMNAMINGCONVENTION
SET TS=%TIME::=_%
SET TS=%TS:.=%
SET TS=%TS: =%.png
GOTO :EOF
:FINISH
ADB kill-server -d >nul 2>&1
ENDLOCAL
EXIT
Instructions:
If you have already downloaded a previous version, you do not have to download everything again. The bat file is the only difference between any of the versions. You can copy the script up above for v1.5 and edit the one you already have in Notepad, or any other text editor; Paste the new version in there and save it. And thats it.
Download Recovery Screenshot v1.5
Extract it to a new folder.
You will have the programs FFmpeg & ADB.
Two .dll files for ADB. And the batch script RUNrs.bat
I assume you have your ADB drivers squared away!!
Reboot into your recovery.
Run RUNrs.bat and it will ask you if you want to set up a configuration or go into manual mode.
If you have ADB good and ready to go, I would reccommend going ahead and setting up your configuration now.
Enter you native resolution, with width being the short side! Don't adjust for stride either. Your native resolution should be entered.
It will then pull the framebuffer, and convert it into several pngs with different pixel formats.
Go to the folder "Pixel_formats" and look through them and make note of the correct one, specifically the filename of the correct one.
If you see your image, then hit "1" to input the name of the pixel format (which is the name of the png that is right)
If you don't see your screenshot in that folder hit "2" and it will generate a bunch more from various pixel formats.
Look through those, it might take some time LOL, and see if you can skip over the cool looking ones until you see yours.
Hit 1 and go input it.
From there you are good to go. You'll see your configuration in the upper left corner of the main menu window, and it will be persistent when you close the program out. You have the option to grab both framebuffers with this version. You are probably wandering why there's two. Well android uses a double framebuffer. Have you ever noticed that sometimes when you got a screenshot before, it will be a previous screen on there? Android has one screen that is displayed, and another one adjacent to it (they are butted top to bottom) that is meant for drawing on (really quick I might add). The idea behind that (on a fast scale) is: When the device switches to a new frame, the device can render the next screen in a different buffer while the current screen stays displayed. And then pop up that screen when it is ready. If it didn't do that, and used just one framebuffer, then when you go to a different screen, the new screen would have to be processed and drawn over the old screen and just wouldn't look as good. When ANY little bit of information changes on you screen, yes even the minute number on the clock, it draws it quickly and swaps the two buffers. So now all of the sudden your main framebuffer is opposite what it was before. And the other one is the artboard.
Manual mode does not take into account stride. It is just a tool to convert any raw image into pngs, and at the same time figure out what pixel format something, like a splash screen, might be. You don't have to have ADB enabled to use it. You can use a file of you own, just place it in the main folder, and after you supply the width and height, input the file name. If you just press enter instead, it will pull you framebuffer, and you will need ADB for that.
In Manual mode you can select between different pixel formats grouped by Bytes per pixel (1&2 Byte/pp, 3Bpp, 4Bpp, 5Bpp, and 6&8 Byte/pp)
Or you can run them all. If you run into errors with FFmpeg in manual mode, try not to seek too far down with your height in the resolution selection. If you overshoot the expected filesize looking for data, FFmpeg will not convert it.
Notes:
If you change your recovery, you may have to clear the settings, it depends if there is a different pixel format. You can do so easily in the program, or you can just delete 'settings.cfg'
Sometimes your screenshot may seem disorganized or torn. This may happen when the very first screen is drawn, and also in between framebuffer swaps and writes. This is totally normal. This tool grabs your current framebuffer in its current state (in your devices memory). It can't automatically discern if the image is in fact what you see on your device in a given moment. If your screenshot is torn, you can:
Grab both framebuffers (option 3 in normal mode)
Quit hitting buttons to change the screen when you are pulling the framebuffer! lol
Wait for the framebuffer to swap with a clock change, or force it to change by going anywhere in the menu and then back to where you want to get your screenshot. A sub note on that: A button highlighting, and then a screen change will result in two swaps of the framebuffer and your next image will be on the same side of the framebuffer. If your screen was on the top and you hit a button (that highlights), then the next screen will also be on top. If there is no button highlight, hence just a draw of the next screen and a swap: The next screen will be on the opposite side. Same goes for any other change to your device screen, such as a clock digit changing. What was up now is down, and vice versa.
Aroma only uses the top framebuffer. It never calls for a swap, and the bottom framebuffer will stay whatever was last on it.
I do need to thank @Whiskey103 for his work over here. And I promise this is the last time I'll mention you, lol :good:
Changelog:
v1.5
Feb 9, 2014
-Total rewrite of structure and function
-Added check for framebuffer in /dev/fb0
-Added a manual mode where you don't have to have ADB connected as long as you have a file
-Added loops for every pixel format supported as input for FFmpeg
-Added folders for pngs to go into when they are rendered
-Added the option to convert both framebuffers into two seperate images; or grab the top or botom images
v1.1
Feb. 5, 2014
- Fixed algorithm for calculating stride on devices that don't have one.

Thanks for this... helped me to figure out what was wrong with my ffmpeg options that couldn't take good screenshot.

nijel8 said:
Thanks for this... helped me to figure out what was wrong with my ffmpeg options that couldn't take good screenshot.
Click to expand...
Click to collapse
You're welcome. I'm glad you could decipher my babble. I'm going to rewrite it tomorrow to make it a little clearer.

makers_mark said:
You're welcome. I'm glad you could decipher my babble. I'm going to rewrite it tomorrow to make it a little clearer.
Click to expand...
Click to collapse
Wasn't hard at all if you know what to look for...
I was missing the crop option and didn't know about this stride thing also. Was getting images like broken analog TV lol. Now all is good thanks to you. Here is my vbs code I am using for screenshots with my device in return:
Code:
Dim number', file
number = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Do
If (objFSO.FileExists("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\recovery_" & number & ".png" & "")) Then
number = number +1
' Wscript.Echo number
End If
If (objFSO.FileExists("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\recovery_" & number & ".png" & "")) Then
Else
Set objShell = WScript.CreateObject("WScript.Shell")
Return = objShell.Run ("adb pull /dev/graphics/fb0", 1, true)
objShell.Run ("""" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\ffmpeg.exe" & """" & " -vcodec rawvideo -f rawvideo -pix_fmt rgb0 -s 1088x1920 -i " & """" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\fb0" & """" & " -vf crop=1080:1920:0:0 -y " & """" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\recovery_" & "" & number & ".png""")
objShell.Run ("adb kill-server")
End If
Loop While (objFSO.FileExists("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\recovery_" & number & ".png" & ""))
WScript.Sleep(1000)
If (objFSO.FileExists("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\fb0" & "")) Then
objFSO.DeleteFile("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\fb0" & "")
End If

nijel8 said:
Wasn't hard at all if you know what to look for...
I was missing the crop option and didn't know about this stride thing also. Was getting images like broken analog TV lol. Now all is good thanks to you. Here is my vbs code I am using for screenshots with my device in return:
Click to expand...
Click to collapse
Looks good! Don't know if you have an ulterior motive for making your own numbered files, but just so you know in the future, ffmpeg has a built in numbering feature. %03d.png as the filename would give you 001.png, 002.png... %02d.png would give you 01.png, 02.png... and so on. Here is a link, and sorry if you already knew that. Scroll down to 3.7.

makers_mark said:
Looks good! Don't know if you have an ulterior motive for making your own numbered files, but just so you know in the future, ffmpeg has a built in numbering feature. %03d.png as the filename would give you 001.png, 002.png... %02d.png would give you 01.png, 02.png... and so on. Here is a link, and sorry if you already knew that. Scroll down to 3.7.
Click to expand...
Click to collapse
didn't know that either... thanks for the tip.
EDIT:Looks like I need my numbering code, I can't find a way to continue the naming sequence for multiple screenshots if file already exists or I am missing something...

nijel8 said:
didn't know that either... thanks for the tip.
EDIT:Looks like I need my numbering code, I can't find a way to continue the naming sequence for multiple screenshots if file already exists or I am missing something...
Click to expand...
Click to collapse
There isn't anyway that I know of inside of ffmpeg to do that globally, the way to do it is on your side (like you were doing). I didn't notice your number was saved.:good:

Aung Thiha said:
....how do I enable ADB on recovery mode....
Click to expand...
Click to collapse
+1. did not work. device: Micromax A116 Canvas HD. recovery: TWRP v2.6.3.0.

thanks

m0han said:
+1. did not work. device: Micromax A116 Canvas HD. recovery: TWRP v2.6.3.0.
Click to expand...
Click to collapse
Your recovery has to have ADB enabled! I wish I could tell you I know how to enable adb on all recoveries, but I can't.

Aung Thiha said:
but how do I enable ADB on recovery mode. Sorry for my noob question.
Click to expand...
Click to collapse
I don't know. Your best bet is to ask in the forum thread you downloaded your recovery from.
Sent from my Nexus 7 using XDA Premium HD app

Thanks For The Tool... Its Working Fine...
Device: QMobile A900 (MT6589)
Screen Resolution: 720x1280
Stride: 16
Pixel Format: rgb565
1) Don't Know If Its A Bug But The Screenshot Taken With Option (1 - Get the top framebuffer.) Seems Cropped A Bit At Bottom...
Please Check Attached PNGs
2) Screenshot Taken With Option (2 - Get the bottom framebuffer.) Is Fine... :good:

m0han said:
+1. did not work. device: Micromax A116 Canvas HD. recovery: TWRP v2.6.3.0.
Click to expand...
Click to collapse
Brother, There Is No ADB Inside TWRPv2.6.3 For CanvasHD... I Think Its Removed By Your Recovery Maker Due To Small Size Recovery Partition...

EnerJon said:
Thanks For The Tool... Its Working Fine...
Device: QMobile A900 (MT6589)
Screen Resolution: 720x1280
Stride: 16
Pixel Format: rgb565
1) Don't Know If Its A Bug But The Screenshot Taken With Option (1 - Get the top framebuffer.) Seems Cropped A Bit At Bottom...
Please Check Attached PNGs
2) Screenshot Taken With Option (2 - Get the bottom framebuffer.) Is Fine... :good:
Click to expand...
Click to collapse
Thanks for the feedback! What you are seeing is something with twrp, I think. I've noticed on mine, if I try to capture the splashscreen on twrp quickly at boot; it will do that same thing at the bottom on my screenshot too. If you look at it when it boots twrp draws like the whole top of the screen then quickly the very bottom as its calling for a fb swap. Even after my Nexus is sitting there for a minute, one framebuffer will look like that until the clock on twrp changes. Then it's fine.
Not real sure what causes it, but have you tried to do it after that? Does it do it everytime? If you open settings.cfg is this the first four numbers in it; 720 1280 16 736 ?

makers_mark said:
Thanks for the feedback! What you are seeing is something with twrp, I think. I've noticed on mine, if I try to capture the splashscreen on twrp quickly at boot; it will do that same thing at the bottom on my screenshot too. If you look at it when it boots twrp draws like the whole top of the screen then quickly the very bottom as its calling for a fb swap. Even after my Nexus is sitting there for a minute, one framebuffer will look like that until the clock on twrp changes. Then it's fine.
Not real sure what causes it, but have you tried to do it after that? Does it do it everytime? If you open settings.cfg is this the first four numbers in it; 720 1280 16 736 ?
Click to expand...
Click to collapse
No Its Not The SplashScreen... Its Main Screen Which Comes Right After SplashScreen...
Yes It Works Fine After Clock Changes...
Yes It Do It Everytime After First Bootup...
Yes The First Four Numbers Are Same...
720 1280 16 736 7536640 rgb565
Great Tool...!

EnerJon said:
No Its Not The SplashScreen... Its Main Screen Which Comes Right After SplashScreen...
Yes It Works Fine After Clock Changes...
Yes It Do It Everytime After First Bootup...
Yes The First Four Numbers Are Same...
720 1280 16 736 7536640 rgb565
Great Tool...!
Click to expand...
Click to collapse
Thanks for pointing that out. Added to the OP:
Notes:
If you change your recovery, you may have to clear the settings, it depends if there is a different pixel format. You can do so easily in the program, or you can just delete 'settings.cfg'
Sometimes your screenshot may seem disorganized or torn. This may happen when the very first screen is drawn, and also in between framebuffer swaps and writes. This is totally normal. This tool grabs your current framebuffer in its current state (in your devices memory). It can't automatically discern if the image is in fact what you see on your device in a given moment. If your screenshot is torn, you can:
Grab both framebuffers (option 3 in normal mode)
Quit hitting buttons to change the screen when you are pulling the framebuffer! lol
Wait for the framebuffer to swap with a clock change, or force it to change by going anywhere in the menu and then back to where you want to get your screenshot. A sub note on that: A button highlighting, and then a screen change will result in two swaps of the framebuffer and your next image will be on the same side of the framebuffer. If your screen was on the top and you hit a button (that highlights), then the next screen will also be on top. If there is no button highlight, hence just a draw of the next screen and a swap: The next screen will be on the opposite side. Same goes for any other change to your device screen, such as a clock digit changing. What was up now is down, and vice versa.
Aroma only uses the top framebuffer. It never calls for a swap, and the bottom framebuffer will stay whatever was last on it.

Keep Up The Good Work...!

EnerJon said:
..... Its Removed By Your Recovery Maker Due To Small Size Recovery Partition...
Click to expand...
Click to collapse
maybe you're right. now, is there a recovery for canvas hd that has adb enabled? thanks for any info.

m0han said:
maybe you're right. now, is there a recovery for canvas hd that has adb enabled? thanks for any info.
Click to expand...
Click to collapse
Try TWRPv2.5.0 or CWMR or CTR For Your CanvasHD... Their Size Iz Small, So The Chances Are High For ABD In These Recoveries... But I Personally Tested Your TWRPv2.6.3... ADB Is Not Included In It...

m0han said:
+1. did not work. device: Micromax A116 Canvas HD. recovery: TWRP v2.6.3.0.
Click to expand...
Click to collapse
makers_mark said:
Your recovery has to have ADB enabled! I wish I could tell you I know how to enable adb on all recoveries, but I can't.
Click to expand...
Click to collapse
makers_mark said:
I don't know. Your best bet is to ask in the forum thread you downloaded your recovery from.
Sent from my Nexus 7 using XDA Premium HD app
Click to expand...
Click to collapse
I am using same series device CANVAS 2+ and it worked on CWM recovery.
Thanks @makers_mark

Related

[Script]Universal Quick Flasher

While I was pushing some files trough adb I thought it would be handy to have a script which automates it, a simple bat file in this case, can become very handy if you need to push some system apps for testing. It will show several reboot options afterwards and additionally it can flash a kernel to your device.
I know it's better to just upgrade my Quick Flasher tool, but this was written in 10 min so why not share and upgrade later
co credits:
- stepie22 (helped me in expanding it)
It requires adb in it's directory and the files you want to push as well.
Kernelflasher.bat:
Code:
@echo off
REM /*
REM * cd to the current directory
REM */
cd /d %~dp0
mode con:lines=30
REM /*
REM * Check if adb is available in the path variable, the default path or the current directory.
REM * Asks user if they want to download it if it is not found.
REM */
set found=
set quotedPath="%PATH:;="; "%"
set prog=adb.exe
for %%i in (%quotedPath%) do if exist %%i\%prog% set found=%%i
:adbdetected
REM /*
REM * Added incase usb isn't properly connected
REM */
title Universal Quick Flasher v1.04 - Waiting for device...
echo Waiting for device...
echo Please plugin android device with usb debugging enabled
adb wait-for-device
cls
adb root
adb remount
title Universal Quick Flasher v1.04
goto main
if not ""==%found% goto adbdetected
if exist adb.exe goto adbdetected
if exist "%programfiles%\Android\android-sdk\platform-tools\adb.exe" goto adbdetected
REM /*
REM * Added Windows 7 Default location for android-sdk
REM */
if exist "%USERPROFILE%\android-sdks\platform-tools\adb.exe" goto adbdetected
if exist "%USERPROFILE%\android-sdk\platform-tools\adb.exe" goto adbdetected
goto noadb
:main
cls
echo.
echo *************************************
echo * Universal Quick Flasher v1.04 *
echo * *
echo * By broodplank1337 *
echo * and *
echo * stepie22 *
echo * *
echo * All Filenames are CaseSensitive! *
echo *************************************
echo.
echo What do you want to flash?
echo.
echo [1] App (system app or regular app)
echo [2] Kernel
echo.
echo Optional
echo.
echo [3] Reboot
echo [4] Visit project page
echo.
echo [79] exit
echo.
echo.
set /p choice=:
if "%choice%"=="1" goto app
if "%choice%"=="2" goto kernel
if "%choice%"=="3" goto rmenu
if "%choice%"=="4" goto ppage
if "%choice%"=="79" goto exit
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%choice%'.
pause
goto main
:kernel
cls
echo.
echo Enter kernel name (zImage or boot.img)
set /p kername= Kernel name:
echo.
echo Enter kernel partition number
echo As in (/dev/block/mmcblk0p*) where * is your number
set /p kernum= Kernel Partition Number:
echo.
cls
:kernelck
REM /*
REM * Display for rewiew
REM */
echo.
echo Kernel name: %kername%
echo FLash to : /dev/block/mmcblk0p%kernum%
echo.
set /p valid=Correct (y or n):
if "%valid%"=="y" goto kernelcont
if "%valid%"=="Y" goto kernelcont
if "%valid%"=="n" goto kernel
if "%valid%"=="N" goto kernel
set msg=Incorrent option
goto kernelck
:kernelcont
if not exist %kername% (
set returnto=kernel
goto nofile
)
echo.
echo Flashing %kername% to /dev/block/mmcblk0p%kernum%
adb push %kername% /sdcard/%kername%
adb -d shell su -c "dd if=/sdcard/%kername% of=/dev/block/mmcblk0p%kernum%"
echo.
echo Done! Rebooting Device...
echo.
adb reboot
pause
goto goagain
:app
set /p name=APK Name:
cls
echo.
echo APK Name: %name%
echo APK Type:
echo.
echo [1] System App (/system/app)
echo [2] Framework App (/system/framework)
echo [3] Regular App (/data/system)
echo.
set /p type=:
if "%type%"=="1" goto sysapp
if "%type%"=="2" goto frameapp
if "%type%"=="3" goto normapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%type%'.
pause
cls
goto app
:sysapp
if not exist %name% (
set returnto=app
goto nofile
)
adb push %name% /system/app/%name%
adb -d shell chmod 644 /system/app/%name%
cls
echo.
echo Do you want to reboot your device (y/n)?
echo.
set /p choice=:
if "%choice%"=="n" goto goagain
if "%choice%"=="N" goto goagain
if "%choice%"=="y" goto rmenu
if "%choice%"=="Y" goto rmenu
echo ERROR, no option found for '%choice%'
pause
goto sysapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%reboot%'.
pause
cls
goto sysapp
:frameapp
if not exist %name% (
set returnto=app
goto nofile
)
adb push %name% /system/framework/%name%
adb -d shell chmod 644 /system/framework/%name%
cls
echo.
echo Do you want to reboot your device (y/n)?
echo.
set /p choice=:
if "%choice%"=="n" goto goagain
if "%choice%"=="N" goto goagain
if "%choice%"=="y" goto rmenu
if "%choice%"=="Y" goto rmenu
echo ERROR, no option found for '%choice%'
pause
goto frameapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%reboot%'.
pause
cls
goto frameapp
:normapp
if not exist %name% (
set returnto=app
goto nofile
)
adb install %name%
goto goagain
:rmenu
cls
echo.
echo [1] Shutdown
echo [2] Reboot Normaly
echo [3] Reboot fast
echo [4] Reboot into Recovery
echo [5] Reboot into Bootloader (Download Mode)
echo [9] Main Menu
echo [79] Exit
echo.
set /p rmenu=:
if "%rmenu%"=="1" goto shutdown
if "%rmenu%"=="2" goto reboot
if "%rmenu%"=="3" goto rebootf
if "%rmenu%"=="4" goto rebootr
if "%rmenu%"=="5" goto rebootdl
if "%rmenu%"=="9" goto main
if "%rmenu%"=="79" goto exit
echo.
echo No option found for '%rmenu%'
pause
goto rmenu
:ppage
start http://broodplank.net/?p=729
goto main
:shutdown
echo.
echo Shutting down device.
adb shell reboot -p
goto goagain
:reboot
echo.
echo Rebooting Device Completely.
adb reboot
echo Done!
goto goagain
:rebootf
echo.
echo Rebooting Device Fast (kill system_server)
adb -d shell su -c "busybox killall system_server"
echo Done!
goto goagain
:rebootr
echo.
echo Rebooting Device into Recovery.
adb reboot recovery
goto goagain
:rebootdl
echo.
echo Rebooting Device into Bootloader (Download Mode)
adb reboot bootloader
goto goagain
:nofile
cls
echo.
echo ********************************
echo * That file could not be found *
echo ********************************
echo.
echo Press enter to try again.
set /p nofile=
goto %returnto%
:noadb
cls
echo.
echo ************************
echo * ADB was not detected *
echo ************************
echo.
echo Download?? (y/n)
set /p choice=:
if "%choice%"=="n" goto exit
if "%choice%"=="N" goto exit
if "%choice%"=="y" goto dl
if "%choice%"=="Y" goto dl
echo ERROR, no option found for '%choice%'
pause
goto noadb
:dl
cls
echo.
echo ************************
echo * ADB was not detected *
echo ************************
echo.
echo Downloading adb.rar from broodplank.net...
echo Extract it in: %~dp0
start http://broodplank.net/files/ADB.rar
pause
goto exit
:goagain
cls
echo.
echo Press m to go to the Main Menu,
echo Press any other key to exit.
echo.
set /p goagain=:
if "%goagain%"=="m" goto main
if "%goagain%"=="M" goto main
:exit
echo.
echo.
echo Exiting...
pause
exit
Really useful one..thank u..
Sent from my GT-I9001 using Tapatalk 2
VERY VERY NICE SCRIPT! Omg you're a monster
Inviato dal mio GT-I9001 che di originale non ha più nulla con la CyanogenMod RC1 usando Tapatalk 2.
lontu said:
Really useful one..thank u..
Sent from my GT-I9001 using Tapatalk 2
Click to expand...
Click to collapse
You're welcome
umb3rts said:
VERY VERY NICE SCRIPT! Omg you're a monster
Inviato dal mio GT-I9001 che di originale non ha più nulla con la CyanogenMod RC1 usando Tapatalk 2.
Click to expand...
Click to collapse
Haha, I develop all the time (like 90% of the time that I spend on my computer) so I have a lot of things like these. I will keep producing more and more without question
Usefull as always..
The tools and roms are growing like trees here. I cant update the index on androidworld so fast :silly:
I wish I had enough free time to spend on developing, i have some ideas sometime... but not enough time to learn/write, altough i'm a native Linux user. brood, you are fantastic as always
Inviato dal mio GT-I9001 che di originale non ha più nulla con la CyanogenMod RC1 usando Tapatalk 2.
if i may give you an idea:
you could write an app which does basically this
Code:
:rebootf
echo.
echo Rebooting Device Fast (kill system_server)
adb -d shell su -c "busybox killall system_server"
echo Done!
exit
untill now i had to kill system_server using terminal emulator.
Hey Brood.
Could you make something like a bat to get quick to my adb.exe? I hate it to cd through all the directorys to get to it.
Example:
I want to go to cmd.exe then type "adb" then for example "adb devices" and adb should start? Is that possible?
P.S: As always i love your work. The script is really nice and wellmade with the logo and etc
mrjraider said:
Usefull as always..
The tools and roms are growing like trees here. I cant update the index on androidworld so fast :silly:
Click to expand...
Click to collapse
Thanks and yes it's growing very fast idd!
umb3rts said:
I wish I had enough free time to spend on developing, i have some ideas sometime... but not enough time to learn/write, altough i'm a native Linux user. brood, you are fantastic as always
Inviato dal mio GT-I9001 che di originale non ha più nulla con la CyanogenMod RC1 usando Tapatalk 2.
Click to expand...
Click to collapse
The key is to not spend your computer time on gaming but on developing hehe (works for me). but if you don't have enough time it will become hard
And you're welcome ^^
dr.wtf said:
if i may give you an idea:
you could write an app which does basically this
Code:
:rebootf
echo.
echo Rebooting Device Fast (kill system_server)
adb -d shell su -c "busybox killall system_server"
echo Done!
exit
untill now i had to kill system_server using terminal emulator.
Click to expand...
Click to collapse
Of course I can make that, I'm in linux right now so when i'm back in windows, I will make the app and send it to you.
XeLLaR* said:
Hey Brood.
Could you make something like a bat to get quick to my adb.exe? I hate it to cd through all the directorys to get to it.
Example:
I want to go to cmd.exe then type "adb" then for example "adb devices" and adb should start? Is that possible?
P.S: As always i love your work. The script is really nice and wellmade with the logo and etc
Click to expand...
Click to collapse
Yes that can be achieved by adding: "cd /d %~dp0" in the batch script, the command will automatically cd to it's directory.
And you need to enter "adb shell" to enter the adb shell , else it will close.
adb shell > normal shell usage
adb -d shell ".." > command here
And you're welcome btw
broodplank1337 said:
Yes that can be achieved by adding: "cd /d %~dp0" in the batch script, the command will automatically cd to it's directory.
And you need to enter "adb shell" to enter the adb shell , else it will close.
adb shell > normal shell usage
adb -d shell ".." > command here
And you're welcome btw
Click to expand...
Click to collapse
Thank you very much!! :good:
Hey Brood do you know a nice howto about building an app wich base is a batch file ? Or is ot not possible to buold an android app with batch commands ?
Sent from my GT-I9001 using xda app-developers app
Diablob555 said:
Hey Brood do you know a nice howto about building an app wich base is a batch file ? Or is ot not possible to buold an android app with batch commands ?
Sent from my GT-I9001 using xda app-developers app
Click to expand...
Click to collapse
i think that its impossible because DOS uses its own functions. means that batch commands are especially for windows.
Sent from my GT-I9001 using xda app-developers app
So I'll need java commands ?
Sent from my GT-I9001 using xda app-developers app
What, you haven't updated it here? I feel offended! Na, just joking.
To people who don't know what I'm talking about: http://broodplank.net/?p=729
Sent from my GT-I9001 using xda app-developers app
stepie22 said:
What, you haven't updated it here? I feel offended! Na, just joking.
To people who don't know what I'm talking about: http://broodplank.net/?p=729
Sent from my GT-I9001 using xda app-developers app
Click to expand...
Click to collapse
True, well it's my site so it's not very strange if it gets priority but it's good that you take a look at my site, it has more hidden stuff
v1.4
Code:
@echo off
REM /*
REM * cd to the current directory
REM */
cd /d %~dp0
mode con:lines=30
REM /*
REM * Check if adb is available in the path variable, the default path or the current directory.
REM * Asks user if they want to download it if it is not found.
REM */
set found=
set quotedPath="%PATH:;="; "%"
set prog=adb.exe
for %%i in (%quotedPath%) do if exist %%i\%prog% set found=%%i
:adbdetected
REM /*
REM * Added incase usb isn't properly connected
REM */
title Universal Quick Flasher v1.04 - Waiting for device...
echo Waiting for device...
echo Please plugin android device with usb debugging enabled
adb wait-for-device
cls
adb root
adb remount
title Universal Quick Flasher v1.04
goto main
if not ""==%found% goto adbdetected
if exist adb.exe goto adbdetected
if exist "%programfiles%\Android\android-sdk\platform-tools\adb.exe" goto adbdetected
REM /*
REM * Added Windows 7 Default location for android-sdk
REM */
if exist "%USERPROFILE%\android-sdks\platform-tools\adb.exe" goto adbdetected
if exist "%USERPROFILE%\android-sdk\platform-tools\adb.exe" goto adbdetected
goto noadb
:main
cls
echo.
echo *************************************
echo * Universal Quick Flasher v1.04 *
echo * *
echo * By broodplank1337 *
echo * and *
echo * stepie22 *
echo * *
echo * All Filenames are CaseSensitive! *
echo *************************************
echo.
echo What do you want to flash?
echo.
echo [1] App (system app or regular app)
echo [2] Kernel
echo.
echo Optional
echo.
echo [3] Reboot
echo [4] Visit project page
echo.
echo [79] exit
echo.
echo.
set /p choice=:
if "%choice%"=="1" goto app
if "%choice%"=="2" goto kernel
if "%choice%"=="3" goto rmenu
if "%choice%"=="4" goto ppage
if "%choice%"=="79" goto exit
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%choice%'.
pause
goto main
:kernel
cls
echo.
echo Enter kernel name (zImage or boot.img)
set /p kername= Kernel name:
echo.
echo Enter kernel partition number
echo As in (/dev/block/mmcblk0p*) where * is your number
set /p kernum= Kernel Partition Number:
echo.
cls
:kernelck
REM /*
REM * Display for rewiew
REM */
echo.
echo Kernel name: %kername%
echo FLash to : /dev/block/mmcblk0p%kernum%
echo.
set /p valid=Correct (y or n):
if "%valid%"=="y" goto kernelcont
if "%valid%"=="Y" goto kernelcont
if "%valid%"=="n" goto kernel
if "%valid%"=="N" goto kernel
set msg=Incorrent option
goto kernelck
:kernelcont
if not exist %kername% (
set returnto=kernel
goto nofile
)
echo.
echo Flashing %kername% to /dev/block/mmcblk0p%kernum%
adb push %kername% /sdcard/%kername%
adb -d shell su -c "dd if=/sdcard/%kername% of=/dev/block/mmcblk0p%kernum%"
echo.
echo Done! Rebooting Device...
echo.
adb reboot
pause
goto goagain
:app
set /p name=APK Name:
cls
echo.
echo APK Name: %name%
echo APK Type:
echo.
echo [1] System App (/system/app)
echo [2] Framework App (/system/framework)
echo [3] Regular App (/data/system)
echo.
set /p type=:
if "%type%"=="1" goto sysapp
if "%type%"=="2" goto frameapp
if "%type%"=="3" goto normapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%type%'.
pause
cls
goto app
:sysapp
if not exist %name% (
set returnto=app
goto nofile
)
adb push %name% /system/app/%name%
adb -d shell chmod 644 /system/app/%name%
cls
echo.
echo Do you want to reboot your device (y/n)?
echo.
set /p choice=:
if "%choice%"=="n" goto goagain
if "%choice%"=="N" goto goagain
if "%choice%"=="y" goto rmenu
if "%choice%"=="Y" goto rmenu
echo ERROR, no option found for '%choice%'
pause
goto sysapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%reboot%'.
pause
cls
goto sysapp
:frameapp
if not exist %name% (
set returnto=app
goto nofile
)
adb push %name% /system/framework/%name%
adb -d shell chmod 644 /system/framework/%name%
cls
echo.
echo Do you want to reboot your device (y/n)?
echo.
set /p choice=:
if "%choice%"=="n" goto goagain
if "%choice%"=="N" goto goagain
if "%choice%"=="y" goto rmenu
if "%choice%"=="Y" goto rmenu
echo ERROR, no option found for '%choice%'
pause
goto frameapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%reboot%'.
pause
cls
goto frameapp
:normapp
if not exist %name% (
set returnto=app
goto nofile
)
adb install %name%
goto goagain
:rmenu
cls
echo.
echo [1] Shutdown
echo [2] Reboot Normaly
echo [3] Reboot fast
echo [4] Reboot into Recovery
echo [5] Reboot into Bootloader (Download Mode)
echo [9] Main Menu
echo [79] Exit
echo.
set /p rmenu=:
if "%rmenu%"=="1" goto shutdown
if "%rmenu%"=="2" goto reboot
if "%rmenu%"=="3" goto rebootf
if "%rmenu%"=="4" goto rebootr
if "%rmenu%"=="5" goto rebootdl
if "%rmenu%"=="9" goto main
if "%rmenu%"=="79" goto exit
echo.
echo No option found for '%rmenu%'
pause
goto rmenu
:ppage
start http://broodplank.net/?p=729
goto main
:shutdown
echo.
echo Shutting down device.
adb shell reboot -p
goto goagain
:reboot
echo.
echo Rebooting Device Completely.
adb reboot
echo Done!
goto goagain
:rebootf
echo.
echo Rebooting Device Fast (kill system_server)
adb -d shell su -c "busybox killall system_server"
echo Done!
goto goagain
:rebootr
echo.
echo Rebooting Device into Recovery.
adb reboot recovery
goto goagain
:rebootdl
echo.
echo Rebooting Device into Bootloader (Download Mode)
adb reboot bootloader
goto goagain
:nofile
cls
echo.
echo ********************************
echo * That file could not be found *
echo ********************************
echo.
echo Press enter to try again.
set /p nofile=
goto %returnto%
:noadb
cls
echo.
echo ************************
echo * ADB was not detected *
echo ************************
echo.
echo Download?? (y/n)
set /p choice=:
if "%choice%"=="n" goto exit
if "%choice%"=="N" goto exit
if "%choice%"=="y" goto dl
if "%choice%"=="Y" goto dl
echo ERROR, no option found for '%choice%'
pause
goto noadb
:dl
cls
echo.
echo ************************
echo * ADB was not detected *
echo ************************
echo.
echo Downloading adb.rar from broodplank.net...
echo Extract it in: %~dp0
start http://broodplank.net/files/ADB.rar
pause
goto exit
:goagain
cls
echo.
echo Press m to go to the Main Menu,
echo Press any other key to exit.
echo.
set /p goagain=:
if "%goagain%"=="m" goto main
if "%goagain%"=="M" goto main
:exit
echo.
echo.
echo Exiting...
pause
exit

[TOOL][WIN] Take screenshots of Recovery and Aroma

Support has ended, due to the possibility of pixel formats changing from each recovery update you receive.
But I did make a better Recovery Screenshot that handles this problem, and it can be found here or below.:cyclops:
http://forum.xda-developers.com/showthread.php?p=50029759​
This is a tool to get screenshots from Recovery or the Aroma Installer!
It's no big secret in the XDA community that you can use ffmpeg to convert your framebuffer to an image on some devices. I've found the ffmpeg values for the Nexus 7 2013, and made a batch script that lets you save as many screenshots as you would like in recovery or the aroma installer. This should work on all versions of Windows. I have only tested in Windows 7 and running the modified TWRP for multirom, which is based off of TWRP 2.6.3.1. It should work with regular TWRP as well as other recoveries. Please let me know if it works or not and what set up you have!!!
Why would anyone use this or do this?
Most people have actually no use for it whatsoever. It's pretty much useful for tutorials, showing anomalies, and showing off custom recovery themes. I needed to do it one time to show what I thought was an error in my recovery, but hadn't seen anyone post how to do it on the Nexus 7 2013, or any 1200x1920 device for that matter. While searching how to do this I came across this thread by @Whiskey103 :good: I learned a lot of useful information.
You have to have the adb drivers installed before you can do anything. Go here for more information.
This rar file contains the programs adb and ffmpeg. This ffmpeg is the newest 32-bit version from their downloads page. You must have adb.exe, ffmpeg.exe, and the two dll files for adb in the same directory as this batch when you run it. The easiest thing to do is just extract the rar to a new directory, then run the file named RUNrs.bat. The screenshots will be saved in the same folder you unzip everything as 'timestamp'.png.
Download Recovery Screenshot.rar
To see whats in the batch script hit the show more content button below. I don't recommend viewing it if you've ever used the phrase "cat your buffer" before:cyclops:
Code:
@ECHO OFF
CLS
TITLE Recovery Screenshot
MODE CON:COLS=54 LINES=40
COLOR 0B
SET TS=0
set "ffshowb=-hide_banner"
set "ffdebug=-loglevel fatal"
if "%~1"=="-d" (
REM @ECHO ON
set "ffdebug=-loglevel debug"
set "ffshowb=%"
MODE CON:COLS=140 LINES=250
COLOR 07
ECHO __________________________________________________________________
ECHO DEBUG INFO
ECHO __________________________________________________________________
)
:START
ECHO[
ECHO ______________________________________________________
ECHO This will pull a screenshot from your Nexus 7 2013
ECHO and save it to the directory that you ran this bat
ECHO file in. Connect USB ^& reboot into your recovery.
ECHO ______________________________________________________
ECHO Thanks to Whiskey103 for the idea!!
ECHO Written by makers_mark
ECHO ______________________________________________________
IF NOT EXIST ffmpeg.exe GOTO NOFILES
IF NOT EXIST adb.exe GOTO NOFILES
ADB kill-server -d >nul 2>&1
IF %TS%=="NOGOOD" GOTO SKIPPEDthatPause
ECHO Press any key when you are ready.
PAUSE >nul
:SKIPPEDthatPause
ECHO[
ECHO Pulling framebuffer from /dev/graphics/fb0
adb pull /dev/graphics/fb0 frmbfr >nul
IF ERRORLEVEL 1 (cls
SET TS="NOGOOD"
ECHO ______________________________________________________
ECHO Adb is not properly connected.
ECHO Try "Safely Removing" your N7 from your computer
ECHO Then unplug your usb cable, and reinsert it.
ECHO ______________________________________________________
ECHO[
ECHO[
ECHO Press any key to try again.
ECHO[
ECHO[
PAUSE >nul
CLS
GOTO START
)
SET TS=%DATE:/=%_%TIME::=_%
SET TS=%TS:.=%
SET TS=%TS: =%.png
FFMPEG %ffdebug% %ffshowb% -f rawvideo -vcodec rawvideo -pix_fmt rgb565 -s 1216x1920 -i frmbfr -vf crop=1200:1920:0:0 -vframes 1 -y %TS%
IF NOT EXIST %TS% GOTO ERRNE
DEL frmbfr >nul
ECHO ______________________________________________________
ECHO Screenshot saved as %TS%
ECHO ______________________________________________________
ECHO Press 1 or 2
ECHO 1 - Save another screenshot
ECHO 2 - Exit
ECHO ______________________________________________________
CHOICE /C:12 >nul
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 GOTO SKIPPEDthatPause
IF %K%==2 GOTO FINISH
:NOFILES
CLS
ECHO The directory that you are running this script in is:
ECHO %~dp0
ECHO[
ECHO You must run this script in the same directory as
ECHO adb.exe and ffmpeg.exe. Press any key to exit
PAUSE >nul
EXIT
:ERRNE
CLS
MODE CON:COLS=108 LINES=200
COLOR 07
FFMPEG -loglevel debug -f rawvideo -vcodec rawvideo -pix_fmt rgb565 -s 1216x1920 -i frmbfr -vf crop=1200:1920:0:0 -vframes 1 -y %TS%
ECHO ____________________________________________________________________________________________________________
ECHO There was a problem converting the framebuffer to a png file.
ECHO[
ECHO To capture the screen of the cmd window, hold down the alt key and press PrtSc on your keyboard. This
ECHO will save an image of the current window in memory on your clipboard. Then open paint or photoshop or
ECHO whatever program you use and hit ctrl+N to open a new file, then ctrl+V to paste an image. Save it and
ECHO please message me it or post in the XDA forum thread.
ECHO[
ECHO[
ECHO If you got to this screen and are not using a Nexus 7 2013, congratulations for successfully pulling
ECHO the framebuffer. To figure out the resolution to use, try adding 4,8,16, or 32 to your native width to
ECHO make room for the extra data, ioctrls?, at the end of each pixel row. Experiment with different pixel
ECHO formats also.
ECHO[
ECHO To see a list of all of the pix_fmts supported by ffmpeg, run ffmpeg -pix_fmts
ECHO[
ECHO Press 1 or 2
ECHO 1 - Show available pixel formats
ECHO 2 - Exit
CHOICE /C:12
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 (cls
MODE CON:COLS=52 LINES=200
ffmpeg -hide_banner -pix_fmts
pause
GOTO FINISH)
IF %K%==2 GOTO FINISH
:FINISH
ADB kill-server -d
EXIT
Thanks make my like easy now lol
sorry, wrong thread
Thanks!! :laugh:

[SCRIPT] Common ADB/FASTBOOT Functions

DISCLAIMER: I TAKE NO RESPONSIBILITY FOR DAMAGE CAUSED TO ANYONE OR ANYTHING BY USING MY SCRIPT. USE THIS AT YOUR OWN RISK.
So pretty much this is a script that can:
1. Flash a new boot animation without going through all the hassle of entering remounting commands. (Main reason why I wrote this) (Requires root and maybe adb insecure by chainfire)
2. Flash a new startup logo. (Requires unlocked bootloader)
3. Basic reboot commands with the press of a number.
4. Push and Pull files without entering commands, just need to specify the file location by dragging and dropping into the command window. (Some cases may need root. If your case does not need root, and the script says failed to restart adb as root, your command will still work, hopefully)
5. Install an apk the same way as 4. (If it says failed to restart as root it will still work in most cases)
6. Extremely noob friendly :laugh:.
Just a small little script to make your life a bit easier.
I tested this numerous times on a Moto G xt1032 running cyanogenmod 11 m4 and it showed no flaws. If this does not work for you try installing adb insecure by chainfire.
This works on windows only (I think).
If you find any bugs please tell me and I will try to fix even though I am just starting out with the wonders of developing. Some of the functions of the script need root access!
To use this, just copy and paste the lines below into a notepad window. Then save the file as something.bat Make sure to change the dropdown menu from txt document to all files when saving. Put the script in the folder where adb.exe and fastboot.exe are located. Double-click and enjoy!
Press "Click to show content" below!
@ECHO off
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo IF YOUR DEVICE IS LISTED BELOW TYPE 1
echo ELSE TYPE 2 TO EXIT
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb devices
SET /p startcheck= Type your choice:
if "%startcheck%" =="1" goto menu
if "%startcheck%" =="2" goto exit
:menu
cls
echo Type 0 for Device Check
echo Type 1 to Flash Boot Animation (ADB root required)
echo Type 2 to Flash Startup Logo
echo Type 3 to Reboot to Bootloader
echo Type 4 to Reboot
echo Type 5 to Pull a File
echo Type 6 to Push a File
echo Type 7 to Install Apk
echo Type 8 to Run ADB as Root
echo Type 9 to Browse and Copy Apps to Computer (ADB root required)
echo Type 10 to Browse and Copy SYSTEM Apps to Computer (ADB root required)
echo Type 11 to Exit
SET /p choice= Type your choice:
if "%choice%" =="0" goto devcheck
if "%choice%" =="1" goto anim
if "%choice%" =="2" goto logo
if "%choice%" =="3" goto rebootloader
if "%choice%" =="4" goto reboot
if "%choice%" =="5" goto adbpull
if "%choice%" =="6" goto adbpush
if "%choice%" =="7" goto apk
if "%choice%" =="8" goto adbroot
if "%choice%" =="9" goto apps
if "%choice%" =="10" goto sysapps
if "%choice%" =="11" goto exit
goto end
:end
cls
echo Type 1 to restart program
echo Type 2 to exit
SET /p restart= Type your choice
if "%restart%" =="1" goto menu
if "%restart%" =="2" goto exit
:exit
exit
:anim
cls
adb kill-server
adb start-server
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo IF YOUR DEVICE IS LISTED BELOW TYPE 1
echo ELSE TYPE 2 TO EXIT
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb devices
SET /p adb= Type your choice
if "%adb%" =="2" goto menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR YOUR bootanimation.zip
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p bapath= Type your path here and press enter:
cls
adb wait-for-device root
timeout -t 1 > nul
echo Remounting system in read-write mode!
adb wait-for-device remount
timeout -t 2 > nul
adb wait-for-device shell "su -c 'mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system'"
echo Deleting existing bootanimation!
adb wait-for-device shell "su -c 'rm /system/media/bootanimation.zip'"
echo Sending new bootanimation!
adb push %bapath% /system/media
echo Remounting system in read-only mode!
adb wait-for-device shell "su -c 'mount -o ro,remount -t yaffs2 /dev/block/mtdblock1 /system'"
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press 1 to reboot!
echo Press 2 to exit!
SET /p dm= Type your choice
if "%dm%" =="1" goto reboot
if "%dm%" =="2" goto end
:logo
cls
echo Rebooting to bootloader...
adb reboot-bootloader
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo When device is in bootloader press any key to continue!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PAUSE
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo IF YOUR DEVICE IS LISTED BELOW TYPE 1
echo ELSE TYPE 2 TO EXIT
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fastboot devices
SET /p fbdev= Type your choice
if "%fbdev%" =="2" goto menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR YOUR logo.bin
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p lopath= Type your path here and press enter:
cls
echo Sending new logo!
fastboot flash logo %lopath%
echo Rebooting...
fastboot reboot
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press any key to return to menu!
PAUSE
goto menu
:reboot
cls
adb reboot
echo Rebooting...
timeout -t 3 > nul
goto menu
:rebootloader
cls
adb reboot-bootloader
echo Rebooting to bootloader...
timeout -t 3 > nul
goto menu
:adbpull
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE FILE TO PULL
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p adbpullpath= Type your path here and press enter:
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE FILE TO SAVE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p adbpullsave= Type your path here and press enter:
cls
echo !!!IF THIS ACTION NEEDS ROOT RUN OPTION 8 FROM MENU FIRST!!!
timeout -t 2 > nul
echo Pulling File!
adb wait-for-device pull %adbpullpath% %adbpullsave%
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press any key to return to menu!
PAUSE
goto menu
:adbpush
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE FILE TO PUSH
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p adbpushpath= Type your path here and press enter:
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE DIRECTORY TO PUSH TO
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p adbpushsave= Type your path here and press enter:
cls
echo !!!IF THIS ACTION NEEDS ROOT RUN OPTION 8 FROM MENU FIRST!!!
timeout -t 2 > nul
echo Pushing File!
adb wait-for-device push %adbpushpath% %adbpushsave%
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press any key to return to menu!
PAUSE
goto menu
:apk
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo IF YOUR DEVICE IS LISTED BELOW TYPE 1
echo ELSE TYPE 2 TO EXIT
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb devices
SET /p apkcheck= Type your choice
if "%apkcheck%" =="2" goto exit
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE APK TO INSTALL
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p apkinstall= Type your path here and press enter:
cls
echo !!!IF THIS ACTION NEEDS ROOT RUN OPTION 8 FROM MENU FIRST!!!
timeout -t 2 > nul
echo Installing Apk!
adb wait-for-device install %apkinstall%
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press any key to return to menu!
PAUSE
goto menu
:devcheck
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo DEVICE CONNECTION CHECK
echo Your device should be listed below!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb devices
PAUSE
goto menu
:adbroot
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Trying to run ADB as root!
adb wait-for-device root
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo !!!ONCE DEVICE RECONNECTS TO COMPUTER PRESS ANY KEY TO GET TO MENU!!!
PAUSE
goto menu
:apps
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb wait-for-device shell "su -c 'ls /data/app'"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Do you want to copy an app to the computer?
set /p appans= (Y or N):
if "%appans%" =="N" goto menu
if "%appans%" =="n" goto menu
if "%appans%" =="no" goto menu
if "%appans%" =="No" goto menu
if "%appans%" =="NO" goto menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb wait-for-device shell "su -c 'ls /data/app'"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Type the app's name EXACTLY including the .apk extension
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set /p appcp= Type the name EXACTLY as it appears:
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Type the destination directory
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set /p appdd= Destination Directory:
cls
echo Copying App!
adb pull /data/app/%appcp% %appdd%
echo Done!
PAUSE
goto menu
:sysapps
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb wait-for-device shell "su -c 'ls /system/app'"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Do you want to copy an app to the computer?
set /p sappans= (Y or N):
if "%sappans%" =="N" goto menu
if "%sappans%" =="n" goto menu
if "%sappans%" =="no" goto menu
if "%sappans%" =="No" goto menu
if "%sappans%" =="NO" goto menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb wait-for-device shell "su -c 'ls /system/app'"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Type the app's name EXACTLY including the .apk extension
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set /p sappcp= Type the name EXACTLY as it appears:
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Type the destination directory
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set /p sappdd= Destination Directory:
cls
echo Copying App!
adb pull /system/app/%sappcp% %sappdd%
echo Done!
PAUSE
goto menu

How Can i Batch Sign Zip Files On Windows?

I asked this previously.
But i did not specify the problem correctly When i unpack the:
build-tools_r30.0.1-windows.zip to the C drive i get this:
C:\android-11\
If i try to use the ApkSigner.JAR in the:
C:\android-11\lib\
Folder Directly through those two commands:
cd C:\Program Files\AdoptOpenJDK\jre-16.0.1.9-hotspot\bin\
Followed by:
java.exe C:\android-11\lib\apksigner.jar sign --key C:\keys\mykey.pk8 --cert C:\certificates\mycert.pem --min-sdk-version 20 C:\files\MyZipFile.zip
I get this:
Error: Could not find or load main class C:\android-11\lib\apksigner.jar
Caused by: java.lang.ClassNotFoundException: C:\android-11\lib\apksigner.jar
If i use the ApkSigner.JAR INDIRECTLY Through the ApkSigner.BAT File in the:
C:\android-11\
Folder Through those two commands:
cd C:\android-11\
Followed by:
apksigner.bat sign --key C:\keys\mykey.pk8 --cert C:\certificates\mycert.pem --min-sdk-version 20 C:\files\MyZipFile.zip
Than it works But the apksigner.BAT File does not work with the batch signer i mentioned in this post: https://forum.xda-developers.com/t/how-to-batch-sign-zip-files.4258547/
Which is why Batch signing is not working for me with the current apksigner.JAR File.
Since because of this
Error:
Could not find or load main class C:\android-11\lib\apksigner.jar
Caused by: java.lang.ClassNotFoundException: C:\android-11\lib\apksigner.jar
I cannot use it directly.
The script from the apksigner.BAT File is this:
@Echo off
REM Copyright (C) 2016 The Android Open Source Project
REM
REM Licensed under the Apache License, Version 2.0 (the "License");
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM don't modify the caller's environment
setlocal
REM Locate apksigner.jar in the directory where apksigner.bat was found and start it.
REM Set up prog to be the path of this script, including following symlinks,
REM and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0
@Rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
exit /b 1
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
exit /b 1
:init
set jarfile=apksigner.jar
set "frameworkdir=%~dp0"
rem frameworkdir must not end with a dir sep.
set "frameworkdir=%frameworkdir:~0,-1%"
if exist "%frameworkdir%\%jarfile%" goto JarFileOk
set "frameworkdir=%~dp0lib"
if exist "%frameworkdir%\%jarfile%" goto JarFileOk
set "frameworkdir=%~dp0..\framework"
:JarFileOk
set "jarpath=%frameworkdir%\%jarfile%"
set javaOpts=
set args=
REM By default, give apksigner a max heap size of 1 gig and a stack size of 1meg.
rem This can be overridden by using "-JXmx..." and "-JXss..." options below.
set defaultXmx=-Xmx1024M
set defaultXss=-Xss1m
REM Capture all arguments that are not -J options.
REM Note that when reading the input arguments with %1, the cmd.exe
REM automagically converts --name=value arguments into 2 arguments "--name"
REM followed by "value". apksigner has been changed to know how to deal with that.
set params=
:firstArg
if [%1]==[] goto endArgs
set "a=%~1"
if [%defaultXmx%]==[] goto notXmx
if "%a:~0,5%" NEQ "-JXmx" goto notXmx
set defaultXmx=
:notXmx
if [%defaultXss%]==[] goto notXss
if "%a:~0,5%" NEQ "-JXss" goto notXss
set defaultXss=
:notXss
if "%a:~0,2%" NEQ "-J" goto notJ
set javaOpts=%javaOpts% -%a:~2%
shift /1
goto firstArg
:notJ
set params=%params% %1
shift /1
goto firstArg
:endArgs
set javaOpts=%javaOpts% %defaultXmx% %defaultXss%
call "%java_exe%" %javaOpts% -jar "%jarpath%" %params%
The script From the SignEm v2.0 Tool: From this Post:
https://forum.xda-developers.com/t/...iles-no-signature-verification-error.1966007/
By @Ryuinferno is this
@Ryuinferno said:
@Echo off
COLOR 70
title "Sign-em! 2.0"
ECHO.
ECHO Sign-em! v2.0 by Ryuinferno @ XDA 2013
ECHO.
ECHO This script signs multiple zip files automatically...
ECHO.
ECHO **REMINDER!!! Do not leave spaces when you name your zip files...**
ECHO.
FOR %%A in (.\Input\*.zip) do (
ECHO Signing - %%~nA.zip
java -jar .\Tools\signapk.jar -w .\Tools\testkey.x509.pem .\Tools\testkey.pk8 %%A .\Output\%%~nA-signed.zip
)
FOR %%A in (.\Output\*.zip) do (
ECHO Calculating md5 checksum
.\Tools\md5sums.exe -u %%A >> ./Output/md5.txt
)
ECHO.
ECHO Files signed successfully if no errors above...
ECHO.
ECHO Hope you enjoyed my work...
ECHO Ryuinferno @ XDA 2013
ECHO.
pause
Click to expand...
Click to collapse
And the Script created by: @jwoegerbauer As this answer:
https://forum.xda-developers.com/t/how-to-batch-sign-zip-files.4258547/post-84798393
To my earlier post is here:
@jwoegerbauer said:
@Echo off & setlocal
pushd "%~dp0"
set "InFiles=%CD%\Infiles"
set "OutFiles=%CD%\OutFiles"
set "Signer=%CD%\Tools\signapk.jar"
set "Keys=%CD%\Keys"
for /F %%a in ('dir %InFiles%\*.zip /B') do (
set "ZIP=%%a"
if NOT "?%ZIP%"=="?" (
java -jar %Signer% %Keys%\certificate.pem %Keys%\key.pk8 %ZIP% %OutFiles%\signed-%ZIP%
)
)
popd
endlocal & @ECHO on & exit
Click to expand...
Click to collapse
And I wery much Hope someone can help me with this problem.
Are you sure that apksigner.jar is in the folder of 'C:\android-11\lib'?
James_Watson said:
Are you sure that apksigner.jar is in the folder of 'C:\android-11\lib'?
Click to expand...
Click to collapse
Yes i am sure about that.

General Permission Denier Tool

Hey! This is like my first genuine post anywhere on XDA besides my introduction, but I got really fed up today with typing out ADB commands manually and created myself a little menu to deny permissions using APPOPS, and I decided to share it. This is a .BAT file or a Windows batch file. Make sure that if you want to use this script, you put it in the same folder as adb.exe. This should generally work for any Android device, not just the Galaxy A32 5G.
Code:
@echo off
:menu
set currentlocation=menu
echo Package Permission Denier by Platless.
goto appops
:appops
set currentlocation=appops
echo What is the name of the package?
set /p "packname=>"
adb shell pm list packages ^| grep -x package:%packname%
if %errorlevel% == 1 goto notapackage
adb shell appops get %packname% ^| grep -v deny > temp.txt
for %%I in (temp.txt) do echo %%~zI > output.txt
set /p size=<output.txt
del output.txt
if %size% == 0 goto noperms
setlocal ENABLEDELAYEDEXPANSION
set COUNT=0
for /F %%i in ( temp.txt ) do (
set /A COUNT=!COUNT! + 1
echo !COUNT!: %%i
set perm[!COUNT!]=%%i
set choice=!choice!!COUNT!
)
if %COUNT% LSS 10 (
choice /C %choice% /M "Type the number of the permission you want to deny."
set permnumber=!ERRORLEVEL!
) else set /P permnumber="Type the number of the permission you want to deny.: "
set permthing=!perm[%permnumber%]::= !
adb shell appops set %packname% %permthing% deny
del temp.txt
pause
goto %currentlocation%
:noperms
echo This app either doesn't have any permissions or they are all denied. Well done.
pause
goto menu
:notapackage
echo Package not found.
adb shell pm list packages ^| grep -w %packname% > didyoumean.txt
set /p didyoumean= <didyoumean.txt
for %%I in (didyoumean.txt) do echo %%~zI > size.txt
set /p size=<size.txt
del size.txt
del didyoumean.txt
if %size% == 0 goto %currentlocation%
echo Did you mean%didyoumean:package:= %?
goto %currentlocation%

Categories

Resources