CN105187945B - Method for realizing apk control of android set top box screen direction - Google Patents

Method for realizing apk control of android set top box screen direction Download PDF

Info

Publication number
CN105187945B
CN105187945B CN201510596291.XA CN201510596291A CN105187945B CN 105187945 B CN105187945 B CN 105187945B CN 201510596291 A CN201510596291 A CN 201510596291A CN 105187945 B CN105187945 B CN 105187945B
Authority
CN
China
Prior art keywords
apk
screen
android
interface
orientation
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.)
Active
Application number
CN201510596291.XA
Other languages
Chinese (zh)
Other versions
CN105187945A (en
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.)
Inspur Software Technology Co Ltd
Original Assignee
Inspur Software Group 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 Inspur Software Group Co Ltd filed Critical Inspur Software Group Co Ltd
Priority to CN201510596291.XA priority Critical patent/CN105187945B/en
Publication of CN105187945A publication Critical patent/CN105187945A/en
Application granted granted Critical
Publication of CN105187945B publication Critical patent/CN105187945B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/485End-user interface for client configuration
    • H04N21/4858End-user interface for client configuration for modifying screen layout parameters, e.g. fonts, size of the windows
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method for realizing apk control of the screen direction of an android set top box, which comprises the following specific implementation processes: firstly, providing a jar packet interface of apk by an Android set top box, wherein the interface has the function of setting the global direction of a system screen; secondly, designing a system property SystemProperties interface; the interface is a global sharing interface, so that other apks can obtain the screen direction value set by the customized apk when running; apk sets the values 0, 90, 180, 270 for this property SystemProperties, and for the rest of the system apks, the android system will set the screen orientation of the rest of the apks according to the global SystemProperties property. Compared with the prior art, the method for controlling the screen direction of the android set top box by the apk can meet the requirements of special customers, the apk can be provided by the customer to set the screen direction of the system, other apks in the system can also be dynamically adjusted along with the direction, and the method is high in practicability, wide in application range and easy to popularize.

Description

A kind of method for realizing apk control android set-top box screen orientations
Technical field
The present invention relates to set-top box technique field, specifically it is a kind of it is highly practical, realize that apk controls android machines The method of top box screen orientation.
Background technology
Google in 2007 release the Android system based on linux kernel increased income, and android is popular in half a day afterwards Side, with its freely customized property infiltration industry-by-industry of increasing income, including set-top box industry, has expedited the emergence of the production of android set-top boxes It is raw.
TV is to belong to transverse screen equipment at present, and the output image of android set-top boxes is generally integrally fixed on the basis of transverse screen 's.As the extensive use of android set-top boxes is also getting faster, it is necessary to change.There are a kind of such TV applications at present Scene, in order to be more convenient display laminated content, TV is vertically arranged, requires android set-top boxes to be controlled by apk so as to generate The demand in system overall situation direction processed.Based on this, a kind of method for realizing apk control android set-top box screen orientations is now provided.
The content of the invention
The technical assignment of the present invention is to be directed to above shortcoming, there is provided one kind is highly practical, realizes apk controls The method of android set-top box screen orientations.
A kind of method for realizing apk control android set-top box screen orientations, its specific implementation process are:
Android set-top boxes provide the jar packet interfaces of apk first, and the function of the interface is setting system screen overall situation side To;
Secondly design system attribute SystemProperties interfaces;The interface is globally shared interface, you can allows other Apk gets the screen orientation value set by customized apk when operation;
Apk sets the value 0,90,180,270 of attribute SystemProperties, for remaining apk of system, android System will set the screen orientation of remaining apk according to global SystemProperties attributes.
The apk is the application run in android, is made of one or more window interface activity, Window interface inherits the activity.java of android standards, an activity life defined in activity.java The significant function interface that must be called in cycle, the basic life cycle that Android defines an activity are:Just firstly appear OnCreate functions must be called when building;OnDestroy functions must be called during destruction, foreground is exited and shows and must call OnPause and onStart functions, onStart functions and onResume functions must be called by being shown in foreground again.
The value 0,90,180,270 of the attribute SystemProperties, corresponding A ndroid four direction outputs itself, Transverse screen i.e. 0 degree is respectively forced, portrait layout i.e. 90 degree is forced, forces transverse screen upset i.e. 180 degree, forces portrait layout upset i.e. 270 degree.
The jar packet interfaces include interface name setSystemOrientation, return value void, parameter list int orientation;And current activity directions can be forced to the direction of incoming parameter by the interface first, then writing system Other activity of property notification are arranged to identical screen orientation.
The SystemProperties interfaces include attribute-name sys.inspur.orientation, default value -1, adopt Remember the direction value set by it with SystemProperties, so remaining apk can get this at any time when operation Shared value, achievees the purpose that system so apk follows a direction.
The step of further including adaptation modification android framework interfaces so that after customized apk sets screen orientation, Change in system in the screen orientation for following customized apk to set in the apk of running background.
The adaptation modification android framework interfaces concretely comprise the following steps:Intercept framework layers of android Canonical function onResume functions modify adaptation, when apk shows foreground and calls to framework layers of system During onResume functions, homepage takes out the system screen direction value required by the apk in control system direction, then according to the value come Direction variable built in matching system, the variable in representation system direction are located in ActivityInfo classes, respectively force transverse screen i.e. 0 Degree, force portrait layout i.e. 90 degree, force transverse screen upset i.e. 180 degree, force portrait layout upset i.e. 270 degree;Finally standard interface is called to sentence Break screen orientation original current activity, if current screen direction and required screen orientation are inconsistent, calls mark Quasi- interface come force set show foreground apk screen orientation.
A kind of method for realizing apk control android set-top box screen orientations of the present invention, has the following advantages:
A kind of method for realizing apk control android set-top box screen orientations of the invention, can be used in extending The flexibility of android set-top boxes and special customized property, meet the requirement of particular client, can provide apk by client and set system Unite screen orientation, other apk in system also follow the direction to be adjusted into Mobile state, highly practical, applied widely, are easy to Promote.
Embodiment
With reference to specific embodiment, the invention will be further described.
A kind of method for realizing apk control android set-top box screen orientations of the offer of the present invention, this method realize base It is respectively SCREEN_ORIENTATION_LANDSCAPE in the four direction output that Android is supported in itself(Force transverse screen be 0 degree)、SCREEN_ORIENTATION_PORTRAIT(Force portrait layout i.e. 90 degree)、SCREEN_ORIENTATION_REVERSE_ LANDSCAPE(It is 180 degree to force transverse screen upset)、SCREEN_ORIENTATION_REVERSE_PORTRAIT(Portrait layout is forced to be turned over Turn i.e. 270 degree).It realizes that process is:Can be with android standard interface setRequestedOrientation (int Orientation) apk directions are set.The method design of apk control Android system overall situation screen orientations is that system carries For an overall situation SystemProperties attribute.Apk sets the value of the attribute(0、90、180、270), for system remaining Apk, Android system will set the screen orientation of remaining apk according to global SystemProperties attributes.
It is the specific implementation process is as follows described:
The 1st, the jar packet interfaces design of apk is provided.
System external opens an interface, and the function of the interface is setting system screen overall situation direction.The interface first can Current activity directions are forced to the direction of incoming parameter, then other activity of writing system property notification are arranged to Identical screen orientation.Interface detailed design such as following table:
2nd, system property SystemProperties Interface designs.
Due to being that apk can not possibly operate in foreground always by apk control system overall situation screen orientations, so needing to provide Certain globally shared interface mode, can get the screen orientation set by customized apk when allowing other apk to run Value, remembers the direction value set by it using SystemProperties here, and so remaining apk operations whens can be with When get the shared value, thus achieve the purpose that system so apk follows a direction.Interface detailed design such as following table:
3rd, android framework interfaces adaptation modification.
The application run in android is referred to as apk, and for apk, android has its unique life cycle, For an apk, usually by one or more activity(That is a window interface)Composition, an activity can be inherited The activity.java of android standards.It must be adjusted in activity life cycle defined in activity.java Significant function interface.The basic life cycle that Android defines an activity is:It must be called during initial creation OnCreate functions.OnDestroy functions must be called during destruction, onPause and onStart must be called by exiting foreground and showing Function, onStart functions and onResume functions must be called by being shown in foreground again.
After screen orientation is set for customized apk, there may be apk in running background in system, so to allow from the background Apk follows the screen orientation that customized apk is set, and the screen side of the apk must must be reset when apk shows foreground when backstage To.So according to the life cycle of activity, it can run apk's with onStart functions and the mandatory modification of onResume functions Screen orientation.
The canonical function onResume functions that selection intercepts framework layers of android are modified adaptation, when apk is shown Simultaneously call to homepage during the onResume functions of framework layers of system and can take out sys.inspur.orientation in existing foreground The direction value stored(System screen direction i.e. required by the apk in control system direction), then it is to match according to the value Direction variable built in system, the variable in representation system direction are located in ActivityInfo classes, are respectively SCREEN_ ORIENTATION_LANDSCAPE(Force transverse screen i.e. 0 degree)、SCREEN_ORIENTATION_PORTRAIT(Force portrait layout i.e. 90 Degree)、SCREEN_ORIENTATION_REVERSE_LANDSCAPE(It is 180 degree to force transverse screen upset)、SCREEN_ ORIENTATION_REVERSE_PORTRAIT(Force portrait layout upset i.e. 270 degree).Finally call standard interface GetRequestedOrientation () judges the original screen orientations of current activity, if current screen direction is with wanting The screen orientation asked is inconsistent, then calls standard interface setRequestedOrientation to force to set and show foreground The screen side of apk
Embodiment:
(1)System layer provides the customized jar bags needed for apk, includes interface setSystemOrientation (int orientation).Incoming parameter is the shapings such as 0,90,180,270, carrys out decision systems screen orientation.
(2)Increase SystemProperties attributes sys.inspur.orientation connects for storing above-mentioned jar bags The system orientation interface that oral instructions enter.
(3)According to the life cycle of android apk, when each activity switchs to foreground, will necessarily call OnResume functions, the onResume interfaces of the no matter heavy not activity.java of rewriting system of the activity, can all call The onResume interfaces of system.So increase following code in the onResume interfaces of system activity.java:
int rotation = SystemProperties.getInt (“sys.inspur.orientation”,-1);
int orientation = 0;
if(rotation>=0&&rotation<=270){
switch(rotation){
case 0:
orientation = ActivityInfo.SCREEN_ ORIENTATION_LANDSCAPE;
break;
case 90:
orientation = ActivityInfo.SCREEN_ ORIENTATION_PORTRAIT;
break;
case 180:
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_ LANDSCAPE;
break;
case 270:
orientation = ActivityInfo.SCREEN_ORIENTATION_ REVERSE_PORTRAIT;
break;
default:
break;
}
}
if(this.getRequestedOrientation() != orientation){
this.setRequestedOrientation(orientation);
}
Code homepage takes out the system orientation value that apk is set, i.e. system property sys.inspur.orientation is deposited The value of storage, then sets the canonical variable value of android directions institute code according to value, and finally obtain apk works as front direction, if Set system screen direction is required when front direction is not equal to, then calls android standard interfaces SetRequestedOrientation is set by force so the direction of the activity of apk is to require system screen direction.
Above-mentioned embodiment is only the specific case of the present invention, and scope of patent protection of the invention includes but not limited to Above-mentioned embodiment, a kind of any method for realizing apk control android set-top box screen orientations for meeting the present invention The appropriate change or replacement that claims and any person of an ordinary skill in the technical field does it, should all fall into The scope of patent protection of the present invention.

Claims (2)

  1. A kind of 1. method for realizing apk control android set-top box screen orientations, it is characterised in that specific implementation process is:
    Android set-top boxes provide the jar packet interfaces of apk first, and the function of the interface is setting system screen overall situation direction;
    Secondly design system attribute SystemProperties interfaces;The interface is globally shared interface, you can allows other apk to transport The screen orientation value set by customized apk is got when row;
    Apk sets the value 0,90,180,270 of attribute SystemProperties, for remaining apk of system, Android system The screen orientation of remaining apk will be set according to global SystemProperties attributes;
    The value 0,90,180,270 of the attribute SystemProperties, corresponding A ndroid four direction outputs itself, respectively It it is 270 degree to force transverse screen i.e. 0 degree, forcing portrait layout i.e. 90 degree, pressure transverse screen upset i.e. 180 degree, force portrait layout upset;
    The jar packet interfaces include interface name setSystemOrientation, return value void, parameter list int orientation;And current activity directions can be forced to the direction of incoming parameter by the interface first, then writing system Other activity of property notification are arranged to identical screen orientation;
    The SystemProperties interfaces include attribute-name sys.inspur.orientation, default value -1, use SystemProperties remembers the direction value set by it, and so remaining apk can get this at any time when operation common Value is enjoyed, achievees the purpose that all apk of system follow a direction;
    The step of further including adaptation modification android framework interfaces so that after customized apk sets screen orientation, system In in the apk of running background follow the screen orientation change that customized apk sets;
    The adaptation modification android framework interfaces concretely comprise the following steps:Intercept the mark of framework layers of android Quasi-function onResume functions are modified adaptation, when apk shows foreground and the onResume called to framework layers of system During function, homepage takes out the system screen direction value required by the apk in control system direction, then according to the value come matching system Built-in direction variable, the variable in representation system direction are located in ActivityInfo classes, respectively force transverse screen i.e. 0 degree, force Portrait layout i.e. 90 degree, force transverse screen upset to be 180 degree, i.e. 270 degree of pressure portrait layout upset;Standard interface is finally called to judge current Screen orientation original activity, if current screen direction and required screen orientation are inconsistent, calls standard interface To force to set the screen orientation for the apk for showing foreground.
  2. 2. a kind of method for realizing apk control android set-top box screen orientations according to claim 1, its feature exist In the apk is the application run in android, is made of one or more window interface activity, window circle Face inherits the activity.java of android standards, defined in activity.java in an activity life cycle The significant function interface that must be called, the basic life cycle that Android defines an activity are:Must during initial creation OnCreate functions must be called;OnDestroy functions must be called during destruction, exit foreground show must call onPause and OnStart functions, onStart functions and onResume functions must be called by being shown in foreground again.
CN201510596291.XA 2015-09-18 2015-09-18 Method for realizing apk control of android set top box screen direction Active CN105187945B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510596291.XA CN105187945B (en) 2015-09-18 2015-09-18 Method for realizing apk control of android set top box screen direction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510596291.XA CN105187945B (en) 2015-09-18 2015-09-18 Method for realizing apk control of android set top box screen direction

Publications (2)

Publication Number Publication Date
CN105187945A CN105187945A (en) 2015-12-23
CN105187945B true CN105187945B (en) 2018-05-08

Family

ID=54909742

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510596291.XA Active CN105187945B (en) 2015-09-18 2015-09-18 Method for realizing apk control of android set top box screen direction

Country Status (1)

Country Link
CN (1) CN105187945B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107168692A (en) * 2017-04-01 2017-09-15 山东超越数控电子有限公司 A kind of handheld subscriber interface implementing method and system based on ReWorks operating systems
CN107610624B (en) * 2017-08-23 2020-12-01 深圳易普森科技股份有限公司 Display link driving type automatic horizontal screen control method and system
CN110662095B (en) * 2019-08-28 2021-10-26 北京小米移动软件有限公司 Screen projection processing method and device, terminal and storage medium
CN111273981B (en) * 2020-01-17 2024-02-20 深圳市研强物联技术有限公司 Android system-based display screen adaptation method and system
CN112486621B (en) * 2020-12-07 2022-05-06 广州朗国电子科技股份有限公司 Horizontal and vertical screen adaptation method, device and storage medium based on IO level

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004279909A (en) * 2003-03-18 2004-10-07 Seiko Epson Corp Display controller and display device
CN103745709A (en) * 2014-01-24 2014-04-23 福州瑞芯微电子有限公司 Embedded self-adaptive screen displaying method
CN103997670A (en) * 2014-05-05 2014-08-20 深圳市九洲电器有限公司 Control method and control system for application on set top box
CN104615336A (en) * 2015-02-15 2015-05-13 联想(北京)有限公司 Information processing method and electronic equipment
CN104699482A (en) * 2015-03-11 2015-06-10 深圳市泰霖科技有限公司 Display system rotating method based on Android digital label system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004279909A (en) * 2003-03-18 2004-10-07 Seiko Epson Corp Display controller and display device
CN103745709A (en) * 2014-01-24 2014-04-23 福州瑞芯微电子有限公司 Embedded self-adaptive screen displaying method
CN103997670A (en) * 2014-05-05 2014-08-20 深圳市九洲电器有限公司 Control method and control system for application on set top box
CN104615336A (en) * 2015-02-15 2015-05-13 联想(北京)有限公司 Information processing method and electronic equipment
CN104699482A (en) * 2015-03-11 2015-06-10 深圳市泰霖科技有限公司 Display system rotating method based on Android digital label system

Also Published As

Publication number Publication date
CN105187945A (en) 2015-12-23

Similar Documents

Publication Publication Date Title
CN105187945B (en) Method for realizing apk control of android set top box screen direction
EP3474136A1 (en) Method and apparatus for use in converting building block programming into program code
US10671250B2 (en) Controlling a device using a radial graphical user interface
CN107291456A (en) The control method and system of a kind of multihead display
WO2007149532A3 (en) Compiler system, method and software for a resilient integrated circuit architecture
US9317304B2 (en) Launching multiple applications in a processor
CN105117320B (en) Electric terminal middle pipe ought to method and its electric terminal
TWI608420B (en) Virtual machine monitoring method and system thereof
CN104239076A (en) Interface color adjusting method and device
CN103645924A (en) Method and device for managing program parameters of embedded device
CA2985129C (en) Cross domain desktop compositor
KR102136474B1 (en) Synchronization of client-side keyboard layout with server-side keyboard layout in a virtual session
CN107799093A (en) Adjust method, terminal and the computer-readable recording medium of screen luminance of terminal
AU2003300506A1 (en) A method and system for policy-based control in a distributed network
KR20230021035A (en) Devices and method for building group networks in Software Definition Data Center
US20190065720A1 (en) Key reference updating method and module, and terminal device
US10462194B2 (en) Minimizing productivity loss in a collaborative sharing environment
CN102354275B (en) Text input box and data processing method thereof
US10122907B1 (en) Integration of transducer outputs in a conferencing system
CN105516782A (en) Method and system for implementing suspension interface mutual exclusion function of smart television with Android system
CN107453971A (en) Communication means and system between a kind of multiple virtual machines
CN104461701A (en) Control method and electronic equipment
CN112003708A (en) Monitoring method, device, equipment and medium for access equipment
CN110134483A (en) A kind of LED display shows that content custom-configures method and system
CN106603793B (en) The method and system of batch setting contact head image

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20200526

Address after: 250100 Inspur Science Park, No. 1036, Inspur Road, high tech Zone, Jinan City, Shandong Province

Patentee after: Inspur Software Technology Co., Ltd

Address before: 250100 Ji'nan science and Technology Development Zone, Shandong Branch Road No. 2877

Patentee before: INSPUR GROUP Co.,Ltd.

TR01 Transfer of patent right