🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🔧 AI Nachrichten ChatGPT automatically logged out [Fix](12.09.2026 um 17:09 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🪟 Windows TippsServertimeout in Outlook über 10 Minuten verlängern(12.09.2026 um 15:10 Uhr)
🔧 AI Nachrichten Stealing AI Reasoning Traces(08.09.2026 um 12:20 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🔧 AI Nachrichten ChatGPT automatically logged out [Fix](12.09.2026 um 17:09 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🪟 Windows TippsServertimeout in Outlook über 10 Minuten verlängern(12.09.2026 um 15:10 Uhr)
🔧 AI Nachrichten Stealing AI Reasoning Traces(08.09.2026 um 12:20 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 3 Min Lesezeit
0

Hongmeng File Access Framework: User file access and permission control📂

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

Hongmeng Next's File Access Framework (File Access Framework, FAF) provides applications with secure and controllable user file access capabilities.This article analyzes its core functions, permission configuration and practical usage~






1. FAF core: a safe and convenient file access bridge 🔗



FAF is a user file management framework provided by Hongmeng. It is implemented based on ExtensionAbility and has three major features:





  • Security Isolation: Limit file access scope through permission control


  • Unified Interface: Standardized file selection/save/management process


  • Span-device support: Compatible with multi-terminal file systems (mobile phone/tablet/car machine)






2. Permission configuration: "key" to access user files🔑






1. Declare file operation permissions (module.json5)






CODE
{  
"abilities": [
{
"skills": [
{
"actions": ["ohos.arkui.intent.action.CHOOSE"], // File selection
"uris": [{ "scheme": "file", "host": "*", "path": "/storage/*" }]
},
{
"actions": ["ohos.arkui.intent.action.SAVE"], // File saving
"uris": [{ "scheme": "file", "host": "*", "path": "/storage/*" }]
}
]
}
]
}









2. Runtime authorization mechanism




  • When the user triggers file selection/save, the system pops up the authorization pop-up window

  • Applications can only access the file path authorized by the user, prohibiting over-authorization operations






3. Core interface and practical examples🚀






1. File selection (taking picture as an example)






CODE
import { fileAccess, wantAgent } from '@ohos.fileAccess';  

// Call the system file selector
const chooseFile = () => {
const intent = {
action: 'ohos.arkui.intent.action.CHOOSE',
type: 'image/*', // Limited selection of image types
entities: ['image/*']
};
const want = wantAgent.createWant(intent);
this.context.startAbility(want, (result) => {
if (result && want.response.result) {
const fileUri = want.response.result;
// Get file information (such as size/type)
fileAccess.getFileInfo(fileUri, (err, info) => {
console.log('Select image:', info.fileName);
});
}
});
};









2. File saving (text file example)






CODE
const saveTextFile = () => {  
const saveIntent = {
action: 'ohos.arkui.intent.action.SAVE',
type: 'text/plain', // Specify the save type as plain text
extra: { fileName: 'note.txt' } // Preset file name
};
const saveWant = wantAgent.createWant(saveIntent);
this.context.startAbility(saveWant, (result) => {
if (result) {
const saveUri = want.response.result;
// Write file contents
fileAccess.saveFile(saveUri, 'Hongmeng Development Notes', (err) => {
if (!err) console.log('Save successfully');
});
}
});
};









3. File management operations






CODE
// Create a directory
fileAccess.createDir('/storage/emulated/0/app/newFolder', (err) => {
if (!err) console.log('Directory creation successfully');
});

// Delete the file
fileAccess.deleteFile('/storage/emulated/0/app/temp.log', (err) => {
if (!err) console.log('File deletion successfully');
});









4. Security design: the "protective wall" of user data 🛡️






1. Access restrictions outside the sandbox




  • By default, the application can only access its own sandbox files (/data/el2/files/)

  • Access to external storage (such as album/download directory) must pass through the FAF unified interface, and direct path operation is prohibited






2. Principle of Minimization




  • Each file operation requires separate authorization (if you can only access the file after selecting the picture)

  • Authorization is only valid for this operation and no permanent access is granted






3. Cross-device security policy




  • In distributed scenarios, file access needs to be authenticated by device

  • Sensitive files (such as privacy images) are prohibited from being transferred across devices






Summary: 3 steps to achieve secure file access





  1. Declare permissions: Declare operation permissions such as CHOOSE/SAVE in the configuration file


  2. Calling interface: Initiate file operations through the unified interface provided by FAF


  3. Compliance processing: Follow the process of "User Authorization → Limited Access → Timely Release"

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
ChatGPT automatically logged out [Fix]
1 Quelle
Windows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Hongmeng File Access Framework: User file access and permission control📂

Thematisch verwandte Begriffe: Hongmeng, File, Access, Framework · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...