CN107765972A - A kind of android terminal screenshotss method - Google Patents

A kind of android terminal screenshotss method Download PDF

Info

Publication number
CN107765972A
CN107765972A CN201711014352.2A CN201711014352A CN107765972A CN 107765972 A CN107765972 A CN 107765972A CN 201711014352 A CN201711014352 A CN 201711014352A CN 107765972 A CN107765972 A CN 107765972A
Authority
CN
China
Prior art keywords
screenshotss
function
suspended window
button
shell
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201711014352.2A
Other languages
Chinese (zh)
Inventor
肖剑锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
World (beijing) Network Technology Co Ltd
Original Assignee
World (beijing) Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by World (beijing) Network Technology Co Ltd filed Critical World (beijing) Network Technology Co Ltd
Priority to CN201711014352.2A priority Critical patent/CN107765972A/en
Publication of CN107765972A publication Critical patent/CN107765972A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality

Landscapes

  • Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The present invention provides a kind of android terminal screenshotss method, screenshotss are realized instead of long-press system in combination button by the virtual key of definition in Android intelligent terminal screen optional position, the function of realization is showed in the form of the virtual key on suspended window, the optional position of screen can be suspended to, and it may be displayed on almost all of terminal applies interface, thus can realize screenshotss instead of pressing system in combination button by operating virtual key under any circumstance.

Description

A kind of android terminal screenshotss method
Technical field
The invention belongs to intelligent terminal technical field, and in particular to a kind of android terminal screenshotss method.
Background technology
Screenshotss function is one of common function of terminal.The screenshotss mode of operation provided when terminal is dispatched from the factory usually requires simultaneously Long-press two systems button, for example, long-press power key+Home key, either in long-press power key+volume key (or lower key) or Other two systems Macintosh.Intelligent terminal after a particular period of use, easily occur some physical buttons or Virtual key is using failure or insensitive situation, for example, entity power key, entity or system virtualization return key, entity or is Unite virtual Home key etc..Although other aspects of terminal are all also fine, because some system buttons are insensitive or failure Problem, user would have to spend to change button, or even the terminal that purchase is new.In addition, entered using the mode of long-press Macintosh Row screenshotss, operation needs certain skill, two hands to operate together, while pushes button, and operation is not especially square Just.
As described in Figure 1, a kind of method of screenshotss function is disclosed in the prior art, including:When detecting the touch-screen When being touched, the motion state (101) for touching duration, touch area and the mobile terminal is obtained;When the touch duration Immobilize more than preset duration, the touch area, and when the motion state of the mobile terminal meets preparatory condition, open Dynamic screenshotss function.It can be completed without bimanualness one hand when starting screenshotss function by the present invention, make startup screenshotss function Operate more simple and efficient (102).I.e. user is big by the singlehanded region for touching screen block for a long time and fixing, the duration of touch In the default time, and when current mobile terminal is in default motion state, start screenshotss function.
Above-mentioned technical proposal of the prior art has the disadvantage that:
First, the FX touched for a long time is if not the default region of program, but one piece of careless area on screen Domain is possible to the maloperation for causing user, such as, hand holds terminal, a certain piece of fixed area of finger long-time meeting contact screen Domain, it is possible to which the condition of regarding as is met, and this may can cause the maloperation of user;
Second, the motion state of mobile terminal must meet preparatory condition, the motion state of mobile terminal, Ke Nengxu are monitored The various sensors in monitor terminal are wanted, this operating procedure will be very cumbersome;The various sensors of terminal are very more, if Slightly omit, may will cause big bug;
It is that no authority starts screenshotss function, system does not carry third, for common third party application For the interface of opening, this is the compulsory measure that system is for safety done, and only manufacturer terminal oneself can just be accomplished.
The content of the invention
To overcome above-mentioned the deficiencies in the prior art, the invention provides a kind of android terminal screenshotss method.
First need not be with manufacturer terminal cooperation, it is only necessary to terminal Root, fixed without long-time touch terminal Region reaches certain preset time, and without judging which kind of motion state is current terminal be in, it is only necessary to startup is made by oneself One shell-command row performing environment of justice, then under Root environment, call the executable file that carries of execution system Screencap, and (these all occur on backstage the routing information of the picture file of specified generation, are all transparent to user simultaneously ), you can screenshotss are realized, whole process does not need the excessive participation of user.And this functional simulation passes through into a virtual key The mode of suspended window is presented to user, and (benefit of suspended window is can be suspended in the optional position of screen, and user can arbitrarily drag It is dynamic, any number of virtual keys can be placed above suspended window, each button can correspond to any function of our needs, such as certain Individual button can realize return key function, and another button can be with screenshotss function etc.), so as to make user conveniently enter Row operation.The android terminal screenshotss method, comprises the following steps:
S401, beginning, click on suspension button;
S402, expansion suspended window, click on the function button on suspended window;
S403, start a sub-line journey, the realization of screenshotss function is carried out in sub-line journey;
S404, judge terminal whether Root;If it is judged that being no, then perform S405, if it is judged that be it is yes, then Perform S406;
The non-Root of S405, prompt terminal, this function can not be used, continues executing with S4015;
Whether S406, application Root authority, system prompt assign the app authorities, are performed after Root authority application success S408, when Root authority application is unsuccessful, perform S407;
S407, Root authority is not obtained, perform failure, continue executing with S4015;
The filename of the screenshot picture generated after S408, structure screenshotss success;
S409, the performing environment for creating a shell;
S4010, the execute instruction in shell environment;
Whether S4011, decision instruction run succeeded;When judged result is no, step S4012 is performed, works as judged result During to be, step S4013 is performed;
S4012, instruction perform failure, continue executing with S4015;
S4013, the successful animation of screenshotss file generated is performed, while send a Custom Notification column;
S4014, realize screenshotss function;
S4015, exit;Can now select close suspended window, can continue to retain suspended window, continue executing with it is other by Key function.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention, And can be practiced according to the content of specification, below with presently preferred embodiments of the present invention and coordinate accompanying drawing describe in detail as after.
Brief description of the drawings
Fig. 1 shows the method flow diagram for realizing terminal screenshotss in the prior art;
Fig. 2 shows suspension button schematic diagram according to an embodiment of the invention;
Fig. 3 shows suspended window schematic diagram according to an embodiment of the invention;
Fig. 4 shows the method flow diagram according to an embodiment of the invention for realizing screenshotss;
Fig. 5 shows suspension button and suspended window Booting sequence figure according to an embodiment of the invention;
Fig. 6 shows shell environment visioning procedure figure according to an embodiment of the invention.
Embodiment
Further to illustrate the present invention to reach the technological means and effect that predetermined goal of the invention is taken, below in conjunction with Accompanying drawing and preferred embodiment, to according to its embodiment of a kind of android terminal screenshotss method proposed by the present invention, feature and Its effect, describe in detail as after.In the following description, what different " embodiment " or " embodiment " referred to is not necessarily same reality Apply example.In addition, the special characteristic, structure or feature in one or more embodiments can be combined by any suitable form.
Term used in the present invention is as follows:
Android:Chinese is Android, is a kind of freedom based on Linux and the operating system of open source code, leads It is used for mobile device, such as intelligent terminal and tablet personal computer, by Google companies and open terminal alliance leader and develops.
Root authority:Root authority refers to system manager's power of Unix type operating systems (including Linux, Android) Limit, similar to the Administrator (keeper) in Windows systems.Android Root authority can access and change you eventually Almost all of file (android system file and user file, not including ROM) in end.
Executable file:Executable file (executable file) refers to that can carry out loading by operating system holds Capable file.Under different operating system environments, the presentation mode of executable program is different.
shell:Shell is the user interface of system, there is provided user interacts a kind of interface of operation with kernel.It Receive the order of user's input and it is sent into kernel and go to perform.It is a linux command interpreter, and it is explained by user The order of input and they are sent to kernel go to perform.The function and be that the order line process created in the present invention is realized The shell of system is identical, therefore is also named as shell.
Virtual key:Terminal virtual key refers to the virtual button in screen for full touch terminal, utilizes this Button can be directly realized by the function of system button.
In the specific embodiment of the present invention, there is provided one kind is led in Android intelligent terminal screen optional position The method that the virtual key of definition replaces long-press system in combination button to realize screenshotss is crossed, by the function of realization with the void on suspended window The form for intending button is showed, and its benefit is can be suspended to the optional position of screen, and may be displayed on almost institute , thus can be under any circumstance by operating virtual key come instead of pressing system in combination on some terminal applies interfaces Button realizes screenshotss.We provide a suspension button first, such as the suspension button in red circle in Fig. 2, can be suspended into screen Optional position, and can be suspended on most of terminal applies interface.A suspension can be ejected by clicking on suspension button Window, while suspension button is closed.According to a preferred embodiment of the present invention, as shown in figure 3, suspended window size can be set For for placing some buttons, these buttons correspond to different functions respectively, clicking on some button therein can realize accordingly Function.In the specific embodiment of the present invention, exemplified by realizing screenshotss function, such as " cutting with reference to the middle part of figure 3 Screen " button.
After " screenshotss " key is clicked on, we are firstly the need of a sub-line journey is started, because the follow-up process of this scheme is one It is individual to be performed than relatively time-consuming process, it is necessary to be put into sub-line journey, prevent that blocking main thread causes to crash.
Then, terminal is judged in sub-line journey, and whether Root is successful, prompts user to use this function if non-Root Firstly the need of Root, and provide can be with the instrument download address of root termination, and then screenshotss flow can exit;If Root successes , then authority that this application can be assigned by system ejection authorizes window, after user clicks on permission, just gets Root authority, no Then prompt not authorize authority, operation performs failure.
After Root authority is obtained, filename corresponding to screenshot picture is then built.This filename can be as needed It is defined, according to a preferred embodiment of the present invention, the character string generated with current time after formatting is made For title, form as similar " yyyy-MM-dd-HH-mm-ss ", yyyy represents the time, and MM represents the moon, and dd represents day, HH Hour is represented, mm represents minute, and ss represents the second, and it is not in duplication of name phenomenon that the file so generated, which ensures,.It is currently also other Method, according to a preferred embodiment of the present invention, the filename of random number or timestamp as generation can be used.If Using formatted. times as filename, then the time of file generated can be known from file name.Then, generation text is obtained The part path to be saved in, this path can be write extremely in a program, can also be selected by user, be generally directed to SD card Under some catalogue, such as picture directory, photograph catalogue etc., so it is easy to user to check the figure cut by picture browsing software Piece.Finally by the path of setting, plus filename, and after " .png " (suffix name, representative are the pictures of png forms) is such Sew name and be spliced into a complete file name, it includes routing information, file name information, file type information.
After a complete file name is generated, use " su " to be used as parameter, create shell performing environment, Root authority will be asked for system when performing this instruction, because application has got authority before, here not User is reminded to assign application permission again., will be shaped like character string as " the complete filenames of screencap " after creating successfully Order is delivered in shell execute instruction environment by packaged method, and this instruction is then performed in shell environment, Wherein " screencap " represents the feasibility file of system, it be used for realize screenshotss function, be generally present in system/ Under system/bin catalogues.It is the screenshotss program that system carries, and the java applet being different from, it is one binary Executable program, it can only be performed in command line environment.This performs file and not opened to the outside world, only obtains System Privileges Or the application of Root authority can just call it, so one of this patent scheme on condition that system must need Root, so It could call and arrive this executable file.It is upon execution, it is necessary to a parameter-filename, and we have been passed to belt path here Filename, the screenshotss content of generation is saved in Parameter File by so this executable file upon execution, ultimately generates and cuts Shield file.
During screenshotss are carried out, it would be desirable to suspension button is hidden temporarily, avoid occurring in screenshot picture suspending by Key, influence screenshotss effect.After the completion of screenshotss, it is necessary to by hiding suspension button show again for subsequently continue screenshotss or The other operations of person.
After the completion of screenshotss, we, which generally require, shows the file of screenshotss generation by an animation, improves and cuts The experience effect of screen.Meanwhile an informing message can be sent, can be logical by this customized informing message user Know that the information of screenshotss is seen on column, including screenshotss generation file path information etc., and user is after informing information is clicked on, can be with Under screenshotss file path corresponding to leaping to, checking for screenshotss effect is carried out.
By so a series of step, " virtual " is realized to the function of screenshotss, instead of long-press system in combination key and enter Row screenshotss, and because adding animated show and informing is shown, user's screenshotss Experience Degree also greatly promotes.
In the specific embodiment of the present invention, there is provided detailed is instructed using shell, system executable file The method that screencap realizes screenshotss, such as exemplary plot 4, the step of it is realized, is as follows:
S401, suspension button is clicked on, started;According to a preferred embodiment of the present invention, opened up using suspension button Show holding state, specific function is realized using suspended window.Suspended window will be unfolded after clicking on suspension button, be suspended simultaneously Button is hidden;After suspended window is closed, suspension button can be shown.That is suspension button and suspension button excludes each other out Existing, it then follows " you show that I hides;You hide, and I shows ".According to a preferred embodiment of the present invention, suspended window can Arbitrarily dragging, and be suspended on any application, therefore carrier of the suspended window as virtual key is used in the present invention.According to A preferred embodiment of the present invention, the carrier of virtual key can be otherwise realized, is not necessarily suspended window, can be with It is suspension button, for example, point one-touch performs the instruction once preset, such as return key.
S402, expansion suspended window, click on the screenshotss function button on suspended window;According to the side of being preferable to carry out of the present invention Formula, click on after suspension button expansion suspended window further by click on the function button on suspended window select specific function by Key, such as return key, Menu key, screenshotss key.According to a preferred embodiment of the present invention, carried out exemplified by clicking on screenshotss key It is described below.
S403, start a sub-line journey, the realization of screenshotss function is carried out in sub-line journey;Pass through new Thread () first Method creates an anonymous sub-line journey object, then calls start () method of sub-line journey object to be started, then exists Screenshotss function is performed in sub-line journey.Due to implement screenshotss function need to judge system whether Root;Obtain Root authority;Create The performing environment of shell-command row;Command verification is carried out in order line;Specific instruction etc. is performed, it is time-consuming longer, in order to The flow of main thread is not interfered with, it is therefore desirable to its process is put into sub-line journey and performed.Otherwise, once perform the time exceed be Unite the maximum time born, it will cause main thread without response, the generation using deadlock phenomenon occur for a long time.
S404, judge terminal whether Root;If it is judged that being no, then perform S405, if it is judged that be it is yes, then Perform S406.The realization of this function needs the support of terminal Root authority.Judge terminal whether Root, generally by detection one Conventional system directory whether there is su files to realize a bit, such as detection/system/bin/ ,/system/xbin/ ,/ The catalogues such as sbin/ ,/system/sd/xbin/ ,/data/local/xbin/ ,/data/local/bin/ are with the presence or absence of su texts Part, if there is being considered as terminal Root.According to a preferred embodiment of the present invention, it can also pass through other detection sides Formula, for example " su " directly is performed in shell instructions, a simple print command is performed in the output system of return, if Return successfully, then represent Root successes;According to a preferred embodiment of the present invention, can by third-party built-in function come Detected.
The non-Root of S405, prompt terminal, this function can not be used, continues executing with S4015;When detect the non-Root of terminal into Work(, such as su files are not present, then provide corresponding miscue;According to a preferred embodiment of the present invention, may be guided User goes to carry out terminal Root, such as the address of one download Root instrument of prompting, so as to obtain more preferable Consumer's Experience.
Whether S406, application Root authority, system prompt assign the app authorities, are performed after Root authority application success S408, when Root authority application is unsuccessful, perform S407.
, it is necessary to get Root authority before specific shell instruction is performed, although terminal Root, If there is no the mandate using Root authority, failure can be equally performed.According to a preferred embodiment of the present invention, make Detect whether to assign this app authority with the hasRooted () method in third party library rootmanager_1.5.0.jar, hold After row hasRooted () method, the rights management of system can be triggered, after only system assigns Root authority, could continue to hold OK.
Terminal is generally managed after by Root by a Root management tool to the Root authority of system, is being needed When using Root authority, the Root management tools of system can be all triggered, management tool generally prompts user, if assign Root Authority, Root authority only could be obtained after confirmation is clicked on, then could perform corresponding function, otherwise can prompted to obtain and weigh Limit failure.User can also actively assign app authorities into Root management tools, can select to allow, and prompt, and forbid three kinds of behaviour Make.
S407, Root authority is not obtained, perform failure, continue executing with S4015;Prompt to use if Root authority is not obtained Family, and exit function.According to a preferred embodiment of the present invention, friendly prompting can be set, guiding user goes to decontrol authority.
The filename of the screenshot picture generated after S408, structure screenshotss success;After Root authority success is obtained, then structure Build filename corresponding to screenshot picture.
After Root authority is obtained, filename corresponding to screenshot picture is then built.This filename can be as needed It is defined, according to a preferred embodiment of the present invention, the character string generated with current time after formatting is made For title, form as similar " yyyy-MM-dd-HH-mm-ss ", yyyy represents the time, and MM represents the moon, and dd represents day, HH Hour is represented, mm represents minute, and ss represents the second, and it is not in duplication of name phenomenon that the file so generated, which ensures,.It is currently also other Method, according to a preferred embodiment of the present invention, the filename of random number or timestamp as generation can be used.If Using formatted. times as filename, then the time of file generated can be known from file name.Then, generation text is obtained The part path to be saved in, this path can be write extremely in a program, can also be selected by user, be generally directed to SD card Under some catalogue, such as picture directory, photograph catalogue etc., so it is easy to user to check the figure cut by picture browsing software Piece.Finally by the path of setting, plus filename, and after " .png " (suffix name, representative are the pictures of png forms) is such Sew name and be spliced into a complete file name, it includes routing information, file name information, file type information.According to this One preferred embodiment of invention, similar to "/storage/emulated/0/Pictures/2017-08-16-24-00- Such a character strings of 00.png ".Wherein "/storage/emulated/0/Pictures/ " is routing information, " 2017- 08-16-24-00-00 " is that file is become famous, and " .png " is suffix name, and representative is the picture of a png form.
S409, the performing environment for creating a shell;Use " su " to be used as parameter, create shell execution ring Border, Root authority will be asked for system when performing this instruction, because having got Root authority before, here No longer user is reminded to assign Root authority.Establishment shell-command row performing environment is a more complicated process, it is necessary to first A Process process is generated, a sub-line journey is then created in process verifies whether it succeeds, after the completion of, pass through one Whether the further verification command row environment of instruction of entitled " id " is Root environment, then could be used.Specific step is permissible With reference to figure 6, it is carried out relatively to be described in detail.
S4010, performed in shell environment shaped like " the complete filenames of screencap " such instruction:Creating After shell environment success, packaged method will be passed through shaped like character string command as " the complete filenames of screencap " It is delivered in shell execute instruction environment, this instruction is then performed in shell environment, wherein " screencap " system of representatives The feasibility file of system, it be used for realize screenshotss function, be generally present in system /system/bin catalogues under.It is system The screenshotss program carried, the java applet being different from, it is a binary executable program, can only be in order line ring Border is performed, and is realized with C language or C Plus Plus.This perform file do not open to the outside world, only obtain System Privileges or The application of person's Root authority can just call it, so one of this patent scheme on condition that system must need Root, so It can call and arrive this executable file.It is upon execution, it is necessary to a parameter-filename, and we have been passed to belt path here The screenshotss content of generation is saved in this file by filename, so this executable file upon execution, ultimately generates screenshotss text Part.
The execute instruction in shell environment, according to a preferred embodiment of the present invention, instruction can use shaped like The character string of " the complete filenames of screencap ";, will be shaped like " screencap is complete after shell environment success is created Character string command as filename " is delivered in shell execute instruction environment by packaged method, then in shell This instruction is performed in environment, wherein " screencap " represents the feasibility file of system, it is used for realizing screenshotss function, one As be present in system /system/bin catalogues under.It is the screenshotss program that system carries, the java applet being different from, It is a binary executable program, can only be performed in command line environment.This performs file and not opened to the outside world, only There is the application for obtaining System Privileges or Root authority just to call it, so the premise that the present invention is implemented is that system must need Root is wanted, could so call and arrive this executable file.It upon execution, it is necessary to a parameter-filename, here we The filename of belt path has been passed to, the screenshotss content of generation is saved in this file by so this executable file upon execution, Ultimately generate screenshotss file.
Whether S4011, decision instruction run succeeded;This step, which relies primarily on, judges the return value of implementing result to be located Reason, if true, represent that order runs succeeded, return to false, expression performs failure.When judged result is no, step is performed Rapid S4012, when judged result is to be, perform step S4013.
S4012, instruction perform failure, continue executing with S4015;Shell instructions perform failure, will move out program, discharge it The resource of preceding application, shell processes of establishment etc. are exited, and prompt user's information to malfunction.
S4013, the successful animation of screenshotss file generated is performed, while send a Custom Notification column;Screenshotss file is given birth to Cheng Hou, meeting file corresponding to generation under specified file directory, but user can not know, can add to improve Experience Degree Add an animation.For example one screenshotss picture of increase is descending, the animation of the change procedure finally to disappear, such user's sense Feel that screenshotss are successful, Consumer's Experience will be very good.In addition, in order to allow user to recognize the position that screenshot picture preserves, with And the position that can be jumped to where file.An informing message can be defined after screenshotss success, be subsequently transmitted to System, will be in routing information corresponding to informing position display screenshotss file after the notified column message of system, and clicks on After can jump to position corresponding to picture, will so greatly promote user experience.
S4014, realize screenshotss function;Run succeeded, system can respond the system keypress function of execution.When click screenshotss key When, that is, realize screenshotss function.
S4015, exit:Exit function is performed, can now select to close suspended window, can continue to retain suspended window, Continue executing with other keypress functions.
It is convenient in order to quick according to a preferred embodiment of the present invention, can cut the arbitrary operation of user Shield function, use the technology of suspension button and suspended window, and in order to make suspension button and suspended window timely respond to use Family inputs, and starts a Service process to be managed, and application program is not easy by system or third party's kill.Ginseng Examine Fig. 5 and illustrate suspension button and suspended window start-up course and workflow.
S501, startup program;Program starts three kinds of situations of entrance point, and one kind is that program just installs success, at this moment automatically Startup program;Second is that terminal has been mounted with this program, is turned back on, and receives system boot broadcast or other conventional System broadcast message, such as network change, bluetooth, GPS etc. is switched, the operation of its automatic start will be triggered;The third is user's hand Dynamic point hits program icon, startup program.
S502, start client process;Program runs client process first after starting, and suspended window is contained in this process All setting functions and some other miscellaneous function, as theme is replaced, the switches of function items is set, feedback of the information, helped, The contents such as version information.
S503, by client process start an Android Service process;Generally there are two processes, one is Client process, one is Service processes, and the former is that some auxiliary of major function are set, and the latter is used for realizing specifically Function, Service advantage is the backstage for the system that may operate in, and is not easy to be killed, and can be provided persistently with it Suspended window displaying, improve the Experience Degree of user.
S504, suspension button and suspended window are respectively created in Service processes;The realization of suspension button and suspended window is former Manage similar, be all the addView methods by the WindowManager (window manager) of system offer in system interface management A window is added in device, and the priority of this window newly added is arranged to TYPE_SYSTEM_ALERT ranks, so it Priority it is very high, it is possible to be shown on most systems window, reached " suspension " on other windows Purpose.
S505, Service process are being always maintained at running from the background, show suspension button, hide suspended window;Sevice processes An advantage exactly can be always maintained at running from the background, after its starting, during holding state, suspension button is shown Come, and suspended window is hidden, the relation of both is mutual exclusion, and " you show that I hides;You hide, and I shows ".
S506, judge whether to click on suspension button;Need first to click on suspension button when performing concrete function, suspended window is shown Show to come.If it is judged that being no, then S507 is performed;If it is judged that being yes, then S508 is performed.
S507, standby operation, continue to monitor key-press event, be back to S505;If not having to click on event, suspension is pressed Key will keep standby operation, until listening to key-press event.
S508, display suspended window, hide suspension button;Click event is received, suspension button is hidden, and realizes suspension Window.
The various keypress functions that S509, displaying are supported;Deploy suspended window, the supported institute of displaying is functional, for example, virtually Return to keypress function.By ViewPager, (a kind of standard control of android system, can horizontally slip the different boundary of switching Face) control come realize suspended window page function items show, multi-screen content can be shown, switched over by horizontally slipping.
S5010, screen is clicked on, whether the position for judging to click on is virtual functions key on suspended window;Screen is clicked on, is judged Whether the position of click is function button corresponding to suspended window.If the judgment is Yes, then S5012 is performed;If the judgment is No, then Perform S5011.
S5011, suspended window is exited, hidden, flex suspension button;If the position clicked on is not certain on suspended window One button, and be click on blank space, then suspended window is exited, suspended window is closed, opens suspension button, returns to S505;Keep The standby operation of suspension button, continue to monitor the key-press event of suspension button.As long as not shutting down, suspension button can suspend aobvious always Show, standby offer virtual key function, reach the same effect of system button.
Whether the button that S5012, judgement currently perform is screenshotss function, if it is judged that being yes, then performs S5013; If it is judged that being no, then S5014 is performed;Screenshotss function needs the processing that suspension button is hidden and shown, prevents It influences the result of screenshotss.
S5013, current suspension button is hidden, prevent that suspension button is shown in current screenshotss picture during screenshotss, continued Perform S5014;According to a preferred embodiment of the present invention, during screenshotss, simply expect current interface content, be not desired to by In the currently displayed screenshotss interface of suspension button, so needing current suspension button being hidden.According to one of the present invention Preferred embodiment, if the user desired that it is included in screenshotss interface, user can be given by way of menu is set Selected, then increasing a switch in screenshotss flow carries out judging whether show or hide.
Function corresponding to S5014, execution;Corresponding keypress function is performed for clicking on.
S5015, function are finished, if performed is screenshotss function, need to show suspension button; , it is necessary to judge function performed after function is finished, if screenshotss function, then need suspension hiding before Button is shown, is easy to subsequently be continuing with suspension button, makes program continue to keep standby operation.
S5016, standby operation, continue to monitor key-press event, continue executing with S509;Keypress function is finished, and keeps outstanding Floating window is shown, continues executing with other functions.The standby operation of suspended window, continue to monitor key-press event.
Above is suspension button and suspended window start-up course and workflow, will be described how to create below has The shell-command row performing environment of Root authority, and how to realize by this environment the detailed process of screenshotss.Obtaining , it is necessary to create shell-command row performing environment after Root authority, this establishment process is more complicated, must need to verify that its is correct Property, screenshotss instruction then could be performed in this environment.Specific execution flow is as shown in Figure 6:
S601, prepare to create shell-command row environment;Will be by the executable file of Root authority and system Screencap carries out screenshotss, it is necessary to create the command line environment that an executable file is able to carry out, and applies in order line Root authority, then screencap is called to realize screenshotss.Such a command line environment must be created that first, this environment It is a Process process in the angle that program is realized, and order line needs inlet flow DataInputStream (java systems The data input stream of system) and output stream DataOutputStream (data output of java systems), it is used for into line command Input and the output of implementing result, need first to be created that these to come in the shell classes of establishment.
S602, using system class ProcessBuilder create a Process process, incoming parameter is " su ":By S601 knows that shell-command row environment is a Process process in fact, and we use system class ProcessBuilder's Start () method creates such a Process, while parameter " su " passes to class ProcessBuilder construction Function, represent to order using " su " to create this process.After creating successfully, it should be an order line with Root authority Environment, its effect are similar to start Windows dos window, and " adb shell " start shell for input wherein Environment, su instructions are then inputted, it is the same into Root command line execution environments.
S603, start whether sub-line journey checking Process processes create success;According to the side of being preferable to carry out of the present invention Formula, using " echo Started n " command verification, whether this Process process creates success;Here Thread is started Thread judges whether this process creates success, according to output stream DataOutputStream (java systems in sub-line journey Data output), write one " echo Started n " instruction wherein, then obtain the result of its execution, if knot Fruit is equal to " Started ", illustrates that in this environment be a normal command line execution environment.Here echo is a system Shell instruction, represent by below character string as former state export.
S604, judge whether there is abnormal generation during checking, if it is judged that being yes, then perform S605;If it is determined that As a result it is no, then performs S606;, it is necessary to be operated to iostream during checking, it is possible to occur IO input and output as IOException (one kind of system is abnormal, represents that there occurs abnormal conditions in terms of iostream) It is abnormal, so needing to capture this kind of exception, if abnormal occur, illustrate to malfunction during checking, the Process of establishment enters Problem be present in journey;Otherwise represent normal.
S605, shell environment failure is created, perform S6012;Abnormal to occur, the Process processes for illustrating to create, which exist, asks Topic, shell environment create failure.
S606, instructed using id and further verify whether the shell-command row process context created is a Root environment; Process processes or the success of shell process creations are determined by above step, but need to determine whether currently whether be in Under Root patterns or environment.Whether character string uid=0 is included to judge used here as the result that decision instruction id is performed.Wound Character string command row as building one " id " gives the execution of shell processes, then judges whether implementing result includes " uid= 0 " such character string, if comprising the process for illustrating to create is a process under Root environment.Because order id is to use To determine the instruction of currently used person's identity, only after system Root, and when being currently at Root environment, can just obtain Uid is result as 0.
S607, judge whether implementing result is correct;If it is judged that being no, then S605 is performed;If it is judged that it is It is then to perform S608;Whether judged result is comprising character string as " uid=0 ", if creating one comprising explanation has The shell environment of Root authority, otherwise illustrate that this shell environment creates failure.
S608, establishment shell order line process context run succeeded;If it is determined that contain the shell of Root authority Order line process context create successfully, expression can continue executing with screenshotss instruction.
Filename pathName corresponding to the screenshotss file that S609, acquisition create before;Before structure screenshotss instruction, need Filename corresponding to screenshotss file is first generated and get, the establishment of this filename, which may be referred to Fig. 4, detailed introduction, Variable pathName is assigned to after acquisition.
S6010, execute instruction " the screencap pathName " in shell-command row;Obtain corresponding to screenshotss file After filename pathName, creating screenshotss instruction, " screencap pathName ", wherein screencap are the executable of system Program, for realizing screenshotss, pathName is a string variable, represents the filename of screenshotss file, performs such refer to After order, the screencap executable programs of calling system are subjected to screenshotss, and the storage of screenshotss content is represented to pathName In file.
Whether S6011, decision instruction run succeeded, if it is judged that being no, then perform S6012;If it is judged that It is yes, then performs S6013;Judge whether screenshotss succeed by the return value of instruction execution.
S6012, false is returned to, screenshotss failure, perform S6014;If performing failure, one, upper strata false is returned to Value.
S6013, true is returned to, screenshotss success, perform S6014:If run succeeded, one, upper strata true is returned to Value.
S6014, exit, return to implementing result;The result performed is returned to, upper strata receives return value, determined according to return value Whether continue down to perform.
Two hands of user are needed in screenshotss while two Macintosh of long-press system could be real for intelligent terminal user Existing screenshotss, this is used for the unskilled user of intelligent terminal for some, it will it is difficult to operate;And some users are at all Also such function is not known, can also be done by screenshotss.In addition, entity key is after a long time use, also frequently There is the problem of insensitive or failure.The present invention proposes a kind of method of solution.First, screenshotss function has been transplanted to one On individual virtual key, being achieved that as long as clicking on, the scheme that than two hands press two systems button simultaneously is more convenient, Everybody can operate, in addition, because virtual key has explanatory note, user is also very easy to find this function;Secondly, for a long time Pressing system button can cause to damage to system button, makes its insensitive or fails.And this invention is come in the form of suspended window Virtual key screenshotss function is provided, avoids button caused by pressing system button from damaging, extend system button uses the longevity Life;Some benefits that pressing system button can not be accomplished are also played simultaneously, for example user can be fast light in arbitrary interface Carry out operate, only need to gently click on, it is convenient and swift.Finally, the present invention can solve nearly all root termination The hard-to-use problem of user subject button.Because its " virtual " realizes screenshotss keypress function, solves user in system button The bad used time, screenshotss function can not be realized, avoiding can only go to repair button or change the embarrassment of terminal, reduce the money of user Loss.
The above described is only a preferred embodiment of the present invention, any formal limitation not is made to the present invention, though So the present invention is disclosed above with preferred embodiment, but is not limited to the present invention, any to be familiar with this professional technology people Member, without departing from the scope of the present invention, when the technology contents using the disclosure above make a little change or modification For the equivalent embodiment of equivalent variations, as long as being the content without departing from technical solution of the present invention, the technical spirit according to the present invention Any simple modification, equivalent change and modification made to above example, in the range of still falling within technical solution of the present invention.

Claims (10)

  1. A kind of 1. android terminal screenshotss method, it is characterised in that comprise the following steps:
    S401, beginning, click on suspension button;
    S402, expansion suspended window, click on the function button on suspended window;
    S403, start a sub-line journey, the realization of screenshotss function is carried out in sub-line journey;
    S404, judge terminal whether Root;If it is judged that being no, then S405 is performed, if it is judged that being yes, then performed S406;
    The non-Root of S405, prompt terminal, this function can not be used, continues executing with S4015;
    Whether S406, application Root authority, system prompt assign the app authorities, and S408 is performed after Root authority application success, When Root authority application is unsuccessful, S407 is performed;
    S407, Root authority is not obtained, perform failure, continue executing with S4015;
    The filename of the screenshot picture generated after S408, structure screenshotss success;
    S409, the performing environment for creating a shell;
    S4010, the execute instruction in shell environment;
    Whether S4011, decision instruction run succeeded;When judged result is no, step S4012 is performed, when judged result is yes When, perform step S4013;
    S4012, instruction perform failure, continue executing with S4015;
    S4013, the successful animation of screenshotss file generated is performed, while send a Custom Notification column;
    S4014, realize screenshotss function;
    S4015, exit;It can now select to close suspended window, can continue to retain suspended window, continue executing with other button work( Energy.
  2. 2. android terminal screenshotss method as claimed in claim 1, it is characterised in that:
    Suspended window will be unfolded after clicking on suspension button, while the button that suspends is hidden;After suspended window is closed, suspension button Show.
  3. 3. android terminal screenshotss method as claimed in claim 1 or 2, it is characterised in that:
    Judge whether Root is specially terminal:Detection/system/bin/ ,/system/xbin/ ,/sbin/ ,/system/sd/ Xbin/ ,/data/local/xbin/ ,/data/local/bin/ catalogue whether there is su files;Or in shell instructions Perform " su ", print command is performed in the output system of return, if returned successfully, represent Root successes.
  4. 4. the android terminal screenshotss method as described in claim 1-3 is any, it is characterised in that:
    Start a sub-line journey, the realization that screenshotss function is carried out in sub-line journey is specially:Created by new Thread () method An anonymous sub-line journey object is built, then calls start () method of sub-line journey object to be started, then in sub-line journey Middle execution screenshotss function.
  5. 5. the android terminal screenshotss method as described in claim 1-4 is any, suspension button and suspended window start-up course and work Flow is as follows:
    S501, startup program;
    S502, start client process;All setting functions of suspended window are contained in this process;
    S503, by client process start an Android Service process;
    S504, suspension button and suspended window are respectively created in Service processes;
    S505, Service process are being always maintained at running from the background, show suspension button, hide suspended window;
    S506, judge whether to click on suspension button;If it is judged that being no, then S507 is performed;If it is judged that be it is yes, then Perform S508;
    S507, standby operation, continue to monitor key-press event, be back to S505;If not having to click on event, suspension button will Standby operation is kept, until listening to key-press event;
    S508, display suspended window, hide suspension button;Click event is received, suspension button is hidden, and realize suspended window;
    The various keypress functions that S509, flex suspension window are supported;
    S5010, screen is clicked on, whether the position for judging to click on is virtual functions key on suspended window;If the judgment is Yes, then hold Row S5012;If the judgment is No, then S5011 is performed;
    S5011, suspended window is exited, hidden, flex suspension button, return to S505;
    Whether the button that S5012, judgement currently perform is screenshotss function, if it is judged that being yes, then performs S5013;If Judged result is no, then performs S5014;
    S5013, current suspension button is hidden, prevent that suspension button is shown in current screenshotss picture during screenshotss, continue executing with S5014;
    Function corresponding to S5014, execution;Corresponding keypress function is performed for clicking on;
    S5015, function are finished, if performed is screenshotss function, need to show suspension button;
    S5016, standby operation, continue to monitor key-press event, continue executing with S509.
  6. 6. android terminal screenshotss method as claimed in claim 5, it is characterised in that:
    Suspension button and suspended window are all the addView methods provided by the window manager of system in system interface manager One window of middle addition, and the priority of this window newly added is arranged to TYPE_SYSTEM_ALERT ranks.
  7. 7. the android terminal screenshotss method as described in claim 1-6 is any, it is specific as follows to create shell performing environments:
    S601, prepare to create shell-command row environment;Apply for Root authority in order line, call input to realize virtual key Function;
    S602, using system class ProcessBuilder create a Process process, incoming parameter is " su ";
    S603, start whether sub-line journey checking Process processes create success;
    S604, judge whether there is abnormal generation during checking;If it is judged that being yes, then S605 is performed;If it is judged that It is no, then performs S606.
    S605, shell environment failure is created, perform S6012;
    S606, instructed using id and further verify whether the shell-command row process context created is a Root environment;
    S607, judge whether implementing result is correct;If it is judged that being no, then S605 is performed;If it is judged that be it is yes, then Perform S608;
    S608, establishment shell order line process context run succeeded;
    Filename pathName corresponding to the screenshotss file that S609, acquisition create before;
    S6010, execute instruction " the screencap pathName " in shell-command row;Obtain file corresponding to screenshotss file After name pathName, screenshotss instruction " screencap pathName " are created;
    Whether S6011, decision instruction run succeeded, if it is judged that being no, then perform S6012;If it is judged that be it is yes, Then perform S6013;
    S6012, false is returned to, instruction performs failure;Perform S6014;If performing failure, one, upper strata false is returned to Value;
    S6013, true is returned to, instruction runs succeeded;If run succeeded, one, upper strata true values are returned to;
    S6014, exit, return to implementing result.
  8. 8. android terminal screenshotss method as claimed in claim 7, it is characterised in that:
    Process process creations are specially in S602:This is created using system class ProcessBuilder start () method Sample Process, while parameter " su " is passed to class ProcessBuilder constructed fuction, represent to use " su " order to create Build this process.
  9. 9. the android terminal screenshotss method as described in claim 7-8 is any, it is characterised in that:
    Using " echo Started n " command verification, whether this Process process creates success;
    Comprise the following steps that:
    Start a Thread sub-line journey to judge whether this process creates success, according to output stream in sub-line journey DataOutputStream, one " echo Started n " instruction is write wherein, then obtain the result of its execution, if As a result it is equal to " Started ", illustrates that in this environment be a normal command line execution environment.
  10. 10. the android terminal screenshotss method as described in claim 7-9 is any, wherein described, using id instructions, further checking is created Whether the shell-command row process context built is comprising the following steps that for Root environment;
    Character string command row as creating one " id " gives the execution of shell processes, then judges whether implementing result includes " Character string as uid=0 ", if comprising the process for illustrating to create is a process under Root environment.
CN201711014352.2A 2017-10-26 2017-10-26 A kind of android terminal screenshotss method Pending CN107765972A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711014352.2A CN107765972A (en) 2017-10-26 2017-10-26 A kind of android terminal screenshotss method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711014352.2A CN107765972A (en) 2017-10-26 2017-10-26 A kind of android terminal screenshotss method

Publications (1)

Publication Number Publication Date
CN107765972A true CN107765972A (en) 2018-03-06

Family

ID=61270394

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711014352.2A Pending CN107765972A (en) 2017-10-26 2017-10-26 A kind of android terminal screenshotss method

Country Status (1)

Country Link
CN (1) CN107765972A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108874279A (en) * 2018-05-04 2018-11-23 珠海格力电器股份有限公司 A kind of selection method and device, terminal device and readable storage medium storing program for executing
CN110413366A (en) * 2019-07-30 2019-11-05 深圳市乘法信息技术有限公司 A kind of screenshotss method, apparatus, equipment and storage medium based on block chain
CN110418004A (en) * 2019-07-29 2019-11-05 努比亚技术有限公司 Screenshot processing method, terminal and computer readable storage medium
CN112799758A (en) * 2021-01-20 2021-05-14 努比亚技术有限公司 Screenshot method, screenshot equipment and computer-readable storage medium
CN114385304A (en) * 2022-03-23 2022-04-22 麒麟软件有限公司 Method for calling Linux screenshot tool by android application

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130191467A1 (en) * 2012-01-25 2013-07-25 Silverpop Systems, Inc. Temporary Suspension of Electronic Communications
CN103472996A (en) * 2013-09-17 2013-12-25 深圳市佳创软件有限公司 Method and device for receiving touch in mobile device
CN104216752A (en) * 2014-09-30 2014-12-17 珠海市君天电子科技有限公司 Window-based information loading method and device
CN106371752A (en) * 2016-08-30 2017-02-01 竞技世界(北京)网络技术有限公司 Virtual press key realization method and device of Android system intelligent terminal
CN106775298A (en) * 2016-11-28 2017-05-31 北京小米移动软件有限公司 The processing method and processing device of sectional drawing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130191467A1 (en) * 2012-01-25 2013-07-25 Silverpop Systems, Inc. Temporary Suspension of Electronic Communications
CN103472996A (en) * 2013-09-17 2013-12-25 深圳市佳创软件有限公司 Method and device for receiving touch in mobile device
CN104216752A (en) * 2014-09-30 2014-12-17 珠海市君天电子科技有限公司 Window-based information loading method and device
CN106371752A (en) * 2016-08-30 2017-02-01 竞技世界(北京)网络技术有限公司 Virtual press key realization method and device of Android system intelligent terminal
CN106775298A (en) * 2016-11-28 2017-05-31 北京小米移动软件有限公司 The processing method and processing device of sectional drawing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
赵毅: "《跨平台程序设计语言-Java》", 31 May 2006 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108874279A (en) * 2018-05-04 2018-11-23 珠海格力电器股份有限公司 A kind of selection method and device, terminal device and readable storage medium storing program for executing
CN108874279B (en) * 2018-05-04 2020-11-03 珠海格力电器股份有限公司 Selection method and device, terminal equipment and readable storage medium
CN110418004A (en) * 2019-07-29 2019-11-05 努比亚技术有限公司 Screenshot processing method, terminal and computer readable storage medium
CN110413366A (en) * 2019-07-30 2019-11-05 深圳市乘法信息技术有限公司 A kind of screenshotss method, apparatus, equipment and storage medium based on block chain
CN110413366B (en) * 2019-07-30 2023-10-31 深圳市乘法信息技术有限公司 Screen capturing method, device, equipment and storage medium based on blockchain
CN112799758A (en) * 2021-01-20 2021-05-14 努比亚技术有限公司 Screenshot method, screenshot equipment and computer-readable storage medium
CN114385304A (en) * 2022-03-23 2022-04-22 麒麟软件有限公司 Method for calling Linux screenshot tool by android application

Similar Documents

Publication Publication Date Title
CN107765972A (en) A kind of android terminal screenshotss method
CN106371752B (en) A kind of the virtual key implementation method and device of Android system intelligent terminal
EP2775416B1 (en) Apparatus and method for configuring password and for releasing lock
JP2021511592A (en) Application program processing methods, devices, storage media and computer devices
EP3543847B1 (en) Service processing method and device
US20140365971A1 (en) Systems and methods for sharing and switching between personas on mobile technology platforms
CN108681662B (en) Method and device for installing program
CN105144058B (en) Prompt is placed in delay
CN106951335B (en) Process daemon method and mobile terminal
EP2904535B1 (en) Limiting the functionality of a software program based on a security model
CN107357580A (en) A kind of method that guiding terminal user opens the miscellaneous function authority of application
US10481752B2 (en) Method and device for a guided application to enhance a user interface
CN103677527A (en) Suspension problem interaction control display method and device suitable for mobile terminal
WO2013086988A1 (en) Software installation method and device
US20090177791A1 (en) Remote device communication platform user interface
CN106355059A (en) Password input method and terminal
CN108170438A (en) A kind of application program automatic installation method, terminal and computer-readable medium
CN107168602A (en) One kind control application drawing calibration method and terminal
CN111949334B (en) Sandbox environment-based virtual application starting control method, device and equipment
CN103257788A (en) Windows desktop dynamic icon forming method
CN102855129A (en) Method and system for automatically creating isolated processes
CN113448651A (en) Method and device for realizing application singleton function
CN107728888B (en) Virtual key implementation method for android terminal
RO127448A0 (en) Natural communication technology
CN110554817A (en) desktop icon display control method and device, readable medium and computing equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180306

RJ01 Rejection of invention patent application after publication