CN114071234B - Application use duration acquisition method for android television - Google Patents

Application use duration acquisition method for android television Download PDF

Info

Publication number
CN114071234B
CN114071234B CN202111328022.7A CN202111328022A CN114071234B CN 114071234 B CN114071234 B CN 114071234B CN 202111328022 A CN202111328022 A CN 202111328022A CN 114071234 B CN114071234 B CN 114071234B
Authority
CN
China
Prior art keywords
time
system clock
application
use duration
file
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
CN202111328022.7A
Other languages
Chinese (zh)
Other versions
CN114071234A (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.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric 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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN202111328022.7A priority Critical patent/CN114071234B/en
Publication of CN114071234A publication Critical patent/CN114071234A/en
Application granted granted Critical
Publication of CN114071234B publication Critical patent/CN114071234B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/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/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/4424Monitoring of the internal components or processes of the client device, e.g. CPU or memory load, processing speed, timer, counter or percentage of the hard disk space used
    • 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/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/4425Monitoring of client processing errors or hardware failure

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Databases & Information Systems (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Electric Clocks (AREA)

Abstract

The invention discloses an application use duration acquisition method for an android television, which comprises the steps of judging whether a system clock is synchronous or not when an android television equipment system monitors application time information, and adjusting file data created before synchronization and verifying file validity after synchronization; when the application use duration is calculated every time, if the calculated application use duration is greater than the time jump value, the fact that the initial point of the section of application use duration data acquisition is before system clock synchronization and the end point of the acquisition is after the system clock synchronization is shown, the difference value of the application use duration and the time jump is used for replacing the use duration data; when the UsageStatsservice is used for collecting the application time length, circularly writing the collected data stored in the memory into a persistent file; when the application data are written into the persistent file, whether new application data exist is judged, if not, the current system clock time is obtained in real time and stored in the persistent file timestamp.

Description

Application use duration acquisition method for android television
Technical Field
The invention relates to the technical field of android televisions, in particular to a method for acquiring application use duration of an android television.
Background
The android terminal device can collect the service duration of each application through a system service UsageStatsservice, and the basis of the service duration data statistics is based on a system clock. When the system clock of the android terminal device is not synchronized, the collected application use duration may be error data. For an android terminal device which cannot maintain the running of a system clock in a shutdown state and a power-down state, such as an android television, whether the system clock can be synchronized in time when a system service UsagStatsService is started depends on various factors such as system starting time, a network connection state and service starting time, so that the application use time length collection on an android television platform cannot be carried out by using the UsagStatsService.
Disclosure of Invention
When this patent utilizes usages stats service to carry out long collection of application to android television, the system clock is not synchronous, leads to data error, data loss scheduling problem, has provided a long collection method of application use suitable for android television, increases file synchronization, data calibration, degree of accuracy optimization mechanism on usages stats service basis, and the applicable environment of effective compatible android television has greatly improved robustness, the accuracy of long time collection.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method for acquiring application use duration of an android television comprises the following steps:
when the android television equipment system monitors application time information, judging whether a system clock is synchronous or not, and if so, adjusting file data created before synchronization and verifying file validity;
when the application use duration is calculated every time, if the calculated application use duration is greater than the time jump value, the fact that the initial point of the section of application use duration data acquisition is before system clock synchronization and the end point of the acquisition is after the system clock synchronization is shown, the difference value of the application use duration and the time jump is used for replacing the use duration data;
when the UsageStatsService is used for acquiring the application time length, circularly writing the acquired data stored in the memory into a persistent file;
when the application data are written into the persistent file, judging whether new application data exist, if not, acquiring the current system clock time in real time and storing the current system clock time in a timestamp of the persistent file;
when the android television system is started, acquiring the modification time of the latest recording file as the end time of the previous unclosed foreground application.
In some embodiments, when the android television device system monitors the application time information, the determining whether a system clock is synchronized includes: the method comprises the steps of firstly acquiring a current system clock and a counting clock from system start to the present every time an event of application start or application stop is monitored, and integrating the system clock of the last monitored event and the counting clock from system start to the present to accurately restore expected system clock information, namely, if the system clock is synchronized and the value is not equal to the system clock information of the current monitored event, considering that time jump occurs, and judging whether the system clock synchronization occurs or not.
In some embodiments, the desired system clock information calculation formula is as follows:
expected system clock information = (system starts to present count clock when event is monitored this time-system starts to present count clock when event is monitored last time) + system clock when event is monitored last time.
In some embodiments, the time jump value calculation formula is as follows:
time jump value = system clock at the time of this monitored event — expected system clock information.
In some embodiments, the method for adjusting the file data created before synchronization refers to calculating a time jump value during synchronization; and for file data created before the system clock of the android television equipment is synchronized, the file data is synchronized together when the system clock is synchronized, and the file data needs to be added with a time jump value generated by the system clock synchronization.
In some embodiments, the file validity verification comprises: and comparing the current system clock, and if the file creation time is less than the current system clock and greater than the expected system clock information, determining that the file is valid.
In some embodiments, the file validity verification means that the usages statssservice service is prohibited from adjusting the recorded data, that is, the service is prohibited from judging whether the recorded data is expired or not based on the unsynchronized time; meanwhile, whether the system clock is synchronous or not is detected in real time, and the recorded data is carried out after synchronization.
In some embodiments, the persistent file timestamp is a file modification time.
In some embodiments, the foreground application is an application that is opened when the system is powered off and is shown not closed yet at the interface.
The application use duration acquisition method for the android television disclosed by the application has the following possible beneficial effects that the application use duration acquisition method for the android television is not limited to: due to the technical scheme, on the basis of the android native UsageStatsService service, the method for synchronizing the files, calibrating the data and optimizing the accuracy effectively achieves that the application use duration can be accurately and effectively obtained on the android television equipment of which the shutdown and power-down states cannot maintain the system clock to run.
Drawings
FIG. 1 is a flowchart of a process for file synchronization according to the present invention.
Fig. 2 is a modified usagettasservice service flow diagram according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
On the contrary, this application is intended to cover any alternatives, modifications, equivalents, and alternatives that may be included within the spirit and scope of the application as defined by the appended claims. Furthermore, in the following detailed description of the present application, certain specific details are set forth in order to provide a thorough understanding of the present application. It will be apparent to one skilled in the art that the present application may be practiced without these specific details.
An application usage duration collecting method for an android television according to an embodiment of the present application will be described in detail below with reference to fig. 1-2. It should be noted that the following examples are merely illustrative of the present application and are not to be construed as limiting the present application.
In an embodiment of the present application, as shown in fig. 1-2, a method for acquiring an application use duration of an android television includes:
when the android television equipment system monitors application time information, judging whether a system clock is synchronous or not, and if so, adjusting file data created before synchronization and verifying file validity;
when the application use duration is calculated every time, if the calculated application use duration is greater than the time jump value, the fact that the initial point of the section of application use duration data acquisition is before system clock synchronization and the end point of the acquisition is after the system clock synchronization is shown, the difference value of the application use duration and the time jump is used for replacing the use duration data;
when the UsageStatsService is used for acquiring the application time length, circularly writing the acquired data stored in the memory into a persistent file; the frequency of writing the acquired data into the persistent file is improved, and the method is used for avoiding large loss of power-down data of the android television equipment;
when the application data are written into the persistent file, judging whether new application data exist, if not, acquiring the current system clock time in real time and storing the current system clock time in a persistent file timestamp; once the android television equipment is powered off and powered down, the application in the foreground can be stored when being closed, the use duration of the application is calculated when the system is powered on next time, and the accuracy of data acquisition is improved. Wherein the persistent file timestamp is a file modification time. And when the foreground application is the system shutdown, the application which is displayed on the interface and is not closed is opened.
When the android television system is started, acquiring the modification time of the latest recording file as the end time of the previous unclosed foreground application.
When the system clock of the android television equipment is not synchronized, the UsageStatsService service is forbidden to carry out validity verification on the recorded data, namely the forbidden service judges whether the recorded data is overdue or not by taking the unsynchronized time as a standard. Meanwhile, whether the system clock is synchronous or not is detected in real time, and validity verification of the recorded data is carried out after synchronization.
When the system clocks of the android television equipment are synchronized, calculating a time jump value, namely a difference value between synchronized system clock information and system clock information just before synchronization; file data created before system clock synchronization of the android television equipment are synchronized together during system clock synchronization, and the file data needs to be added with a time jump value generated by the system clock synchronization.
And when the application use duration is calculated every time, if the calculated application use duration is greater than the time jump value, the calculated application use duration indicates that the initial point of the acquisition of the application use duration data is before the synchronization of the system clock and the end point of the acquisition is after the synchronization of the system clock, and the difference value of the application use duration and the time jump is used for replacing the use duration data.
When the UsageStatsservice is used for collecting the application time, the frequency of writing the collected data into the persistence file is improved, the problem that the android television equipment loses power due to large data loss is avoided, and the accuracy of the collected data is improved.
When the memory data are written into the persistent file, if no new data exist, the current system clock time is obtained in real time and stored in the persistent file information, once the android television equipment is powered off and powered off, the application closing time in the foreground can be stored, the service time of the application is calculated when the system is started next time, and the accuracy of data acquisition is improved.
S1, file synchronization processing:
the method comprises the steps of firstly acquiring a current system clock and a counting clock from system start to the present every time an event of application start or application stop is monitored, and integrating the system clock of the last monitored event and the counting clock from system start to the present to accurately restore expected system clock information, namely, if the system clock is synchronized, the value is not equal to the system clock information of the current monitored event (the expected system clock information is far smaller than the system clock information of the monitored event), considering that the occurrence time jumps, and judging whether the system clock synchronization occurs.
The expected system clock information calculation formula is as follows:
expected system clock information = (system starts to present counting clock when event is monitored this time-system starts to present counting clock when event is monitored last time) + system clock when event is monitored last time
The time jump value calculation formula is as follows:
time jump value = system clock at the time of this monitored event — expected system clock information
S1.1 adjusting File data created before synchronization
And after the system clock synchronization of the android television occurs, acquiring file creation time, comparing expected system clock information, and adding a time jump value to the file data if the file creation time is less than the expected system clock information.
S1.2 document validation
And after the system clock synchronization of the android television occurs, acquiring file creation time, comparing the current system clock, and if the file creation time is smaller than the current system clock and larger than the expected system clock information, determining that the file is valid.
S2 data calibration
And when the application use duration is calculated every time, acquiring a time jump value, and if the calculated application use duration is greater than the time jump value, replacing the use duration data by the difference value of the application use duration and the time jump.
S3 accuracy optimization
S3.1, a time frequency is preset, and the operation of writing the collected data stored in the memory into the persistent file is performed cyclically at the time frequency, in this embodiment, the frequency is taken once every 5 minutes.
S3.2, when the memory data are written into the persistent file, whether new data exist is judged. If no new application event data exists, the synchronous recording file is modified into the current system clock; and if new application event data exist, writing the data in the memory into the file.
When the android television system is started, acquiring the modification time of the latest recording file as the end time of the application which is not closed in the foreground last time.
Through the processing, the UsageStatsservice can be suitable for an android television system, is not limited by the conditions of networks, power failure and the like, and can call a service interface to acquire accurate application service time data.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (9)

1. A method for acquiring application use duration of an android television is characterized by comprising the following steps:
when the android television equipment system monitors application time information, judging whether a system clock is synchronous or not, and if so, adjusting file data created before synchronization and verifying file validity;
when the application use duration is calculated every time, if the calculated application use duration is greater than the time jump value, the fact that the starting point of the application use duration data acquisition is before system clock synchronization and the end point of the acquisition is after the system clock synchronization is indicated, the difference value between the application use duration and the time jump is used for replacing the use duration data;
acquiring application time by using UsageStatsService, and circularly writing acquired data stored in a memory into a persistent file;
when the application data are written into the persistent file, judging whether new application data exist, if not, acquiring the current system clock time in real time and storing the current system clock time in a persistent file timestamp;
when the android television system is started, acquiring the modification time of the latest recording file as the end time of the previous unclosed foreground application.
2. The method for acquiring the application use duration of the android television as claimed in claim 1, wherein the step of judging whether a system clock is synchronous when the android television device system monitors the application time information comprises the steps of: the method comprises the steps of firstly obtaining a current system clock and a counting clock from system start to present when an event of application start or close is monitored each time, and synthesizing the system clock of the last monitored event and the counting clock from system start to present to accurately restore expected system clock information, namely, supposing that a value of the system clock which is not in clock synchronization between the monitored event and the last monitoring is supposed to be, if the system clock synchronization occurs and the value is not equal to the system clock information when the event is monitored, considering that the occurrence time jumps, so as to judge whether the system clock synchronization occurs or not.
3. The method for acquiring the application use duration of the android television as claimed in claim 2, wherein the expected system clock information calculation formula is as follows:
expected system clock information = (system starts to present count clock when event is monitored this time-system starts to present count clock when event is monitored last time) + system clock when event is monitored last time.
4. The method for collecting the application usage duration of the android television set as claimed in claim 3,
the time jump value calculation formula is as follows:
time jump value = system clock at the time of this monitored event — expected system clock information.
5. The method for acquiring the application use duration of the android television according to claim 1, wherein the method for adjusting the file data created before synchronization refers to calculating a time jump value during synchronization; file data created before system clock synchronization of the android television equipment are synchronized together during system clock synchronization, and the file data needs to be added with a time jump value generated by the system clock synchronization.
6. The method for collecting the application use duration of the android television as claimed in claim 1, wherein the file validity verification comprises: and comparing the current system clock, and if the file creation time is less than the current system clock and greater than the expected system clock information, determining that the file is valid.
7. The method for acquiring the application use duration of the android television set as claimed in claim 1, wherein the file validity verification means that the usagettasservice is prohibited from adjusting the recorded data, that is, the service is prohibited from judging whether the recorded data is out of date by using unsynchronized time as a standard; meanwhile, whether the system clocks are synchronous or not is detected in real time, and the recorded data is carried out after the system clocks are synchronous.
8. The method for collecting the application use duration of the android television as claimed in claim 1, wherein the persistent file timestamp is a file modification time.
9. The method for acquiring the application use duration of the android television as claimed in claim 1, wherein the foreground application is an application which is opened and displayed on an interface and is not closed when a system is turned off.
CN202111328022.7A 2021-11-10 2021-11-10 Application use duration acquisition method for android television Active CN114071234B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111328022.7A CN114071234B (en) 2021-11-10 2021-11-10 Application use duration acquisition method for android television

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111328022.7A CN114071234B (en) 2021-11-10 2021-11-10 Application use duration acquisition method for android television

Publications (2)

Publication Number Publication Date
CN114071234A CN114071234A (en) 2022-02-18
CN114071234B true CN114071234B (en) 2022-12-13

Family

ID=80274797

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111328022.7A Active CN114071234B (en) 2021-11-10 2021-11-10 Application use duration acquisition method for android television

Country Status (1)

Country Link
CN (1) CN114071234B (en)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7171161B2 (en) * 2002-07-30 2007-01-30 Cognio, Inc. System and method for classifying signals using timing templates, power templates and other techniques
CN106383869B (en) * 2016-09-05 2021-02-19 Tcl科技集团股份有限公司 Method and device for acquiring user behavior information
CN109491883A (en) * 2018-09-13 2019-03-19 武汉灯塔之光科技有限公司 Performance detects control methods and system simultaneously between applying under a kind of Android platform more
US10984876B2 (en) * 2019-06-19 2021-04-20 SanDiskTechnologies LLC Temperature based programming in memory
CN111130676B (en) * 2019-12-02 2022-06-28 上海赫千电子科技有限公司 Time synchronization correction method and device applied to master clock and slave clock
CN110932814B (en) * 2019-12-05 2020-10-02 北京邮电大学 Software-defined network time service safety protection method, device and system
CN112463557A (en) * 2020-11-12 2021-03-09 苏州浪潮智能科技有限公司 Recording method, device and medium for user space operation

Also Published As

Publication number Publication date
CN114071234A (en) 2022-02-18

Similar Documents

Publication Publication Date Title
CA2688750A1 (en) Device time adjustment for accurate data exchange
JP6574031B2 (en) Mobile video call quality measurement method and system
CN103563287B (en) Synchronization device and synchronization method
EP2775673B1 (en) Content reproduction information estimating device, method and program
CN111865466B (en) Time synchronization method, device, time-given equipment and storage medium
US20110158556A1 (en) Imaging apparatus, data processing method, and program
CN110677211B (en) Time synchronization method and device and power acquisition terminal
CN113835336B (en) Multi-dimensional self-adaptive metering device patrol and timing method for supporting electric power spot market
CN111984059A (en) PPS (polyphenylene sulfide) jump detection method and system for timing by time service module
CN114509753A (en) Fusion method of radar video data and related equipment
CN114071234B (en) Application use duration acquisition method for android television
JP6754693B2 (en) How to match data and event gaps sent and received on networks using different communication technologies
CN1536788B (en) Journal remaining system and method
CN102291592A (en) Method for collecting self-checking failure information of television by using external storage medium
CN109861843B (en) Method, device and equipment for completely collecting and confirming log files
CN106201753B (en) Method and system for processing PCIE errors in linux
CN112423121B (en) Video test file generation method and device and player test method and device
CN110298001B (en) Method and device for acquiring log data packet and computer readable storage medium
CN111751776A (en) Time verification system and method for digital relay protection tester
CN115913437A (en) Time synchronization method, system, fault injection equipment and storage medium
CN114422407B (en) Network testing method, system, terminal and storage medium
CN115225523B (en) Intelligent terminal equipment information acquisition time correction system and method
CN113873232B (en) Video clamping detection method, device and system and storage medium
CN111723116A (en) Data backfill method, device and system
CN113688051A (en) Electric energy meter software upgrading test method and storage medium

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
GR01 Patent grant
GR01 Patent grant