App (file format)

From Wikipedia the free encyclopedia

APP
Filename extension
.app,.hap
Developed byHuawei
Type of formatPackage format
Container for
Extended fromJAR

The HarmonyOS App Pack or the App file, identified with the file extension ".app", serves as the file format used by the HarmonyOS operating system. It functions as a native HarmonyOS app for distribution and installation through Huawei AppGallery,[1] or for distribution through Huawei Ability Gallery in respect of installation-free apps under both current classic dual-framework and HarmonyOS NEXT system. The App file is also used by a number of other open source HarmonyOS-based operating systems such as OpenHarmony and Oniro OS-based operating systems for distribution and installation of applications, video games and middleware. Including non OpenHarmony-based operating systems, such as GNU Linux-based Unity Operating System that supports the app file format.[2] [3][4][5][6]

Each HarmonyOS app contains one or more HarmonyOS Ability Package (HAP) files with the file extension ".hap",[7] and the pack.info file that describes the attributes of the App file.[8]

Most HarmonyOS apps contain at least one HAP file of the entry type, which is the main module of the app, and additional HAP files of the feature type, which is used to implement a specific app feature.[8]

The package management subsystem within OpenHarmony for handling app installation packages. When considering a PC environment. Installation and Update function allows users to install or update applications by interacting with the package manager through a graphical user interface or command-line interface. Query and Uninstallation function enable users to query installed packages and uninstall unwanted ones using similar interfaces. Also, storage where Package information would be stored in a database or configuration files on the PC. The package management subsystem ensures frictionless management of app packages, regardless of the device form.[9]

Overview[edit]

App Pack and HAP files[edit]

HarmonyOS apps are distributed as a software package file known as the App Pack or the App file, suffixed with .app, which is analogous to other software packages such as apk used by the Android operating system, appx in Microsoft Windows, or a Debian package in Debian-based operating systems.

To make a HarmonyOS app, a software development tool such as DevEco Studio is required to code and pack HarmonyOS Ability Package (HAP) and associated files into an app package.[10]

The HAP files may consist of resources, third-party libraries and configuration files. They are classified into two types of modules, i.e., entry and feature. The entry type of the HAP files is the main module and must be included into an app package, while the feature type of the HAP files is additional modules for implementing the features of the apps.

Moreover, an App file that contains different builds and specifications optimized for the various devices may contain more than one HAP file of the entry type.[3]

Historically, the development of the HAP format has gone through two phases. The first stage, after decompression, there was a non-executable APK as the program entrance to connect with AOSP file libraries of binaries to interact with AOSP base of HarmonyOS 2.0 API 6, which is caused by the imperfect ecology of the early development of the new app file format during dual framework of OpenHarmony L3-L5 that consists of EMUI Android base convergence. During early app development, third party developers facilitated development for mixed packaging of APK and HAP.[11] Since introduction of HAR on HarmonyOS 3.1 API 9 with ArkUI declarative programming framework and ArkTS evolved from eTS on 3.0, as primary programming language replacing Java binaries in the second stage of HAP, APKs was eliminated after decompression, and HAP cannot be converted into APKs by simple unpacking and packaging, therefore HAP file format is not a casing of the APK.

Prior to packing into an App Pack, HAP files are allowed to run directly on a real device or an emulator for developers to debug and verify the apps during the development phase.[12]

After development, the apps containing signature information can be distributed to different devices with AppGallery Connect, a tool kit of services for creation, development, distribution and maintenance of an app.[13]

Shared packages[edit]

HarmonyOS Shared Packages

For sharing code and resources in an App Pack, the operating system offers two kinds of shared packages: Harmony Archive (HAR), which is a static shared package, and Harmony Shared Package (HSP), which is a dynamic shared package.[14]

Both HAR and HSP enable sharing of code, C++ libraries, resources, and configuration files. In HAR, the code and resources are compiled together with invoking modules, possibly resulting in multiple copies of the same code and resources. In contrast, HSP allows independent compilation, leading to only one copy of code and resources in the build product.[14]

When multiple HAPs reference the same HAR, the HSP can be used instead to share some state variables and reduce the size of an App Pack. However, the HSP has some restrictions; for example, it does not support the declaration of abilities in its configuration file and its invoking modules must be in the same stage model as with the HSP.[14]

On OpenHarmony 4.1 API 11 improvements with System-level HSP that supports OTA upgrades within the App Package Management system. Also, the API 11 upgrade under Public Basic Class Library supports the creation of Workers within HSP and HAR that is something a user give a task and continue in the process, while the worker, or multiple workers also known as Thread pools, process the task on a different thread. A call back method is initiated when a special method provided on the initial call gets called. [15]

App file structure[edit]

The structure of the App file after built and packaged in a stage model usually contains the following files and folders.[8]

  • entry.hap and feature.hap: the basic modules of both entry and feature types for installing an app, containing the following folders and files.
    • ets: a folder storing bytecode files generated after the code build.
    • libs: a folder storing the dependency files of the main module.
    • resources: a folder containing resource files such as graphics, multimedia, character strings, and layouts.
    • resources.index: a file providing a resource index table generated when an app is built.
    • app.json5 and module.json5: JSON files with configuration information for build tools, operating system and application markets.[16]
  • pack.info: a file describing the attributes of the App Pack.

See also[edit]

References[edit]

  1. ^ "HarmonyOS Project Overview". developer.harmonyos.com. Retrieved 2023-08-23.
  2. ^ "UOS could support HarmonyOS hap app format". HC Newsroom. Retrieved 15 January 2024.
  3. ^ a b "Application Fundamentals". developer.harmonyos.com. Retrieved 2023-08-20.
  4. ^ "What Is an Atomic Service". developer.harmonyos.com. Retrieved 2023-08-20.
  5. ^ Li, Deng (2022-11-28). "Orange Pi OS launched, based on Huawei HarmonyOS". Huawei Central. Retrieved 2023-11-30.
  6. ^ Anand, Abhinav (2023-11-13). "Huawei ditches Android with HarmonyOS Next". Android Headlines. Retrieved 2023-12-09.
  7. ^ "HAP File - What is a .hap file and how do I open it?". fileinfo.com. Retrieved 2023-08-20.
  8. ^ a b c "Application Package Structure in Stage Model". developer.harmonyos.com. Retrieved 2023-08-20.
  9. ^ "Package management subsystem". Gitee. Retrieved 13 April 2023.
  10. ^ "Huawei DevEco Studio - HUAWEI HarmonyOS APP". developer.harmonyos.com. Retrieved 2023-08-20.
  11. ^ Khalsa, Bhamini. "Youku Hongmon Development Practice | Youku Android and HarmonyOS Hap hybrid packaging". Mo4Tech. Retrieved 24 March 2024.
  12. ^ "Overview - Building Your App". developer.harmonyos.com. Retrieved 2023-08-20.
  13. ^ "Overview - AppGallery Connect". developer.huawei.com. Retrieved 2023-08-20.
  14. ^ a b c "Shared Package Overview". developer.harmonyos.com. Retrieved 2023-09-27.
  15. ^ Bates, Kryzt. "OpenHarmony 4.1 Release Now Available With Over 4,000 New APIs". GAMINGDEPUTY. GAMINGDEPUTY. Retrieved 16 April 2024.
  16. ^ "Application Configuration File Overview (Stage Model)". developer.harmonyos.com. Retrieved 2023-08-21.